From 5d798386c3b1c1dc45a2fbc382c9367ccc27c524 Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Wed, 9 Nov 2022 09:25:48 -0600 Subject: Implement reset --- rtl/core/porch/porch.sv | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'rtl/core/porch') diff --git a/rtl/core/porch/porch.sv b/rtl/core/porch/porch.sv index 6f5caf7..2eec438 100644 --- a/rtl/core/porch/porch.sv +++ b/rtl/core/porch/porch.sv @@ -3,6 +3,7 @@ module core_porch ( input logic clk, + rst_n, flush, stall, input psr_flags flags, @@ -35,8 +36,12 @@ module core_porch dec.ctrl.conditional = !flush && (dec.ctrl.conditional || conditional); end - always @(posedge clk) - if(!stall) begin + always_ff @(posedge clk or negedge rst_n) + if(!rst_n) begin + insn <= `NOP; + insn_pc <= 0; + hold_dec <= nop; + end else if(!stall) begin insn <= fetch_insn; hold_dec <= fetch_dec; @@ -44,10 +49,4 @@ module core_porch insn_pc <= fetch_insn_pc; end - initial begin - insn = `NOP; - insn_pc = 0; - hold_dec = nop; - end - endmodule -- cgit v1.2.3