Presentation is loading. Please wait.

Presentation is loading. Please wait.

Recitation3: CS 3843 Computer Organization 4th week

Similar presentations


Presentation on theme: "Recitation3: CS 3843 Computer Organization 4th week"— Presentation transcript:

1 Recitation3: CS 3843 Computer Organization 4th week
Instructor: Dr. Vijayalakshmi Saravanan TA: Tianyi Liu

2 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.

3 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). = z = 1207 (mod 1024) = 183. = 361, which fits in 10 bits, so z = 361. = -361 which has the same 10-bit representation as , so z = = 663. 784 * 423 = 331,632. z = 331,632 (mod 1024) = 880. 5. 784/423 = 1.

4 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 = = that is -( ) = -103 z = x-y = = 75 z = y-x = = -75 z = x*y = 498*423= 210,654(mod 1024)=734 z = x/y = 498/423 = 1

5 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 = = = (x<<9) + (x << 8) – (x<<1) -x 1) convert 37 into sum of 2n 3) convert 503 into sum of 2n 37 = 503 = = (x<<5) + (x << 2) + x (x<<9) + (x << 3) – x

6 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] = ( )b* 25 s=0, E = 5 and exp = = 132 = [ ] and frac = Second, the answer is: The answer is = = ( )16.

7 Recitation3: 7 problems First, convert into IEEE format 6. For the IEEE single precision floating point representation (32 bits) what is the representation of the number ? Show your answer in binary in the form: x xxxxxxxx xxxxxxxxxxxxxxxxxxxxxxx and also as 8 hexadecimal digits. = ( )b = ( )b * 27 Since is negative, s = 1, E = 7 and exp = = 134 = [ ] and frac = Second, the answer is: The answer is = = (c37d4000)16.

8 Recitation3: 7 problems EXP=[ ]= 159 E = = 32 s = 0 Frac= M = So, V = ( )b * 232 = 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= Third, convert IEEE format into decimal ( )b = 0x187a = 6,570,377,216 Second, convert binary into IEEE format


Download ppt "Recitation3: CS 3843 Computer Organization 4th week"

Similar presentations


Ads by Google