Upload
nikkos
View
94
Download
1
Embed Size (px)
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
Citation preview
Ch 2. Number Systems and Codes
2.2 Octal and Hexadecimal Numbers
10 ~ 15 : Alphabet
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
𝟐𝟑 .𝟓𝟔𝟖=010011.101110𝟐𝑨𝑩 .𝟓𝑪𝟏𝟔=10101011.01011100𝟐
𝟏𝟏𝟎𝟎𝟏𝟏𝟎𝟏𝟎𝟎𝟏𝟏𝟏𝟎𝟐=315168𝟏𝟎𝟏𝟎𝟏𝟏𝟏𝟏𝟎𝟎𝟏𝟏𝟏𝟎𝟏𝟏𝟎𝟏𝟎𝟏𝟏 𝟐=15 𝐸76 𝐵16
𝟏𝟎𝟏𝟎𝟏𝟏𝟎𝟎 .𝟏𝟏𝟏𝟏𝟎𝟎𝟏𝟏𝟐=254.7468𝟏𝟎𝟏𝟎𝟏𝟏𝟎𝟎 .𝟏𝟏𝟏𝟏𝟎𝟎𝟏𝟏𝟐=𝐴𝐶 .𝐹 316
• Number conversion example
123416
7716
4 13
2 𝟏𝟐𝟑𝟒𝟏𝟎=𝟒𝑫𝟐𝟏𝟔
5678
708
8 6
7
8
1 0
𝟓𝟔𝟕𝟏𝟎=𝟏𝟎𝟔𝟕𝟖
• Number conversion example (decimal to hexadecimal, octal)
0.78
6.24
8×
8×
1.92
8×
7.36
8×
𝟎 .𝟕𝟖𝟏𝟎=𝟎 .𝟔𝟏𝟕⋯𝟖
• Number conversion example (decimal to octal)
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
2.4 Addition and Subtraction of Nondecimal Numbers
+
𝐹 9𝐵𝐵
Hexadecimal addition
• 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
𝒓𝒏−𝑫 :
: (𝒓 ¿¿𝒏−𝟏)−𝑫 ¿
(𝒓 ¿¿𝒏−𝟏)−𝑫 ¿(𝒓 ¿¿𝒏)−𝑫 ¿
Number :
• Conversion example
1000010184910−
815110
999910184910−
815010𝒓𝒏−𝑫 (𝒓 ¿¿𝒏−𝟏)−𝑫 ¿
+1Easy to complement
2.6 Two’s-Complement Addition and Subtraction
: (𝒓 ¿¿𝒏−𝟏)−𝑫 ¿
[ -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3, 4, 5, 6, 7 ]
[ 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 ]
2.7 One’s-Complement Addition and Subtraction
+6 (0110) -3 (1100) +
10010
1
0011
End-around carry
One’s complement
2.8 Binary Multiplication
Shifted and negated multiplicand
2.8 Binary Division
2.10 Binary Codes for Decimal Numbers
2.11 Gray Code
(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
2.13 Codes for Actions, Conditions, and States
2.14 n-Cubes and Distance
• Hamming Distance– Distance between two vertices, the number of difference
bits in each position EX) D(010, 111) = 2
2.15 Codes for Detecting and Correcting Errors
Parity-bit
At least two non codes between each pair of code words
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
111 110 101 100 011 010 001
LSB is 1 if all 7 bits are odd
LSB is 0 if all 7 bits are even
k = # of parity bitsm = # of info bits
𝟐𝐤≥𝒎+𝒌+𝟏 , m=4,3,2,1 , m=11,10,9,…,2,1
Undetectable Error
An important application of 2-D codes
2.16 Codes for Serial Data Transmission and Storage
NRZ : Non-Return to Zero
NRZI : Non-Return to Zero Invert on 1s
BPRZ : Bipolar Return to Zero