322 162 Introduction to Computer Organization and Architecture

  • Slides: 62
Download presentation
322 162 Introduction to Computer Organization and Architecture Episode 3 Numbers Representation การแทนขอมลตวเลข

322 162 Introduction to Computer Organization and Architecture Episode 3 Numbers Representation การแทนขอมลตวเลข

����� Hamacher, V. Carl and others th Computer Organization 4 ed. New York :

����� Hamacher, V. Carl and others th Computer Organization 4 ed. New York : Mc. Graw-Hill, 1996. P. 257 - 301. H Hayes, John P. Computer rd Architecture and Organization 3 ed. Malaysia: Mc. Graw-Hill, 1998. P. 160 - 178, P. 223 - 302. H 4

����� H Stallings, William Computer Organization and Architecture : th designing for performance 5

����� H Stallings, William Computer Organization and Architecture : th designing for performance 5 ed. New. Jersey : Prentice-Hall, 2000. P. 269 - 312. 5

����� H Schneider, G. Michael and others Computer Organization and Assembly Language Programming for

����� H Schneider, G. Michael and others Computer Organization and Assembly Language Programming for the VAX John Wiley&Sons, 1987. P. 15 - 86. 6

Numeric Representation Fixed-point Numbers • Unsigned Binary • Sign-Magnitude • Complementation • Packed Decimal

Numeric Representation Fixed-point Numbers • Unsigned Binary • Sign-Magnitude • Complementation • Packed Decimal 7

เลขยกกำลงของสอง 0 2 = 1 21 = 2 2 2 = 4 3 2

เลขยกกำลงของสอง 0 2 = 1 21 = 2 2 2 = 4 3 2 = 8 4 2 = 16 5 2 = 32 6 2 = 64 7 2 = 128 28 = 256 29 = 512 10 2 = 1, 024 11 2 = 2, 048 12 2 = 4, 096 13 2 = 8, 192 7 2 = 128 28 = 256 29 = 512 10 2 =K=1, 024 15 2 = 32, 768 20 2 =M=1, 048, 576 30 2 =G=1, 073, 741, 824 8

Complement Numbers ������ a ’ 1 s Complements a’ 2 s Complements 17

Complement Numbers ������ a ’ 1 s Complements a’ 2 s Complements 17

’ 1 s Complements = 18+0001 0010 2 2 4 ตองการหาคา 1. 1’s Complement

’ 1 s Complements = 18+0001 0010 2 2 4 ตองการหาคา 1. 1’s Complement ของ -18 = 18+0 0 0 1 -18 1 1 1 01 = 18+0001 0010 --> -18 = 1110 20

’ 1 s Complements +65 = 0100 0001 2 2 6 ตองการหาคา 1. 1’s

’ 1 s Complements +65 = 0100 0001 2 2 6 ตองการหาคา 1. 1’s Complement ของ -65 +65 = 0 1 0 0 0 1 -65 1 0 1 1 00 +65 = 0100 0001 --> -65 = 1011 1110 21

