Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions cv32e40p/env/corev-dv/cv32e40p_load_store_instr_lib.sv
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
class cv32e40p_multi_page_load_store_instr_stream extends riscv_multi_page_load_store_instr_stream;
rand int has_taken_avail_comp_reg[];
riscv_reg_t s0_a5_avail_regs[];
riscv_reg_t s0_a5_avail_regs_q[$]; // a temp queue for using .find method

constraint with_compress_instructions_c {
has_taken_avail_comp_reg.size() == rs1_reg.size();
Expand All @@ -42,14 +43,24 @@
function void pre_randomize();
super.pre_randomize();
s0_a5_avail_regs = {S0, S1, A0, A1, A2, A3, A4, A5};
s0_a5_avail_regs = s0_a5_avail_regs.find() with (!(item inside {cfg.reserved_regs, reserved_rd}));

s0_a5_avail_regs_q = s0_a5_avail_regs.find() with (!(item inside {cfg.reserved_regs, reserved_rd}));

// resize the dynamic array to the temp queue
s0_a5_avail_regs = new[s0_a5_avail_regs_q.size()];

// copy content of temp queue to the dynamic array
for (int i = 0; i < s0_a5_avail_regs_q.size(); i++) begin
s0_a5_avail_regs[i] = s0_a5_avail_regs_q[i];
end
endfunction
endclass


class cv32e40p_mem_region_stress_test extends riscv_mem_region_stress_test;
rand int has_taken_avail_comp_reg[];
riscv_reg_t s0_a5_avail_regs[];
riscv_reg_t s0_a5_avail_regs_q[$]; // a temp queue for using .find method

constraint with_compress_instructions_c {
has_taken_avail_comp_reg.size() == rs1_reg.size();
Expand All @@ -74,6 +85,15 @@
function void pre_randomize();
super.pre_randomize();
s0_a5_avail_regs = {S0, S1, A0, A1, A2, A3, A4, A5};
s0_a5_avail_regs = s0_a5_avail_regs.find() with (!(item inside {cfg.reserved_regs, reserved_rd}));

s0_a5_avail_regs_q = s0_a5_avail_regs.find() with (!(item inside {cfg.reserved_regs, reserved_rd}));

// resize the dynamic array to the temp queue
s0_a5_avail_regs = new[s0_a5_avail_regs_q.size()];

// copy content of temp queue to the dynamic array
for (int i = 0; i < s0_a5_avail_regs_q.size(); i++) begin
s0_a5_avail_regs[i] = s0_a5_avail_regs_q[i];
end
endfunction
endclass
12 changes: 11 additions & 1 deletion cv32e40p/env/corev-dv/cv32e40p_loop_instr.sv
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ class cv32e40p_loop_instr extends riscv_loop_instr;
rand int loop_cnt_has_taken_avail_comp_reg[];
rand int loop_limit_has_taken_avail_comp_reg[];
riscv_reg_t s0_a5_avail_regs[];
riscv_reg_t s0_a5_avail_regs_q[$]; // a temp queue for using .find method

constraint with_compress_instructions_c {
loop_cnt_has_taken_avail_comp_reg.size() == loop_cnt_reg.size();
Expand Down Expand Up @@ -50,7 +51,16 @@ class cv32e40p_loop_instr extends riscv_loop_instr;
function void pre_randomize();
super.pre_randomize();
s0_a5_avail_regs = {S0, S1, A0, A1, A2, A3, A4, A5};
s0_a5_avail_regs = s0_a5_avail_regs.find() with (!(item inside {cfg.reserved_regs, reserved_rd}));

s0_a5_avail_regs_q = s0_a5_avail_regs.find() with (!(item inside {cfg.reserved_regs, reserved_rd}));

// resize the dynamic array to the temp queue
s0_a5_avail_regs = new[s0_a5_avail_regs_q.size()];

// copy content of temp queue to the dynamic array
for (int i = 0; i < s0_a5_avail_regs_q.size(); i++) begin
s0_a5_avail_regs[i] = s0_a5_avail_regs_q[i];
end
endfunction

endclass