FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]

Slides:



Advertisements
Similar presentations
Recap : Always block module and_gate (out, in1, in2); inputin1, in2; outputout; regout; or in2) begin out = in1 & in2; end endmodule zAlways.
Advertisements

FSM and Efficient Synthesizable FSM Design using Verilog
//HDL Example 8-2 // //RTL description of design example (Fig.8-9) module Example_RTL (S,CLK,Clr,E,F,A);
Synchronous Sequential Logic
Combinational Logic.
Table 7.1 Verilog Operators.
//HDL Example 5-1 // //Description of D latch (See Fig.5-6) module D_latch (Q,D,control); output Q; input.
Verilog. 2 Behavioral Description initial:  is executed once at the beginning. always:  is repeated until the end of simulation.
Analysis of Clocked Sequential Circuits
FSM Revisit Synchronous sequential circuit can be drawn like below  These are called FSMs  Super-important in digital circuit design FSM is composed.
Give qualifications of instructors: DAP
CSE Spring Verilog for Sequential Systems - 1 Today: Verilog and Sequential Logic zFlip-flops yrepresentation of clocks - timing of state.
FSM examples.
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.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
Digital System Design by Verilog University of Maryland ENEE408C.
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
Arbitrary Waveform Discussion 12.2 Example 34. Recall Divide-by-8 Counter Use q2, q1, q0 as inputs to a combinational circuit to produce an arbitrary.
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.
ELEN 468 Advanced Logic Design
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
Verilog Intro: Part 2. Procedural Blocks There are two types of procedural blocks in Verilog. – initial for single-pass behavior : initial blocks execute.
Sequential Logic in Verilog
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 Workshop Topics - Outline Workshop 1 - Introduction Workshop 2 - module instantiation Workshop 3 - Lexical conventions Workshop 4 - Value Logic System.
ECE/CS 352 Digital System Fundamentals© 2001 C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Spring 2001 Chapters 3 and 4: Verilog – Part 2 Charles R.
Workshop Topics - Outline
Behavioral Modelling - 1. Verilog Behavioral Modelling Behavioral Models represent functionality of the digital hardware. It describes how the circuit.
Finite State Machine (FSM) Nattha Jindapetch December 2008.
Why segregate blocking and non-blocking assignments to separate always blocks? always blocks start when triggered and scan their statements sequentially.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL State Machines Anselmo Lastra.
Chapter 11: System Design Methodology Digital System Designs and Practices Using Verilog HDL and 2008, John Wiley11-1 Chapter 11: System Design.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
ACCESS IC LAB Graduate Institute of Electronics Engineering, NTU 99-1 Under-Graduate Project Design of Datapath Controllers Speaker: Shao-Wei Feng Adviser:
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
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.
Figure Implementation of an FSM in a CPLD..
Exp#7 Finite State Machine Design in Verilog COE203 Digital Logic Laboratory Dr. Ahmad Almulhem KFUPM Spring 2009.
Overview Logistics Last lecture Today HW5 due today
Supplement on Verilog FF circuit examples
Supplement on Verilog for Algorithm State Machine Chart
Figure 8.1. The general form of a sequential circuit.
Last Lecture Talked about combinational logic always statements. e.g.,
© Copyright 2004, Gaetano Borriello and Randy H. Katz
EMT 351/4 DIGITAL IC DESIGN Week # Synthesis of Sequential Logic 10.
‘if-else’ & ‘case’ Statements
Supplement on Verilog Sequential circuit examples: FSM
TODAY’S OUTLINE Procedural Assignments Verilog Coding Guidelines
Sequential logic examples
Why segregate blocking and non-blocking assignments to separate always blocks? always blocks start when triggered and scan their statements sequentially.
Digital Logic Design Digital Design, M. Morris Mano and Michael D
HDL Compiler Unsupport (Do NOT use in your verilog code)
ESE 437: Sensors and Instrumentation
COE 202 Introduction to Verilog
Topics Verilog styles for sequential machines. Flip-flops and latches.
Supplement on Verilog Sequential circuit examples: FSM
Dr. Tassadaq Hussain Introduction to Verilog – Part-3 Expressing Sequential Circuits and FSM.
The Verilog Hardware Description Language
Lecture 4: Continuation of SystemVerilog
332:437 Lecture 9 Verilog Example
332:437 Lecture 9 Verilog Example
Dr. Tassadaq Hussain Introduction to Verilog – Part-4 Expressing FSM in Verilog (contd) and FSM State Encoding Dr. Tassadaq Hussain.
Why segregate blocking and non-blocking assignments to separate always blocks? always blocks start when triggered and scan their statements sequentially.
332:437 Lecture 9 Verilog Example
Lecture 7: Verilog Part II
Presentation transcript:

Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]

