Skip to content

Commit 4451bb2

Browse files
committedSep 30, 2015
genlib/fifo: remove Record support
1 parent 913558a commit 4451bb2

File tree

1 file changed

+8
-20
lines changed

1 file changed

+8
-20
lines changed
 

Diff for: ‎migen/genlib/fifo.py

+8-20
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
from migen.fhdl.module import Module
33
from migen.fhdl.specials import Memory
44
from migen.genlib.cdc import NoRetiming, MultiReg, GrayCounter
5-
from migen.genlib.record import layout_len, Record
65

76

87
def _inc(signal, modulo):
@@ -26,7 +25,7 @@ class _FIFOInterface:
2625
Parameters
2726
----------
2827
width_or_layout : int, layout
29-
Bit width or `Record` layout for the data.
28+
Bit width for the data.
3029
depth : int
3130
Depth of the FIFO.
3231
@@ -54,18 +53,9 @@ def __init__(self, width_or_layout, depth):
5453
self.re = Signal()
5554
self.readable = Signal() # not empty
5655

57-
if isinstance(width_or_layout, list):
58-
self.din = Record(width_or_layout)
59-
self.dout = Record(width_or_layout)
60-
self.din_bits = self.din.raw_bits()
61-
self.dout_bits = self.dout.raw_bits()
62-
self.width = layout_len(width_or_layout)
63-
else:
64-
self.din = Signal(width_or_layout)
65-
self.dout = Signal(width_or_layout)
66-
self.din_bits = self.din
67-
self.dout_bits = self.dout
68-
self.width = width_or_layout
56+
self.din = Signal(width_or_layout)
57+
self.dout = Signal(width_or_layout)
58+
self.width = width_or_layout
6959

7060

7161
class SyncFIFO(Module, _FIFOInterface):
@@ -105,7 +95,7 @@ def __init__(self, width_or_layout, depth, fwft=True):
10595
).Else(
10696
wrport.adr.eq(produce)
10797
),
108-
wrport.dat_w.eq(self.din_bits),
98+
wrport.dat_w.eq(self.din),
10999
wrport.we.eq(self.we & (self.writable | self.replace))
110100
]
111101
self.sync += If(self.we & self.writable & ~self.replace,
@@ -118,7 +108,7 @@ def __init__(self, width_or_layout, depth, fwft=True):
118108
self.specials += rdport
119109
self.comb += [
120110
rdport.adr.eq(consume),
121-
self.dout_bits.eq(rdport.dat_r)
111+
self.dout.eq(rdport.dat_r)
122112
]
123113
if not fwft:
124114
self.comb += rdport.re.eq(do_read)
@@ -142,10 +132,8 @@ def __init__(self, width_or_layout, depth):
142132
self.submodules.fifo = fifo = SyncFIFO(width_or_layout, depth, False)
143133

144134
self.writable = fifo.writable
145-
self.din_bits = fifo.din_bits
146135
self.din = fifo.din
147136
self.we = fifo.we
148-
self.dout_bits = fifo.dout_bits
149137
self.dout = fifo.dout
150138
self.level = Signal(max=depth+2)
151139

@@ -214,12 +202,12 @@ def __init__(self, width_or_layout, depth):
214202
self.specials += wrport
215203
self.comb += [
216204
wrport.adr.eq(produce.q_binary[:-1]),
217-
wrport.dat_w.eq(self.din_bits),
205+
wrport.dat_w.eq(self.din),
218206
wrport.we.eq(produce.ce)
219207
]
220208
rdport = storage.get_port(clock_domain="read")
221209
self.specials += rdport
222210
self.comb += [
223211
rdport.adr.eq(consume.q_next_binary[:-1]),
224-
self.dout_bits.eq(rdport.dat_r)
212+
self.dout.eq(rdport.dat_r)
225213
]

0 commit comments

Comments
 (0)
Please sign in to comment.