2/3/2006EECS150 Lab Lecture #31 Implementation of FSMs EECS150 Spring 2006 – Lab Lecture #3 Guang Yang Greg Gibeling.

Slides:



Advertisements
Similar presentations
Table 7.1 Verilog Operators.
Advertisements

Slide 1 7. Verilog: Combinational always statements. VHDL: Combinational Processes: To avoid (I.E. DO NOT What in your HDL code?) Cases that generate Synthesis.
CSE Spring Verilog for Sequential Systems - 1 Today: Verilog and Sequential Logic zFlip-flops yrepresentation of clocks - timing of state.
Spring 20067W. Rhett Davis with minor modifications by Dean Brock ECE 406 at UNASlide 1 ECE 406 Design of Complex Digital Systems Lecture 10: 9: State.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 4 - Sequential Design.
2/24/2006EECS150 Lab Lecture #61 N64 Controller (Project Checkpoint#1) EECS150 Spring2006 – Lab Lecture #6 Philip Godoy Guang Yang Greg Gibeling.
1/27/06EECS150 Lab Lecture #21 Designing with Verilog EECS150 Spring 2006 – Lab Lecture #2 Brian Gawalt Greg Gibeling.
Digital System Design by Verilog University of Maryland ENEE408C.
9/13/07EECS150 F07 Culler Lec 6 1 EECS Components and Design Techniques for Digital Systems Lec 06 – Using FSMs David Culler Electrical.
2/16/2007EECS150 Lab Lecture #51 Logic Analyzers EECS150 Spring 2007 – Lab Lecture #5 Shah Bawany.
2/17/2006EECS150 Lab Lecture #51 Logic Analyzers EECS150 Spring 2006 – Lab Lecture #5 David Lin Greg Gibeling.
Spring 2002EECS150 - Lec0-intro Page 1 EECS150 - Digital Design Lecture 9 - Finite State Machines 1 February 19, 2002 John Wawrzynek.
9/5/2008EECS150 Lab Lecture #21 Designing with Verilog EECS150 Fall Lab Lecture #2 Chen Sun Adopted from slides designed by Greg Gibeling.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 4 - Verilog 2 (Sequential.
ENEE 408C Lab Capstone Project: Digital System Design Fall 2005 Sequential Circuit Design.
2/9/2007EECS150 Lab Lecture #41 Debugging EECS150 Spring2007 – Lab Lecture #4 Laura Pelton Greg Gibeling.
From Design to Verilog EECS150 Fall Lecture #4
Advanced Verilog EECS 270 v10/23/06.
8/31/2007EECS150 Lab Lecture #11 EECS150 Intro. & CAD Tools EECS150 Fall 2007 Lab Lecture #1 Shah Bawany.
1 COMP541 State Machines – 2 Registers and Counters Montek Singh Feb 8, 2007.
02/10/06EECS150 Lab Lecture #41 Debugging EECS150 Spring 2006 – Lab Lecture #4 Philip Godoy Greg Gibeling.
1/19/2007EECS150 Lab Lecture #11 EECS150 Intro. & CAD Tools EECS150 Spring 2008 Lab Lecture #1 Ke Xu.
Prof Sandip Kundu ECE 353 Lab B (Part B – Verilog Design Approach)
10/31/2008EECS150 Lab Lecture #10 The Waveform Generator EECS150 Fall Lab Lecture #10 Chris Fletcher Adopted from slides designed by Chris Fletcher.
Overview Logistics Last lecture Today HW5 due today
Guest Lecture by Ben Magstadt CprE 281: Digital Logic.
Guest Lecture by Ben Magstadt CprE 281: Digital Logic.
Sequential Logic in Verilog
1 COMP541 State Machines Montek Singh Feb 8, 2012.
ECE 551 Digital System Design & Synthesis Fall 2011 Midterm Exam Overview.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Ders 8: FSM Gerçekleme ve.
ECE 551 Digital Design And Synthesis
EEE2243 Digital System Design Chapter 4: Verilog HDL (Sequential) by Muhazam Mustapha, January 2011.
Slide 1 6. VHDL/Verilog Behavioral Description. Slide 2 Verilog for Synthesis: Behavioral description Instead of instantiating components, describe them.
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
Verilog for Synthesis Ing. Pullini Antonio
Finite State Machine (FSM) Nattha Jindapetch December 2008.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL State Machines Anselmo Lastra.
Introduction to ASIC flow and Verilog HDL
1 COMP541 State Machines – 2 Registers and Counters Montek Singh Feb 11, 2010.
Teaching Digital Logic courses with Altera Technology
1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
1 COMP541 State Machines - II Montek Singh Feb 13, 2012.
2/2/07EECS150 Lab Lecture #31 Verilog Synthesis & FSMs EECS150 Spring 2007 – Lab Lecture #3 Brent Mochizuki Greg Gibeling.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Chapter 11: System Design.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU 99-1 Under-Graduate Project Design of Datapath Controllers Speaker: Shao-Wei Feng Adviser:
CprE 281: Verilog Tutorial Ben Magstadt – Master’s Student Electrical Engineering.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 9: State Machines & Reset Behavior Spring.
EMT 351/4 DIGITAL IC DESIGN Verilog Behavioral Modeling  Finite State Machine -Moore & Mealy Machine -State Encoding Techniques.
Pusat Pengajian Kejuruteraan Mikroelektronik EMT 351/4 DIGITAL IC DESIGN Verilog Behavioural Modeling (Part 4) Week #
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
Lecture 5. Verilog HDL #3 Prof. Taeweon Suh Computer Science & Engineering Korea University COSE221, COMP211 Logic Design.
1 Lecture 3: Modeling Sequential Logic in Verilog HDL.
Exp#7 Finite State Machine Design in Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Figure 8.1. The general form of a sequential circuit.
Last Lecture Talked about combinational logic always statements. e.g.,
Discussion 2: More to discuss
Logic Analyzers EECS150 Fall Lab Lecture #5 Arjun Singh
332:437 Lecture 8 Verilog and Finite State Machines
EECS150 Fall 2007 – Lab Lecture #4 Shah Bawany
Debugging EECS150 Fall Lab Lecture #4 Sarah Swisher
Designing with Verilog
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
Debugging EECS150 Fall Lab Lecture #4 Sarah Swisher
The Verilog Hardware Description Language
Logic Analyzers EECS150 Fall Lab Lecture #5 Arjun Singh
Dr. Tassadaq Hussain Introduction to Verilog – Part-4 Expressing FSM in Verilog (contd) and FSM State Encoding Dr. Tassadaq Hussain.
Verilog Synthesis & FSMs
332:437 Lecture 8 Verilog and Finite State Machines
Lecture 7: Verilog Part II
Presentation transcript:

