Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. For the following two hexadecimal numbers which represent two 32-bit binary b

ID: 3701034 • Letter: 1

Question

1. For the following two hexadecimal numbers which represent two 32-bit binary bit patterns. a. 0x02324820 b. Ox8E130064 Please answer the following questions: (a) What decimal numbers do the above hexadecimal numbers represent if they are unsigned numbers? (10%) (b) What decimal numbers do the above hexadecimal numbers represent if they are signed numbers (in 2's complement format)? (10%) (c) What instructions do the above hexadecimal numbers represent if they are the machine codes of MIPS and what type (I-type, R-type) of instructions are they? (1 0%)

Explanation / Answer

a. Conversion of hexa-decimal numbers to unsigned decimal numbers

Suppose the number is rep by "abcdefgh" then its equivalent decimal number will be

a x 167 + b x 166 + c x 165 + d x 164 + e x 163 + f x 162 + g x 161 + h x 160

So given numbers "02324820" and "8E130064"can be return as

a.1) 0 x 167 + 2 x 166 + 3 x 165 + 2 x 164 + 4 x 163 + 8 x 162 + 2 x 161 + 0 x 160 = 36849696

a.2) 8 x 167 + E x 166 + 1 x 165 + 3 x 164 + 0 x 163 + 0 x 162 + 6 x 161 + 4 x 160 = 2383609956

b) Converting unsigned to signed integers.

Steps:

1)Take the note of the most significant bit of the number represented in binary form. if it is 0 then the number is positive, if it is 1 then the number will be negative. The sign is '-'

2) if it is 1, then invert the bits of the binary representation and then add 1 to the bin number.

3) Add negative sign to resultant number.

36849696 = 00000010001100100100100000100000

So the answer for 36849696 is same in signed form because the most significant bit is 0 in binary representation of the number.

2383609956 = 10001110000100110000000001100100

and for 2383609956 the answer is -1911357340

c)

c.1) MIPS code for 02324820 -> ADD $t1 $s1 $s2 (R-type add)

c.2) MIPS code for 8E130064 -> LW $s3 0x0064 $s0 (I-type Load Word)