core/multiplexer/steerel_sel: add support for dynamic rd/rdcmd/wr/wrcmd phases.
This is useful for development and also simplifies code (without using more resources when constants are used).
This commit is contained in:
parent
020cff1970
commit
f5184b41b5
|
@ -317,23 +317,17 @@ class Multiplexer(Module, AutoCSR):
|
||||||
Cat(*all_wrdata_mask).eq(~interface.wdata_we)
|
Cat(*all_wrdata_mask).eq(~interface.wdata_we)
|
||||||
]
|
]
|
||||||
|
|
||||||
def steerer_sel(steerer, r_w_n):
|
def steerer_sel(steerer, access):
|
||||||
|
assert access in ["read", "write"]
|
||||||
r = []
|
r = []
|
||||||
for i in range(settings.phy.nphases):
|
for i in range(settings.phy.nphases):
|
||||||
s = steerer.sel[i].eq(STEER_NOP)
|
r.append(steerer.sel[i].eq(STEER_NOP))
|
||||||
if r_w_n == "read":
|
if access == "read":
|
||||||
if i == settings.phy.rdphase:
|
r.append(If(i == settings.phy.rdphase, steerer.sel[i].eq(STEER_REQ)))
|
||||||
s = steerer.sel[i].eq(STEER_REQ)
|
r.append(If(i == settings.phy.rdcmdphase, steerer.sel[i].eq(STEER_CMD)))
|
||||||
elif i == settings.phy.rdcmdphase:
|
if access == "write":
|
||||||
s = steerer.sel[i].eq(STEER_CMD)
|
r.append(If(i == settings.phy.wrphase, steerer.sel[i].eq(STEER_REQ)))
|
||||||
elif r_w_n == "write":
|
r.append(If(i == settings.phy.wrcmdphase, steerer.sel[i].eq(STEER_CMD)))
|
||||||
if i == settings.phy.wrphase:
|
|
||||||
s = steerer.sel[i].eq(STEER_REQ)
|
|
||||||
elif i == settings.phy.wrcmdphase:
|
|
||||||
s = steerer.sel[i].eq(STEER_CMD)
|
|
||||||
else:
|
|
||||||
raise ValueError
|
|
||||||
r.append(s)
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
# Control FSM ------------------------------------------------------------------------------
|
# Control FSM ------------------------------------------------------------------------------
|
||||||
|
@ -348,7 +342,7 @@ class Multiplexer(Module, AutoCSR):
|
||||||
choose_cmd.cmd.ready.eq(~choose_cmd.activate() | ras_allowed),
|
choose_cmd.cmd.ready.eq(~choose_cmd.activate() | ras_allowed),
|
||||||
choose_req.cmd.ready.eq(cas_allowed)
|
choose_req.cmd.ready.eq(cas_allowed)
|
||||||
),
|
),
|
||||||
steerer_sel(steerer, "read"),
|
steerer_sel(steerer, access="read"),
|
||||||
If(write_available,
|
If(write_available,
|
||||||
# TODO: switch only after several cycles of ~read_available?
|
# TODO: switch only after several cycles of ~read_available?
|
||||||
If(~read_available | max_read_time,
|
If(~read_available | max_read_time,
|
||||||
|
@ -369,7 +363,7 @@ class Multiplexer(Module, AutoCSR):
|
||||||
choose_cmd.cmd.ready.eq(~choose_cmd.activate() | ras_allowed),
|
choose_cmd.cmd.ready.eq(~choose_cmd.activate() | ras_allowed),
|
||||||
choose_req.cmd.ready.eq(cas_allowed),
|
choose_req.cmd.ready.eq(cas_allowed),
|
||||||
),
|
),
|
||||||
steerer_sel(steerer, "write"),
|
steerer_sel(steerer, access="write"),
|
||||||
If(read_available,
|
If(read_available,
|
||||||
If(~write_available | max_write_time,
|
If(~write_available | max_write_time,
|
||||||
NextState("WTR")
|
NextState("WTR")
|
||||||
|
|
Loading…
Reference in New Issue