2/3/2006EECS150 Lab Lecture #31 Implementation of FSMs EECS150 Spring 2006 – Lab Lecture #3 Guang Yang Greg Gibeling

2/3/2006EECS150 Lab Lecture #32 Today Designing Digital System Efficient Hardware Design HDL Simulation Blocking vs. Non-Blocking Administrative Info Lab #3: The Combo Lock FSMs in Verilog

2/3/2006EECS150 Lab Lecture #33 Designing Digital System (1) High Level Design Top-Down Design Partitioning & Interfaces Implementing the Partitioned Digital Logic Start with the formal description Identify Inputs Determine State Generate Outputs

2/3/2006EECS150 Lab Lecture #34 Designing Digital System (2) Formal descriptions Mathematical Logic Data Flow Model Petri Net Finite State Machine …

2/3/2006EECS150 Lab Lecture #35 Designing Digital System (3) S:States S 0 :Initial State I:Inputs O:Outputs T:Transition Function Example: Finite State Machine

2/3/2006EECS150 Lab Lecture #36 Designing Digital System (4) Identify Inputs What are they? Possible Values and Don’t Cares Timing Process Them Raw inputs are often not what you need Might need delay/timing change Might look for a specific value/range

2/3/2006EECS150 Lab Lecture #37 Designing Digital System (5) Determine States What does the module need to remember? Has it seen a particular input? How many cycles have passed? Design Memory for State Standard D Register Counter Shift Register

2/3/2006EECS150 Lab Lecture #38 Designing Digital System (6) Generate Outputs What are they? Possible Values Timing Create the outputs They’re always there Compute them from state (and inputs) Learn to think in Boolean equations assign is helpful

2/3/2006EECS150 Lab Lecture #39 Designing Digital System (7) Mealy Machines Output based on input and current state Can have major timing problems Moore Machines Output based on current state Easier to work with Slightly harder to build Mealy Machine Moore Machine

2/3/2006EECS150 Lab Lecture #310 Efficient Hardware Design (1) (a or A or B or C) begin if (a) aux =B; else aux =C; Z = A + aux; end (a or A or B or C) begin if (a) Z =A + B; else Z =A + C; end

2/3/2006EECS150 Lab Lecture #311 Efficient Hardware Design (2) assign B = 3; assign Z = A * B; assign Z = A + (2 * A); assign Z = A + (A << 1); assign Z = A + {A, 1’b0};

2/3/2006EECS150 Lab Lecture #312 Efficient Hardware Design (3) assign aux = A + {1’b0, A[n-1:1]}; assign Z = {aux, A[0]};

2/3/2006EECS150 Lab Lecture #313 HDL Simulation (1) Software Based Simulation Simple and accurate Allows for simulation at any precision Easy to see any signal - perfect Visibility Drawbacks Slow Simulator Dependant Deadlocks are Possible! Simulation != Synthesis

2/3/2006EECS150 Lab Lecture #314 HDL Simulation (2) Event Driven Simulation Virtual time axis Maintain a queue of events Pull next event off the queue Determine its consequences Add more events to the queue Implications Verilog is not executed! Things don’t necessarily happen in order Verilog is SIMULATED

