diff --git a/rv32_csrs.sv b/rv32_csrs.sv index 2203c81..032f9f4 100644 --- a/rv32_csrs.sv +++ b/rv32_csrs.sv @@ -137,6 +137,7 @@ module rv32_csrs ( input clk, + input stall_in, /* control in */ input read_in, @@ -301,7 +302,7 @@ module rv32_csrs ( end always_ff @(posedge clk) begin - if (write_in) begin + if (!stall_in && write_in) begin case (csr_in) `RV32_CSR_MSCRATCH: mscratch <= new_value; endcase diff --git a/rv32_execute.sv b/rv32_execute.sv index d72d8c5..0b9d13f 100644 --- a/rv32_execute.sv +++ b/rv32_execute.sv @@ -117,6 +117,7 @@ module rv32_execute ( rv32_csrs csrs ( .clk(clk), + .stall_in(stall_in), /* control in */ .read_in(csr_read_in),