Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better mstatus when FPU instruction #867

Merged
merged 3 commits into from
Sep 6, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 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 Down Expand Up @@ -706,11 +706,11 @@ insn_trace_t trace_if, trace_id, trace_ex, trace_ex_next, trace_wb;
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 (s_mstatus_sd_fs_mirror != 32'h0) begin
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you delete this piece of code instead of commenting it? you can always find it back in the github history

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's done

// 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 +1111,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
Loading