2/3/2006EECS150 Lab Lecture #315 Blocking vs. Non-Blocking (1) (a) begin b = a; c = b; end (posedge Clock) begin b <= a; c <= b; end C = B = A B = A C = Old B Verilog FragmentResultHardware CBA B DQ C DQ A Clock

2/3/2006EECS150 Lab Lecture #316 Blocking vs. Non-Blocking (2) Use Non-Blocking for FlipFlop Inference posedge/negedge require Non-Blocking Else simulation and synthesis wont match Use #1 to show causality (posedge Clock) begin b <= #1 a; c <= #1 b; end

2/3/2006EECS150 Lab Lecture #317 Administrative Info You could get checked off during your lab or during any lab TA’s office hours, though the TA would give higher priority to his own students Or in the first 10 minutes in your next lab session Try NOT to get checked off in other labs. As the lab gets busier, you may not be checked off at all

2/3/2006EECS150 Lab Lecture #318 Administrative Info (2) Cardkey forms distributed on 2/2 lecture See the office in Cory 253 or Soda 390 To download files from course website, cs150-temp no longer works If you cs150-xx does not work either, please David

2/3/2006EECS150 Lab Lecture #319 Administrative Info (3) Partners You MUST have one for Lab4 and later… Try to keep the same one for the project You must have one in your lab section If you do not have a partner: See a TA right after this lab lecture Post to the newsgroup

2/3/2006EECS150 Lab Lecture #320 Lab #3: The Combo Lock (1) Used to control entry to a locked room 2bit, 2 digit combo (By Default 11, 01) Set code to 11, Press Enter Set code to 01, Press Enter Lock Opens (Open = 1)

2/3/2006EECS150 Lab Lecture #321 Lab #3: The Combo Lock (2) SignalWidthDirDescription Code 2ICode from the dipswitches Enter 1IEnter button (examine the code) ResetCombo 1IReset to the default combination Clock 1ISystem Clock Reset 1ISystem Reset, doesn’t affect the combo Open 1OIndicates the lock is open Error 1OIndicates a bad combination Prog1 1OReprogramming the first digit Prog2 1OReprogramming the second digit LED 8OUse these for debugging

2/3/2006EECS150 Lab Lecture #322 Lab #3: The Combo Lock (3) Example 1: 1: Press ResetCombo, Combo: 2’b11, 2’b01 2: Set 2’b11, Press Enter 3: Set 2’b01, Press Enter, LEDs: “OPEN” 4: Press Enter, LEDs: “Prog1” 5: Set 2’b00, Press Enter, LEDs: “Prog2” 6: Set 2’b10, Press Enter, LEDs: “OPEN” 7: Combo: 2’b00, 2’b10

2/3/2006EECS150 Lab Lecture #323 Lab #3: The Combo Lock (4) Example 2: 1: Press ResetCombo, Combo: 2’b11, 2’b01 2: Set 2’b01, Press Enter 3: Set 2’b01, Press Enter, LEDs: “Error” Why doesn’t “Error” show until step 3?

2/3/2006EECS150 Lab Lecture #324 Lab #3: The Combo Lock (5)

2/3/2006EECS150 Lab Lecture #325 Lab #3: The Combo Lock (6)

2/3/2006EECS150 Lab Lecture #326 Lab #3: The Combo Lock (7) Debugging with LEDs A powerful way to debug Easy to understand Lower overhead than other debugging tools A great way to see NextState/CurrentState Drawbacks Slow, can’t see fast events No timing information, no waveform Limited number Dipswitches!

2/3/2006EECS150 Lab Lecture #327 FSMs in Verilog (1) Mealy Machines Output based on input and current state Can have major timing problems Moore Machines Output based on current state Easier to work with Slightly harder to build Mealy Machine Moore Machine

2/3/2006EECS150 Lab Lecture #328 FSMs in Verilog (2) Two or Three always blocks 1 st : CurrentState Register Clocked Handles Reset 2 nd : Generates NextState (+ Outputs in Mealy) Uses CurrentState and Inputs Combinational 3 rd : Generates Outputs (Optional) Uses CurrentState only (for Moore Machines) Might be replaced with a few assign s

2/3/2006EECS150 Lab Lecture #329 FSMs in Verilog (3) (posedge Clock) begin if (Reset) CurrentState <=STATE_Idle; else CurrentState <=NextState; end module MyFSM(In, Out, Clock, Reset); inputIn, Clock, Reset; outputOut; parameterSTATE_Idle =1’b0, STATE_Run =1’b1; STATE_X =1’bx; regCurrentState, NextState, Out; …

2/3/2006EECS150 Lab Lecture #330 FSMs in Verilog (4) // The case block goes here // Its on the next slide… end endmodule … (CurrentState or In) begin NextState =CurrentState; Out =1’b0;

2/3/2006EECS150 Lab Lecture #331 FSMs in Verilog (5) case (CurrentState) STATE_Idle: begin if (In) NextState =STATE_Run; Out =1’b0; end STATE_Run: begin if (In) NextState =STATE_Idle; Out =1’b1; end default: begin NextState =STATE_X; Out =1’bX; end endcase