1. Consider a 32-bit binary number 0b11101101001011100000000101011010. Do the fo
ID: 2267493 • Letter: 1
Question
1. Consider a 32-bit binary number 0b11101101001011100000000101011010. Do the following. Express this number in the hexadecimal form Take the 2's complement of this number. Express the 2's complement in the hexadecimal form. Add the 2's complement you obtained to the original binary number 2. The following decimal X and Y values are to be added using 4-bit registers. Determine the Carry and oVerflow valus e., the C and V flags. Hint: use the 2's complement to represent the negative values ·X=2, Y = 7Explanation / Answer
1)Given binary is 0b11101101001011100000000101011010.
2's complement is obtained as follows:
The binary digits have to be complemented 1's as 0's and 0's as 1's this gives the 1's complement .Adding 1 to the LSB (least significant bit) gives the 2's complement form
1's complement for the given binary is 0b 10010110100011111111010100101
2's complement is 0b 10010110100011111111010100101+1
1 0010 1101 0001 1111 1110 1010 0110 => 12D1FEA6 H
2) The rules for turning on the carry flag in binary/integer math are two:
1.The carry flag is set if the addition of two numbers causes a carry out of the most significant (leftmost)
bits added.
Otherwise, the carry flag is turned off (zero).
The rules for turning on the overflow flag in binary/integer math are two:
1. If the sum of two numbers with the sign bits off yields a result number with the sign bit on, the
overflow flag is turned on.
eg:0100 + 0100 = 1000 (overflow flag is turned on)
2.If the sum of two numbers with the sign bits on yields a result number with the sign bit off, the
overflow flag is turned on.
. eg:1000 + 1000 = 0000 (overflow flag is turned on)
0010
+0011
----------
0101
---------
Here C=0and V=0
0010
+0111
----------
1001
----------
Here C=0and V=1
0100
+1011 (2'complement)
----------
1001
----------
Final sum is -001 i.e -1 in decimal
Here C=0and V=0
1011(2's complement)
+1001(2's complement)
----------
1100
----------
Here C=1and V=1
Result is -1100
0010
+1111(2's complement)
----------
0001
----------
Carry 1 will be discarded as positive numer is greater than the negative number
Here C=1and V=0
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.