Skip to content

Commit

Permalink
[pmp] Fix plusarg detection for MML and MMWP
Browse files Browse the repository at this point in the history
Signed-off-by: Marno van der Maas <[email protected]>
  • Loading branch information
marnovandermaas committed Oct 14, 2022
1 parent a2f9360 commit 383f030
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/riscv_pmp_cfg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ class riscv_pmp_cfg extends uvm_object;
stack_entry = pmp_num_regions - 2;
sig_entry = pmp_num_regions - 1;
// This is the default offset.
pmp_cfg[code_entry].offset = assign_default_addr_offset(pmp_num_regions, 0);
pmp_cfg[code_entry].offset = assign_default_addr_offset(pmp_num_regions, code_entry);
pmp_cfg[pmp_num_regions - 3].offset = pmp_max_offset;
end

Expand Down Expand Up @@ -443,7 +443,7 @@ class riscv_pmp_cfg extends uvm_object;
// In case the randomly selected code entry is not also configured in the arguments,
// overwrite it in pmp_cfg.
// The pmp_config has value LXWR = 1010, which means it is executable in both M and U mode.
if (!inst.get_arg_value($sformatf("+pmp_region_%d=", code_entry), arg_value)) begin
if (!inst.get_arg_value($sformatf("+pmp_region_%0d=", code_entry), arg_value)) begin
pmp_cfg[code_entry].l = tmp_pmp_cfg.l;
pmp_cfg[code_entry].a = tmp_pmp_cfg.a;
pmp_cfg[code_entry].x = tmp_pmp_cfg.x;
Expand Down Expand Up @@ -480,7 +480,7 @@ class riscv_pmp_cfg extends uvm_object;
pmp_cfg_already_configured[stack_entry] = 1'b1;
// In case the randomly selected stack_entry is not also specified in the arguments,
// overwrite it in pmp_cfg. We use this for the stack entry.
if (!inst.get_arg_value($sformatf("+pmp_region_%d=", stack_entry), arg_value)) begin
if (!inst.get_arg_value($sformatf("+pmp_region_%0d=", stack_entry), arg_value)) begin
if (mseccfg.mml) begin
// Marking the pmp stack region as shared write/read region before starting main.
pmp_cfg[stack_entry].l = 1'b0;
Expand All @@ -504,12 +504,12 @@ class riscv_pmp_cfg extends uvm_object;
instr.push_back($sformatf("srli x%0d, x%0d, 2", scratch_reg[0], scratch_reg[0]));
instr.push_back($sformatf("csrw 0x%0x, x%0d", base_pmp_addr + sig_entry,
scratch_reg[0]));
`uvm_info(`gfn, $sformatf("Address of pmp_addr_%d is signature_addr", sig_entry),
`uvm_info(`gfn, $sformatf("Address of pmp_addr_%0d is signature_addr", sig_entry),
UVM_LOW)
pmp_cfg_already_configured[sig_entry] = 1'b1;
// In case the randomly selected sig_entry is not also specified in the arguments,
// overwrite it in pmp_cfg. This is used for the signature address.
if (!inst.get_arg_value($sformatf("+pmp_region_%d=", sig_entry), arg_value)) begin
if (!inst.get_arg_value($sformatf("+pmp_region_%0d=", sig_entry), arg_value)) begin
if (mseccfg.mml) begin
// Marking the PMP signature region as shared write/read region before starting main.
pmp_cfg[sig_entry].l = 1'b0;
Expand Down

0 comments on commit 383f030

Please sign in to comment.