Skip to content

Commit

Permalink
Fix stalling logic of CSR result signal
Browse files Browse the repository at this point in the history
Fix the logic that stalls the decode buffer in case a CSR instruction
is committed but the result module is not yet ready to accept the
result (i.e., `result_csr_ready` is deasserted).  Fixes #59.
  • Loading branch information
michael-platzer committed May 23, 2022
1 parent dcf1d14 commit 93692f4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions rtl/vproc_core.sv
Original file line number Diff line number Diff line change
Expand Up @@ -331,12 +331,16 @@ module vproc_core #(
end
end

if (dec_buf_valid_q & (dec_data_q.unit == UNIT_CFG) & (dec_data_q.id == xif_commit_if.commit.id) & result_csr_ready) begin
if (dec_buf_valid_q & (dec_data_q.unit == UNIT_CFG) & (dec_data_q.id == xif_commit_if.commit.id)) begin
// Configuration instructions are not enqueued. The instruction
// is retired and the result returned as soon as it is
// committed.
dec_clear = 1'b1;
result_csr_valid = ~xif_commit_if.commit.commit_kill;
if (result_csr_ready | xif_commit_if.commit.commit_kill) begin
dec_clear = 1'b1;
end else begin
instr_notspec_d[xif_commit_if.commit.id] = 1'b1;
end
end else begin
instr_notspec_d[xif_commit_if.commit.id] = 1'b1;
end
Expand All @@ -347,9 +351,11 @@ module vproc_core #(
// Execute a configuration instruction that has already been
// committed earlier (i.e., while decoding and accepting the
// instruction).
dec_clear = result_csr_ready;
result_csr_valid = ~instr_killed_q[dec_data_q.id];
instr_notspec_d[dec_data_q.id] = 1'b0;
result_csr_valid = ~instr_killed_q[dec_data_q.id];
if (result_csr_ready | instr_killed_q[dec_data_q.id]) begin
dec_clear = 1'b1;
instr_notspec_d[dec_data_q.id] = 1'b0;
end
end
for (int i = 0; i < PIPE_CNT; i++) begin
if (instr_complete_valid[i]) begin
Expand Down

0 comments on commit 93692f4

Please sign in to comment.