Presentation is loading. Please wait.

Presentation is loading. Please wait.

Computer Organization and Architecture Tutorial 6 Kenneth Lee.

Similar presentations


Presentation on theme: "Computer Organization and Architecture Tutorial 6 Kenneth Lee."— Presentation transcript:

1 Computer Organization and Architecture Tutorial 6 Kenneth Lee

2

3 For example: 2 bits 2s complement: 1011 00 01 -2 -1 0 +1 4 bits 2s complement: 1000 1001 1010 1011 1100 1101 1110 1111 0000 0001 0010 0011 0100 0101 0110 0111 -8 -7 -6 -5 -4 -3 -2 -1 0 +1 +2 +3 +4 +5 +6 +7 Addition of two 2-bit 2s complements generate a 2-bit result 11 +01 100 Means 3+1=4 or -1+1=0 Multiplication of two 2-bit in 2s complements generate a 4-bit result 11 X 01 0011 0000 0011 In unsigned integer, it means 3x1=3; but in 2s complement, it means (-1)x(+1)=+3. It is due to the unsigned integer and 2s complement have different extension pattern 11 X 01 1111 0000 1111

4

5 Biased representation example: 4-bit biased representation: 4-bit binary unsigned integer is from 0000 (0) ~ 1111 (15) Bias = 2 k-1 – 1 = 2 3 – 1 = 7 4-bit biased representation is from (0 – 7) ~ (15 – 7) 0000 0001 0010 0011 0100 0101 0110 0111 1000 1001 1010 1011 1100 1101 1110 1111 -7 -6 -5 -4 -3 -2 -1 0 +1 +2 +3 +4 +5 +6 +7 +8 The smallest is 0000 and the largest is 1111 The same with unsigned integer

6 Examples: Positive overflow (2 -1 + 2 -2 +…+ 2 -n = 1-2 -n )

7 Examples: Exponent overflow For 4-bit exponent in biased representation, the range is -7 ~ +8, so the largest exponent is +8 Examples: significant overflow 0.11 + 0.01 = 1.00

8 a.e is in 0~X with bias q, so the exponent is in –q~X-q the largest positive significant is 1-b -p (e.g. if b is 2 and significant is 3 digits, the largest positive is (0.111) 2 ; if b is 10 and significant is 3 digits, the largest positive is (0.999) 10 ) so the largest positive value is (1-b -p )x(b X-q ) the smallest positive significant is b -p (e.g. if b is 2 and significant is 3 digits, the largest positive is (0.001) 2 ; if b is 10 and significant is 3 digits, the largest positive is (0.001) 10 ) so the smallest positive value is b -p x(b -q ) b. For the normalized floating-point numbers, the difference with above is that the first bit can not be 0, so the largest value will keep the same. But the smallest positive value will be b -1 (e.g. if b is 2 and significant is 3 digits, the largest positive is (0.1) 2 ; if b is 10 and significant is 3 digits, the largest positive is (0.1) 10 ) so the smallest positive significant is b -1 x(b -q )

9 c. Minus means the sign is 1 (-1.5) 10 = (-1.1) 2 x2 0 so E is 0 and its biased representation is 01111111 (0+2 7 -1) (0.5) 10 = (0.1) 2 so the significant is 100000000000000000000000 d. 384 = 110000000 = 1.1x2 8 = 1.1x2 1000 So E is 8 and its biased representation is 8+2 7 -1 = 135 = 10000111 The significant is 0.1 and represented as 100000000000000000000000 e. 1/16 = (0.0001) 2 = 1.0x2 -4 So E is -4 and its biased representation is -4+2 7 -1=123=01111011 The significant is 0.0 and represented as 000000000000000000000000 f.Minus means the sign is 1 1/32 = 0.0001 = 1.0x2 -5 So E is -5 and its biased representation is -5+2 7 -1=122=01111010 The significant is 0.0 and represented as 000000000000000000000000

10 signBiased exponentFraction (Significant) 1 bit 11 bits 52 bits The exponent value is in 1~2046 (0 and 2047 are kept for special use) The bias is 1023 so the biased exponent is in -1022~+1023 So the largest positive is (2-2 -52 )x2 1023, the smallest positive is 2 -1022

11

12 9.27 Show how the following additions are performed. a.5.566 x 10 2 + 7.777 x 10 2 b. 3.344 x 10 1 + 8.877 x 10 -2

13 9.27 Show how the following additions are performed. a.7.744 x 10 -3 - 6.666 x 10 -3 b.8.844 x 10 -3 – 2.233 x 10 -1

14

15 B.1 Construct a truth table for following expressions:

16

17 B.2 simplify the following expressions according to the commutative law Commutative law: A+B = B+A; AB = BA

18 B.4 Apply DeMorgen’s theorem

19 B.4 Simplify the following expressions

20 B.5 Construct the operation XOR from Boolean AND, OR, and NOT ABXOR 000 011 101 110

21 B.6 Given a NOR gate and NOT gates, draw a three input AND function

22 B.7 Write the Boolean expression for a four-input NAND gate


Download ppt "Computer Organization and Architecture Tutorial 6 Kenneth Lee."

Similar presentations


Ads by Google