Skip to content

Commit 9df60bf

Browse files
committedMar 3, 2015
lasmicon: better management of optional bandwidth module (automatically inserted by -Ot with_memtest True)
1 parent ff29c86 commit 9df60bf

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed
 

‎misoclib/mem/sdram/core/lasmicon/multiplexer.py

+11-6
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ def stb_and(cmd, attr):
9090

9191
class Multiplexer(Module, AutoCSR):
9292
def __init__(self, phy, geom_settings, timing_settings, bank_machines, refresher, dfi, lasmic,
93-
with_bandwidth_measurement=False):
93+
with_bandwidth=False):
9494
assert(phy.settings.nphases == len(dfi.phases))
9595

9696
# Command choosing
9797
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)
100100
self.comb += [
101101
choose_cmd.want_reads.eq(0),
102102
choose_cmd.want_writes.eq(0)
@@ -106,7 +106,6 @@ def __init__(self, phy, geom_settings, timing_settings, bank_machines, refresher
106106
choose_cmd.want_cmds.eq(1),
107107
choose_req.want_cmds.eq(1)
108108
]
109-
self.submodules += choose_cmd, choose_req
110109

111110
# Command steering
112111
nop = CommandRequest(geom_settings.mux_a, geom_settings.bank_a)
@@ -212,5 +211,11 @@ def steerer_sel(steerer, phy, r_w_n):
212211
fsm.finalize()
213212
self.comb += refresher.ack.eq(fsm.state == fsm.encoding["REFRESH"])
214213

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)

‎misoclib/soc/sdram.py

+6-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ class SDRAMSoC(SoC):
1919
def __init__(self, platform, clk_freq,
2020
ramcon_type="lasmicon",
2121
with_l2=True, l2_size=8192,
22-
with_memtest=False,
22+
with_bandwidth=False, # specific to LASMICON,
23+
with_memtest=False, # ignored for MINICON
2324
**kwargs):
2425
SoC.__init__(self, platform, clk_freq, **kwargs)
2526
self.ramcon_type = ramcon_type
@@ -28,6 +29,7 @@ def __init__(self, platform, clk_freq,
2829
self.l2_size = l2_size
2930

3031
self.with_memtest = with_memtest
32+
self.with_bandwidth = with_bandwidth or with_memtest
3133

3234
self._sdram_phy_registered = False
3335

@@ -41,6 +43,9 @@ def register_sdram_phy(self, phy, sdram_geom, sdram_timing):
4143

4244
# LASMICON frontend
4345
if self.ramcon_type == "lasmicon":
46+
if self.with_bandwidth:
47+
self.sdram.controller.multiplexer.add_bandwidth()
48+
4449
if self.with_memtest:
4550
self.submodules.memtest_w = memtest.MemtestWriter(self.sdram.crossbar.get_master())
4651
self.submodules.memtest_r = memtest.MemtestReader(self.sdram.crossbar.get_master())

0 commit comments

Comments
 (0)
Please sign in to comment.