’ 2 s Complementsn ������� 2 (n = data-bits( ���� 1’s Complements n =�������

’ 2 s Complementsn ������� 2 (n = data-bits( ���� 1’s Complements n =������� 4 )�� 4 n 4 1( =2 2 2������ = 2 = 161010000 = 10000 ’ 2 s Complements ��� 0011 ��� 0 0 1 1 1 0 0 1 1 23

’ 2 s Complements ตองการหาคา 1’s Complement ของ -18 = 18+0 0 0 1

’ 2 s Complements ตองการหาคา 1’s Complement ของ -18 = 18+0 0 0 1 1 1 1 01 + 1 -18 1 1 1 0 1 1 10 = 18+0001 0010 --> -18 = 1110 111 25

����� 56710 0101 011001111011 แทนดวย 5 6 7 95, 324+แทนดวย 10 - 0101 1001

����� 56710 0101 011001111011 แทนดวย 5 6 7 95, 324+แทนดวย 10 - 0101 1001 0010 0011 1100 010 5 9 2 3 + 4 29

����� Floating-point Numbers • Single Precision • Double Precision • Extended Format 30

����� Floating-point Numbers • Single Precision • Double Precision • Extended Format 30

Floating-Point Numbers ������������� (Floating of Binary Point) ������� 2 23 -1. 0341 X 10

Floating-Point Numbers ������������� (Floating of Binary Point) ������� 2 23 -1. 0341 X 10 6. 0247 X 10 ����� -14 -27 -7. 3000 X 10 6. 6254 X 10 ������� 5 ���� (Significant Digits) 31

Floating-Point Numbers 23 -27 2 ����� 10 , ���� Scale Factor -14 10 �������

Floating-Point Numbers 23 -27 2 ����� 10 , ���� Scale Factor -14 10 ������� (Normalized) ���� 3 24 ���� 0. 60247 X 10 -0. 10341 X 10 0. 66254 X -26 10 -0. 73000 X +/-X 1 X 2 X 3 X 4 X 5 X 6 X 7 X -13 10 +/-Y Y 1 2 10 32

Floating-Point Numbers ������� 3 ���� J ����� (Fraction or Mantissa) J ������ (Biased S

Floating-Point Numbers ������� 3 ���� J ����� (Fraction or Mantissa) J ������ (Biased S Exponent Mantissa Fraction Exponent) 33

IEEE 754 The Institute of Electrical and Electronic Engineers ������� Floating. Point Numbers ������

IEEE 754 The Institute of Electrical and Electronic Engineers ������� Floating. Point Numbers ������ 34

35

35

36

36

Single Precision 37

Single Precision 37

S Exponent ตวอยาง Mantissa Fraction 0 10010011 101000000000 1010001 + 14710 E = E’

S Exponent ตวอยาง Mantissa Fraction 0 10010011 101000000000 1010001 + 14710 E = E’ - 127 E = 147 - 127 = 20 = 10100 แทนคาเลขในฐานสบ มคาเทากบ 10100 +0. 11010001 X 2 1010001 40

S E’ ตวอยาง M 0 10010011 101000000000 1010001 +0. 11010001 X 10100 2 1

S E’ ตวอยาง M 0 10010011 101000000000 1010001 +0. 11010001 X 10100 2 1 10010011 101000000000 1010001 -0. 11010001 X 10100 2 41

S Exponent ตวอยาง Mantissa Fraction 0 01101011 101000000000 1010001 + 10710 แทนคาเลขในฐานสบ +0. 110100012

S Exponent ตวอยาง Mantissa Fraction 0 01101011 101000000000 1010001 + 10710 แทนคาเลขในฐานสบ +0. 110100012 X E = E’ - 127 E = 107 - 127 = -20 มคาเทากบ -20 2 43

S Exponent ตวอยาง Mantissa Fraction 0 001010000000000 00101 + 4010 แทนคาเลขในฐานสบ +0. 1001010…. .

S Exponent ตวอยาง Mantissa Fraction 0 001010000000000 00101 + 4010 แทนคาเลขในฐานสบ +0. 1001010…. . 02 E = E’ - 127 E = 40 - 127 = -87 มคาเทากบ -87 X 2 44

S Exponent ตวอยาง Mantissa Fraction 0 001010000000000 00101 + 4010 E = E’ -

S Exponent ตวอยาง Mantissa Fraction 0 001010000000000 00101 + 4010 E = E’ - 127 E = 40 - 127 = -87 45

Double Precision E = E’ - 102310 47

Double Precision E = E’ - 102310 47

Un-normalized Formats ������� Un-normalized��� Value ����� 1 Normalized ������ Binary Point ������� +0. 0010

Un-normalized Formats ������� Un-normalized��� Value ����� 1 Normalized ������ Binary Point ������� +0. 0010 9. . . X 2 1000=13610 – 12710 = 910 48

Normalized Formats ������� Normalized Value ��� Normalized ������� +1. 0110. . . 6 X

Normalized Formats ������� Normalized Value ��� Normalized ������� +1. 0110. . . 6 X 2 10000101=13310 – 12710 = 610 49

Exception Types ���������� Exceptions ��� 4 ��� • Invalid Operation • Division by Zero

Exception Types ���������� Exceptions ��� 4 ��� • Invalid Operation • Division by Zero • Overflow • Underflow 51

Invalid Operation ������ Square Root ���� 52

Invalid Operation ������ Square Root ���� 52

Division by Zero ������ 53

Division by Zero ������ 53

����� ` ������� IBM System 360 -370 Series ` Intel-Pentium II 59

����� ` ������� IBM System 360 -370 Series ` Intel-Pentium II 59

60

60

61

61

Introduction to Computer Organization and Architecture Coming Soon Chapter 2 Physical Representation

Introduction to Computer Organization and Architecture Coming Soon Chapter 2 Physical Representation