2
2
from migen .fhdl .module import Module
3
3
from migen .fhdl .specials import Memory
4
4
from migen .genlib .cdc import NoRetiming , MultiReg , GrayCounter
5
- from migen .genlib .record import layout_len , Record
6
5
7
6
8
7
def _inc (signal , modulo ):
@@ -26,7 +25,7 @@ class _FIFOInterface:
26
25
Parameters
27
26
----------
28
27
width_or_layout : int, layout
29
- Bit width or `Record` layout for the data.
28
+ Bit width for the data.
30
29
depth : int
31
30
Depth of the FIFO.
32
31
@@ -54,18 +53,9 @@ def __init__(self, width_or_layout, depth):
54
53
self .re = Signal ()
55
54
self .readable = Signal () # not empty
56
55
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
69
59
70
60
71
61
class SyncFIFO (Module , _FIFOInterface ):
@@ -105,7 +95,7 @@ def __init__(self, width_or_layout, depth, fwft=True):
105
95
).Else (
106
96
wrport .adr .eq (produce )
107
97
),
108
- wrport .dat_w .eq (self .din_bits ),
98
+ wrport .dat_w .eq (self .din ),
109
99
wrport .we .eq (self .we & (self .writable | self .replace ))
110
100
]
111
101
self .sync += If (self .we & self .writable & ~ self .replace ,
@@ -118,7 +108,7 @@ def __init__(self, width_or_layout, depth, fwft=True):
118
108
self .specials += rdport
119
109
self .comb += [
120
110
rdport .adr .eq (consume ),
121
- self .dout_bits .eq (rdport .dat_r )
111
+ self .dout .eq (rdport .dat_r )
122
112
]
123
113
if not fwft :
124
114
self .comb += rdport .re .eq (do_read )
@@ -142,10 +132,8 @@ def __init__(self, width_or_layout, depth):
142
132
self .submodules .fifo = fifo = SyncFIFO (width_or_layout , depth , False )
143
133
144
134
self .writable = fifo .writable
145
- self .din_bits = fifo .din_bits
146
135
self .din = fifo .din
147
136
self .we = fifo .we
148
- self .dout_bits = fifo .dout_bits
149
137
self .dout = fifo .dout
150
138
self .level = Signal (max = depth + 2 )
151
139
@@ -214,12 +202,12 @@ def __init__(self, width_or_layout, depth):
214
202
self .specials += wrport
215
203
self .comb += [
216
204
wrport .adr .eq (produce .q_binary [:- 1 ]),
217
- wrport .dat_w .eq (self .din_bits ),
205
+ wrport .dat_w .eq (self .din ),
218
206
wrport .we .eq (produce .ce )
219
207
]
220
208
rdport = storage .get_port (clock_domain = "read" )
221
209
self .specials += rdport
222
210
self .comb += [
223
211
rdport .adr .eq (consume .q_next_binary [:- 1 ]),
224
- self .dout_bits .eq (rdport .dat_r )
212
+ self .dout .eq (rdport .dat_r )
225
213
]
0 commit comments