Skip to content

Commit

Permalink
litedram_gen: Add block_until_ready port parameter to control blockin…
Browse files Browse the repository at this point in the history
…g 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).
  • Loading branch information
enjoy-digital committed Jan 13, 2022
1 parent 2d47363 commit 62abf9c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion examples/arty.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"id_width": 32,
},
"wishbone_0" : {
"type": "wishbone",
"type": "wishbone",
"block_until_ready": True,
},
"native_0" : {
"type": "native",
Expand Down
12 changes: 10 additions & 2 deletions litedram/gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -654,13 +654,21 @@ def __init__(self, platform, core_config, **kwargs):
self.comb += wb_bus.connect_to_pads(wb_pads, mode="slave")

# User ports -------------------------------------------------------------------------------
user_enable = Signal()
self.sync += user_enable.eq(self.ddrctrl.init_done.storage & ~self.ddrctrl.init_error.storage)
self.comb += [
platform.request("user_clk").eq(ClockSignal()),
platform.request("user_rst").eq(ResetSignal()),
]
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 -------------------------------------------------------------------------------
if port["type"] == "native":
user_port = self.sdram.crossbar.get_port(data_width=port.get("data_width", None))
Expand Down

0 comments on commit 62abf9c

Please sign in to comment.