ElasticBuffer: infer reset
authorRobert Jordens <jordens@gmail.com>
Fri, 14 Oct 2016 07:43:09 +0000 (09:43 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Fri, 14 Oct 2016 07:43:09 +0000 (09:43 +0200)
litex/gen/genlib/cdc.py

index e9dd501d55f7c1e1c78db0670a9d2b331b20af13..7f72b471985c40a98044b2656f3e4977fba8ca22 100644 (file)
@@ -144,21 +144,22 @@ class GrayCounter(Module):
 
 class ElasticBuffer(Module):
     def __init__(self, width, depth, idomain, odomain):
-        self.reset = Signal()
         self.din = Signal(width)
         self.dout = Signal(width)
 
         # # #
 
+        reset = Signal()
         cd_write = ClockDomain()
         cd_read = ClockDomain()
         self.comb += [
             cd_write.clk.eq(ClockSignal(idomain)),
-            cd_read.clk.eq(ClockSignal(odomain))
+            cd_read.clk.eq(ClockSignal(odomain)),
+            reset.eq(ResetSignal(idomain) | ResetSignal(odomain))
         ]
         self.specials += [
-            AsyncResetSynchronizer(cd_write, self.reset),
-            AsyncResetSynchronizer(cd_read, self.reset)
+            AsyncResetSynchronizer(cd_write, reset),
+            AsyncResetSynchronizer(cd_read, reset)
         ]
         self.clock_domains += cd_write, cd_read