Skip to content

Commit

Permalink
Merge pull request #872 from YoannPruvost/dev_rvfi_debug
Browse files Browse the repository at this point in the history
RVFI - fixing dcsr reporting and cv.lbu reporting issue when in debug test
  • Loading branch information
davideschiavone authored Sep 14, 2023
2 parents 531b867 + e1c6e75 commit d0f3305
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions bhv/cv32e40p_rvfi.sv
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit d0f3305

Please sign in to comment.