Switching Circuits & Logic Design
Switching Circuits & Logic Design
Logic Design
Jie-Hong Roland Jiang
江介宏
Fall 2012
http://www.cs.lmu.edu/~ray/notes/languagetheory/ 2
Outline
Summary of design procedure for
sequential circuits
Design example – code converter
Design of iterative circuits
Design of sequential circuits using ROMs
and PLAs
4
Design Example – Code Converter
Convert BCD to excess-3 code
Add 3 to a binary-coded-decimal X Z
digit in the range 0 to 9 Input Output
(BCD) (excess-3)
Assume serial input and output
with the least significant bit first t3 t2 t1 t0 t3 t2 t1 t0
Reset to initial state after 0 0 0 0 0 0 1 1
receiving every 4 inputs 0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
X Code Z 0 1 0 0 0 1 1 1
(BCD) Converter (excess-3) 0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
Can the converter be realized
1 0 0 0 1 0 1 1
without delaying the output?
1 0 0 1 1 1 0 0
t0 t1 t2 t3 …
other codes - - - -
X = X(0) X(1) X(2) X(3) …
Z = Z(0) Z(1) Z(2) Z(3) … 5
t0 reset A B C 1 0 A
t0 0/1 1/0
0 B D F 1 0
t1
1 C E G 0 1
B C
00 D H L 0 1 t1 0/1 1/0 0/0 1/1
01 E I M 1 0
t2
10 F J N 1 0
11 G K P 1 0
D F E G
t2 0/0 1/1 0/1 1/0 0/1 1/0 0/1 1/0
000 H A A 0 1
001 I A A 0 1
010 J A - 0 -
H L J N I M K P
t3 0/0 1/1 0/0 0/0 0/1 0/0 1/1 0/1 0/0 0/1
011 K A - 0 -
t3
100 L A - 0 -
101 M A - 1 -
110 N A - 1 -
111 P A - 1 - 6
Design Example – Code Converter
Step 2: Reduce state table
Input Next Present Next Present
Sequence State Output (Z) State Output (Z)
Received Present Present
Time (LSB first) State X=0 1 X=0 1 Time State X=0 1 X= 0 1
t0 reset A B C 1 0 t0 A B C 1 0
0 B D F 1 0 t1 B D E 1 0
t1
1 C E G 0 1 C E E 0 1
00 D H L 0 1 t2 D H H 0 1
01 E I M 1 0 E H M 1 0
t2
10 F J N 1 0
t3 H A A 0 1
11 G K P 1 0
M A - 1 -
000 H A A 0 1
001 I A A 0 1
The matching assumes, under
010 J A - 0 -
011 K A - 0 - X=1, the next state is A and Z=1
t3
100 L A - 0 -
101 M A - 1 - The matching imposes no
110 N A - 1 - particular condition on these
111 P A - 1 - don’t cares
7
8
Design Example – Code Converter
Step 3: Perform state assignment
Need 3 flip-flops for 7 states
0 0 0 0 1 1 0 0 00 1 1 1 1 00 0 1 1 0
0 0 0 1 x x x x 01 X 1 1 X 01 X 1 1 X
0 0 1 0 1 0 0 0 11 0 0 0 0 11 0 1 1 0
0 0 1 1 0 0 0 0
10 0 0 0 X 10 0 1 1 X
0 1 0 0 1 1 1 1
0 1 0 1 0 1 1 0 D1=Q1+=Q2' D2=Q2+=Q1
0 1 1 0 1 0 1 1
0 1 1 1 0 0 1 1 XQ1 XQ1
1 0 0 0 0 1 0 1 Q2 Q3 00 01 11 10 Q2 Q3 00 01 11 10
1 0 0 1 x x x x 00 0 1 0 1 00 1 1 0 0
1 0 1 0 x x x x
01 X 0 0 X 01 X 0 1 X
1 0 1 1 1 0 0 0
1 1 0 0 0 1 1 0 11 0 1 1 0 11 0 0 1 1
1 1 0 1 1 1 1 0 10 0 1 0 X 10 1 1 0 X
1 1 1 0 0 0 1 0
1 1 1 1 1 0 1 1 D3=Q3+=Q1Q2Q3+X'Q1Q3'+XQ1'Q2' Z=X'Q3'+XQ3
11
D3 Q3
A3 D Q A6 G7 Z
X Q1' G3
G4
X'
Q2' FF1 Q3' G6
Q'
CLK
12
Design of Iterative Circuits
Many of the design procedures used for sequential circuits can be
applied to the design of iterative circuits
E.g., the design procedure used for the (sequential) serial adder of
Unit 13 can be applied to the design of the parallel adder of Unit 4
Unilateral iterative circuit is the simplest form of an iterative
circuit
A linear array of combinational cells with signals between cells
traveling in only one direction
X1 X2 X3 Xi Xn
Z1 Z2 Z3 Zi Zn
Xi and Zi are the primary input and output, respectively, of cell i
ai and ai+1 resemble the present state and next state, respectively, of cell i
13
x1 y1 x2 y2 xi yi xn yn
a1 a2 a3 ai ai+1 an an+1
Output Z1(X<Y)
Cell b2 Cell bi Cell b Cell b
b1 b3 i+1 bn n+1 Net- Z2(X=Y)
1 2 i n
work Z3(X>Y)
14
Design of Iterative Circuits
Design of a Comparator
Steps 1,2: derive and reduce state table
Si+1
Si xiyi=00 01 11 10 Z1 Z2 Z3
X=Y S0 S0 S2 S0 S1 0 1 0 Z1:X<Y
X>Y S1 S1 S1 S1 S1 0 0 1 Z2:X=Y
X<Y S2 S2 S2 S2 S2 1 0 0 Z3:X>Y
Clock CK
t1 t2 tn time
X = x1 x2 … xn …
Y = y1 y2 … yn …
17
18
Design of Sequential Circuits Using
ROMs
Example
Realize the prior BCD to excess-3 code converter using a
ROM and D-FFs
State table Transition table
Present
Present Next State Output (Z) Q1+Q2+Q3+ Z
state X=0 1 X=0 1 Q1Q2Q3 X=0 X=1 X=0 X=1
A B C 1 0 A 0 0 0 001 010 1 0
B D E 1 0 B 0 0 1 011 100 1 0
C E E 0 1 C 0 1 0 100 100 0 1
D 0 1 1 101 101 0 1
D H H 0 1
E 1 0 0 101 110 1 0
E H M 1 0
H 1 0 1 000 000 0 1
H A A 0 1
M 1 1 0 000 - 1 -
M A - 1 -
19
CK
Clock
21
22
Design of Sequential Circuits Using
PLAs
Example (cont’d)
Realize the prior BCD to excess-3 code converter using a
PLA and D-FFs
XQ1 XQ1
Q2Q3 00 01 11 10 Q2Q3 00 01 11 10
00 1 1 1 1 00 0 1 1 0
01 X 1 1 X 01 X 1 1 X
11 0 0 0 0 11 0 1 1 0
10 0 0 0 X 10 0 1 1 X
D1=Q1+=Q2' D2=Q2+=Q1
XQ1 XQ1
Q2Q3 00 01 11 10 Q2Q3 00 01 11 10
00 0 1 0 1 00 1 1 0 0
01 X 0 0 X 01 X 0 1 X
11 0 1 1 0 11 0 0 1 1
10 0 1 0 X 10 1 1 0 X
D3=Q3+=Q1Q2Q3+X'Q1Q3'+XQ1'Q2' Z=X'Q3'+XQ3 23
PLA table
X Q1 Q2 Q3 Z D1 D2 D3
Q2' - - 0 - 0 1 0 0
Q1 - 1 - - 0 0 1 0
Q1Q2Q3 - 1 1 1 0 0 0 1
X'Q1Q3' 0 1 - 0 0 0 0 1 D1 = Q1+ = Q2'
XQ1'Q2' 1 0 0 - 0 0 0 1 D2 = Q2+ = Q1
X'Q3' 0 - - 0 1 0 0 0 D3 = Q3+ = Q1Q2Q3+X'Q1Q3'+XQ1'Q2'
XQ3 1 - - 1 1 0 0 0 Z = X'Q3'+XQ3
25