aboutsummaryrefslogtreecommitdiff
path: root/rv64cpu/rtl/core/if_id_reg.sv
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-11-07 02:59:33 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-11-07 02:59:33 +0800
commitbc3ec25107314be3cd816c0b669d82338e892806 (patch)
treeff3e69ce6be1218be8bd0dd04e0c75760776d7dc /rv64cpu/rtl/core/if_id_reg.sv
parentc67ba709482821f37d63601b001ac07e6db867b6 (diff)
downloadrcc-project-bc3ec25107314be3cd816c0b669d82338e892806.tar.gz
rcc-project-bc3ec25107314be3cd816c0b669d82338e892806.tar.xz
checkpoint: preserve current RV64 CPU development state
Diffstat (limited to 'rv64cpu/rtl/core/if_id_reg.sv')
-rw-r--r--rv64cpu/rtl/core/if_id_reg.sv29
1 files changed, 22 insertions, 7 deletions
diff --git a/rv64cpu/rtl/core/if_id_reg.sv b/rv64cpu/rtl/core/if_id_reg.sv
index 904f038..0ea4fae 100644
--- a/rv64cpu/rtl/core/if_id_reg.sv
+++ b/rv64cpu/rtl/core/if_id_reg.sv
@@ -32,24 +32,39 @@ module if_id_reg
// Inputs from IF Stage
input logic [XLEN-1:0] if_pc, // PC from IF stage
input logic [INST_WIDTH-1:0] if_instr, // Fetched instruction from IF stage
+ input logic [2:0] if_instr_len,
+ input logic if_instr_access_fault,
+ input logic if_instr_page_fault,
// Outputs to ID Stage
output logic [XLEN-1:0] id_pc, // Passed to ID stage
- output logic [INST_WIDTH-1:0] id_instr // Passed to ID stage
+ output logic [INST_WIDTH-1:0] id_instr, // Passed to ID stage
+ output logic [2:0] id_instr_len,
+ output logic id_instr_access_fault,
+ output logic id_instr_page_fault
);
localparam logic [31:0] NOP_INSTR = 32'h0000_0013;
always_ff @(posedge clk) begin
if (rst) begin
- id_pc <= '0;
- id_instr <= NOP_INSTR;
+ id_pc <= '0;
+ id_instr <= NOP_INSTR;
+ id_instr_len <= 3'd4;
+ id_instr_access_fault <= 1'b0;
+ id_instr_page_fault <= 1'b0;
end else if (flush_en) begin
- id_pc <= '0;
- id_instr <= NOP_INSTR;
+ id_pc <= '0;
+ id_instr <= NOP_INSTR;
+ id_instr_len <= 3'd4;
+ id_instr_access_fault <= 1'b0;
+ id_instr_page_fault <= 1'b0;
end else if (~stall_en) begin
- id_pc <= if_pc;
- id_instr <= if_instr;
+ id_pc <= if_pc;
+ id_instr <= if_instr;
+ id_instr_len <= if_instr_len;
+ id_instr_access_fault <= if_instr_access_fault;
+ id_instr_page_fault <= if_instr_page_fault;
end
// If stall_en && !flush_en, maintain current state
end