UNIT 1 – Introduction: Number Systems
and Conversion
This chapter in the book includes:
Objectives
Study Guide
1.1
Digital Systems and Switching Circuits
1.2
Number Systems and Conversion
1.3
Binary Arithmetic
1.4
Representation of Negative Numbers
1.5
Binary Codes
Problems
Objectives
Topics introduced in this chapter:
• Difference between Analog and Digital System
• Difference between Combinational and Sequential Circuits
• Binary number and digital systems
• Number systems and Conversion
• Add, Subtract, Multiply, Divide Positive Binary Numbers
• 1’s Complement, 2’s Complement for Negative binary number
• BCD code, 6-3-1-1 code, excess-3 code
1.1 Digital Systems and Switching Circuits
1.1 Digital Systems and Switching Circuits
Digital systems
computation, data processing, control, communication, measurement..
Analog – Continuous
- Natural Phenomena (Pressure, Temperature, Speed…)
- It is difficult to realize and process using electronics
Digital – Discrete
- Binary Digit Signal Processing with “Bit” unit
- It is easy to realize and process using electronics
- High performance due to Integrated Circuit (IC) Technology
Binary Digit?
Binary
• Two values(0, 1)
• Each digit is called a “bit”
Advantages with Binary Numbers
• Number representation with only two values (0,1)
• Can be implemented with simple electronic devices
(ex: Voltage High(1), Low(0) ;
Switch On (1) Off(0)…)
Switching Circuit
• Combinational Circuit :
• Outputs depend on only present inputs, not on past inputs
• Sequential Circuit:
• Outputs depend on both present inputs and past inputs (i.e. sequence)
• Have “memory” elements
Discrete number
Figure 1-1: Switching circuit
Discrete number
Combinational & Sequential Circuits in this Class
UNIT1 – Introduction Number Systems and Conversion
UNIT2 – Boolean Algebra
UNIT3 – Boolean Algebra (continued)
UNIT4 – Applications of Boolean Algebra
UNIT5 – Karnaugh Maps
UNIT6 – Quine-McCluskey Method
UNIT7 – Multi-Level Gates Circuits NAND and NOR Gates
UNIT8 – Combinational Circuit Design and Simulation using Gates
UNIT9 – MUXs, Decoders, and PLDs
UNIT11 – Latches and Flip-Flops
UNIT12 – Registers and Counters
UNIT13 – Analysis of Clocked Sequential Circuits
UNIT14 – Derivation of State Graphs and Tables
UNIT15 – Reduction of State Tables, State Assignment (optional)
1.2
Number Systems and Conversion
Decimal:
953.7810 = 9 × 10 2 + 5 × 101 + 3 × 10 0 + 7 × 10 −1 + 8 × 10 −2
Binary:
1011.112 = 1× 23 + 0 × 2 2 + 1× 21 + 1× 2 0 + 1× 2 −1 + 1× 2 −2
= 8 + 0 + 2 +1+
For Radix(=Base) R,
Here, “R” is
a positive integer
1 1
3
+ = 11 = 11.7510
2 4
4
N = (a4 a3a2 a1a0 .a−1a− 2 a−3 ) R
= a4 × R 4 + a3 × R 3 + a2 × R 2 + a1 × R1 + a0 × R 0
+ a−1 × R −1 + a− 2 × R − 2 + a−3 × R −3
3
8
Octal-Decimal:
147.38 = 1× 82 + 4 × 81 + 7 × 80 + 3 × 8−1 = 64 + 32 + 7 +
Hexa-Decimal:
= 103.37510
A2 F16 = 10 × 16 2 + 2 × 161 + 15 × 160 = 2560 + 32 + 15 = 260710
0,1,2,3,…,9, A, B, C, D, E, F
The above examples show how to convert a Base-R number into a decimal number (N)
1.2
Number Systems and Conversion
How to convert a decimal number (N) into a Base-R number (anan-1…a2a1a0)
N = (an an −1 ⋅ ⋅ ⋅ a2 a1a0 ) R = an R n + an −1 R n −1 + ⋅ ⋅ ⋅ + a2 R 2 + a1 R1 + a0
unknown
N
= an R n −1 + an −1R n −2 + ⋅⋅⋅ + a2 R1 + a1 = Q1 , remainder a0
R
Q1
= an R n −2 + an −1R n −3 + ⋅⋅⋅ + a3 R1 + a2 = Q2 , remainder a1
R
Q2
= an R n −3 + an −1 R n − 4 + ⋅ ⋅ ⋅ + a3 = Q3 , remainder a2
R
.
.
.
.
.
(n+1)th division
.
.
.
.
remaninder an
1.2
Number Systems and Conversion
Example: Decimal to Binary Conversion
2
53
2
26
rem. = 1 = a0
2
13
rem. = 0 = a1
2
6
rem. = 1 = a2
2
3
rem. = 0 = a3
2
1
rem. = 1 = a4
0
rem. = 1 = a5
N = 53, R = 2
5310 = 1101012
1.2
Number Systems and Conversion
Conversion of a decimal fraction (F) to Base-R
(e.g. 0.625)
F = (.a−1a− 2 a−3 ⋅ ⋅ ⋅ a− m ) R = a−1 R −1 + a− 2 R −2 + a−3 R −3 + ⋅ ⋅ ⋅ + a− m R − m
FR = a−1 + a− 2 R −1 + a−3 R −2 + ⋅ ⋅ ⋅ + a− m R − m +1 = a−1 + F1
F1 R = a− 2 + a−3 R −1 + ⋅ ⋅ ⋅ + a− m R − m + 2 = a− 2 + F2
F2 R = a−3 + ⋅ ⋅ ⋅ + a− m R − m +3 = a−3 + F3
Example:
Each multiplication
leaves a decimal fraction Fi
with an integer a-i representing
each digit in the base R.
F = .625 F1 = .250 F2 = .500
×
2
×
2
×
2
1.250
1.000
0.500
(a−1 = 1)
(a− 2 = 0)
(a−3 = 1)
.62510 = .1012
1.2
Number Systems and Conversion
Example: Convert 0.7 to binary
.7
2
(1).4
2
(0).8
2
(1).6
2
(1).2
2
(0).4
2
(0).8
Once 0.4 appears in the process, then the sequence of 8-6-2-4 is
generated repeatedly
0.710 = 0.10110 0110 0110 ⋅ ⋅ ⋅2
1.2
Number Systems and Conversion
231.34 = 2 ×16 + 3 × 4 + 1 +
Example: Convert 231.34 to base-7
One arbitrary base to another
arbitrary base:
Base Ra
Base 10 (i.e. decimal)
Base Rb
7
45
7
6
rem.3
0
rem.6
3
= 45.7510
4
.75
7
(5).25
7
45.7510 = 63.5151 ⋅ ⋅ ⋅7
(1).75
7
(5).25
7
(1).75
Conversion of Binary to Hexa-decimal
4 digits of base 2
1 digit of base 16
1001101.0101112 = 0100 1101 . 0101 1100 = 4D.5C16
1.2
Number Systems and Conversion
EXAMPLES : Conversion of Binary to Octal, Hexa-decimal
(101011010111)2
=(
)8, octal
(10111011.11)2
=(
)8, octal
(1010111100100101)2
=(
)16, Hexadecimal
(1111101000.011)2
=(
)16, Hexadecimal
1.3
Binary Arithmetic
Addition
0+0=0
0 +1 = 1
1+ 0 =1
1 + 1 = 0 and carry 1 to the next column
Example:
1101 + 1011
1111
1310 = 1101
carries
1110 = 1011
11000 = 2410
1.3
Binary Arithmetic
column 2
Subtraction with Decimal Numbers
column 1
205
− 18
187
205 − 18 = [2 × 10 2 + 0 × 101 + 5 × 10 0 ]
−[
1× 101 + 8 × 10 0 ]
borrow from column 1
= [2 × 10 2 + (0 − 1) × 101 + (10 + 5) × 10 0 ]
−[
1× 101 +
8 × 10 0 ]
borrow from column 2
= [(2 − 1) × 10 2 + (10 + 0 − 1) × 101 + 15 × 100 ]
−[
= [1× 10 2
1) × 101 + 8 × 100 ]
+ 8 × 101
+ 7 × 100 ] = 187
1.3
Binary Arithmetic
Subtraction
0−0 = 0
0 − 1 = 1 and borrow 1 from the next column
1− 0 =1
1 −1 = 0
Example:
1
11101
− 10011
1010
(indicates
a borrow
from the
3rd column)
1111
10000
−
11
1101
borrows
111
111001
−
1011
101110
borrows
1.3
Binary Arithmetic
Multiplication
Multiply: 13 x11(10)
0× 0 = 0
0 ×1 = 0
1× 0 = 0
1101
0000
1× 1 = 1
1111
1101
1111
Addition in each step
to avoid carries
greater than 1
×
1101
1011
1101
1101
10001111 = 14310
multiplicand
multiplier
first partial product
second partial product
0000
(01111) sum of first two partial products
third partial product
1111
(1001011) sum after adding third partial product
fourth partial product
1111
11000011 final product (sum after adding fourth partial product)
1.3
Binary Arithmetic
Division
Example: 14510 by 1110 (i.e. 100100012 by 10112)
1101
1011 10010001
1011
1110
1011
1101
1011
10
(1) and (2)
(3)
(4)
Begin from high digits
(1) Compare 1001 and 1011
1001 < 1011
Moves one place
quotient 0
(2) Compare 10010 and 1011
10010 > 1011
quotient 1
(3) Compare 1110 and 1011
1110 > 1011
quotient 1
.
.
.
(4) Done with a remainder of 10