Skip to content

Commit e34333f

Browse files
committed
[prim_subreg_shadow] Prevent X-propagation for W1S/W0C shadow registers
The unfiltered input wd can be X and we must thus first qualify that with the write enable before factoring it into the update error signal. Signed-off-by: Pirmin Vogel <vogelpi@lowrisc.org>
1 parent 7fbd858 commit e34333f

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

hw/ip/prim/rtl/prim_subreg_shadow.sv

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -220,8 +220,9 @@ module prim_subreg_shadow
220220

221221
// Update errors can only occur in Phase 1. At this point, the shadow register contains the
222222
// unfiltered but negated input from software, i.e., the check has to be performed based on the
223-
// unfiltered input.
224-
assign err_update = (~shadow_q != wd) ? phase_q & wr_en : 1'b0;
223+
// unfiltered input. Note: the unfiltered input wd may be X - we should only use it if wr_en is
224+
// asserted.
225+
assign err_update = (phase_q && wr_en) ? (~shadow_q != wd) : 1'b0;
225226
end
226227

227228
// The committed register:

0 commit comments

Comments
 (0)