@@ -90,13 +90,13 @@ def stb_and(cmd, attr):
90
90
91
91
class Multiplexer (Module , AutoCSR ):
92
92
def __init__ (self , phy , geom_settings , timing_settings , bank_machines , refresher , dfi , lasmic ,
93
- with_bandwidth_measurement = False ):
93
+ with_bandwidth = False ):
94
94
assert (phy .settings .nphases == len (dfi .phases ))
95
95
96
96
# Command choosing
97
97
requests = [bm .cmd for bm in bank_machines ]
98
- choose_cmd = _CommandChooser (requests )
99
- choose_req = _CommandChooser (requests )
98
+ self . submodules . choose_cmd = choose_cmd = _CommandChooser (requests )
99
+ self . submodules . choose_req = choose_req = _CommandChooser (requests )
100
100
self .comb += [
101
101
choose_cmd .want_reads .eq (0 ),
102
102
choose_cmd .want_writes .eq (0 )
@@ -106,7 +106,6 @@ def __init__(self, phy, geom_settings, timing_settings, bank_machines, refresher
106
106
choose_cmd .want_cmds .eq (1 ),
107
107
choose_req .want_cmds .eq (1 )
108
108
]
109
- self .submodules += choose_cmd , choose_req
110
109
111
110
# Command steering
112
111
nop = CommandRequest (geom_settings .mux_a , geom_settings .bank_a )
@@ -212,5 +211,11 @@ def steerer_sel(steerer, phy, r_w_n):
212
211
fsm .finalize ()
213
212
self .comb += refresher .ack .eq (fsm .state == fsm .encoding ["REFRESH" ])
214
213
215
- if with_bandwidth_measurement :
216
- self .submodules .bandwidth = Bandwidth (choose_req .cmd )
214
+ self .with_bandwidth = with_bandwidth
215
+
216
+ def add_bandwidth (self ):
217
+ self .with_bandwidth = True
218
+
219
+ def do_finalize (self ):
220
+ if self .with_bandwidth :
221
+ self .submodules .bandwidth = Bandwidth (self .choose_req .cmd )
0 commit comments