Recitation3: CS 3843 Computer Organization 4th week Instructor: Dr. Vijayalakshmi Saravanan TA: Tianyi Liu
Recitation3: 7problems 1. Perform the following addition in base 8 without converting to another base. You must show the carries. Do not use a calculator, but you may use your fingers.
Recitation3: 7problems 2. Assume that x, y, and z are unsigned 10-bit integers. Suppose x = 784 and y = 423. Find the value of z if: 1) z = x + y; 2) z = x - y; 3) z = y - x; 4) z = x*y; 5) z = x/y; Unsigned 10-bit integer means there are 1024 integer numbers (0-1023). 784 + 423 = 1207. z = 1207 (mod 1024) = 183. 784 - 423 = 361, which fits in 10 bits, so z = 361. 423 - 784 = -361 which has the same 10-bit representation as 1024 - 361, so z = 1024 - 361 = 663. 784 * 423 = 331,632. z = 331,632 (mod 1024) = 880. 5. 784/423 = 1.
Recitation3: 7 problems 3. Assume that x, y, and z are two's complement 10-bit integers. Suppose x = 498 and y = 423. Find the value of z if: 1) z = x + y; 2) z = x - y; 3) z = y - x; 4) z = x*y; 5) z = x/y; First, we should know the range of 10-bit integers. That is -512 to +511. z = x+y = 498+423 = 511 + 410 that is -(513-410) = -103 z = x-y = 498-423 = 75 z = y-x = 423-498 = -75 z = x*y = 498*423= 210,654(mod 1024)=734 z = x/y = 498/423 = 1
Recitation3: 7 problems 2) convert 765 into sum of 2n 4. Use shifting, adding and subtracting to show how you would multiply an unsigned x by: 1) 37 2) 765 (do not use more than 3 shifts) 3) 503 (do not use more than 2 shifts) 765 = 512 + 256 -2 -1 = 29 + 28-21-20= (x<<9) + (x << 8) – (x<<1) -x 1) convert 37 into sum of 2n 3) convert 503 into sum of 2n 37 = 25 + 22 + 1 503 = 512 - 8 -1= 29 -23-20 (x<<5) + (x << 2) + x (x<<9) + (x << 3) – x
Recitation3: 7 problems First, convert 57 into IEEE format 5. For the IEEE single precision floating point representation (32 bits) what is the representation of the number 57? Show your answer in binary in the form: x xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx and also as 8 hexadecimal digits. 57 = [111001] = (1.11001)b* 25 s=0, E = 5 and exp = 5 + 127 = 132 = [10000100] and frac = 1100100...000. Second, the answer is: The answer is 0 10000100 11001000000000000000000 = 0100 0010 0110 0100 0000 0000 0000 0000 = (42640000)16.
Recitation3: 7 problems First, convert -253.25 into IEEE format 6. For the IEEE single precision floating point representation (32 bits) what is the representation of the number -253.25? Show your answer in binary in the form: x xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx and also as 8 hexadecimal digits. 253.25 = (11111101.01)b = (1.111110101)b * 27 Since -253.25 is negative, s = 1, E = 7 and exp = 7 + 127 = 134 = [10000110] and frac = 1111101010000...000. Second, the answer is: The answer is 1 10000110 11111010100000000000000 = 1100 0011 0111 1101 0100 0000 0000 0000 = (c37d4000)16.
Recitation3: 7 problems EXP=[1001 1111]= 159 E = 159-127 = 32 s = 0 Frac=. 100 0011 1101 0000 0000 0000 M = 1. 100 0011 1101 0000 0000 0000 So, V = (1. 100 0011 1101 0000 0000 0000)b * 232 = 1100 0011 1101 0000 0000 0000 0000 0000 7. For the IEEE single precision floating point representation (32 bits) what number os represented by the bit pattern corresponding to: 0x4fc3d000? First, convert 0x4fc3d000 into binary 0x4fc3d000= 0100 1111 1100 0011 1101 0000 00000 0000 Third, convert IEEE format into decimal (1100 0011 1101 0000 0000 0000 0000 0000)b = 0x187a0 0000 = 6,570,377,216 Second, convert binary into IEEE format 0 1001 1111 100 0011 1101 0000 00000 0000