Pregunta

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?

¿Fue útil?

Solución

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

Otros consejos

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top