1 / 22

Computer Organization and Architecture

Computer Organization and Architecture. Tutorial 6 Kenneth Lee. For example: 2 bits 2s complement: 11 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

brooks
Download Presentation

Computer Organization and Architecture

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Computer Organization and Architecture Tutorial 6 Kenneth Lee

  2. For example: • 2 bits 2s complement: • 11 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

  3. Biased representation example: 4-bit biased representation: 4-bit binary unsigned integer is from 0000 (0) ~ 1111 (15) Bias = 2k-1 – 1 = 23 – 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

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

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

  6. 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(bX-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-px(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-1x(b-q)

  7. c. Minus means the sign is 1 • (-1.5)10 = (-1.1)2x20 so E is 0 and its biased representation is 01111111 (0+27-1) • (0.5)10 = (0.1)2 so the significant is 100000000000000000000000 • d. 384 = 110000000 = 1.1x28 = 1.1x21000 • So E is 8 and its biased representation is 8+27-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+27-1=123=01111011 • The significant is 0.0 and represented as 000000000000000000000000 • Minus means the sign is 1 • 1/32 = 0.0001 = 1.0x2-5 • So E is -5 and its biased representation is -5+27-1=122=01111010 • The significant is 0.0 and represented as 000000000000000000000000

  8. 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)x21023, the smallest positive is 2-1022

  9. 9.27 Show how the following additions are performed. • 5.566 x 102 + 7.777 x 102 b. 3.344 x 101 + 8.877 x 10-2

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

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

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

  13. B.4 Apply DeMorgen’s theorem

  14. B.4 Simplify the following expressions

  15. B.5 Construct the operation XOR from Boolean AND, OR, and NOT

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

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

More Related