Ch 2 . Number Systems and Codes

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

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 of Ch 2 . Number Systems and Codes

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

8Γ—

8Γ—

1.92

8Γ—

7.36

8Γ—

𝟎 .πŸ•πŸ–πŸπŸŽ=𝟎 .πŸ”πŸπŸ•β‹―πŸ–

β€’ 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