ElasticBuffer: infer reset
This commit is contained in:
parent
4362e5c528
commit
677243bd8c
|
@ -144,21 +144,22 @@ class GrayCounter(Module):
|
||||||
|
|
||||||
class ElasticBuffer(Module):
|
class ElasticBuffer(Module):
|
||||||
def __init__(self, width, depth, idomain, odomain):
|
def __init__(self, width, depth, idomain, odomain):
|
||||||
self.reset = Signal()
|
|
||||||
self.din = Signal(width)
|
self.din = Signal(width)
|
||||||
self.dout = Signal(width)
|
self.dout = Signal(width)
|
||||||
|
|
||||||
# # #
|
# # #
|
||||||
|
|
||||||
|
reset = Signal()
|
||||||
cd_write = ClockDomain()
|
cd_write = ClockDomain()
|
||||||
cd_read = ClockDomain()
|
cd_read = ClockDomain()
|
||||||
self.comb += [
|
self.comb += [
|
||||||
cd_write.clk.eq(ClockSignal(idomain)),
|
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 += [
|
self.specials += [
|
||||||
AsyncResetSynchronizer(cd_write, self.reset),
|
AsyncResetSynchronizer(cd_write, reset),
|
||||||
AsyncResetSynchronizer(cd_read, self.reset)
|
AsyncResetSynchronizer(cd_read, reset)
|
||||||
]
|
]
|
||||||
self.clock_domains += cd_write, cd_read
|
self.clock_domains += cd_write, cd_read
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue