projects
/
nmutil.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
ce31076
)
input is a keyword in python
author
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Fri, 17 Dec 2021 22:55:19 +0000
(22:55 +0000)
committer
Luke Kenneth Casson Leighton
<lkcl@lkcl.net>
Fri, 17 Dec 2021 22:55:19 +0000
(22:55 +0000)
src/nmutil/grev.py
patch
|
blob
|
history
diff --git
a/src/nmutil/grev.py
b/src/nmutil/grev.py
index 18b2398fb23b7cde3d3f5ec2746f353f443a07eb..fa21551d267eeaada50e638154c61ee56f3f0e64 100644
(file)
--- 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
from nmigen.cli import rtlil
-def grev(in
put
, chunk_sizes, log2_width):
+def grev(in
val
, 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
"""XXX start comments here with no space
Python reference implementation of generalized bit-reverse.
See `GRev` for documentation.
"""
# mask inputs into range
- in
put
&= 2 ** 2 ** log2_width - 1
+ in
val
&= 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
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 = (in
put
& (1 << i)) != 0
+ bit = (in
val
& (1 << i)) != 0
retval |= bit << (i ^ chunk_sizes)
return retval
retval |= bit << (i ^ chunk_sizes)
return retval