Professional Documents
Culture Documents
Class Notes (Part 1) : Dr. C. N. Zhang Department of Computer Science University of Regina Regina, SK, Canada, S4S 0A2
Class Notes (Part 1) : Dr. C. N. Zhang Department of Computer Science University of Regina Regina, SK, Canada, S4S 0A2
CS201
Dr. C. N. Zhang
Department of Computer Science
University of Regina
Regina, SK, Canada, S4S 0A2
C. N. Zhang, CS400 2
I. DIGITAL CIRCUITS
1 Binary Algebra and Gates
1.1 Binary Algebra
An algebra that deals with binary variables and logic operations.
All variables take on two discrete values 1 and 0 (binary variable).
There are three basic operations: OR, AND, NOT dened as follows:
AND OR NOT
X Y X.Y X Y X+Y X X
0 0 0 0 0 0 0 1
0 1 0 0 1 1 1 0
1 0 0 1 0 1
1 1 1 1 1 1
X 0 0 1 1
Y 0 1 0 1
(AND) X . Y 0 0 0 1
(OR) X + Y 0 1 1 1
(NOT) X 1 1 0 0
A
A B
B F = ABC C F=A+B+C+D
C D
Three-input AND gate Four-input OR gate
Y F
Z
Y
Y F F
Z
Z
F=XYZ+XYZ+XZ F=XY+XZ
Example 2:
XY + XZ + Y Z = XY + XZ + Y Z (X + X by (7)
= XY + XZ + XY Z + XY Z by (14)
= XY + XY Z + XZ + XY Z by (12)
= XY (1 + Z ) + XZ (1 + Y ) by (14)
= XY + XZ by (7)
Example 3:
(A + B )(A + C ) = AA + AC + AB + BC by (14)
= AC + AB + BC by (8)
= AC + AB + ABC + ABC by (1 and 14)
= AC (1 + B ) + AB (1 + C ) by (14)
= AC + AB by (3)
Example 4:
(A + C )(B + C ) = AB + AC + BC + CC by (14)
= AB + AC + BC + C by (6)
= AB + (A + B + 1)C by (14)
= AB + C by (3)
Find complement of Boolean function.
The complement of Boolean function f (x1; : : :; xn) denoted by f (x1; : : :; xn) can be ob-
tained by the following approaches:
1. Approach-1 (based on truth table): The truth table of f (x1; : : : ; xn) can be
obtained from the truth table of f (x1; : : : ; xn) by exchanging the values of 0 to 1
and 1 to 0 in the function value column.
2. Approach-2 (apply DeMorgan Law repeatedly):
Example-1: Find complement of function F = XY Z + XY Z .
F = XY Z + XY Z
= (XY Z ) (XY Z )
= (X + Y + Z ) (X + Y + Z )
= XX + XY + XZ + XY + Y Y + Y Z + XZ + Y Z + ZZ
= X + XY + XZ + XY + Y Z + XZ + Y Z
= X (1 + Y + Z + Y + Z + Y ) + Y Z + Y Z
= X +YZ +YZ
C. N. Zhang, CS400 6
A B t
5V
∆t
t
5 ns < ∆t < 10 ns
Time delay of logic circuit: It adds up the time delay of all gates on a path from
input to output which requires longest time delay.
Logic circuit cost: It depends on:
{ number of gates required
{ number of inputs for each gate
Minimum cost logic circuit design:
{ minimum number of gates with minimum total number of inputs
Goal of logic circuit design:
{ minimum cost and minimum time delay
C. N. Zhang, CS400 7
Example:
MINTERMS MAXTERMS
0 0 0 X Y Z m0 X+Y+Z M0
0 0 1 X Y Z m1 X+Y+Z M1
0 1 0 X Y Z m2 X+Y+Z M2
0 1 1 X Y Z m3 X+Y+Z M3
1 0 0 X Y Z m4 X+Y+Z M4
1 0 1 X Y Z m5 X+Y+Z M5
1 1 0 X Y Z m6 X+Y+Z M6
1 1 1 X Y Z m7 X+Y+Z M7
2. Product of maxterms.
E (X; Y; Z ) = XY + Z
= (X + Z )(Y + Z )
= (X + Z + Y Y )(Y + Z + XX )
= (X + Y + Z )(X + Y + Z )(X + Y + Z )(X + Y + Z )
= M4 M6 M2
= M (2; 4; 6)
Note:
if f (x1; x2; : : : ; xn) = m(i1; i2; : : :; in), then f (x1; x2; : : : ; xn) = M (j1; j2; : : :; jn ), where
fi1; i2; : : : ; ik g + fj1; j2; : : :; jlg = f0; 1; : : : ; 2n ; 1g and jm 6= in for all 1 m l and
1 n k.
Y
F
Z
X
Y
Z
C
F
D
1 m2 m3 1 XY XY X
Y Y
X 00 01 11 10 X 00 01 11 10
0 m0 m1 m3 m2 0 XYZXYZXYZXYZ
1 m4 m5 m7 m6 1 XYZXYZXYZXYZ X
01 m4 m5 m7 m6 01
X
11 m12 m13 m 15 m 14 11
W
10 m8 m9 m 11 m 10 10
m4 m5 m7 m6
1 1 1 0 0
{ Any square marked by '1' can be selected more than once, but at least once.
{ If there are 2k squares adjacent together, then k variables should be eliminated.
Example-1: F (X; Y; Z ) = m(1; 2; 3; 4; 5)
1. '1' is marked in each minterm of the function.
2. Find all possible adjacent squares which correspond to a prime implicant in the map,
write down the corresponding products, i.e., XY and XY .
3. There is only one square uncircled in the map (i.e., m1). The largest adjacent square
which includes m1 can be (m1; m5) or (m1; m3). Since both of them have the same
number of squares (i.e., two), we can pick up any one of them. Let (m1; m5) be the
chosen square and Y Z be the product. Now all squares marked by '1' have been
circled.
4. Write down the function in sum of product form: F = XY + XY + Y Z .
YZ
X 00 01 11 10
0 0 1 1 1 XY
1 1 1 0 0
XY YZ
Example-2:
F1(X; Y; Z ) = m(3; 4; 6)
F2(X; Y; Z ) = m(0; 2; 4; 5; 6)
C. N. Zhang, CS400 13
YZ YZ
X 00 01 11 10 X 00 01 11 10
0 1 0 1 1
1 1 1 1 1 1 1
XYZ YZ XY Z
F1 = X Y Z + Y Z F2 = X Y + Z
Z YZ
X
AND XY=XY
Y
OR X Y=X+Y
X
OR X+Y=X+Y
Y
AND X+Y=XY
D D
B B
C C
F F
D D
E E
X X
Y Y
C
P
Z Z
5 Integrated Circuits
5.1 Digital Logic Families
TTL: transistor-transistor logic
ECL: emitter-coupled logic
MOS: metal-oxide semiconductor
CMOS: complementary metal-oxide semiconductor
5.2 Levels of Integration
SSI: small scale integration (number of gates < 10)
MSI: medium scale integration (10 ; 100)
LSI: large scale integration (100 ; 5000)
VLSI: very large scale integration (> 5000)
WSI: wafer scale integration (> 30000 ?)
C. N. Zhang, CS400 17
6 Combinational Circuits
6.1 Denition
A combinational circuit consists of logic gates whose output at any time is fully determined by
the values of the inputs.
0 1 1 1
XZ
4. The circuit:
X
Y
01 1 1 1 01 1
B B
11 x x x x 11 x x x x
A A
10 1 1 x x 10 1 x x
D D
W=A+BC+BD X=BC+BD+BCD
C C
CD CD
00 01 11 10 00 01 11 10
AB AB
00 1 1 00 1 1
01 1 1 01 1 1
B B
11 x x x x 11 x x x x
A A
10 1 x x 10 1 x x
D D
Y=CD+CD Z=D
4. The circuit:
A
B X
C Y
D Z
3. Map:
YZ YZ
X 00 01 11 10 X 00 01 11 10
0 1 1 0 1
1 1 1 1 1 1 1
S =XYZ+XYZ+XYZ+XYZ C=XY+XZ+YZ
=X Y Z = X Y + Z (X Y + X Y)
= X Y + Z (X Y)
C
Z
FA FA FA FA C0
C3 C2 C1
C4 S3 S2 S1 S0
6.5 Decoder
It generates 2n minterms with n inputs.
Example-1: (2 4) decoder with enable input.
D0
A1
(2 x 4) Decoder
D1 A1 D0
D1
A0
D2 D2
E D3
A0 D3
(2x4) Decoder
0 D4
20
1 D5
21 2 D6
Enable
3 D7
1
X
2
Y 3
4
Z 5
6
7
6.6 Encoder
It does inverse operation of a decoder.
Example: 8 to 3 encoder.
Table 7: Truth table for octal to binary encoder.
D7 D6 D5 D4 D3 D2 D1 D0 A2 A1 A0
0 0 0 0 0 0 0 1 0 0 0
0 0 0 0 0 0 1 0 0 0 1
0 0 0 0 0 1 0 0 0 1 0
0 0 0 0 1 0 0 0 0 1 1
0 0 0 1 0 0 0 0 1 0 0
0 0 1 0 0 0 0 0 1 0 1
0 1 0 0 0 0 0 0 1 1 0
1 0 0 0 0 0 0 0 1 1 1
A0 = D1 + D3 + D5 + D7
A1 = D2 + D3 + D6 + D7
A2 = D4 + D5 + D6 + D7
D0 0
(8 to 3) Encoder
D1 1
A0
D2 2
D3 3
A1
D4 4
D5 5 A2
D6 6
D7 7
S0
S1
D0 Y
D1 S0
Y (4 to 1) MUX
S1
D2
D0 D1 D2 D3
D3
Note: Let n be the number of input lines and k be the number of selection lines, then we
have n = 2k .
Example-2: Construct a (4 to 1) MUX by using (2 to 1) MUXs.
(2 to 1) MUX: Y Y = S D0 + S D1
(2 to 1) MUX S
D0 D1
(4 to 1) MUX: Y Y = S 1 S 0 D 0 + S 1 S 0 D 1 + S 1 S 0 D 2 + S 1 S3 0 D 3
= S1(S0 D 0 + S0 D 1) + S1( S0 D 2 + S0 D 3)
(2 to 1) MUX S1
(2 to 1) MUX S0 (2 to 1) MUX S0
D0 D1 D2 D3
(2 to 1) MUX a
1 0
(2 to 1) MUX a
0 b
(2 to 1) MUX b
a 1
D0 D 0 = S 1 S0 E
S0 D1 D 1 = S 1 S0 E
D2 D 2 = S 1 S0 E
S1
D3 D 3 = S 1 S0 E
X1 5
6
X2 7
8
X3
9
10
X4
11
12
13
14
15
Z1 Z2 Z3 Z4
Figure 40: Logic diagram of a ROM.
C. N. Zhang, CS400 27
P1 P2 P3 P4
F1
F2
7 Sequential Circuits
A sequential circuit consists of a combinational circuit and storage elements (
ip-
ops)
that together form a feedback system.
Inputs Combinational Outputs
circuit Next state Storage
Present
elements
state
The values of the outputs are determined by the inputs as well as the present states of
the stotage elements.
X
DA A
C A
DB B
C B
Clock
Y
3. Write down characteristic equation for each
ip-
op and substitute all inputs by the
input functions obtained in step 2.
A(t + 1) = DA
= A(t)X + B (t)X
B (t + 1) = DB
= A(t)X
4. Write down output equation.
Y = (A + B )X
5. Draw state diagram starting from state 00 by trying all possible input value X
and determining which state is the next state for this input value according to the
equations obtained in step 3, and determine the output value.
0/0 1/0
00 01
0/1
1/0 10 11
1/0
Note: Any state diagram can be converted into a state table and vice versa.
Design Procedure:
1. Obtain state table from state diagram or from design requirements of the circuit.
2. Derive circuit excitation table and output function(s) from state table.
3. Use map to simplify the output functions and
ip-
op input functions
4. Draw the circuit.
Example-A: Design a sequential circuit whose state diagram is shown below.
0/0
00
1/1 1/0
1/0 01 11 0/0
0/0 1/1
10
0/0
0 1 0 x x x x
1 x x x x A 1 1 A B
BX
A 00 01 11 10
X X
JA = B X KA = B X 0 1
BX B BX B 1 A
1
A 00 01 11 10 A 00 01 11 10
x x 1 X
0 1 x x 0
Y =BX
1 1 x x A 1 x x 1 A
X X
JB = X KB = A X + A X
=A X
4. Draw circuit.
X J
A
C
A
K
J
B
C
B
K
Y
X
Clock
Example-B: Find the state diagram for the following sequential circuit. The circuit has one
input and one output. The output will be in logic '1' if and only if a pattern '101' occurs in
the input sequence, e.g.
if input(X): '001010100101', then output(Y): '000010100001'
Since the pattern has three bits, let (00, 01, 10, 11) be the four states, where each of which
represents the rst two bits of any input received.
Start from one state (node), the next two states and the value of the outputs are determined
by checking the value of the next inputs, i.e. for both X = 0 and X = 1. Repeat this step until
all states have been examined.
0/0
00
0/0
1/0
0/0
10 11 1/0
1/1
0/0 1/0
01
7.3 Register
It consists of a set of D
ip-
ops and MUXs.
The number of D
ip-
ops = the number of bits of the register.
The size of the MUX is determined by the functions performed by the register.
Example: Design a 4-bit register which can perform the following functions under the two
control signals S0 and S1.
Mode Control
S1 S0 Register Operation
0 0 No change
0 1 Shift right (down)
1 0 Shift left (up)
1 1 Parallel load
Serial input
0
1
MUX C
2
I0 3
S0
S 1 (4x1) D Q A1
0
1
MUX C
2
I1 3
S0
S 1 (4x1) D Q A2
0
1
MUX C
2
I2 3
S0
S 1 (4x1) D Q A3
0
1
MUX C
Serial input 2
I3 3
Clock
JA0 = KA0 = 1
JA1 = KA1 = A0
JA2 = KA2 = A0A1
JA3 = KA3 = A0A1A2
C. N. Zhang, CS400 36
A1 A0
A1 A0
A 3A 2 00 01 11 10
00 1 1 x x
01 x x x x 1 x x 1
A2
11 x x x x 1 x x x x x x
A3
10 1 1 x x x x x x
J A2 = A 0 A 1 J A1 = A 0 J A3 = A 0 A 1 A 2
x x x x x x 1 x x x x
1 x x 1 x x x x
1 x x 1 1
x x x x x x 1
K A2 = A 0 A 1 K A1 = A 0 K A3 = A 0 A 1 A 2
J
A1
C
K
J
A2
C
K
J
A3
C
K
Output
Carry
Clock
1. State diagram.
000 111
001 110
010 101
100 011
2. Excitation table.
Present state Next state Flip-flop Inputs
A B C A B C JA K A JB K B JC K C
0 0 0 0 0 1 0 x 0 x 1 x
0 0 1 0 1 0 0 x 1 x x 1
0 1 0 1 0 0 1 x x 1 0 x
0 1 1 1 0 0 1 x x 1 x 1
1 0 0 1 0 1 x 0 0 x 1 x
1 0 1 1 1 0 x 0 1 x x 1
1 1 0 0 0 0 x 1 x 1 0 1
1 1 1 0 0 0 x 1 x 1 x 1
0 1 1 0 1 x x 0 1 x x
1 x x x x A 1 1 x x A 1 1 x x A
C C C
JA = B JB = C JC = B
BC B BC B BC B
A 00 01 11 10 A 00 01 11 10 A 00 01 11 10
0 x x x x 0 x x 1 1 0 x 1 1 x
1 1 1 A 1 x x 1 1 A 1 x 1 1 x A
C C C
KA = B KB = 1 KC = 1
4. The circuit.
A B C
J C K J C K J C K
Clock
Logic-1