Prof Sandip Kundu ECE 353 Lab B (Part B – Verilog Design Approach)

Slides:



Advertisements
Similar presentations
Digital System Design-II (CSEB312)
Advertisements

VERILOG: Synthesis - Combinational Logic Combination logic function can be expressed as: logic_output(t) = f(logic_inputs(t)) Rules Avoid technology dependent.
FSM and Efficient Synthesizable FSM Design using Verilog
Sequential Logic in Verilog
EE 361 Fall 2003University of Hawaii1 Hardware Design Tips EE 361 University of Hawaii.
Combinational Logic.
Prof. Kavita Bala and Prof. Hakim Weatherspoon CS 3410, Spring 2014 Computer Science Cornell University See P&H Appendix B.7. B.8, B.10, B.11.
Table 7.1 Verilog Operators.
Electrical and Computer Engineering MIDI Note Number Display UGA Presentation and Demo ECE 353 Lab B.
ECE 551 Digital System Design & Synthesis Lecture 08 The Synthesis Process Constraints and Design Rules High-Level Synthesis Options.
2/9/20031 ECE 551: Digital System Design & Synthesis Lecture Set 4 4.1: Verilog – Procedural Assignments &Scheduling Semantics 4.2: Verilog – More Behavioral.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 8: Sequential Design Spring 2009 W. Rhett.
ECE 551 Digital System Design & Synthesis Lecture 09 Synthesis of Common Verilog Constructs.
ECE 353 Computer Systems Lab II VHDL AND LABORATORY TOOLS TUTORIAL Professors Maciej Ciesielski & T. Baird Soules.
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.
Useful Things to Know Norm. Administrative Midterm Grading Finished –Stats on course homepage –Pickup after this lab lec. –Regrade requests within 1wk.
CSE241 R1 Verilog.1Kahng & Cichy, UCSD ©2003 CSE241 VLSI Digital Circuits Winter 2003 Recitation 1: Verilog Introduction.
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.
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE VLSI System Design Lecture 4 - Advanced Verilog.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
Advanced Verilog EECS 270 v10/23/06.
ECE 353 Lab B (part 1 – Overview)
Overview Logistics Last lecture Today HW5 due today
Guest Lecture by Ben Magstadt CprE 281: Digital Logic.
Sequential Logic in Verilog
Introduction to FPGA AVI SINGH. Prerequisites Digital Circuit Design - Logic Gates, FlipFlops, Counters, Mux-Demux Familiarity with a procedural programming.
Prof Csaba Andras Moritz
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.
1/8/ L20 Project Step 8 - Data Path Copyright Joanne DeGroat, ECE, OSU1 State Machine Design with an HDL A methodology that works for documenting.
1 An Update on Verilog Ξ – Computer Architecture Lab 28/06/2005 Kypros Constantinides.
1 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
Register Transfer Level & Design with ASM
1 CSE-308 Digital System Design (DSD) N-W.F.P. University of Engineering & Technology, Peshawar.
George Mason University Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code ECE 448 Lecture 6.
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Slide 1 2. Verilog Elements. Slide 2 Why (V)HDL? (VHDL, Verilog etc.), Karen Parnell, Nick Mehta, “Programmable Logic Design Quick Start Handbook”, Xilinx.
1 Hardware description languages: introduction intellectual property (IP) introduction to VHDL and Verilog entities and architectural bodies behavioral,
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL State Machines Anselmo Lastra.
CSCI-365 Computer Organization Lecture Note: Some slides and/or pictures in the following are adapted from: Computer Organization and Design, Patterson.
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 State Machines - II Montek Singh Feb 13, 2012.
2/3/2006EECS150 Lab Lecture #31 Implementation of FSMs EECS150 Spring 2006 – Lab Lecture #3 Guang Yang Greg Gibeling.
2/2/07EECS150 Lab Lecture #31 Verilog Synthesis & FSMs EECS150 Spring 2007 – Lab Lecture #3 Brent Mochizuki Greg Gibeling.
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
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 #
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.
State Machine Design with an HDL
Overview Logistics Last lecture Today HW5 due today
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code.
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
‘if-else’ & ‘case’ Statements
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
SYNTHESIS OF SEQUENTIAL LOGIC
State Machine Design with an HDL
COE 202 Introduction to Verilog
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL Code.
ECE 551: Digital System Design & Synthesis
Verilog Synthesis & FSMs
ECE 448 Lecture 6 Finite State Machines State Diagrams vs. Algorithmic State Machine (ASM) Charts.
Lecture 7: Verilog Part II
Presentation transcript:

Prof Sandip Kundu ECE 353 Lab B (Part B – Verilog Design Approach)

