From bc3ec25107314be3cd816c0b669d82338e892806 Mon Sep 17 00:00:00 2001 From: Richard Qin Date: Sat, 7 Nov 2026 02:59:33 +0800 Subject: checkpoint: preserve current RV64 CPU development state --- rv64cpu/rtl/core/if_id_reg.sv | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) (limited to 'rv64cpu/rtl/core/if_id_reg.sv') 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 -- cgit v1.2.3