Professional Documents
Culture Documents
1.sequential Circuits
1.sequential Circuits
1.sequential Circuits
W Combinational Combinational
Flip-flops Z
circuit Q circuit
Clock
If the outputs depend only on the present state of the circuit inputs, the
circuit is said to be of Moore type
If the outputs depend on both the present state and the present values of the
inputs, the circuit is said to be of Mealy type.
Y1 y1
w
Combinational Combinational z
circuit circuit
Y2 y2
Clock
The present state variables, y1 and y2, determine the present state of the
circuit.
The next state variables, Y1 and Y2, determine the state into which the circuit
will go after the next active edge of the clock signal.
Basic Flip flop circuit
Bistable Circuit
If SR = 00 follows SR = 1 1 0 N.A.
Undefined
11, then there is a 1 1 1 N.A. State
race between two
gates and depending N.A.: Not
on who responds allowed
faster, V2V3 settles at
one of 01 or 10.
SR Latch
S R Qn Qn+1
(PS) (NS)
0 0 0 0 Latches to
0 0 1 1 prior state
0 1 0 0
0 State
0 1 1 0
S R V2 V3 1 0 0 1
1 1 0 0 1 0 1 1 1 State
Qn+1 = S + R’Qn
1 2
3 4
S R Qn Qn+1
Excitation Table S-R Flip (PS) (NS)
Flop 0 0 0 0 Latches to
0 0 1 1 prior state
PS NS S R
0 0 0 X 0 1 0 0
0 State
0 1 1 0 0 1 1 0
1 0 0 1 1 0 0 1
1 0 1 1 1 State
1 1 X 0
1 1 0 N.A. Undefined
1 1 1 N.A. State
N.A.: Not
allowed
Given: PS NS S R
PS=A, B, C, 0 0 0 X
NS= B,C,A
0 1 1 0
1 0 0 1
1 1 X 0
PS NS FF Inputs
Q1 Q0 Q1+ Q0+ S1 R1 S0 R0
0 0 0 1 0 X 1 0
0 1 1 0 1 0 0 1
1 0 0 0 0 1 0 X
1 1 X X X X X X
Q0\Q1 0 1
0 1 0
1 0 X
S0=Q0’Q1’
R0= Q1
Q0\Q1 0 1 S1= Q1
0 0 1 R1= Q1’
1 x x
Q0\Q1 0 1
Q0\Q1 0 1
0 0 1
0 X 0
1 0 X
1 1 X
Design a synchronous circuit which count following
sequence
0, 2, 4,6,7,0
L
A Analysis:
B GooGgg
S Three state & three flip flops are required
E
S PS= 000---010---100---110---111---000
S
I NS= 010—100---110---111---000
O
N Find FF Inputs?
S0,R0 S1, R1 S2, R2
Clockcycle: t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10
w: 0 1 0 1 1 0 1 1 1 0 1
z: 0 0 0 0 0 1 0 0 1 1 0
Present Next state Output
state w = 0 w = 1 z
A A B 0
B A C 0
C A C 1
B 00 00 01 0
01 00 10 0
C 10 00 10 1
11 dd dd d
0 0 0 d 0
Y = wy 1 y 2 Y = wy 1 y 2
1 1
1 1 0 d 0
yy
21
w
00 01 11 10
0 0 0 d 0
1 0 1 d 1 Y = wy y 2 + wy 1 y Y = wy + wy
2 1 2 2 1 2
= w(y +y )
1 2
y
1
y 0 1
2
0 0 0
1 1 d
z=y1y
2 z=y
2
Figure 6.7. Derivation of logic expressions for the sequential circuit in Figure 6.6.
Final implementation of the sequential circuit.
t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10
1
Clock
0
1
w
0
1
y1
0
1
y2
0
1
z
0
w=1
w=0 Az=0 Bz=0
w=0
w=0 w=1
Cz=1
w=1
A No transfer
Reset
w=1
B R2out =
1 R3in = 1
w =0
w =1 w =0
C R1out = 1 R2
win = 1
w =0
w =1
D R 3out = 1 R 1in = 1 Done = 1
A A B 0 0 0 0 0 0 0
B C C 0 0 1 0 0 1 0
C D D 1 0 0 1 0 0 0
D A A 0 1 0 0 1 0 1
B 00 00 01 0 0 0 0 0 0 0
01 10 10 0 0 1 0 0 1 0
C 10 11 11 1 0 0 1 0 0 0
11 00 00 0 1 0 0 1 0 1
D
y2 y1
w
00 01 11 10
0 1 1
Y 2 = y1 y2 + y1 y2
1 1 1
B 00 00 01 0
01 00 11 0
C 11 00 11 1
10 dd dd d
Y1 y1
w
D Q
Clock Q
Resetn
B 00 00 01 0 0 0 0 0 0 0
01 11 11 0 0 1 0 0 1 0
C 11 10 10 1 0 0 1 0 0 0
10 00 00 0 1 0 0 1 0 1
D
y2 y1
w
00 01 11 10
0 1 1
Y 2 = y1
1 1 1
w=1z=0
w=0z=0 A B w=1z=1
w=0z=0
Figure 6.23. State diagram of an FSM that realizes the task Figure
6.22. in
Present Next state O utput z
state w = 0 w =1 w= 0 w = 1
A A B 0 0
B A B 0 1
y Y Y z z
A
0 0 1 0 0
1 0 1 0 1
B
w
D Q y
Clock Q
Resetn
(a) Circuit
t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10
1
Clock
0
1
w
0
1
y
0
1
z
0
A Reset
w = 1 R2out = 1 R3in = 1
B
w =0
w =1 R1out = 1 R2in = 1
C
w =0
w =1 R3out = 1 R1in = 1 Done = 1
// Define output
assign z = (y = = C);
endmodule
10 36
EPM7032
13
z
16
19 22 25 28
endmodule
Figure 6.33. Second version of code for the FSM in Figure 6.3.
module simple (Clock, Resetn, w, z);
input Clock, Resetn, w;
output z;
reg [2:1] y;
parameter [2:1] A = 2'b00, B = 2'b01, C = 2'b10;
// Define output
assign z = (y = = C);
endmodule
Figure 6.34. Third version of code for the FSM in Figure 6.3.
Please see “portrait orientation” PowerPoint file for Chapter
6
a
Shift register
s
Adder
FSM Shift register
Shift register
b
Sum = A + B
B
Clock
00 0 01 0
01 1 G H 10 0
10 1 11 1
00 1
G: carry-
in = 0 H:
carry-
in = 1
G G G G H 0 1 1 0
H G H H H 1 0 0 1
0 0 0 0 1 0 1 1 0
1 0 1 1 1 1 0 0 1
Clock Q
Reset
1 01
00 G0 s =0 H0 s =0
1 10
00
01 01
00 1 1
10 10
1 1
01
G1 s = 1 H1 s = 1 1
10 00 1
Figure 6.44. State diagram for the Moore-type serial adder FSM.
Present Nextstate Output
state ab =00 01 10 11 s
G0 G0 G1 G1 H0 0
G1 G0 G1 G1 H0 1
H0 G1 H0 H0 H1 0
H1 G1 H0 H0 H1 1
Figure 6.45. State table for the Moore-type serial adder FSM.
Nextstate
Present
state ab =00 01 10 11 Output
y2 y1 Y2 Y 1 s
00 00 01 01 10 0
01 00 01 01 10 1
10 01 10 10 11 0
11 01 10 10 11 1
Y2 y2
D Q
Clock Q
Reset
endmodule
Figure 6.48. Code for a left-to-right shift register with an enable input.
Please see “portrait orientation” PowerPoint file for Chapter
6
Two states Si and Sj are said to be equivalent if and only if for every possible input
sequence, the same output sequence will be produced regardless of whether Si or Sj is
the initial state.
Present Next state Output
state w= 0 w= 1 z
A B C 1
B D F 1
C F E 0
D B G 1
E F C 0
F E D 0
G F G 0
A B C 1
B A F 1
C F C 0
F C A 0
sense
N
sense
D
N D
sense N D Q D Q
Clock Q Q
Reset
DN
DN S1 0 DN
DN DN
D N
D
S4 1 N S2 0 S3 0 S7 1
D N
DN
S5 1 S6 0 DN DN
N D
S8 1 S9 1
S1 S1 S3 S2 – 0
S2 S2 S4 S5 – 0
S3 S3 S6 S7 – 0
S4 S1 – – – 1
S5 S3 – – – 1
S6 S6 S8 S9 – 0
S7 S1 – – – 1
S8 S1 – – – 1
S9 S3 – – – 1
S1 S1 S3 S2 – 0
S2 S2 S4 S5 – 0
S3 S3 S2 S4 – 0
S4 S1 – – – 1
S5 S3 – – – 1
S1 0
N
DN
S3 0
D
DN N DN
D
DN S2 0 S5 1
N
D
S4 1
S1
N0 D1
DN
0 S3
N1 D0
N0 D1
S2
DN 0
A B B C 0 0
C D – 0 –
D E F E 0 1
F G B G 0 0
F C 0 1
E D 0 1
F – 0 –
w=1 w=1
A A B 0
B B C 1
C C D 2
D D E 3
E E F 4
F F G 5
G G H 6
H H A 7
01 0 1 1 0 01 0 0 1 1
11 1 0 0 1 11 0 1 0 1
10 1 0 0 1 10 0 1 0 1
Y 0 = wy 0 + wy0 Y 1 = wy1 + y1 y0 + wy 0 y1
y1 y0
wy2
00 01 11 10
00 0 0 0 0
01 1 1 1 1
11 1 1 0 1
10 0 0 1 0
Y 2 = wy 2 + y0 y2 + y1 y2 + wy0 y1
y2
G
Figure 6.65. Excitation table for the counter with JK flip-flops.
H
Please see “portrait orientation” PowerPoint file for Chapter
6
K Q
y1
J Q
K Q
J Q y2
K Q
Clock
Resetn
K Q
y1
J Q
K Q
J Q y2
K Q
Clock
Resetn
A B 000
B C 100
C D 010
D E 110
E F 001
F G 101
G H 011
H A 111
D Q
z1
D Q
z0
w Q
Idle
0xx 1xx
gnt1 g1 = 1
gnt2 g2 = 1
gnt3 g3 = 1
xx1
Idle
r1 r1
gnt1 g1 = 1
r2 r1 r 1r 2
gnt2 g2 = 1
r3 r2 r1r2 r3
gnt3 g3 = 1
r3
Q
w
Y2 y2
D Q
Clock Q
Resetn
A A B 0
B A C 0
00 00 01 0
C A D 0
01 00 10 0
D A D 1
10 00 11 0
11 00 11 1
(a) State-assigned table (b) State table
K Q
K1
J2 y2
J Q
Clock
K Q
K2
Resetn
00 01 01 00 11 0
01 01 01 10 11 0
10 01 01 00 10 0
11 01 01 10 10 1
T2 y2
T Q
Clock Q
Resetn
00 00 01 0
01 00 10 0
10 10 01 0
11 10 01 1
Conditional outputs
or actions (Mealy type)
0
w
1
B
z
0 1
w
Idle
1
r1
0 gnt1 1
0
g1 r1
1
r
2
0 gnt2 1
0
g2 r2
0 1
r3
gnt3 1
0
g3 r3
Figure 6.84. ASM chart for the arbiter FSM in Figure 6.73.
w1 z1
Inputs Outputs
wn Combinational zm
circuit
yk Yk
Present-state Next-state
variables variables
y1 Y1
00 10 11 0
01 01 00 0
10 11 00 0
11 10 01 1
Clock Q
D Q