ch 2 . number systems and codes

47
Ch 2. Number Systems and Codes 2.2 Octal and Hexadecimal Numbers 10 ~ 15 : Alphabet

Upload: nikkos

Post on 22-Feb-2016

94 views

Category:

Documents


1 download

DESCRIPTION

Ch 2 . Number Systems and Codes. 2.2 Octal and Hexadecimal Numbers. 10 ~ 15 : Alphabet . 2.3 General Positional-Number-System Conversions. p digit to the left of the point and n digits to the right of the point. Ex) A number D of the form has the value . p. n. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Ch 2 . Number Systems and Codes

Ch 2. Number Systems and Codes

2.2 Octal and Hexadecimal Numbers

10 ~ 15 : Alphabet

Page 2: Ch 2 . Number Systems and Codes

Ex) A number D of the form has the value

𝐷=∑𝑖=−𝑛

𝑝− 1

𝑑𝑖𝑟𝑖

• p digit to the left of the point and n digits to the right of the point

𝑑𝑝−1𝑑𝑝− 2𝑑𝑝−3…𝑑1𝑑0 .𝑑−1𝑑−2𝑑−3…𝑑−𝑛

p n

2.3 General Positional-Number-System Conversions

Page 3: Ch 2 . Number Systems and Codes

𝟐𝟑 .𝟓𝟔𝟖=010011.101110𝟐𝑨𝑩 .𝟓𝑪𝟏𝟔=10101011.01011100𝟐

𝟏𝟏𝟎𝟎𝟏𝟏𝟎𝟏𝟎𝟎𝟏𝟏𝟏𝟎𝟐=315168𝟏𝟎𝟏𝟎𝟏𝟏𝟏𝟏𝟎𝟎𝟏𝟏𝟏𝟎𝟏𝟏𝟎𝟏𝟎𝟏𝟏 𝟐=15 𝐸76 𝐵16

𝟏𝟎𝟏𝟎𝟏𝟏𝟎𝟎 .𝟏𝟏𝟏𝟏𝟎𝟎𝟏𝟏𝟐=254.7468𝟏𝟎𝟏𝟎𝟏𝟏𝟎𝟎 .𝟏𝟏𝟏𝟏𝟎𝟎𝟏𝟏𝟐=𝐴𝐶 .𝐹 316

• Number conversion example

Page 4: Ch 2 . Number Systems and Codes

123416

7716

4 13

2 𝟏𝟐𝟑𝟒𝟏𝟎=𝟒𝑫𝟐𝟏𝟔

5678

708

8 6

7

8

1 0

𝟓𝟔𝟕𝟏𝟎=𝟏𝟎𝟔𝟕𝟖

• Number conversion example (decimal to hexadecimal, octal)

Page 5: Ch 2 . Number Systems and Codes

0.78

6.24

1.92

7.36

𝟎 .𝟕𝟖𝟏𝟎=𝟎 .𝟔𝟏𝟕⋯𝟖

• Number conversion example (decimal to octal)

Page 6: Ch 2 . Number Systems and Codes
Page 7: Ch 2 . Number Systems and Codes
Page 8: Ch 2 . Number Systems and Codes

Carry in

11+

01

10+

01Carry out

1

Carry out

01-

11

1 01-

11

Burrow out

1 Burrow in

Burrow out

: Carry in

: Burrow in

: Input data 1

: Input data 2

: Carry out

: Sum

: Burrow out

: Difference

Page 9: Ch 2 . Number Systems and Codes

2.4 Addition and Subtraction of Nondecimal Numbers

Page 10: Ch 2 . Number Systems and Codes

+

𝐹 9𝐵𝐵

Hexadecimal addition

Page 11: Ch 2 . Number Systems and Codes

• Signed-Magnitude System– Magnitude and Symbol ( ‘+’, ‘-’ )– Applied to binary number by using ‘sign bit’– Ex)

• Complement System– Negates a number by taking its complement– More difficult than changing the sign bit– Can be added or subtracted directly

2.5 Representation of Negative Numbers

Sign bit

Page 12: Ch 2 . Number Systems and Codes

𝒓𝒏−𝑫 :

