Sequential Logic Implementation: Models For Representing Sequential Circuits
Sequential Logic Implementation: Models For Representing Sequential Circuits
L / TL
A
react right away to leaving the wall
L R / TR, F
CS 150 - Fall 2005 Lec #7: Sequential Implementation 2
B/0
D/1
0
reset
0
1
A/0
1
C/0
E/1
reset
1
0
0
0
0
0
0
0
0
0
0
input
0
1
0
1
0
1
0
1
0
1
current
state
A
A
B
B
C
C
D
D
E
E
next
state
A
B
C
B
D
E
C
E
C
B
D
output
0
0
0
0
0
0
1
1
1
1
reset/0
0/1
1/1
1/0
reset
1
0
0
0
0
0
0
input
0
1
0
1
0
1
current
state
A
A
B
B
C
C
C
1/0
CS 150 - Fall 2005 Lec #7: Sequential Implementation 4
next
state
A
B
C
B
C
B
C
output
0
0
0
0
1
1
0
inputs
Combinational
logic
for
Next State
Logic
for
outputs
Combinational
logic for
Next State
inputs
Logic
for
outputs
reg
outputs
state feedback
outputs
reg
state feedback
D
clock
out
Q
Q
B
clock
Q
Q
out
out
A
Q
Q
D
clock
Q
Q
out
A
Q
B
Q
Q
Q
Q
clock
output
logic
next state
logic
Current State
Outputs
1
0
// State assignment
parameter zero = 0, one1 = 1, two1s = 2;
module reduce (out, clk, reset, in);
output out;
input clk, reset, in;
reg out;
reg [1:0] state;
// state register
reg [1:0] next_state;
zero
[0]
one1
[0]
1
two1s
[1]
zero
[0]
1
0
0
one1
[0]
1
two1s
[1]
zero
[0]
1
endmodule
one1
[0]
two1s
[1]
0/0
zero
0/0
1/0
one1
1/1
0/0
zero
1/0
0/0
one1
1/1
Announcements
Review Session, Today, 5-6 PM, 125 Cory Hall
Examination, Wednesday, 1-2:30 PM, 125 Cory Hall
Five Quiz-like Questions -- Please Read Them Carefully! They
are not intended to be tricky; they should contain all the
information you need to answer the question correctly
No calculators or other gadgets are necessary! Dont bring
them! No blue books! All work on the sheets handed out!
Do bring pencil and eraser please! If you like to unstaple the
exam pages, then bring a stapler with you! Write your name
and student ID on EVERY page in case they get separated -it has happened!
Dont forget your two-sided 8.5 x 11 crib sheet!
Announcements
Examination, Wednesday, 1-2:30 PM, 125 Cory Hall
Topics covered through last Wednesday
Labs 1, 2, 3
K&B: Chapters 1, 2 (2.1-2.5), 3 (3.1, 3.6), 4 (4.1, 4.2, 4.3), 6 (6.1, 6.2.1,
6.3), 7 (7.1, 7.2, 7.3)
Reset
N
Coin
Sensor
Vending
Machine
FSM
Open
Release
Mechanism
Clock
Reset
3 nickels
nickel, dime
dime, nickel
two dimes
S0
N
Inputs: N, D, reset
S1
N
S3
Assumptions:
S7
[open]
S2
D
S4
[open]
S5
[open]
S6
[open]
Reset
0
5
N
D
10
N
D
10
N+D
15
[open]
15
inputs
D
N
0
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
0
0
0
1
1
0
1
1
next
state
0
5
10
5
10
15
10
15
15
15
output
open
0
0
0
0
0
0
0
0
0
next
D1
0
0
1
0
1
1
1
1
1
state
D0
0
1
0
1
0
1
0
1
1
output
open
0
0
0
0
0
0
0
0
0
Q1
D1
0 1 1 1
D
X X X X
1 1 1 1
Q0
Q1
D0
0 0 1 1
Q1
Open
0 0 1 0
0 1 1 0
1 0 1 1
N
D
X X X X
0 0 1 0
0 1 1 1
X X X X
0 0 1 0
Q0
Q0
D1 = Q1 + D + Q0 N
D0 = Q0 N + Q0 N + Q1 N + Q1 D
OPEN = Q1 Q0
0 0
0 1
1 0
inputs
D N
0 0
0 1
1 0
1 1
0 0
0 1
1 0
1 1
0 0
0 1
1 0
1 1
- -
next state
D3 D2 D1
0 0 0
0 0 1
0 1 0
- - 0 0 1
0 1 0
1 0 0
- - 0 1 0
1 0 0
1 0 0
- - 1 0 0
output
D0 open
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
D0 = Q0 D N
D1 = Q0 N + Q1 D N
D2 = Q0 D + Q1 N + Q2 D N
D3 = Q1 D + Q2 D + Q2 N + Q3
OPEN = Q3
Moore machine
outputs associated with state
N D + Reset
Reset
0
[0]
Mealy machine
outputs associated with transitions
N D
N
D
N D/0
N/0
5
[0]
N D
D/0
N
D
(N D + Reset)/0
Reset/0
N D/0
10
N D/0
15
Reset/1
N/0
10
[0]
N D
N+D
D/1
N+D/1
15
[1]
Reset
fifteen: begin
if (!Reset) next_state
else
next_state
open = 1;
end
endcase
N D + Reset
Reset
0
[0]
N D
N
= five;
= ten;
= zero;
5
[0]
N D
N
10
[0]
= fifteen;
= zero;
N D
N+D
15
[1]
Reset
endcase
(N D + Reset)/0
Reset/0
N D/0
N/0
D/0
N D/0
10
N D/0
15
Reset/1
N/0
D/1
N+D/1
highway
description
place FSM in initial state
detect vehicle on the farm road
short time interval expired
long time interval expired
outputs
description
HG, HY, HR assert green/yellow/red highway lights
FG, FY, FR assert green/yellow/red highway lights
ST
start timing a short or long interval
description
highway green (farm road red)
highway yellow (farm road red)
farm road green (highway red)
farm road yellow (highway red)
CS 150 - Fall 2005 Lec #7: Sequential Implementation 27
Reset
(TLC)'
S0
TLC / ST
S0: HG
S1: HY
TS / ST
TL+C / ST
TS'
S1
S3
S2: FG
S3: FY
TS / ST
TL+C' / ST
S2
(TL+C')'
TS'
0
1
1
1
0
0
SA1:
SA2:
SA3:
TS
0
1
0
1
Present State
HG
HG
HG
HY
HY
FG
FG
FG
FY
FY
HG = 00
HG = 00
HG = 0001
Next State
Outputs
ST H
0
Green
0
Green
1
Green
0
Yellow
1
Yellow
0
Red
1
Red
1
Red
0
Red
1
Red
HG
HG
HY
HY
FG
FG
FY
FY
FY
HG
HY = 01
HY = 10
HY = 0010
FG = 11
FG = 01
FG = 0100
FY = 10
FY = 11
FY = 1000
F
Red
Red
Red
Red
Red
Green
Green
Green
Yellow
Yellow
(one-hot)
endcase
Reset
(TLC)'
S0
TLC
TS / ST
TL+C / ST
TS'
S1
S3
TS / ST
TL+C' / ST
S2
(TL+C')'
TS'
SA1
SA2
SA3
CLK
Q0
DQ
Seq
Q1
DQ
Seq
Open
DQ
Com
Reset
CS 150 - Fall 2005 Lec #7: Sequential Implementation 32
DQ
Seq
Q1
DQ
Seq
OPEN
Open
DQ
Seq
Reset
CS 150 - Fall 2005 Lec #7: Sequential Implementation 34