Add unsupported load/store instruction filtering
@@ -269,13 +269,28 @@ class riscv_instr extends uvm_object;
return instr_h;
endfunction : get_rand_instr
- static function riscv_instr get_load_store_instr(riscv_instr_name_t load_store_instr[] = {});
+ static function riscv_instr get_load_store_instr(riscv_instr_name_t load_store_instr[$] = {});
riscv_instr instr_h;
int unsigned idx;
+ int unsigned i;
riscv_instr_name_t name;
if (load_store_instr.size() == 0) begin
load_store_instr = {instr_category[LOAD], instr_category[STORE]};
end
+ // Filter out unsupported load/store instruction
+ if (unsupported_instr.size() > 0) begin
+ while (i < load_store_instr.size()) begin
+ if (load_store_instr[i] inside {unsupported_instr}) begin
+ load_store_instr.delete(i);
+ end else begin
+ i++;
+ end
+ end
+ end
+ if (load_store_instr.size() == 0) begin
+ $error("Cannot find available load/store instruction");
+ $fatal(1);
+ end
idx = $urandom_range(0, load_store_instr.size()-1);
name = load_store_instr[idx];
// Shallow copy for all relevant fields, avoid using create() to improve performance
