Reputation: 627
Implementing 8bit ALU in VHDL with unsigned numbers only. When the result of the sum is (1)00000000, 1 being the carry out, should the zero flag of the ALU be set to 1? Or the result is considered to be different from 0?
Upvotes: 1
Views: 1121
Reputation: 1032
I believe that with most every CPU, the zero flag would be set in this circumstance. The zero flag is independent from the carry flag in this sense. The programmer must check for overflow themselves when dealing with integer arithmetic and handle it appropriately.
Upvotes: 1
Reputation: 100547
(answer from regular CPU point of view... - i.e. http://z80-heaven.wikidot.com/flags-and-bit-level-instructions )
I'd expect if (result)
to chose false
branch after such operation. So it feels like zero flag should be set along with carry flag.
Upvotes: 0