restrict (refine) hazard selection to the one being picked for this port
authorLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 21 Nov 2021 22:44:42 +0000 (22:44 +0000)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Sun, 21 Nov 2021 22:44:42 +0000 (22:44 +0000)
src/soc/simple/core.py

index c47a9464402659851a9e2ceffaa4dd7d1c6a6aac..9f3a114136b74284c503e1858b1d34e06800ea93 100644 (file)
@@ -488,10 +488,11 @@ class NonProductionCore(ControlBase):
                 pick = Signal(name="pick_"+name)     # picker input
                 rp = Signal(name="rp_"+name)         # picker output
                 delay_pick = Signal(name="dp_"+name) # read-enable "underway"
+                rhazard = Signal(name="rhaz_"+name)
 
                 # exclude any currently-enabled read-request (mask out active)
                 comb += pick.eq(fu.rd_rel_o[idx] & fu_active & rdflags[i] &
-                                ~delay_pick & ~hazard_detected)
+                                ~delay_pick & ~rhazard)
                 # entirely block anything hazarded from being picked
                 comb += rdpick.i[pi].eq(pick)
                 comb += fu.go_rd_i[idx].eq(delay_pick) # pass in *delayed* pick
@@ -535,9 +536,11 @@ class NonProductionCore(ControlBase):
                 # if FU is busy (which doesn't get set at the same time as
                 # issue) and no hazard was detected, clear wvchk_en (i.e.
                 # stop checking for hazards)
-                with m.If(fu.busy_o & ~hazard_detected):
+                with m.If(fu.busy_o & ~rhazard):
                         comb += wvchk_en.eq(0)
 
+                comb += rhazard.eq((wvchk.o_data & wvchk_en).bool())
+
                 wvens.append(wvchk_en)
 
         # or-reduce the muxed read signals