ECE353: 2 Computer Systems Lab 1Moritz, Kundu Class Information  If you missed the previous class Labs B and D Office hours Tu 10-11AM Or send for appointment Lecture notes and demo video posted online Check demo schedule and report due date Demo signup link is active Note: I am out of town this coming Tuesday, so no office hours Tuesday

ECE353: 3 Computer Systems Lab 1Moritz, Kundu Recall What You Will Do  Design and implement a serial MIDI receiver Hardware in an Altera Complex Programmable Logic Device (CPLD) MAX 7000S (part number EPM7064SLC44-10) Using ALTERA Quartus II software tools for synthesis Debug - functional simulation (wave forms) Debug of board - logic analyzer  Coding in Verilog  Next we look at Verilog design issues

ECE353: 4 Computer Systems Lab 1Moritz, Kundu Design in Verilog  Acknowledgements Builds on an internal course at BlueRISC, 2009 Papers by Clifford Cummings – SNUG-2000  Please use slides and check links on the web for free Verilog references for refreshing your Verilog skills Many Verilog books also available for purchase, e.g., S Brown et al, “Fundamentals of Digital Logic with Verilog Design” J Lee, “Verilog Quickstart” …

ECE353: 5 Computer Systems Lab 1Moritz, Kundu Hardware Design – Outline  How to Approach the Design Phase  Implementation with Verilog  Requirement for Functional Simulation  Summary

ECE353: 6 Computer Systems Lab 1Moritz, Kundu Translating Abstract Algorithms to Hardware  Identify hardware functionality in algorithm  Divide and conquer Break into smaller ‘black-boxes’ when complicated Think also about performance – what you do in a clock period  Focus on the heart of the problem first  Stub-out all (or majority of) modules List inputs, outputs Write comments - how outputs can be generated from inputs

ECE353: 7 Computer Systems Lab 1Moritz, Kundu Translating Abstract Algorithm to Hardware (contd.)  Implement one by one Control-first design is intuitive for ordering your work FSMs, state-based outputs, output generation logic Verification  Instantiate and wire together in top module

ECE353: 8 Computer Systems Lab 1Moritz, Kundu Example for Breaking Up (Modules Next slide) This is an abstract Montgomery Multiplication algorithm. Here first we try to understand how to partition this into hardware functionality… thinking hardware vs. software

ECE353: 9 Computer Systems Lab 1Moritz, Kundu Pieces Identified Implemented in Modules Courtesy BlueRISC Inc

ECE353: 10 Computer Systems Lab 1Moritz, Kundu Stub-out – Start with Heart of the Problem

ECE353: 11 Computer Systems Lab 1Moritz, Kundu Hardware Design – Outline  How to Approach Design Phase  Implementation with Verilog  Requirements for Functional Simulation  Summary

ECE353: 12 Computer Systems Lab 1Moritz, Kundu In Which Order – Data vs. Control?  Control first design flow (preferred) -State-machines -State-based outputs -Output generation logic -Verification

ECE353: 13 Computer Systems Lab 1Moritz, Kundu In Which Order – Data vs. Control (contd.)  Data first design flow -Output generation logic -State-based outputs -State machines -Verification

ECE353: 14 Computer Systems Lab 1Moritz, Kundu Recall Modules  Defines ‘black- box’ piece of hardware  May be instantiated in other modules  Can instantiate other modules

ECE353: 15 Computer Systems Lab 1Moritz, Kundu Blocks in Modules  always Commonly used, synthesizable Evaluated whenever a signal in sensitivity list changes in simulator Evaluated regardless of sensitivity list in actual hardware  initial Commonly used, non-synthesizable Useful for testbench creation Setting initial conditions else triggered by external events  forever Commonly used for generating clocks forever clk = #5 ~clk;

ECE353: 16 Computer Systems Lab 1Moritz, Kundu Combinatorial vs. Sequential Blocks  Combinatorial Generate signals inside a clock period E.g., the next version of state_nxt, or signal_nxt (will see example shortly)  Sequential Latch signal values on clock edges E.g., signal <= signal_nxt;

ECE353: 17 Computer Systems Lab 1Moritz, Kundu Basic Value Manipulations

ECE353: 18 Computer Systems Lab 1Moritz, Kundu Mealy vs. Moore State Machines  Mealy - “event driven” -Next-state and Output depend on both current state and input  Moore - “state driven” -Next-state depends on both current state and input -Output depends only on current state

ECE353: 19 Computer Systems Lab 1Moritz, Kundu Mealy State Machine

ECE353: 20 Computer Systems Lab 1Moritz, Kundu Moore State Machine

