litedram_gen: Add block_until_ready port parameter to control blocking behaviour.

In some cases, blocking the port until controller is ready is not wanted (ex on No-CPU
config where a port is used for the memtest).
This commit is contained in:
Florent Kermarrec 2022-01-13 21:50:55 +01:00
parent 2d47363f46
commit 62abf9ce0c
2 changed files with 12 additions and 3 deletions

View File

@ -38,7 +38,8 @@
"id_width": 32, "id_width": 32,
}, },
"wishbone_0" : { "wishbone_0" : {
"type": "wishbone", "type": "wishbone",
"block_until_ready": True,
}, },
"native_0" : { "native_0" : {
"type": "native", "type": "native",

View File

@ -654,13 +654,21 @@ class LiteDRAMCore(SoCCore):
self.comb += wb_bus.connect_to_pads(wb_pads, mode="slave") self.comb += wb_bus.connect_to_pads(wb_pads, mode="slave")
# User ports ------------------------------------------------------------------------------- # User ports -------------------------------------------------------------------------------
user_enable = Signal()
self.sync += user_enable.eq(self.ddrctrl.init_done.storage & ~self.ddrctrl.init_error.storage)
self.comb += [ self.comb += [
platform.request("user_clk").eq(ClockSignal()), platform.request("user_clk").eq(ClockSignal()),
platform.request("user_rst").eq(ResetSignal()), platform.request("user_rst").eq(ResetSignal()),
] ]
for name, port in core_config["user_ports"].items(): for name, port in core_config["user_ports"].items():
# Common -------------------------------------------------------------------------------
user_enable = Signal()
# By default, block port until controller is ready.
if port.get("block_until_ready", True):
self.sync += user_enable.eq(self.ddrctrl.init_done.storage & ~self.ddrctrl.init_error.storage)
# Else never block.
else:
self.comb += user_enable.eq(1)
# Native ------------------------------------------------------------------------------- # Native -------------------------------------------------------------------------------
if port["type"] == "native": if port["type"] == "native":
user_port = self.sdram.crossbar.get_port(data_width=port.get("data_width", None)) user_port = self.sdram.crossbar.get_port(data_width=port.get("data_width", None))