From 7e7c205367558b622fa56edaaa9c76491d57a4fa Mon Sep 17 00:00:00 2001 From: Alejandro Soto Date: Mon, 3 Oct 2022 12:16:01 -0600 Subject: Fix pipeline hazards --- rtl/core/psr.sv | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'rtl/core/psr.sv') diff --git a/rtl/core/psr.sv b/rtl/core/psr.sv index 2c0d48f..30bb320 100644 --- a/rtl/core/psr.sv +++ b/rtl/core/psr.sv @@ -7,23 +7,24 @@ module core_psr alu_v_valid, input psr_flags alu_flags, - output psr_flags flags, - next_flags + output psr_flags flags ); + psr_flags cpsr_flags; + always_comb begin - next_flags = flags; + flags = cpsr_flags; if(update_flags) begin - next_flags = alu_flags; + flags = alu_flags; if(~alu_v_valid) - next_flags.v = flags.v; + flags.v = cpsr_flags.v; end end always_ff @(posedge clk) - flags <= next_flags; + cpsr_flags <= flags; - initial flags = 4'b0000; + initial cpsr_flags = 4'b0000; endmodule -- cgit v1.2.3