: (𝒓 ¿¿𝒏−𝟏)−𝑫 ¿

(𝒓 ¿¿𝒏−𝟏)−𝑫 ¿(𝒓 ¿¿𝒏)−𝑫 ¿

Page 13: Ch 2 . Number Systems and Codes

Number :

• Conversion example

1000010184910−

815110

999910184910−

815010𝒓𝒏−𝑫 (𝒓 ¿¿𝒏−𝟏)−𝑫 ¿

+1Easy to complement

Page 14: Ch 2 . Number Systems and Codes

2.6 Two’s-Complement Addition and Subtraction

: (𝒓 ¿¿𝒏−𝟏)−𝑫 ¿

Page 15: Ch 2 . Number Systems and Codes
Page 16: Ch 2 . Number Systems and Codes

[ -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 ]

Page 17: Ch 2 . Number Systems and Codes

[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]

Page 18: Ch 2 . Number Systems and Codes

2.7 One’s-Complement Addition and Subtraction

+6 (0110) -3 (1100) +

10010

1

0011

End-around carry

One’s complement

Page 19: Ch 2 . Number Systems and Codes

2.8 Binary Multiplication

Page 20: Ch 2 . Number Systems and Codes

Shifted and negated multiplicand

Page 21: Ch 2 . Number Systems and Codes

2.8 Binary Division

Page 22: Ch 2 . Number Systems and Codes

2.10 Binary Codes for Decimal Numbers

Page 23: Ch 2 . Number Systems and Codes

2.11 Gray Code

Page 24: Ch 2 . Number Systems and Codes
Page 25: Ch 2 . Number Systems and Codes

(0) 1 1 0

1 0 1

Binary to Gray Code

If different, ‘1’else (same) ‘0’

(0) 1 0 1

1 1 0

Gray Code to Binary

If different, ‘1’else (same) ‘0’

12

3

12 3

Page 26: Ch 2 . Number Systems and Codes
Page 27: Ch 2 . Number Systems and Codes

2.13 Codes for Actions, Conditions, and States

Page 28: Ch 2 . Number Systems and Codes
Page 29: Ch 2 . Number Systems and Codes
Page 30: Ch 2 . Number Systems and Codes

2.14 n-Cubes and Distance

Page 31: Ch 2 . Number Systems and Codes
Page 32: Ch 2 . Number Systems and Codes

• Hamming Distance– Distance between two vertices, the number of difference

bits in each position EX) D(010, 111) = 2

Page 33: Ch 2 . Number Systems and Codes

2.15 Codes for Detecting and Correcting Errors

Parity-bit

Page 34: Ch 2 . Number Systems and Codes

At least two non codes between each pair of code words

Page 35: Ch 2 . Number Systems and Codes

If minimum distance = 2C+1, up to C-bits can be correctedIf 2C+D+1, then C-bits can be corrected, and d bits can be detected

4= 2C+D+1, (a) C=1, D=1(b) 1 bit can be corrected(c) D=3, 3 bit errors can be detected

Page 36: Ch 2 . Number Systems and Codes
Page 37: Ch 2 . Number Systems and Codes
Page 38: Ch 2 . Number Systems and Codes
Page 39: Ch 2 . Number Systems and Codes
Page 40: Ch 2 . Number Systems and Codes

111 110 101 100 011 010 001

Page 41: Ch 2 . Number Systems and Codes

LSB is 1 if all 7 bits are odd

LSB is 0 if all 7 bits are even

Page 42: Ch 2 . Number Systems and Codes

k = # of parity bitsm = # of info bits

𝟐𝐤≥𝒎+𝒌+𝟏 , m=4,3,2,1 , m=11,10,9,…,2,1

Page 43: Ch 2 . Number Systems and Codes
Page 44: Ch 2 . Number Systems and Codes

Undetectable Error

Page 45: Ch 2 . Number Systems and Codes

An important application of 2-D codes

Page 46: Ch 2 . Number Systems and Codes

2.16 Codes for Serial Data Transmission and Storage

Page 47: Ch 2 . Number Systems and Codes

NRZ : Non-Return to Zero

NRZI : Non-Return to Zero Invert on 1s

BPRZ : Bipolar Return to Zero