What are the values of the Z, V, C and N bits in the status register after the operation 1000 + 1111 for a 4-bit ALU?

• @Camil Staps I tried adding the binaries together, but currently I am re reading over what each letter represents in regards to the ALU, e.g. zero flag etc
– Sim
Apr 6, 2013 at 12:20
• In doing this I guess the C = 1 and the and N = 0 V = 1 and Z = 1? I think that could be the answer but... any clarification on that?
– Sim
Apr 6, 2013 at 12:23
• The first step is: what would be the 5 bit result value? (5 bits because it makes you notice any carry) Apr 6, 2013 at 12:26
• @WoutervanOoijen 5 bit result would be 10111 I believe
– Sim
Apr 6, 2013 at 12:27
• Correct, and what happens next... what do the Z, V, C and N status bits do? What are their names and how is the answer (10111) going to affect the status bits. I think you are nearly there dude... just a little more confidence and practise. Apr 6, 2013 at 12:31

Let's look at bit level what happens in an addition. We're going to add 1111 to 1000.

• First, take the Least Significant Bits (LSB, the most right). We have a 1 and a 0. Summed, that makes 1. There's no overflow here.
• Now, the second bit. Again a 1 and a 0, so again a 1. No overflow, again.
• The same goes for the third bit.
• The Most Significant Bit (MSB, the most left) is different: two ones. This gives summed a 0, with an overflow. That would mean the fifth bit would get an extra 1, however, there's no fifth bit, so the overflow is placed in the carry.

The end result is thus: 0111

Now, let's have a look at the status bits.

• Z: "Indicates that the result of an arithmetic or logical operation (or, sometimes, a load) was zero." Is 0111 zero?
• V: "Indicates that the signed result of an operation is too large to fit in the register width using twos complement representation." Did we have an overflow?
• C: "used to indicate when an arithmetic carry or borrow has been generated out of the most significant ALU bit position." Was the MSB carried out?
• N: "Indicates that the result of a mathematical operation is negative." Is the result negative?
• Ok, so they're all 1 then...except Z
– Sim
Apr 6, 2013 at 12:41
• @Sim Almost. Is the result negative?
– user17592
Apr 6, 2013 at 12:43
• ah crap it is isn't it! since its 10111 = -9
– Sim
Apr 6, 2013 at 12:44
• @Sim the result isn't 10111. The result is 0111. Is that negative? If so, N=1. If not, N=0.
– user17592
Apr 6, 2013 at 12:46
• Oh right getting confused again, its just 7 which is not negative so N is 0, I just thought about that myself since 1 = true 0 = false was wondering why i thought you said it was wrong when i had it as 1, thanks alot Camil
– Sim
Apr 6, 2013 at 12:48