From 8a6443c35db463b7f32b29fa8655568ba0f2baa4 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 17 Dec 2021 22:55:19 +0000 Subject: [PATCH] input is a keyword in python --- src/nmutil/grev.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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 -- 2.30.2