Skip to content

Commit c755500

Browse files
author
pascalgouedo
authored
Merge pull request #2472 from dd-baoshan/cv32e40p/dev
Fix issue found in random test
2 parents 96c6960 + 4b53f31 commit c755500

File tree

3 files changed

+9
-10
lines changed

3 files changed

+9
-10
lines changed

cv32e40p/env/corev-dv/cv32e40p_asm_program_gen.sv

+1-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,7 @@ class cv32e40p_asm_program_gen extends corev_asm_program_gen;
430430
//gprs for floating point instructions
431431
if(RV32ZFINX inside {supported_isa}) begin
432432
foreach(corev_cfg.zfinx_reserved_gpr[i]) begin
433-
if (corev_cfg.zfinx_reserved_gpr[i] inside {ZERO, RA, SP, GP, TP}) continue;
433+
if (corev_cfg.zfinx_reserved_gpr[i] inside {ZERO, corev_cfg.ra, corev_cfg.sp, GP, corev_cfg.tp}) continue;
434434
imm = get_rand_spf_value();
435435
reg_name = corev_cfg.zfinx_reserved_gpr[i].name();
436436
str = $sformatf("%0sli%0s %0s, 0x%0x", indent, indent, reg_name.tolower(), imm);

cv32e40p/env/corev-dv/cv32e40p_instr_gen_config.sv

