From: Luke Kenneth Casson Leighton Date: Tue, 16 Nov 2021 14:03:28 +0000 (+0000) Subject: capture write port (wrflag) in byregfiles_spec for use in X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1e33b6322eca809194952abfa78542f3738d09f2;p=soc.git capture write port (wrflag) in byregfiles_spec for use in bitvector setting at issue time --- diff --git a/src/soc/simple/core.py b/src/soc/simple/core.py index 1e9c6351..df5de9b5 100644 --- a/src/soc/simple/core.py +++ b/src/soc/simple/core.py @@ -351,6 +351,13 @@ class NonProductionCore(ControlBase): print("read regfile", rpidx, regfile, regs.rf.keys(), rfile, rfile.unary) + # select the write-protection hazard vector. note that this still + # requires to WRITE to the hazard bitvector! read-requests need + # to RAISE the bitvector (set it to 1), which, duh, requires a WRITE + if self.make_hazard_vecs: + wv = regs.wv[regfile.lower()] + wvport = wv.w_ports["rd_"+rpidx] # write-vec bit-level hazard ctrl + fspecs = fspec if not isinstance(fspecs, list): fspecs = [fspecs] @@ -361,7 +368,7 @@ class NonProductionCore(ControlBase): ppoffs = [] for i, fspec in enumerate(fspecs): # get the regfile specs for this regfile port - (rf, read, write, wid, fuspec) = fspec + (rf, wf, read, write, wid, fuspec) = fspec print ("fpsec", i, fspec, len(fuspec)) ppoffs.append(pplen) # record offset for picker pplen += len(fuspec) @@ -379,8 +386,10 @@ class NonProductionCore(ControlBase): rens = [] addrs = [] + wvens = [] + for i, fspec in enumerate(fspecs): - (rf, read, write, wid, fuspec) = fspec + (rf, wf, read, write, wid, fuspec) = fspec # connect up the FU req/go signals, and the reg-read to the FU # and create a Read Broadcast Bus for pi, (funame, fu, idx) in enumerate(fuspec): @@ -423,6 +432,27 @@ class NonProductionCore(ControlBase): # all FUs connect to same port comb += src.eq(rport.o_data) + # now connect up the bitvector write hazard. unlike the + # regfile writeports, a ONE must be written to the corresponding + # bit of the hazard bitvector (to indicate the existence of + # the hazard) + if not self.make_hazard_vecs: + continue + + # the detection of what shall be written to is based + # on *issue* + print ("write vector (for regread)", regfile, wvport) + wname = "wvaddr_en_%s_%s_%d" % (funame, regname, idx) + wvaddr_en = Signal(len(wvport.wen), name=wname) + issue_active = Signal(name="iactive_"+name) + comb += issue_active.eq(fu.issue_i & fu_active & rdflags[i]) + with m.If(issue_active): + if rfile.unary: + comb += wvaddr_en.eq(addr_en) + else: + comb += wvaddr_en.eq(1<