Skip to content

Commit

Permalink
Referencing variables in with clause
Browse files Browse the repository at this point in the history
%Error: /path/riscv-dv/src/riscv_page_table_list.sv:182:87: Can't find definition of variable: 'u'
  182 |     if (!(valid_leaf_pte.randomize() with { if(privileged_mode == USER_MODE) {        u == 1'b1;      } else {                          if(!(cfg.mstatus_sum && cfg.mstatus_mprv)) {          u == 1'b0;        }      }             a == 1'b1;      d == 1'b1;             soft x
wr == R_W_EXECUTE_PAGE;             v == 1'b1; })) begin
      |                                                                                       ^

Signed-off-by: Ryszard Rozak <[email protected]>
  • Loading branch information
RRozak committed Dec 11, 2024
1 parent bcb2b3f commit 1d965e2
Showing 1 changed file with 2 additions and 19 deletions.
21 changes: 2 additions & 19 deletions src/riscv_page_table_list.sv
Original file line number Diff line number Diff line change
Expand Up @@ -161,24 +161,7 @@ class riscv_page_table_list#(satp_mode_t MODE = SV39) extends uvm_object;
// Create the basic legal page table entries
virtual function void create_valid_pte();
// Randomize a valid leaf PTE entry
`DV_CHECK_RANDOMIZE_WITH_FATAL(valid_leaf_pte,
// Set the correct privileged mode
if(privileged_mode == USER_MODE) {
u == 1'b1;
} else {
// Accessing user mode page from supervisor mode is only allowed when MSTATUS.SUM and
// MSTATUS.MPRV are both 1
if(!(cfg.mstatus_sum && cfg.mstatus_mprv)) {
u == 1'b0;
}
}
// Set a,d bit to 1 avoid page/access fault exceptions
a == 1'b1;
d == 1'b1;
// Default: Readable, writable, executable page
soft xwr == R_W_EXECUTE_PAGE;
// Page is valid
v == 1'b1;
`DV_CHECK_RANDOMIZE_WITH_FATAL(valid_leaf_pte,
)
$cast(valid_link_pte, valid_leaf_pte.clone());
$cast(valid_data_leaf_pte, valid_leaf_pte.clone());
Expand All @@ -196,7 +179,7 @@ class riscv_page_table_list#(satp_mode_t MODE = SV39) extends uvm_object;
virtual function void inject_page_table_exception(riscv_page_table_entry#(MODE) pte, int level);
`DV_CHECK_RANDOMIZE_FATAL(exception_cfg)
`DV_CHECK_RANDOMIZE_WITH_FATAL(illegal_pte,
!(xwr inside {NEXT_LEVEL_PAGE, R_W_EXECUTE_PAGE});)
)
// Wrong privilege mode setting
if(exception_cfg.allow_privileged_mode_exception) begin
pte.u = ~pte.u;
Expand Down

0 comments on commit 1d965e2

Please sign in to comment.