From: Luke Kenneth Casson Leighton Date: Fri, 17 Dec 2021 22:55:19 +0000 (+0000) Subject: input is a keyword in python X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8a6443c35db463b7f32b29fa8655568ba0f2baa4;p=nmutil.git input is a keyword in python --- diff --git a/src/nmutil/grev.py b/src/nmutil/grev.py index 18b2398..fa21551 100644 --- a/src/nmutil/grev.py +++ b/src/nmutil/grev.py @@ -19,19 +19,19 @@ from nmigen.hdl.ir import Elaboratable from nmigen.cli import rtlil -def grev(input, chunk_sizes, log2_width): +def grev(inval, chunk_sizes, log2_width): """XXX start comments here with no space Python reference implementation of generalized bit-reverse. See `GRev` for documentation. """ # mask inputs into range - input &= 2 ** 2 ** log2_width - 1 + inval &= 2 ** 2 ** log2_width - 1 chunk_sizes &= 2 ** log2_width - 1 # core algorithm: retval = 0 for i in range(2 ** log2_width): # don't use `if` so this can be used with nmigen values - bit = (input & (1 << i)) != 0 + bit = (inval & (1 << i)) != 0 retval |= bit << (i ^ chunk_sizes) return retval