Hi, I\'m having a hard time with these problems. Please explain and show your wo
ID: 3167682 • Letter: H
Question
Hi, I'm having a hard time with these problems. Please explain and show your work thoroughly. Also, make sure that your work is legible. Thanks.
Perform binary addition of the following pairs of 16-bit numbers (shown
in hexadecimal) and indicate whether your result is “right” or “wrong.” First
treat them as unsigned values, then as signed values (stored in two’s complement
format). Thus, you will have two “right/wrong” answers for each sum. Note that
the computer performs only one addition, setting both the CF and OF according
to the results of the addition. It is up to the program to test the appropriate flag
depending on whether the numbers are being considered as unsigned or signed in
the program.
a) 1111 + abcd
b) 0101 + 8080
c) 0f0f + 048b
Explanation / Answer
Answer:
a)
1111
0001 0001 0001 0001
abcd
1010 1011 1100 1101
bcde
1011 1100 1101 1110
The answer is correct. CF = 0, OF =0
b)
0101
0000 0001 0000 0001
8080
1000 0000 1000 0000
8181
1000 0001 1000 0001
The answer is correct. CF = 0 , OF = 0
c)
0f0f
0000 1111 0000 1111
048b
0000 0100 1000 1011
139a
0001 0011 1001 1010
The answer is correct. CF = 0 , OF = 0
Adding of hexadecimal numbers using signed bit:
a)
1111
0001 0001 0001 0001
abcd
1010 1011 1100 1101
2’s complement of abcd
0101 0100 0011 0011
In abcd, the left most bit is 1, which implies, it is a negative value. So, find the 2’s complement of abcd ‘s binary value. Then add the result.
Find the 2’s complement of the obtained result.
1111
0001 0001 0001 0001
2’s complement of abcd
0101 0100 0011 0011
6544
0110 0101 0100 0100
Answer: 6544
Convert 6544 into 2’complement value is (1001 1010 1011 1100)= 9ABC
CF = 0
OF = 1
b)
0101
0000 0001 0000 0001
8080
1000 0000 1000 0000
2’s complement of 8080
0111 1111 1000 0000
In 8080, the leftmost bit is 1, which implies, it is a negative value. So, find the 2’s complement of 8080 ‘s binary value. Then add the result.
Find the 2’s complement of the obtained result.
0101
0000 0001 0000 0001
2’s complement of 8080
0111 1111 1000 0000
9091
1001 0000 1001 0001
Answer: 9091
CF = 0
OF = 1
Convert 9091 into 2’complement value is (0110 1111 0110 1111)= 6f6f
c)
0f0f
0000 1111 0000 1111
048b
0000 0100 1000 1011
2’s complement of 048b
1111 1011 0111 0101
In 048b, the left most bit is 1, which implies, it is a negative value. So, find the 2’s complement of 048b ‘s binary value. Then add the result.
Find the 2’s complement of the obtained result.
0f0f
0000 1111 0000 1111
2’s complement of 048b
1111 1011 0111 0101
0a84
10000 1010 1000 0100
Answer: 0a84
CF = 1
OF = 0
Convert 0a84 into 2’complement value is (1111 0101 0111 1011)= F57B
1111
0001 0001 0001 0001
abcd
1010 1011 1100 1101
bcde
1011 1100 1101 1110
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.