Skip to content

Commit 8a97f64

Browse files
committed
when get_rand_instr is called with include_category, return null if no match. Simulation should fail as it is likely due to improper configuration
1 parent aa9da63 commit 8a97f64

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/isa/riscv_instr.sv

+6-2
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,12 @@ class riscv_instr extends uvm_object;
215215
idx = $urandom_range(0, allowed_instr.size()-1);
216216
name = allowed_instr[idx];
217217
end else begin
218-
idx = $urandom_range(0, instr_names.size()-1);
219-
name = instr_names[idx];
218+
if ( include_category.size() > 0 ) begin
219+
return null;
220+
end else begin
221+
idx = $urandom_range(0, instr_names.size()-1);
222+
name = instr_names[idx];
223+
end
220224
end
221225
end else begin
222226
if (!std::randomize(name) with {

src/riscv_directed_instr_lib.sv

+1-2
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@ class riscv_push_stack_instr extends riscv_rand_instr_stream;
336336
enable_branch = 0;
337337
end
338338
if(enable_branch) begin
339-
//branch_instr = riscv_instr::get_rand_instr(.include_category({BRANCH}));
340-
branch_instr = riscv_instr::get_rand_instr(.include_instr({BEQ, BNE, BLT, BGE, BLTU, BGEU}));
339+
branch_instr = riscv_instr::get_rand_instr(.include_category({BRANCH}));
341340
`DV_CHECK_RANDOMIZE_FATAL(branch_instr)
342341
branch_instr.imm_str = push_start_label;
343342
branch_instr.branch_assigned = 1'b1;

0 commit comments

Comments
 (0)