from migen.fhdl import verilog
from migen.genlib import divider
-@DecorateModule(InsertReset)
-@DecorateModule(InsertCE)
+@ResetInserter()
+@CEInserter()
class Example(Module):
def __init__(self, width):
d1 = divider.Divider(width)
"""Asynchronous FIFO (first in, first out)
Read and write interfaces are accessed from different clock domains,
- named `read` and `write`. Use `RenameClockDomains` to rename to
+ named `read` and `write`. Use `ClockDomainsRenamer` to rename to
other names.
{interface}
depth_bits = log2_int(depth, True)
- produce = RenameClockDomains(GrayCounter(depth_bits+1), "write")
- consume = RenameClockDomains(GrayCounter(depth_bits+1), "read")
+ produce = ClockDomainsRenamer("write")(GrayCounter(depth_bits+1))
+ consume = ClockDomainsRenamer("read")(GrayCounter(depth_bits+1))
self.submodules += produce, consume
self.comb += [
produce.ce.eq(self.writable & self.we),
sync.append(counterlogic)
return sync
-@DecorateModule(InsertReset)
-@DecorateModule(InsertCE)
+@ResetInserter()
+@CEInserter()
class FlipFlop(Module):
def __init__(self, *args, **kwargs):
self.d = Signal(*args, **kwargs)
self.q = Signal(*args, **kwargs)
self.sync += self.q.eq(self.d)
-@DecorateModule(InsertReset)
-@DecorateModule(InsertCE)
+@ResetInserter()
+@CEInserter()
class Counter(Module):
def __init__(self, *args, increment=1, **kwargs):
self.value = Signal(*args, **kwargs)
self.width = flen(self.value)
self.sync += self.value.eq(self.value+increment)
-@DecorateModule(InsertReset)
-@DecorateModule(InsertCE)
+@ResetInserter()
+@CEInserter()
class Timeout(Module):
def __init__(self, length):
self.reached = Signal()