ALU Status Flags
How zero, negative, and carry flags summarize a small ALU result.
Updated 2026-07-09
Status flags carry small facts about an ALU result. A zero flag is high when every bit of the result is 0. A negative flag can use the most-significant bit of a fixed-width result, which is the bit later signed interpretations treat as the sign bit.
Carry is different: it describes an addition that needed one more bit than the visible result. Add two four-bit values into a five-bit temporary result, keep the lower four bits as y, and use the fifth bit as the carry flag. For example, 4'hF + 4'h1 produces a lower result of 0 with carry set.
Flags should receive defaults just like the ALU result. That makes the behavior for every opcode explicit, including logic operations that do not produce an arithmetic carry.