From 0bc06d345774846acaaa3597dd23e318124625ce Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Wed, 17 Nov 2021 14:08:50 +0000 Subject: [PATCH] move core hazard set/clear to separate function, for clarity --- src/soc/simple/core.py | 82 +++++++++++++++++++++++++++--------------- 1 file changed, 53 insertions(+), 29 deletions(-) diff --git a/src/soc/simple/core.py b/src/soc/simple/core.py index d8815c72..e0ad6763 100644 --- a/src/soc/simple/core.py +++ b/src/soc/simple/core.py @@ -476,6 +476,51 @@ class NonProductionCore(ControlBase): self.connect_rdport(m, fu_bitdict, rdpickers, regfile, regname, fspec) + def make_hazards(self, m, regfile, rfile, wvclr, wvset, + funame, regname, idx, + addr_en, wp, fu, fu_active, wrflag, write): + """make_hazards: a setter and a clearer for the regfile write ports + + setter is at issue time (using PowerDecoder2 regfile write numbers) + clearer is at regfile write time (when FU has said what to write to) + + there is *one* unusual case here which has to be dealt with: + when the Function Unit does *NOT* request a write to the regfile + (has its data.ok bit CLEARED). this is perfectly legitimate. + and a royal pain. + """ + comb = m.d.comb + name = "%s_%s_%d" % (funame, regname, idx) + + # deal with write vector clear: this kicks in when the regfile + # is written to, and clears the corresponding bitvector entry + print ("write vector", regfile, wvclr) + wvaddr_en = Signal(len(wvclr.wen), name="wvaddr_en_"+name) + if rfile.unary: + comb += wvaddr_en.eq(addr_en) + else: + with m.If(wp): + comb += wvaddr_en.eq(1< clear bit + wvseten.append(wv_issue_en) # set data same as enable + wvsets.append(wv_issue_en) # because enable needs a 1 # here is where we create the Write Broadcast Bus. simple, eh? comb += wport.i_data.eq(ortreereduce_sig(wsigs)) -- 2.30.2