Sequential logic implementation

Slides:



Advertisements
Similar presentations
ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 23 Finite State Machine.
Advertisements

Chapter #8: Finite State Machine Design Contemporary Logic Design
Introduction to Sequential Circuits
FSM Word Problems Today:
Traffic light contoller using FSM
Sequential logic examples
Chapter #10: Finite State Machine Implementation
Lecture 15 Finite State Machine Implementation
Implementation Strategies
State-machine structure (Mealy)
VIII - Working with Sequential Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite state machine optimization State minimization  fewer.
FSM Revisit Synchronous sequential circuit can be drawn like below  These are called FSMs  Super-important in digital circuit design FSM is composed.
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
COE 202: Digital Logic Design Sequential Circuits Part 3
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
ECE C03 Lecture 111 Lecture 11 Finite State Machine Optimization Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design 8.5 Finite State Machine.
Give qualifications of instructors: DAP
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design Finite State.
ECE C03 Lecture 121 Lecture 12 Finite State Machine Design Prith Banerjee ECE C03 Advanced Digital Design Spring 1998.
1 Synchronous Sequential Circuit Design. 2 Sequential circuit design In sequential circuit design, we turn some description into a working circuit – We.
VII - Finite State Machines © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite State Machines Sequential circuits  primitive sequential elements.
Lecture 23 Design example: Traffic light controller.
FPGA-Based System Design: Chapter 5 Copyright  2004 Prentice Hall PTR Verilog for sequential machines.

Sequential Logic in Verilog
1 COMP541 State Machines Montek Singh Feb 8, 2012.
FPGA-Based System Design: Chapter 5 Copyright  2004 Prentice Hall PTR Topics n Verilog styles for sequential machines. n Flip-flops and latches.
ECE C03 Lecture 101 Lecture 10 Finite State Machine Design Hai Zhou ECE 303 Advanced Digital Design Spring 2002.
Chapter #8: Finite State Machine Design
Chapter #8: Finite State Machine Design
ECNG1014 Digital Electronics
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Ders 8: FSM Gerçekleme ve.
Introduction to Sequential Logic Design Finite State-Machine Design.
Register Transfer Level & Design with ASM
DLD Lecture 26 Finite State Machine Design Procedure.
IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Sequential logic implementation Implementation  random logic.
IX - Sequential Logic TechnologyContemporary Logic Design1 Ch 9. Sequential Logic Technologies.
Copied with Permission from prof. Mark PSU ECE

1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
Finite State Machine. Clock Clock cycle Sequential circuit Digital logic systems can be classified as combinational or sequential. – Combinational circuits.
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
Exp#7 Finite State Machine Design in Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Finite State Machines Mealy machine inputs Outputs next state function
Finite state machine optimization
Figure 8.1. The general form of a sequential circuit.
Finite state machine optimization
Chapter #6: Sequential Logic Design
Chapter #8: Finite State Machine Design Contemporary Logic Design Randy H. Katz University of California, Berkeley.
© Copyright 2004, Gaetano Borriello and Randy H. Katz
COMP541 Sequential Logic – 2: Finite State Machines
ECEN 248 Lab 9: Design of a Traffic Light Controller
Synchronous Sequential Circuit Design
Typical Timing Specifications
Sequential logic examples
ECE 171 Digital Circuits Chapter 13 Finite State Automata
CSE 370 – Winter Sequential Logic-2 - 1
CS150 Midterm2 Review Joy! Another midterm.
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
CS150 Midterm2 Review Joy! Another midterm.
CSE 370 – Winter Sequential Logic-2 - 1
Topics Verilog styles for sequential machines. Flip-flops and latches.
Lecture 24 Logistics Last lecture Today HW7 back today
CSE 140 Lecture 9 Sequential Networks
Finite State Machine Continued
CSE 370 – Winter Sequential Logic-2 - 1
Implementation Strategies
Lecture 4: Finite State Machines
Presentation transcript:

Sequential logic implementation random logic gates and FFs programmable logic devices (PAL with FFs) Design procedure state diagrams state transition table state assignment next state functions IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

© Copyright 2004, Gaetano Borriello and Randy H. Katz Median filter FSM Remove single 0s between two 1s (output = NS3) I PS1 PS2 PS3 NS1 NS2 NS3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 X X X 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 0 1 0 0 1 1 0 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 X X X 1 1 1 0 1 1 1 1 1 1 1 1 1 1 000 1 100 010 110 111 011 001 Reset IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Median filter FSM (cont’d) Realized using the standard procedure and individual FFs and gates I PS1 PS2 PS3 NS1 NS2 NS3 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 1 1 0 0 1 0 1 0 0 0 1 0 0 1 0 1 X X X 0 1 1 0 0 1 1 0 1 1 1 0 1 1 1 0 0 0 1 0 0 1 0 0 1 1 0 0 1 0 1 0 1 1 1 1 0 1 1 1 1 1 1 1 0 0 1 1 0 1 1 0 1 X X X 1 1 1 0 1 1 1 1 1 1 1 1 1 1 NS1 = Reset’ (I) NS2 = Reset’ ( PS1 + PS2 I ) NS3 = Reset’ PS2 O = PS3 IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Median filter FSM (cont’d) But it looks like a shift register if you look at it right 000 Reset 000 Reset 1 1 100 100 101 1 1 1 1 1 010 110 010 1 110 1 1 1 001 111 011 001 111 011 1 1 1 1 IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Median filter FSM (cont’d) An alternate implementation with S/R FFs The set input (S) does the median filter function by making the next state 111 whenever the input is 1 and PS2 is 1 (1 input to state x1x) Out CLK D Q R S In Reset R = Reset S = PS2 I NS1 = I NS2 = PS1 NS3 = PS2 O = PS3 IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Implementation using PALs Programmable logic building block for sequential logic macro-cell: FF + logic D-FF two-level logic capability like PAL (e.g., 8 product terms) D Q Q IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Vending machine example (Moore PLD mapping) D0 = reset'(Q0'N + Q0N' + Q1N + Q1D) D1 = reset'(Q1 + D + Q0N) OPEN = Q1Q0 D Q Q0 Q1 Open Com Seq CLK N Reset IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Vending machine (synch. Mealy PLD mapping) OPEN = reset'(Q1Q0N' + Q1N + Q1D + Q0'ND + Q0N'D) OPEN D Q Q0 Q1 Open Seq CLK N Reset IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

