Skip to content

Commit

Permalink
RVFI - Handle fcsr_we when frm_we or fflags_we late rather than early…
Browse files Browse the repository at this point in the history
… to avoid false fcsr_we issue in rvfi logic
  • Loading branch information
Yoann Pruvost committed Oct 10, 2023
1 parent 3db3dcb commit e45a57d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
4 changes: 3 additions & 1 deletion bhv/cv32e40p_rvfi.sv
Original file line number Diff line number Diff line change
Expand Up @@ -1115,6 +1115,9 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb;
* The third updates the rvfi interface
*/
`define CSR_FROM_PIPE(TRACE_NAME, CSR_NAME) \
if(!trace_``TRACE_NAME``.m_csr.``CSR_NAME``_we) begin \
trace_``TRACE_NAME``.m_csr.``CSR_NAME``_wdata = r_pipe_freeze_trace.csr.``CSR_NAME``_n; \
end\
if (r_pipe_freeze_trace.csr.``CSR_NAME``_we) begin \
trace_``TRACE_NAME``.m_csr.``CSR_NAME``_we = r_pipe_freeze_trace.csr.``CSR_NAME``_we; \
trace_``TRACE_NAME``.m_csr.``CSR_NAME``_wdata = r_pipe_freeze_trace.csr.``CSR_NAME``_n; \
Expand Down Expand Up @@ -1164,7 +1167,6 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb;
`CSR_FROM_PIPE(apu_resp, fcsr)
`CSR_FROM_PIPE(apu_resp, fflags)

// `CSR_FROM_PIPE(apu_resp, mstatus)
`CSR_FROM_PIPE(apu_resp, mstatus_fs)

if (r_pipe_freeze_trace.csr.mstatus_fs_we) begin
Expand Down
4 changes: 0 additions & 4 deletions bhv/pipe_freeze_trace.sv
Original file line number Diff line number Diff line change
Expand Up @@ -650,10 +650,6 @@ task monitor_pipeline();
if (r_pipe_freeze_trace.csr.fcsr_we) begin
r_pipe_freeze_trace.csr.fflags_we = 1'b1;
r_pipe_freeze_trace.csr.frm_we = 1'b1;
end else begin
if (r_pipe_freeze_trace.csr.fflags_we || r_pipe_freeze_trace.csr.frm_we) begin
r_pipe_freeze_trace.csr.fcsr_we = 1'b1;
end
end

if (csr_fcsr_fflags_we_i) begin
Expand Down

0 comments on commit e45a57d

Please sign in to comment.