Assuming nine-bit 2’s complement representation, convert the
decimal number -137 to binary, show the effect of
the ROL operation on it with initial carry C=1,
show the status bits and then convert the result back to decimal.
Repeat with the ASR operation. Write the
RTL specification of both operations shown
here.
Answer:
Given that
-137 to 2's complement representation:
137 in 9-bit binary is ------->010001001
Inverting 0 to 1:
101110110
By Adding 1:
101110111
ROL operation with initial Carry C=1:
Rotating left with carry =1
1 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | <<------------- | 1-- carry |
0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 |
Carry=1
ROL with Carry 1 is :011101111
ASR operation:
0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 | 1 |
--------> rotating right
0 | 0 | 1 | 1 | 1 | 0 | 1 | 1 | 1 |
ASR with by rotating right is : 001110111
Get Answers For Free
Most questions answered within 1 hours.