Skip to content

Commit

Permalink
[dv,csr] Support non-HRO REGWEN fields
Browse files Browse the repository at this point in the history
REGWEN fields may exist in CSRs that are non-HRO, but
those registers must not be modified indirectly by
CSR testing.

Signed-off-by: Adrian Lees <[email protected]>
  • Loading branch information
alees24 authored and Razer6 committed Oct 18, 2024
1 parent dd67758 commit bb4468a
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion util/reggen/fpv_csr.sv.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,29 @@ module ${mod_base}_csr_assert_fpv import tlul_pkg::*;
// Assign regwen to registers. If the register does not have regwen, it will default to value 1.
logic [${num_hro_regs}:0] regwen;
% for hro_reg in hro_regs_list:
<% regwen = hro_reg.regwen %>\
<%
regwen = hro_reg.regwen
hidden_regwen = True
mubi_regwen = False
mubi_width = 4
# Locate the REGWEN register and determine its type.
for reg in hro_regs_list:
if reg.name == regwen:
hidden_regwen = False
if reg.fields[0].mubi:
mubi_regwen = True
mubi_width = reg.fields[0].bits.width()
endif
endif
endfor
%>\
% if regwen == None:
assign regwen[${hro_map.get(hro_reg.offset)[0]}] = 1;
% elif mubi_regwen:
assign regwen[${hro_map.get(hro_reg.offset)[0]}] =
prim_mubi_pkg::mubi${mubi_width}_test_true_strict(prim_mubi_pkg::mubi${mubi_width}_t'(`REGWEN_PATH.${regwen.lower()}_qs));
% elif hidden_regwen:
// Register is controlled by a REGWEN that is not 'hwo' and not supported in fpv_csr
assign regwen[${hro_map.get(hro_reg.offset)[0]}] = 1;
% else:
assign regwen[${hro_map.get(hro_reg.offset)[0]}] = `REGWEN_PATH.${regwen.lower()}_qs;
Expand Down

0 comments on commit bb4468a

Please sign in to comment.