ECE353: 21 Computer Systems Lab 1Moritz, Kundu Style of Coding – Recommendation  Many considerations like the quality of expected/resulting synthesis but also ease of debugging  A good convention is to separate combinational and sequential blocks entirely No combinational code in the sequential block! Sequential block has mainly assignments to latch signals at clock edge or reset! E.g., state <= state_nxt signal <= signal_nxt This keeps your code easy to read and debug and avoids subtle flaws

ECE353: 22 Computer Systems Lab 1Moritz, Kundu Coding Style: Block diagram, Module, and FSM Note: if more states, we would call “next” “state_nxt”

ECE353: 23 Computer Systems Lab 1Moritz, Kundu More on Variables in Hardware – Adder Example // sequential part, uses sum_out_nxt // Created in the above block from sum_out // See style followed! //Continuous assignment

ECE353: 24 Computer Systems Lab 1Moritz, Kundu Continuous Assignment  E.g., assign data = …. in previous slide  Simplest of the high-level constructs  It is like a gate: it drives a value into a wire Left hand side is a wire  Automatically evaluated when any of the operands change  Combinational in nature

ECE353: 25 Computer Systems Lab 1Moritz, Kundu Blocking vs. Non-Blocking Statements  First block non-blocking (NB) a,z updated after 5 time units  Second block blocking (B) Evaluated in order Total time 6 units Value of b toggles 3 times

ECE353: 26 Computer Systems Lab 1Moritz, Kundu Coding Guidelines for B vs NB  Use NB in always blocks for sequential logic, e.g.,  Use B in always blocks for combinational logic  Otherwise pre-synthesis simulation might not match with that of synthesized circuit or has poor simulation performance // Good// Bad

ECE353: 27 Computer Systems Lab 1Moritz, Kundu Example - Shift-Register in Verilog Incorrect implementation clk) begin shift_reg[2] = shift_reg[3]; shift_reg[1] = shift_reg[2]; shift_reg[0] = shift_reg[1]; end * ‘=‘ : Blocking Assignment * Value in shift_reg[3] will be assigned to shift_reg[0] directly Correct implementation clk) begin shift_reg[2] <= shift_reg[3]; shift_reg[1] <= shift_reg[2]; shift_reg[0] <= shift_reg[1]; End * ‘<=‘ : Non-Blocking Assignment * Updating will happen after capturing all right-side register values

ECE353: 28 Computer Systems Lab 1Moritz, Kundu Hardware Design – Outline  How to Approach the Design Phase  Implementation with Verilog  Requirements for Functional Simulation  Summary

ECE353: 29 Computer Systems Lab 1Moritz, Kundu Simulation  Simulation time not real No gate delays All evaluations happen same time Zero time for combinatorial logic Time is “stopped” when needed How to simulate accurately re: synthesis results?  REG_DELAY for sequential logic Register outputs are valid just after the clock edge Manual delay in simulation is inserted to mimic real world delay Illusion for passage of “time” in simulation

ECE353: 30 Computer Systems Lab 1Moritz, Kundu Sensitivity Lists  Simulation depends on this list // simulation matches synthesis or b) out=a&b; // simulation fails to match synthesis when ‘a’ toggles out=a&b;  Consider that ‘a’ and ‘b’ are driven by independent logic (say, with different clocks). The flaw in the second block may give false positive for testing an implemented protocol when ‘a’ switches prior to ‘b’ and prior to evaluation of ‘out’ - likewise this may result in a false negative for otherwise good logic */  Synthesis does not depend on list Only exception is clock edges clk) if(reset)…else…

ECE353: 31 Computer Systems Lab 1Moritz, Kundu Verilog Debugging  Testbenches Verilog code to exercise your logic  Waveforms Check signals and control-flow visually

ECE353: 32 Computer Systems Lab 1Moritz, Kundu Hardware Design – Outline  How to Approach the Design Phase  Implementation with Verilog  Requirements for Functional Simulation  Summary

ECE353: 33 Computer Systems Lab 1Moritz, Kundu Summary – Preferred Coding Style Reviewed  Partition into modules (Lab B may not require multiple)  Stub out all inputs and outputs and comment  Separate combinational block(s) from sequential block FSM is implemented in combinational block Next state is calculated in combinational block Output is calculated in combinational block Sequential block mainly contains simple latching assignments  Make sure you use NB statements in sequential and B in combinational blocks  Use intuitive names (signal, signal_nxt) and follow convention Remember this is hardware not software

ECE353: 34 Computer Systems Lab 1Moritz, Kundu Additional Information  Please consult course website  Also check deliverables for the Lab in the Lab review document