diff options
| author | uvok | 2026-01-25 16:22:21 +0100 |
|---|---|---|
| committer | uvok | 2026-01-25 16:22:21 +0100 |
| commit | 8668bdc4042f0fe91e95e0f70caca201d04955a2 (patch) | |
| tree | 23902dc23686f3cdd13ce7de67a045046f1ca08b /eater_cpu/eater_alu.sv | |
| parent | f69322528ca40c209abc0290b057bdc519aa3fd7 (diff) | |
eater: Set ALU flags
Diffstat (limited to 'eater_cpu/eater_alu.sv')
| -rw-r--r-- | eater_cpu/eater_alu.sv | 8 |
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 |
