from migen.fhdl.module import Module
from migen.fhdl.specials import Memory
from migen.genlib.cdc import NoRetiming, MultiReg, GrayCounter
-from migen.genlib.record import layout_len, Record
def _inc(signal, modulo):
Parameters
----------
width_or_layout : int, layout
- Bit width or `Record` layout for the data.
+ Bit width for the data.
depth : int
Depth of the FIFO.
self.re = Signal()
self.readable = Signal() # not empty
- if isinstance(width_or_layout, list):
- self.din = Record(width_or_layout)
- self.dout = Record(width_or_layout)
- self.din_bits = self.din.raw_bits()
- self.dout_bits = self.dout.raw_bits()
- self.width = layout_len(width_or_layout)
- else:
- self.din = Signal(width_or_layout)
- self.dout = Signal(width_or_layout)
- self.din_bits = self.din
- self.dout_bits = self.dout
- self.width = width_or_layout
+ self.din = Signal(width_or_layout)
+ self.dout = Signal(width_or_layout)
+ self.width = width_or_layout
class SyncFIFO(Module, _FIFOInterface):
).Else(
wrport.adr.eq(produce)
),
- wrport.dat_w.eq(self.din_bits),
+ wrport.dat_w.eq(self.din),
wrport.we.eq(self.we & (self.writable | self.replace))
]
self.sync += If(self.we & self.writable & ~self.replace,
self.specials += rdport
self.comb += [
rdport.adr.eq(consume),
- self.dout_bits.eq(rdport.dat_r)
+ self.dout.eq(rdport.dat_r)
]
if not fwft:
self.comb += rdport.re.eq(do_read)
self.submodules.fifo = fifo = SyncFIFO(width_or_layout, depth, False)
self.writable = fifo.writable
- self.din_bits = fifo.din_bits
self.din = fifo.din
self.we = fifo.we
- self.dout_bits = fifo.dout_bits
self.dout = fifo.dout
self.level = Signal(max=depth+2)
self.specials += wrport
self.comb += [
wrport.adr.eq(produce.q_binary[:-1]),
- wrport.dat_w.eq(self.din_bits),
+ wrport.dat_w.eq(self.din),
wrport.we.eq(produce.ce)
]
rdport = storage.get_port(clock_domain="read")
self.specials += rdport
self.comb += [
rdport.adr.eq(consume.q_next_binary[:-1]),
- self.dout_bits.eq(rdport.dat_r)
+ self.dout.eq(rdport.dat_r)
]