projects
/
litex.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b708b9c
)
gen/genlib/misc: add BitSlip
author
Florent Kermarrec
<florent@enjoy-digital.fr>
Wed, 19 Apr 2017 07:55:19 +0000
(09:55 +0200)
committer
Florent Kermarrec
<florent@enjoy-digital.fr>
Wed, 19 Apr 2017 07:55:19 +0000
(09:55 +0200)
litex/gen/genlib/misc.py
patch
|
blob
|
history
diff --git
a/litex/gen/genlib/misc.py
b/litex/gen/genlib/misc.py
index 42ad878cbf902a8210c906ce7b8cbbaef2a48528..a28e30d96d9f1358111cbb59e2c59165c74faeba 100644
(file)
--- a/
litex/gen/genlib/misc.py
+++ b/
litex/gen/genlib/misc.py
@@
-86,3
+86,19
@@
class WaitTimer(Module):
If(self.wait,
If(~self.done, count.eq(count - 1))
).Else(count.eq(count.reset))
+
+
+class BitSlip(Module):
+ def __init__(self, dw):
+ self.i = Signal(dw)
+ self.o = Signal(dw)
+ self.value = Signal(max=dw)
+
+ # # #
+
+ r = Signal(2*dw)
+ self.sync += r.eq(Cat(r[dw:], self.i))
+ cases = {}
+ for i in range(dw):
+ cases[i] = self.o.eq(r[i:dw+i])
+ self.sync += Case(self.value, cases)