906 views
0 votes
0 votes
A 8-bit CPU has an arithmetic unit that adds bytes and then sets its V, C and Z flag bits. The V bit is set if arithmetic overflow occurs in 2’s complement arithmetic. The C-bit is set if a carry out is generated from the most significant bit during an operation. The Z-bit is set if the result is zero. If the decimal numbers 204 and 143 are added using 8-bit addition, what are the values of the V, C and Z flag bits?

1 Answer

Best answer
1 votes
1 votes
@ Srestha , how can you represent 204 and 143 in 2's complement form with 8-bits????

the range of 2's complement numbers with 8 digits... -128 to +127

if you take it as 9 bits .... Both given positive numbers..

204 ------> 011001100

143 ------> 010010000

--------------------------------

------------>101011100 ------> carry in not equal to carry out.......> overflow occurs.... When overflow occurs remaining bits ( carry and some other flags ) may or may not correct , therefore no need to consider them..

 

204+143 = 344 which can't represent by using 9 bits in 2's complement form....

 

if u take it as 10 bits... Then overflow = 0, zero flag = 0 and carry flag = 0..
selected by

Related questions

1 votes
1 votes
0 answers
2
s_tripathi asked Dec 26, 2017
1,235 views
Is 1's/2's complement valid only for negative numbers? If 2's complement of a number is 1111111111110101, then the number should be 0000000000001011. Then the decimal rep...
0 votes
0 votes
3 answers
3
Parimal Paritosh asked Sep 20, 2017
3,838 views
Please give me an example of adding two negative numbers using 2's complement number system.Let's say:-7 + (-6)
0 votes
0 votes
0 answers
4
hem chandra joshi asked Sep 6, 2017
6,843 views
2's complement representation of a 16 bit number ( one sign bit and 15 magnitude bits) is FFFF . Its magnitude in decimal representation is(a) 0 (b) 1 (c)32767 (d)...