From 1f7f07b366fd0be0a34a8432bf82cbb5d3dcc58b Mon Sep 17 00:00:00 2001 From: xenia Date: Wed, 17 Jan 2024 13:58:14 +0100 Subject: [PATCH] No overflow flag when not in addition nor subtraction mode --- src/alu/alu.v | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/alu/alu.v b/src/alu/alu.v index 3b6b242..f326084 100644 --- a/src/alu/alu.v +++ b/src/alu/alu.v @@ -23,12 +23,16 @@ module alu( wire [31:0] adder_out; begin + wire addition = op == 3'b000; wire subtraction = op == 3'b001; wire [31:0] adder_B = subtraction ? ~B : B; wire adder_cout; carry_select_adder a(A, adder_B, subtraction, adder_out, adder_cout); - assign Fflow = subtraction ? ~adder_cout : adder_cout; + assign Fflow = + addition ? adder_cout : + subtraction ? ~adder_cout : + 0; end wire [31:0] mult_out_hi;