From 383f030f539fe1f0a0a02ee1e74ffded4ac24e20 Mon Sep 17 00:00:00 2001 From: Marno van der Maas Date: Fri, 14 Oct 2022 17:44:44 +0100 Subject: [PATCH] [pmp] Fix plusarg detection for MML and MMWP Signed-off-by: Marno van der Maas --- src/riscv_pmp_cfg.sv | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/riscv_pmp_cfg.sv b/src/riscv_pmp_cfg.sv index b501ba31..853e9601 100644 --- a/src/riscv_pmp_cfg.sv +++ b/src/riscv_pmp_cfg.sv @@ -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 @@ -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; @@ -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; @@ -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;