© Copyright 2004, Gaetano Borriello and Randy H. Katz 22V10 PAL Combinational logic elements (SoP) Sequential logic elements (D-FFs) Up to 10 outputs Up to 10 FFs Up to 22 inputs IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

© Copyright 2004, Gaetano Borriello and Randy H. Katz 22V10 PAL Macro Cell Sequential logic element + output/input selection IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

© Copyright 2004, Gaetano Borriello and Randy H. Katz Light Game FSM Tug of War game 7 LEDs, 2 push buttons (L, R) LED (3) LED (2) LED (1) LED (0) LED (6) LED (5) LED (4) RESET R L IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

© Copyright 2004, Gaetano Borriello and Randy H. Katz Light Game FSM Verilog module Light_Game (LEDS, LPB, RPB, CLK, RESET); input LPB ; input RPB ; input CLK ; input RESET; output [6:0] LEDS ; reg [6:0] position; reg left; reg right; combinational logic wire L, R; assign L = ~left && LPB; assign R = ~right && RPB; assign LEDS = position; sequential logic always @(posedge CLK) begin left <= LPB; right <= RPB; if (RESET) position <= 7'b0001000; else if ((position == 7'b0000001) || (position == 7'b1000000)) ; else if (L) position <= position << 1; else if (R) position <= position >> 1; end endmodule IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Example: traffic light controller A busy highway is intersected by a little used farmroad Detectors C sense the presence of cars waiting on the farmroad 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 Assume you have an interval timer that generates: 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 IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Example: traffic light controller (cont’) Highway/farm road intersection farm road car sensors highway IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Example: traffic light controller (cont’) Tabulation of inputs and outputs inputs description outputs description reset place FSM in initial state HG, HY, HR assert green/yellow/red highway lights C detect vehicle on the farm road FG, FY, FR assert green/yellow/red highway lights TS short time interval expired ST start timing a short or long interval TL long time interval expired Tabulation of unique states – some light configurations imply others state description HG highway green (farm road red) HY highway yellow (farm road red) FG farm road green (highway red) FY farm road yellow (highway red) IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Example: traffic light controller (cont’) State diagram Reset TS' TS / ST (TL•C)' TL•C / ST (TL+C')' TL+C' / ST HG FG FY HY IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Example: traffic light controller (cont’) Generate state table with symbolic states Consider state assignments output encoding – similar problem to state assignment (Green = 00, Yellow = 01, Red = 10) Inputs Present State Next State Outputs C TL TS ST H F 0 – – HG HG 0 Green Red – 0 – HG HG 0 Green Red 1 1 – HG HY 1 Green Red – – 0 HY HY 0 Yellow Red – – 1 HY FG 1 Yellow Red 1 0 – FG FG 0 Red Green 0 – – FG FY 1 Red Green – 1 – FG FY 1 Red Green – – 0 FY FY 0 Red Yellow – – 1 FY HG 1 Red Yellow SA1: HG = 00 HY = 01 FG = 11 FY = 10 SA2: HG = 00 HY = 10 FG = 01 FY = 11 SA3: HG = 0001 HY = 0010 FG = 0100 FY = 1000 (one-hot) IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Logic for different state assignments SA1 NS1 = C•TL'•PS1•PS0 + TS•PS1'•PS0 + TS•PS1•PS0' + C'•PS1•PS0 + TL•PS1•PS0 NS0 = C•TL•PS1'•PS0' + C•TL'•PS1•PS0 + PS1'•PS0 ST = C•TL•PS1'•PS0' + TS•PS1'•PS0 + TS•PS1•PS0' + C'•PS1•PS0 + TL•PS1•PS0 H1 = PS1 H0 = PS1'•PS0 F1 = PS1' F0 = PS1•PS0‘ SA2 NS1 = C•TL•PS1' + TS'•PS1 + C'•PS1'•PS0 NS0 = TS•PS1•PS0' + PS1'•PS0 + TS'•PS1•PS0 ST = C•TL•PS1' + C'•PS1'•PS0 + TS•PS1 H1 = PS0 H0 = PS1•PS0' F1 = PS0' F0 = PS1•PS0 SA3 NS3 = C'•PS2 + TL•PS2 + TS'•PS3 NS2 = TS•PS1 + C•TL'•PS2 NS1 = C•TL•PS0 + TS'•PS1 NS0 = C'•PS0 + TL'•PS0 + TS•PS3 ST = C•TL•PS0 + TS•PS1 + C'•PS2 + TL•PS2 + TS•PS3 H1 = PS3 + PS2 H0 = PS1 F1 = PS1 + PS0 F0 = PS3 IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz

Sequential logic implementation summary Models for representing sequential circuits finite state machines and their state diagrams Mealy, Moore, and synchronous Mealy machines Finite state machine design procedure deriving state diagram deriving state transition table assigning codes to states determining next state and output functions implementing combinational logic Implementation technologies random logic + FFs PAL with FFs (programmable logic devices – PLDs) IX - Sequential Logic Technology © Copyright 2004, Gaetano Borriello and Randy H. Katz