3.6 Is the result zero?

A special flag in an ALU also remembers whether the result of a computation is zero. This is usually called the Z flag for “zero”. The equation to compute the Z-flag after an add operation is quite simple:

z = s0 + s1 + s2 + s3 + sn-1

In other words, the Z-flag has a 1 iff all bits of the sum are zeroes. As with the most significant carry flag, the Z-flag is also latched so that the result of a prior add operation can be used in a later instruction.