diff --git a/bhv/cv32e40p_rvfi.sv b/bhv/cv32e40p_rvfi.sv index 4d8a537ac..e19866958 100644 --- a/bhv/cv32e40p_rvfi.sv +++ b/bhv/cv32e40p_rvfi.sv @@ -925,7 +925,8 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb; endfunction function void dcsr_to_id(); - trace_id.m_csr.dcsr_we = r_pipe_freeze_trace.csr.dcsr_we; + trace_id.m_csr.dcsr_wdata = trace_id.m_csr.dcsr_we ? trace_id.m_csr.dcsr_wdata : r_pipe_freeze_trace.csr.dcsr_n; + trace_id.m_csr.dcsr_we = r_pipe_freeze_trace.csr.dcsr_we | trace_id.m_csr.dcsr_we; trace_id.m_csr.dcsr_rdata = r_pipe_freeze_trace.csr.dcsr_q; trace_id.m_csr.dcsr_rmask = '1; trace_id.m_csr.dcsr_wdata = r_pipe_freeze_trace.csr.dcsr_n; @@ -1273,9 +1274,6 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb; `CSR_FROM_PIPE(id, tdata2) tinfo_to_id(); `CSR_FROM_PIPE(id, mip) - send_rvfi(trace_id); - trace_id.m_valid = 1'b0; - ->e_send_rvfi_trace_id_1; end end @@ -1485,6 +1483,11 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb; if (r_pipe_freeze_trace.csr.we) begin `CSR_FROM_PIPE(id, dpc) end + + if (r_pipe_freeze_trace.csr.dcsr_we) begin + dcsr_to_id(); + end + if (s_fflags_we_non_apu) begin trace_id.m_fflags_we_non_apu = 1'b1; end @@ -1530,6 +1533,10 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb; end else if (!trace_ex.m_valid & r_pipe_freeze_trace.rf_we_wb & !trace_id.m_ex_fw) begin trace_id.m_rd_addr[0] = r_pipe_freeze_trace.rf_addr_wb; trace_id.m_rd_wdata[0] = r_pipe_freeze_trace.rf_wdata_wb; + end else if (r_pipe_freeze_trace.rf_we_wb) begin + trace_id.m_rd_addr[1] = r_pipe_freeze_trace.rf_addr_wb; + trace_id.m_rd_wdata[1] = r_pipe_freeze_trace.rf_wdata_wb; + trace_id.m_2_rd_insn = 1'b1; end if (r_pipe_freeze_trace.data_req_ex) begin @@ -1667,7 +1674,7 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb; `CSR_FROM_PIPE(id, mcause) end - if (!s_id_done) begin + if (!s_id_done && r_pipe_freeze_trace.is_decoding) begin dcsr_to_id(); ->e_commit_dpc; end