1a11) 0 0 0 1 0 0 0 1 0 0 0 0 This is a postive number, so any extra bits in the representation are just zeroes on the left side. 1a12) 0 0 0 1 0 0 0 1 0 0 0 0 Here, we just insert two zeroes between the sign bit (which is a zero), and the magnitude. 1a13) 1 0 0 1 0 0 0 1 0 0 0 0 This is just 2's complement, with the sign bit inverted. You can also convert the original number to decimal, add 2^11, and convert back to 2's complement. 1a21) 1 1 1 0 1 0 1 0 1 0 1 1 Remember to sign-extend the high-order bit, because we're going from a 10-bit representation to a 12-bit representation. 1a22) We start with 1 0 1 0 1 0 1 0 1 1 in 2's complement. This is a negative number - we want to find it's magnitude, so we find the negative of it by taking its 2's complement: = - 0 1 0 1 0 1 0 1 0 1 We extend to 12 bits, making it: = - 0 0 0 1 0 1 0 1 0 1 0 1 Finally We encode the sign bit: = 1 0 0 1 0 1 0 1 0 1 0 1 1a23) 0 1 1 0 1 0 1 0 1 0 1 1 Again, just take the answer to 1a21, and flip the sign bit. You can also convert the original number to decimal, add 2^11, and convert back to 2's complement. 1b) -513 is a negative number, so the sign bit is 1. 513 = 512 + 1 = 1*2^9 + 1*2^0 = 1 0 0 0 0 0 0 0 0 1 . 0 0 0 ... in binary We normalize this by moving the decimal point 9 places to the left: = 1 . 0 0 0 0 0 0 0 0 1 0 0 0 ... x 2^9 Since the leading 1 is implicit, our mantissa is: 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 bit# 01 03 05 07 09 11 13 15 17 19 21 23 bit# 02 04 06 08 10 12 14 16 18 20 22 Because we had 2^9 above, our exponent is +9. We encode this as: 127 + 9 = 136, or in binary, 1 0 0 0 1 0 0 0 We string the bits together to get: Bin: 1 1 0 0|0 1 0 0|0 0 0 0|0 0 0 0|0 1 0 0|0 0 0 0|0 0 0 0|0 0 0 0 S E E E|E E E E|E M M M|M M M M|M M M M|M M M M|M M M M|M M M M in Hex: C | 4 | 0 | 0 | 4 | 0 | 0 | 0 --------------------------------------------------------------------- 2) I assume (destination, source) for this code: MOVE R1, BLOCK AND R1, 0x003fffff ; clear the high 10 bits ; not really needed since shifting clears those bits anyway SHL R1, 10 ; shift into bits 10-31 MOVE R2, SET AND R2, 0x0000000f ; clear all but low 4 bits SHL R2, 6 ; shift into bits 6-9 MOVE R3, OFFSET AND R3, 0x0000003f ; clear all but low 6 bits ; dont have to shift OR R1, R2 ; OR all the bit-strings together OR R1, R3 MOVE CA, R1 ; store the result. --------------------------------------------------------------------- 3) WHO WHAT WHERE NAME POINTER g local 86 a <--SP g local 87 b g oldFP 88 oldFP(points to 92) <--FP g retAddr 89 RA in f g param 90 z = y (from function f) = c (from main) f local 91 u f oldFP 92 oldFP(points to location 99) f RetAddr 93 RA in main f param 94 x = b f param 95 y = c main local 96 a main local 97 b main local 98 c main oldFP 99 oldFP(points to the oldFP for the OS) main RetAddr 100 RA in OS Note that in our program, the main function takes no parameters, so main has no parameters to push onto the stack You only have to supply the last three columns for credit. The WHO and WHAT columns are just for understandability.