From 06b911723fd485323e34749bbb7e7a741b8dbd1e Mon Sep 17 00:00:00 2001 From: Adrian Lees Date: Wed, 22 Nov 2023 20:28:29 +0000 Subject: [PATCH] [dv,csr] Support non-HRO REGWEN fields 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 --- util/reggen/fpv_csr.sv.tpl | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/util/reggen/fpv_csr.sv.tpl b/util/reggen/fpv_csr.sv.tpl index bceaa41733b0c..cc1e49b45cb22 100644 --- a/util/reggen/fpv_csr.sv.tpl +++ b/util/reggen/fpv_csr.sv.tpl @@ -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;