From 7d8339c3be8abcc7613ce0fae2d423d1557f1dd3 Mon Sep 17 00:00:00 2001 From: Jean THOMAS Date: Wed, 5 Aug 2020 15:36:19 +0200 Subject: [PATCH] Remove steerer_sel function --- gram/core/multiplexer.py | 42 ++++++++++++++-------------------------- 1 file changed, 15 insertions(+), 27 deletions(-) diff --git a/gram/core/multiplexer.py b/gram/core/multiplexer.py index f9464b9..f109225 100644 --- a/gram/core/multiplexer.py +++ b/gram/core/multiplexer.py @@ -355,42 +355,26 @@ def elaborate(self, platform): Cat(*all_wrdata_mask).eq(~interface.wdata_we) ] - def steerer_sel(steerer, r_w_n): - r = [] - for i in range(settings.phy.nphases): - s = steerer.sel[i].eq(STEER_NOP) - if r_w_n == "read": - if i == settings.phy.rdphase: - s = steerer.sel[i].eq(STEER_REQ) - elif i == settings.phy.rdcmdphase: - s = steerer.sel[i].eq(STEER_CMD) - elif r_w_n == "write": - 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 - # Control FSM ------------------------------------------------------------------------------ with m.FSM(): with m.State("Read"): m.d.comb += [ read_antistarvation.en.eq(1), choose_req.want_reads.eq(1), - steerer_sel(steerer, "read"), ] + for i in range(settings.phy.nphases): + if i == settings.phy.rdphase: + m.d.comb += steerer.sel[i].eq(STEER_REQ) + elif i == settings.phy.rdcmdphase: + m.d.comb += steerer.sel[i].eq(STEER_CMD) + with m.If(settings.phy.nphases == 1): - m.d.comb += choose_req.cmd.ready.eq( - cas_allowed & (~choose_req.activate() | ras_allowed)) + m.d.comb += choose_req.cmd.ready.eq(cas_allowed & (~choose_req.activate() | ras_allowed)) with m.Else(): m.d.comb += [ choose_cmd.want_activates.eq(ras_allowed), - 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), ] @@ -406,17 +390,21 @@ def steerer_sel(steerer, r_w_n): m.d.comb += [ write_antistarvation.en.eq(1), choose_req.want_writes.eq(1), - steerer_sel(steerer, "write"), ] + for i in range(settings.phy.nphases): + if i == settings.phy.wrphase: + m.d.comb += steerer.sel[i].eq(STEER_REQ) + elif i == settings.phy.wrcmdphase: + m.d.comb += steerer.sel[i].eq(STEER_CMD) + with m.If(settings.phy.nphases == 1): m.d.comb += choose_req.cmd.ready.eq( cas_allowed & (~choose_req.activate() | ras_allowed)) with m.Else(): m.d.comb += [ choose_cmd.want_activates.eq(ras_allowed), - 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), ]