+1-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,7 @@ class cv32e40p_instr_gen_config extends riscv_instr_gen_config;
158158
zfinx_reserved_gpr.size() == num_zfinx_reserved_reg;
159159
unique {zfinx_reserved_gpr};
160160
foreach(zfinx_reserved_gpr[i]) {
161-
!(zfinx_reserved_gpr[i] inside {ZERO, RA, SP, GP, TP, S0, S1, A0, A1, A2, A3, A4, A5});
161+
!(zfinx_reserved_gpr[i] inside {ZERO, ra, sp, GP, tp, S0, S1, A0, A1, A2, A3, A4, A5});
162162
(zfinx_reserved_gpr[i] != dp);
163163
(zfinx_reserved_gpr[i] != str_rs1);
164164
(zfinx_reserved_gpr[i] != str_rs3);

cv32e40p/env/uvme/cov/uvme_rv32x_hwloop_covg.sv

+7-8
Original file line numberDiff line numberDiff line change
@@ -908,6 +908,7 @@ class uvme_rv32x_hwloop_covg # (
908908
if (is_init_mmode_mret && pending_irq_ack) begin
909909
is_init_mmode_mret = 0;
910910
pending_irq_ack = 0;
911+
wait(0); // stop this thread
911912
end
912913
end // INIT_MACHINE_MODE
913914
forever begin : IRQ_PERIOD
@@ -963,6 +964,8 @@ class uvme_rv32x_hwloop_covg # (
963964
enter_hwloop_sub_cnt++;
964965
if (is_trap && is_dbg_mode && !cv32e40p_rvvi_vif.csr_dcsr_step && enter_hwloop_sub_cnt == 1) begin : TRAP_DUETO_DBG_ENTRY // exception trap and debug are b2b cycles (except debug step)
965966
has_pending_trap_due2_dbg = 1;
967+
enter_hwloop_sub = 0; enter_hwloop_sub_cnt = 0;
968+
is_ebreak = 0; is_ecall = 0; is_illegal = 0; is_trap = 0;
966969
end // TRAP_DUETO_DBG_ENTRY
967970
else if (pc_is_mtvec_addr() && !is_mcause_irq()) begin : EXCEPTION_ENTRY
968971
for (int i=0; i<HWLOOP_NB; i++) begin
@@ -983,8 +986,8 @@ class uvme_rv32x_hwloop_covg # (
983986
if (prev_is_lpend_main[0] && prev_is_trap) hwloop_stat_main.track_lp_cnt[0]++;
984987
if (prev_is_lpend_main[1] && prev_is_trap) hwloop_stat_main.track_lp_cnt[1]++;
985988
has_pending_trap_due2_irq = 1;
986-
is_ebreak = 0; is_ecall = 0; is_illegal = 0; is_trap = 0;
987989
enter_hwloop_sub = 0; enter_hwloop_sub_cnt = 0;
990+
is_ebreak = 0; is_ecall = 0; is_illegal = 0; is_trap = 0;
988991
pending_irq = 0;
989992
`uvm_info(_header, $sformatf("DEBUG - EXCEPTION Entry is replaced with IRQ Entry (higher priority)"), UVM_DEBUG);
990993
`IF_CURRENT_IS_MAIN_HWLOOP(0, IS_IRQ)
@@ -1002,13 +1005,9 @@ class uvme_rv32x_hwloop_covg # (
10021005
// [optional] todo: mie has effect on irq during exception. Current hwloop tests do not exercise nested irq with mie enabled
10031006

10041007
check_exception_exit();
1005-
if (!(is_ebreak || is_ecall || is_illegal || has_pending_trap_due2_dbg || has_pending_trap_due2_irq)) begin
1008+
if (!(is_trap || is_ebreak || is_ecall || is_illegal || has_pending_trap_due2_dbg || has_pending_trap_due2_irq)) begin
10061009
enter_hwloop_sub = 0; enter_hwloop_sub_cnt = 0;
10071010
end
1008-
else if (has_pending_trap_due2_dbg) begin
1009-
enter_hwloop_sub = 0; enter_hwloop_sub_cnt = 0;
1010-
is_ebreak = 0; is_ecall = 0; is_illegal = 0; is_trap = 0;
1011-
end
10121011
prev_pc_rdata_sub = cv32e40p_rvvi_vif.pc_rdata;
10131012

10141013
end // ENTER_HWLOOP_SUB
@@ -1029,7 +1028,7 @@ class uvme_rv32x_hwloop_covg # (
10291028
if (has_pending_trap_due2_irq) begin
10301029
assert(prev_pc_rdata_main == cv32e40p_rvvi_vif.pc_rdata);
10311030
if (pc_is_mtvec_addr() || (cv32e40p_rvvi_vif.trap && is_trap)) begin is_trap = 1; enter_hwloop_sub = 1; has_pending_trap_due2_irq = 0; continue; end // if pc is exception related
1032-
else begin is_ebreak = 0; is_ecall = 0; is_illegal = 0; is_trap = 0; enter_hwloop_sub = 0; has_pending_trap_due2_irq = 0; continue; end // if pc is non-exception related
1031+
else begin is_ebreak = 0; is_ecall = 0; is_illegal = 0; is_trap = 0; enter_hwloop_sub = 0; has_pending_trap_due2_irq = 0; end // if pc is non-exception related
10331032
end
10341033
if (is_dbg_mode) begin
10351034
if (prev_is_lpend_main[0] && prev_is_trap && !is_ebreakm) hwloop_stat_main.track_lp_cnt[0]++;
@@ -1039,7 +1038,7 @@ class uvme_rv32x_hwloop_covg # (
10391038
if (has_pending_trap_due2_dbg) begin // e.g exception event intercept with debug step
10401039
assert (!dcsr_cause_t'(cv32e40p_rvvi_vif.csr_dcsr_cause) != STEP); // this is not mean for step debug
10411040
if (pc_is_mtvec_addr() || (cv32e40p_rvvi_vif.trap && is_trap)) begin is_trap = 1; enter_hwloop_sub = 1; has_pending_trap_due2_dbg = 0; continue; end // if pc is exception related
1042-
else begin is_ebreak = 0; is_ecall = 0; is_illegal = 0; is_trap = 0; enter_hwloop_sub = 0; has_pending_trap_due2_dbg = 0; continue; end // if pc is non-exception related
1041+
else begin is_ebreak = 0; is_ecall = 0; is_illegal = 0; is_trap = 0; enter_hwloop_sub = 0; has_pending_trap_due2_dbg = 0; end // if pc is non-exception related
10431042
end
10441043
if (cv32e40p_rvvi_vif.csr_dcsr_ebreakm && cv32e40p_rvvi_vif.insn == TB_INSTR_EBREAK) is_ebreakm = 1; else is_ebreakm = 0;
10451044
if (cv32e40p_rvvi_vif.trap) prev_is_trap = 1; else prev_is_trap = 0;

0 commit comments

Comments
 (0)