Skip to content

Commit

Permalink
Merge pull request #868 from openhwgroup/dev
Browse files Browse the repository at this point in the history
Automatic PR dev->master
  • Loading branch information
davideschiavone authored Sep 6, 2023
2 parents ed9fe0a + 7e13105 commit b1d11a4
Showing 1 changed file with 7 additions and 13 deletions.
20 changes: 7 additions & 13 deletions bhv/cv32e40p_rvfi.sv
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb;
function void empty_fifo();
integer i, trace_q_size;
trace_q_size = wb_bypass_trace_q.size();
if (trace_q_size > 40) begin
if (trace_q_size > 50) begin
$fatal("Reorder queue too long\n");
end
if (trace_q_size != 0) begin
Expand All @@ -636,6 +636,7 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb;
new_rvfi_trace = new();
new_rvfi_trace.copy_full(wb_bypass_trace_q.pop_front());
if (next_send == new_rvfi_trace.m_order) begin
new_rvfi_trace.m_csr.mstatus_rdata = r_pipe_freeze_trace.csr.mstatus_full_n;
rvfi_trace_q.push_back(new_rvfi_trace);
next_send = next_send + 1;
end else begin
Expand All @@ -655,7 +656,6 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb;
if (next_send == new_rvfi_trace.m_order) begin
rvfi_trace_q.push_back(new_rvfi_trace);
next_send = next_send + 1;
// empty_fifo();
end else begin
wb_bypass_trace_q.push_back(new_rvfi_trace);
end
Expand All @@ -674,7 +674,6 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb;
logic [31:0] s_fflags_mirror;
logic [31:0] s_frm_mirror;
logic [31:0] s_fcsr_mirror;
logic [31:0] s_mstatus_sd_fs_mirror;

function void set_rvfi();
insn_trace_t new_rvfi_trace;
Expand All @@ -696,21 +695,12 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb;
end else begin
s_fcsr_mirror = new_rvfi_trace.m_csr.fcsr_rdata;
end
if (new_rvfi_trace.m_csr.mstatus_we) begin
s_mstatus_sd_fs_mirror = new_rvfi_trace.m_csr.mstatus_wdata & 32'h8000_6000;
end else begin
s_mstatus_sd_fs_mirror = new_rvfi_trace.m_csr.mstatus_rdata & 32'h8000_6000;
end

end else begin
new_rvfi_trace.m_csr.fflags_rdata = s_fflags_mirror;
new_rvfi_trace.m_csr.frm_rdata = s_frm_mirror;
new_rvfi_trace.m_csr.fcsr_rdata = s_fcsr_mirror;
if (s_mstatus_sd_fs_mirror != 32'h0) begin
new_rvfi_trace.m_csr.mstatus_wdata = new_rvfi_trace.m_csr.mstatus_wdata | s_mstatus_sd_fs_mirror;
new_rvfi_trace.m_csr.mstatus_wmask = 32'hFFFF_FFFF;
s_mstatus_sd_fs_mirror = 32'h0; // Reset mirror
end

if (new_rvfi_trace.m_fflags_we_non_apu) begin
s_fflags_mirror = new_rvfi_trace.m_csr.fflags_wdata;
s_fcsr_mirror = new_rvfi_trace.m_csr.fcsr_wdata;
Expand Down Expand Up @@ -1111,6 +1101,10 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb;
trace_apu_resp.m_csr.mstatus_rmask = '1;
trace_apu_resp.m_csr.mstatus_wdata = r_pipe_freeze_trace.csr.mstatus_full_n;
trace_apu_resp.m_csr.mstatus_wmask = r_pipe_freeze_trace.csr.mstatus_we ? '1 : '0;

if (r_pipe_freeze_trace.csr.mstatus_we) begin
trace_ex.m_csr.mstatus_rdata = r_pipe_freeze_trace.csr.mstatus_full_n;
end
endfunction

function void csr_to_apu_req();
Expand Down

0 comments on commit b1d11a4

Please sign in to comment.