Skip to content

Commit

Permalink
genlib/fifo: remove Record support
Browse files Browse the repository at this point in the history
sbourdeauducq committed Sep 30, 2015

Verified

This commit was signed with the committer’s verified signature.
headius Charles Oliver Nutter
1 parent 913558a commit 4451bb2
Showing 1 changed file with 8 additions and 20 deletions.
28 changes: 8 additions & 20 deletions migen/genlib/fifo.py
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@
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):
@@ -26,7 +25,7 @@ class _FIFOInterface:
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.
@@ -54,18 +53,9 @@ def __init__(self, width_or_layout, depth):
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):
@@ -105,7 +95,7 @@ def __init__(self, width_or_layout, depth, fwft=True):
).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,
@@ -118,7 +108,7 @@ def __init__(self, width_or_layout, depth, fwft=True):
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)
@@ -142,10 +132,8 @@ def __init__(self, width_or_layout, depth):
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)

@@ -214,12 +202,12 @@ def __init__(self, width_or_layout, depth):
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)
]

0 comments on commit 4451bb2

Please sign in to comment.