projects
/
litex.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
ab5b938
)
gen/genlib/cdc: add GrayDecoder from misoc
author
Florent Kermarrec
<florent@enjoy-digital.fr>
Thu, 12 Jan 2017 03:15:33 +0000
(
04:15
+0100)
committer
Florent Kermarrec
<florent@enjoy-digital.fr>
Thu, 12 Jan 2017 03:15:33 +0000
(
04:15
+0100)
litex/gen/genlib/cdc.py
patch
|
blob
|
history
diff --git
a/litex/gen/genlib/cdc.py
b/litex/gen/genlib/cdc.py
index 7f72b471985c40a98044b2656f3e4977fba8ca22..6bac9e0003430498db835989423354d6414e4532 100644
(file)
--- a/
litex/gen/genlib/cdc.py
+++ b/
litex/gen/genlib/cdc.py
@@
-142,6
+142,20
@@
class GrayCounter(Module):
]
+class GrayDecoder(Module):
+ def __init__(self, width):
+ self.i = Signal(width)
+ self.o = Signal(width)
+
+ # # #
+
+ o_comb = Signal(width)
+ self.comb += o_comb[-1].eq(self.i[-1])
+ for i in reversed(range(width-1)):
+ self.comb += o_comb[i].eq(o_comb[i+1] ^ self.i[i])
+ self.sync += self.o.eq(o_comb)
+
+
class ElasticBuffer(Module):
def __init__(self, width, depth, idomain, odomain):
self.din = Signal(width)