1
votes

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?

2
I find the following Freescale 68S12 microcontroller reference manual useful when designing an ALU, because it documents the logical operation that determines each of the CCR flags for every instruction. CPU12 Reference Manualmattgately

2 Answers

1
votes

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.

0
votes

(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.