mirror of
https://github.com/lowRISC/ibex.git
synced 2025-06-28 09:17:17 -04:00
[rtl] Change code to be more xprop-friendly
Xprop is a simulation feature that improves the SV semantics when conditions contain 'X values. Change RTL or DV code to enable more xprop instrumentation. This addresses lowRISC/opentitan#16791 and some of lowRISC/opentitan#16723. Signed-off-by: Guillermo Maturana <maturana@google.com>
This commit is contained in:
parent
9a65bc1f0d
commit
ec32fb1a64
2 changed files with 15 additions and 17 deletions
|
@ -126,17 +126,17 @@ module ibex_cs_registers #(
|
||||||
// Is a PMP config a locked one that allows M-mode execution when MSECCFG.MML is set (either
|
// Is a PMP config a locked one that allows M-mode execution when MSECCFG.MML is set (either
|
||||||
// M mode alone or shared M/U mode execution)?
|
// M mode alone or shared M/U mode execution)?
|
||||||
function automatic logic is_mml_m_exec_cfg(ibex_pkg::pmp_cfg_t pmp_cfg);
|
function automatic logic is_mml_m_exec_cfg(ibex_pkg::pmp_cfg_t pmp_cfg);
|
||||||
logic unused_cfg;
|
logic unused_cfg = ^{pmp_cfg.mode};
|
||||||
unused_cfg = ^{pmp_cfg.mode};
|
logic value = 1'b0;
|
||||||
|
|
||||||
if (pmp_cfg.lock) begin
|
if (pmp_cfg.lock) begin
|
||||||
unique case ({pmp_cfg.read, pmp_cfg.write, pmp_cfg.exec})
|
unique case ({pmp_cfg.read, pmp_cfg.write, pmp_cfg.exec})
|
||||||
3'b001, 3'b010, 3'b011, 3'b101: return 1'b1;
|
3'b001, 3'b010, 3'b011, 3'b101: value = 1'b1;
|
||||||
default: return 1'b0;
|
default: value = 1'b0;
|
||||||
endcase
|
endcase
|
||||||
end
|
end
|
||||||
|
|
||||||
return 1'b0;
|
return value;
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
localparam int unsigned RV32BExtra = (RV32B == RV32BOTEarlGrey) || (RV32B == RV32BFull) ? 1 : 0;
|
localparam int unsigned RV32BExtra = (RV32B == RV32BOTEarlGrey) || (RV32B == RV32BFull) ? 1 : 0;
|
||||||
|
|
|
@ -56,16 +56,13 @@ module ibex_pmp #(
|
||||||
ibex_pkg::pmp_req_e pmp_req_type,
|
ibex_pkg::pmp_req_e pmp_req_type,
|
||||||
ibex_pkg::priv_lvl_e priv_mode,
|
ibex_pkg::priv_lvl_e priv_mode,
|
||||||
logic permission_check);
|
logic permission_check);
|
||||||
if (csr_pmp_mseccfg_mml) begin
|
return csr_pmp_mseccfg_mml ? mml_perm_check(csr_pmp_cfg,
|
||||||
return mml_perm_check(csr_pmp_cfg,
|
|
||||||
pmp_req_type,
|
pmp_req_type,
|
||||||
priv_mode,
|
priv_mode,
|
||||||
permission_check);
|
permission_check) :
|
||||||
end else begin
|
orig_perm_check(csr_pmp_cfg.lock,
|
||||||
return orig_perm_check(csr_pmp_cfg.lock,
|
|
||||||
priv_mode,
|
priv_mode,
|
||||||
permission_check);
|
permission_check);
|
||||||
end
|
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
// Compute permissions checks that apply when MSECCFG.MML is set. Added for Smepmp support.
|
// Compute permissions checks that apply when MSECCFG.MML is set. Added for Smepmp support.
|
||||||
|
@ -134,13 +131,14 @@ module ibex_pmp #(
|
||||||
// modes. Also deny unmatched for M-mode whe MSECCFG.MML is set and request type is EXEC.
|
// modes. Also deny unmatched for M-mode whe MSECCFG.MML is set and request type is EXEC.
|
||||||
logic access_fail = csr_pmp_mseccfg_mmwp | (priv_mode != PRIV_LVL_M) |
|
logic access_fail = csr_pmp_mseccfg_mmwp | (priv_mode != PRIV_LVL_M) |
|
||||||
(csr_pmp_mseccfg_mml && (pmp_req_type == PMP_ACC_EXEC));
|
(csr_pmp_mseccfg_mml && (pmp_req_type == PMP_ACC_EXEC));
|
||||||
|
logic matched = 1'b0;
|
||||||
|
|
||||||
// PMP entries are statically prioritized, from 0 to N-1
|
// PMP entries are statically prioritized, from 0 to N-1
|
||||||
// The lowest-numbered PMP entry which matches an address determines accessibility
|
// The lowest-numbered PMP entry which matches an address determines accessibility
|
||||||
for (int r = 0; r < PMPNumRegions; r++) begin
|
for (int r = 0; r < PMPNumRegions; r++) begin
|
||||||
if (match_all[r]) begin
|
if (!matched && match_all[r]) begin
|
||||||
access_fail = ~final_perm_check[r];
|
access_fail = ~final_perm_check[r];
|
||||||
break;
|
matched = 1'b1;
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return access_fail;
|
return access_fail;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue