Sequential Logic Implementation: Models For Representing Sequential Circuits
Sequential Logic Implementation: Models For Representing Sequential Circuits
0/1
1/1
reset 1 0 0 0 0 0 0
input 0 1 0 1 0 1
current state A A B B C C
next state A B C B C B C
output 0 0 0 0 1 1 0
inputs
state feedback
state feedback
Q Q
out
Q Q
out
B clock
Q Q
out A D Q Q B D Q Q clock D D Q Q Q Q
" Outputs computed on transition to next state rather than after entering " View outputs as expanded state vector
output logic next state logic Current State
CS 150 - Spring 2007 Lec #7: Sequential Implementation 8
Outputs
Inputs
include all signals that are input to state and output equations
Announcements
! Review Session Announcement ! First Midterm, Thursday, 15 February, 2-3:30 PM, 125 Cory Hall
" ??? 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, Th, 2-3:30 PM, 125 Cory Hall
" Topics likely to be covered
# Combinational logic: design and optimization (K-maps up to and including 6 variables) # Implementation: Simple gates (minimum wires and gates), PLA structures (minimum unique terms), Muxes, Decoders, ROMs, (Simplified) Xilinx CLB # Sequential logic: R-S latches, flip-flops, transparent vs. edge-triggered behavior, master/slave concept # Basic Finite State Machines: Representations (state diagrams, transition tables), Moore vs. Mealy Machines, Shifters, Registers, Counters # Structural and Behavioral Verilog for combinational and sequential logic # 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)
N Coin Sensor D
Open
Release Mechanism
Clock
# Inputs: N, D, reset # Output: open chute # Assume N and D asserted for one cycle # Each state has a self loop for N = D = 0 (no coin)
0 N 5 N D 10 N+D 15 [open] 15 D 10 5
D1 = Q1 + D + Q0 N D0 = Q0 N + Q0 N + Q1 N + Q1 D OPEN = Q1 Q0
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
0 0
0 1
1 0
N D N/0
N D/0
N D/0
N D
= fifteen; = zero;
always @(posedge clk) if (Reset || (!N && !D)) state <= zero; else state <= next_state; endmodule
CS 150 - Spring 2007 Lec #7: Sequential Implementation 23
N D/0
N D/0
N D/0
Reset/1
always @(posedge clk) if (Reset || (!N && !D)) begin state <= zero; open <= 0; end else begin state <= next_state; open <= next_open; end endmodule
CS 150 - Spring 2007 Lec #7: Sequential Implementation 24
" with no car on farmroad, light remain green in highway direction " if vehicle on farmroad, highway lights go from Green to Yellow to Red, allowing the farmroad lights to become green " these stay green only as long as a farmroad car is detected but never longer than a set interval " when these are met, farm lights transition from Green to Yellow to Red, allowing highway to return to green " even if farmroad vehicles are waiting, highway gets at least a set interval as green a short time pulse (TS) and a long time pulse (TL), in response to a set (ST) signal. TS is to be used for timing yellow lights and TL for green lights
CS 150 - Spring 2007 Lec #7: Sequential Implementation 25
highway
(TL+C')'
(one-hot)
Reset
TS / ST S3 TS'
TS / ST S2
TL+C' / ST
always @(posedge Clk) if (Reset) begin state <= S0; ST <= 0; end else begin state <= next_state; ST <= next_ST; end endmodule
(TL+C')'
SA2
SA3
ST = CTLPS0 + TSPS1 + C'PS2 + TLPS2 + TSPS3 H1 = PS3 + PS2 H0 = PS1 F1 = PS1 + PS0 F0 = PS3
DQ
DQ
Q1 Seq
DQ
Open Com
Reset
CS 150 - Spring 2007 Lec #7: Sequential Implementation 32
DQ
DQ
Q1 Seq
OPEN DQ
Open Seq
Reset
CS 150 - Spring 2007 Lec #7: Sequential Implementation 34