FSM MODELING MOORE FSM MELAY FSM

MOORE FSM: Output is a function of present state only that are synchronized with the clock.

MELAY FSM: Output is a function of present state and inputs. When inputs change, outputs are updated immediately, without waiting for a clock edge. Outputs can be written more than once per clock cycle.

Problem Statement: Design a circuit that recognizes a sequence of three or more consecutive 1’s. State Diagram: Melay FSM Moore FSM

FSM Encoding Encoding the states is assigning unique binary numbers to the states. parameter initial = 3’b000, S1 = 3’b001, S2 = 3’b010, S3 = 3’b011, S4 = 3’b100 ; Choice of a particular encoding technique depends on “Area and Power” Constraints.

Moore FSM module Moore_FSM_RTL (y_out, x_in, clk, rst) ; input x_in, clk, rst ; output reg y_out ; //Binary State Encoding parameter S0 = 2'b00, S1 = 2'b01, S2 = 2'b10, S3 = 2'b11 ; //state register reg [1:0] state ;

//Determine next state synchronously //based on present state and input. always @ (posedge clk or posedge rst) //sequential block begin if (rst) state <= S0 ; else case (state) S0: if (x_in) state <= S1 ; else state <= S0 ; S1: if (x_in) state <= S2 ; S2: if (x_in) state <= S3 ; S3: if (x_in) state <= S3 ; endcase end Use “Non-Blocking” assignment for Sequential block.

//output depends only on the state. always @ (state) //combinational block begin case (state) S0: if (x_in) y_out = 1'b0 ; else y_out = 1'b0 ; S1: if (x_in) y_out = 1'b0 ; S2: if (x_in) y_out = 1'b0 ; S3: if (x_in) y_out = 1'b1 ; endcase end endmodule Use “Blocking” assignment for Combinational block.

Synthesis – RTL View

Output Y: 0  1  0

Output Y: 1 0  1

Effect of “reset” input

Effect of “glitches” in the input

Moore FSM Output waveform

Melay FSM module Melay_FSM_RTL (y_out, x_in, clk, rst) ; input x_in, clk, rst ; output reg y_out ; //Binary State Encoding parameter S0 = 2'b00, S1 = 2'b01, S2 = 2'b10 ; //state register reg [1:0] state ;

//determine next state synchronously //based on present state and input. always @ (posedge clk or posedge rst) //sequential block begin if (rst) state <= S0 ; else case (state) S0: if (x_in) state <= S1 ; else state <= S0 ; S1: if (x_in) state <= S2 ; S2: if (x_in) state <= S2 ; endcase end Use “Non-Blocking” assignment for Sequential block.

//Determine output only based on input and //present state. Don’t wait for clock edge. always @ (state or x_in) //combinational block begin case (state) S0: if (x_in) y_out = 1’b0 ; else y_out = 1’b0 ; S1: if (x_in) y_out = 1’b0 ; S2: if (x_in) y_out = 1’b1 ; endcase end endmodule Use “Blocking” assignment for Combinational block.

Synthesis – RTL View

Output Y: 0  1  0

Output Y: 1  0  1

Effect of “reset” input

Effect of “glitches” in the input

Melay FSM Output waveform

Comparison of Moore & Melay FSM output waveform

FSM Modeling Guidelines Use “parameters” to define state encodings. Use two “always” block coding style. Code all “sequential” always blocks using “non-blocking” assignments. Code all “combinational” always blocks using “blocking” assignments.