Please show work, Thanks 1. Given Hexadecimal EDCC 16 Detail steps are required.
ID: 3750732 • Letter: P
Question
Please show work, Thanks
1. Given Hexadecimal EDCC16
Detail steps are required.
c) Convert it to decimal number if this is a 2s-complement signed binary representation in 16-bit register
d) Convert it to decimal number if this is an unsigned binary representation in 16-bit
2. Suppose we have 3 arrays A, B, and C, array A’s base address is in $S3, B’s base address is in $S4, C’s base address is in $S5. You can only use two temporal registers $t0 and $t1. Convert the following code into MIPS assembly language code. Suppose every array element occupies 1 word in MIPS (32 bits).
A[21] = B[2] + C[16];
Explanation / Answer
Question 1))
3)
First convert hexa to binary
That is done by converting each Hexa digit to binary
EDCC16 = 1110 1101 1100 1100 0001 0110
Now the leftmost bit is 1 means number is negative
To find the magnitude we take two's complement of the number(Two step process)
Step 1)) Invert each bit
0001 0010 0011 0011 1110 1001
Step 2)) Add 1
0001 0010 0011 0011 1110 1010
Now convert this to decimal to get the magnitude like you convert simple binary number which is 1192938
So final ans is -1192938
4)
In case of unsigned direcly convert binary to decimal
So the answer is
15584278
Note to convert from binary to decimal
Step1) Index each bit starting with 0 and right most bit and move towards left, increment the index as you move
Ex :: (1 0 0 )2
2 1 0 . Index
Now calculate weight for each position that is (Base of the number system)Index
Next multiply bit and corresponding weight and add all the terms
Ex :: ( 1 0 0)2 = (22.1 + 21.0 + 20.0) = (4)10