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