projects
/
litex.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1f350ad
)
fhdl/tools: bitreverse
author
Sebastien Bourdeauducq
<sebastien@milkymist.org>
Fri, 14 Dec 2012 22:56:16 +0000
(23:56 +0100)
committer
Sebastien Bourdeauducq
<sebastien@milkymist.org>
Fri, 14 Dec 2012 22:56:16 +0000
(23:56 +0100)
migen/fhdl/tools.py
patch
|
blob
|
history
diff --git
a/migen/fhdl/tools.py
b/migen/fhdl/tools.py
index 186dd8e4a3f7130a66b13e2485eb17f12e18f634..c4af475a509df193b35ff226c1135d7d17f282a0 100644
(file)
--- a/
migen/fhdl/tools.py
+++ b/
migen/fhdl/tools.py
@@
-205,3
+205,8
@@
def lower_arrays(f):
f2 = al.visit(f)
f2.comb += al.comb
return f2
+
+def bitreverse(s):
+ length, signed = value_bits_sign(s)
+ l = [s[i] for i in reversed(range(length))]
+ return Cat(*l)