TODO(vendor) [riscv-dv] using random offset for non-NAPOT regions to increase coverage

This commit is contained in:
Marno van der Maas 2022-10-17 15:58:51 +01:00
parent 1ab3bfea05
commit d2b6a7dfad
2 changed files with 4 additions and 8 deletions

View file

@ -743,6 +743,7 @@
gen_opts: >
+instr_cnt=6000
+pmp_randomize=1
+pmp_max_offset=00024000
+pmp_allow_illegal_tor=1
+directed_instr_0=riscv_load_store_rand_addr_instr_stream,50
sim_opts: >

View file

@ -114,12 +114,7 @@ class riscv_pmp_cfg extends uvm_object;
constraint addr_range_c {
foreach (pmp_cfg[i]) {
// Offset of pmp_cfg[0] is always set to 0 from main.
if (i != 0) {
pmp_cfg[i].offset inside {[1 : pmp_max_offset]};
} else {
pmp_cfg[i].offset == 0;
}
pmp_cfg[i].offset inside {[1 : pmp_max_offset]};
}
}
@ -135,7 +130,7 @@ class riscv_pmp_cfg extends uvm_object;
// In case illegal TOR regions are disallowed always add the constraint, otherwise make the
// remove the constraint for 1 in every XLEN entries.
if (i > 0 && pmp_cfg[i].a == TOR && (!pmp_allow_illegal_tor || pmp_cfg[i].addr_mode > 0)) {
pmp_cfg[i].addr > pmp_cfg[i-1].addr;
pmp_cfg[i].offset > pmp_cfg[i-1].offset;
}
}
}
@ -560,7 +555,7 @@ class riscv_pmp_cfg extends uvm_object;
//
// Only set the address if it has not already been configured in the above routine.
if (pmp_cfg_already_configured[i] == 1'b0 || pmp_cfg_addr_valid[i]) begin
if (pmp_cfg_addr_valid[i] || pmp_randomize) begin
if (pmp_cfg_addr_valid[i] || (pmp_randomize && pmp_cfg[i].a == NAPOT)) begin
// In case an address was supplied by the test or full randomize is enabled.
instr.push_back($sformatf("li x%0d, 0x%0x", scratch_reg[0], pmp_cfg[i].addr));
instr.push_back($sformatf("csrw 0x%0x, x%0d", base_pmp_addr + i, scratch_reg[0]));