summaryrefslogtreecommitdiff
path: root/eater_cpu/eater_alu.sv
diff options
context:
space:
mode:
Diffstat (limited to 'eater_cpu/eater_alu.sv')
-rw-r--r--eater_cpu/eater_alu.sv8
1 files changed, 7 insertions, 1 deletions
diff --git a/eater_cpu/eater_alu.sv b/eater_cpu/eater_alu.sv
index d8748a4..fc54fc1 100644
--- a/eater_cpu/eater_alu.sv
+++ b/eater_cpu/eater_alu.sv
@@ -17,8 +17,10 @@ module eater_alu (
output wire AluFlags flags_out
);
+wire [8:0] full_result /* verilator public */;
wire [7:0] result /* verilator public */;
-assign result = subtract_n_add_in ? (A_in - B_in) : (A_in + B_in);
+assign full_result = subtract_n_add_in ? (A_in - B_in) : (A_in + B_in);
+assign result = full_result[7:0];
// wire [7:0] xormask = {8{subtract_n_add_in}};
// wire [7:0] B_neg_if = B_in ^ xormask;
// wire [7:0] result2 = A_in + B_neg_if + subtract_n_add_in;
@@ -29,4 +31,8 @@ zbuffer buffer (
.data_out(bus_out)
);
+assign flags_out.Zero = (result == 0);
+assign flags_out.Carry = full_result[8] == 1;
+assign flags_out.reserved = 'b0;
+
endmodule