ENEE 408C Lab Capstone Project: Digital System Design Fall 2005 Sequential Circuit Design.

Slides:



Advertisements
Similar presentations
FSM and Efficient Synthesizable FSM Design using Verilog
Advertisements

Analysis of Clocked Sequential Circuits
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
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 25 State Reduction and Assignment.
FSMs 1 Sequential logic implementation  Sequential circuits  primitive sequential elements  combinational logic  Models for representing sequential.
Digital System Design by Verilog University of Maryland ENEE408C.
Embedded Systems Hardware:
Verilog Sequential Circuits Ibrahim Korpeoglu. Verilog can be used to describe storage elements and sequential circuits as well. So far continuous assignment.
Dr. Turki F. Al-Somani VHDL synthesis and simulation – Part 3 Microcomputer Systems Design (Embedded Systems)
ENEE 408C Lab Capstone Project: Digital System Design Spring 2006 Class Web Site:
Prof. John Nestor ECE Department Lafayette College Easton, Pennsylvania ECE Senior Design I Lecture 4 - Verilog 2 (Sequential.
Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.
ELEN 468 Advanced Logic Design
ECE 301 – Digital Electronics Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #17)
ECE 331 – Digital Systems Design Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #19)
ENGIN112 L25: State Reduction and Assignment October 31, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 25 State Reduction and Assignment.
Lecture 17 General finite state machine (FSM) design
FPGA-Based System Design: Chapter 5 Copyright  2004 Prentice Hall PTR Topics n Basics of sequential machines. n Sequential machine specification. n Sequential.
Dr. H.v.d.Biggelaar / Mar3-Ver2 / 1 Engineering Technology Dr. H.v.d.Biggelaar March 22, 2000 State Machines in VHDL.
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.
1 CSE370, Lecture 19 Lecture 19 u Logistics n Lab 8 this week to be done in pairs íFind a partner before your lab period íOtherwise you will have to wait.
EEE2243 Digital System Design Chapter 4: Verilog HDL (Sequential) by Muhazam Mustapha, January 2011.
1 © 2014 B. Wilkinson Modification date: Dec Sequential Logic Circuits Previously, we described the basic building blocks of sequential circuits,
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.
Module : FSM Topic : types of FSM. Two types of FSM The instant of transition from the present to the next can be completely controlled by a clock; additionally,
1 COMP541 Sequential Circuits Montek Singh Feb 1, 2012.
1 CSE370, Lecture 18 Lecture 20 u Logistics n HW6 due Wednesday n Lab 7 this week (Tuesday exception) n Midterm 2 Friday (covers material up to simple.
Lecture 5. Sequential Logic 2 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education & Research.
Workshop Topics - Outline
Anurag Dwivedi. Basic Block - Gates Gates -> Flip Flops.
Digital Logic Design.
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.
VHDL Discussion Finite State Machines
VHDL Discussion Finite State Machines IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Introduction to ASIC flow and Verilog HDL
1 COMP541 State Machines – 2 Registers and Counters Montek Singh Feb 11, 2010.
Digital System Design using VHDL
CEC 220 Digital Circuit Design Mealy and Moore State Machines Friday, March 27 CEC 220 Digital Circuit Design Slide 1 of 16.
1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
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:
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 9: State Machines & Reset Behavior Spring.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
1 Modeling of Finite State Machines Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
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.
Figure 8.1. The general form of a sequential circuit.
© Copyright 2004, Gaetano Borriello and Randy H. Katz
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
CSE 370 – Winter Sequential Logic-2 - 1
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
COE 202 Introduction to Verilog
The Verilog Hardware Description Language
Lecture 20 Logistics Last lecture Today HW6 due Wednesday
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Lecture 22 Logistics Last lecture Today HW7 is due on Friday
Lecture 22 Logistics Last lecture Today HW7 is due on Friday
Presentation transcript:

ENEE 408C Lab Capstone Project: Digital System Design Fall 2005 Sequential Circuit Design

Finite State Machines A finite state machine (FSM) is a circuit designed to sequence through specific patterns of states in a sequential manner. A finite state machine (FSM) is a circuit designed to sequence through specific patterns of states in a sequential manner. Each state is represented by a binary value. Each state is represented by a binary value. An FSM contains a sequential state register, and combinational next-state and output logic. An FSM contains a sequential state register, and combinational next-state and output logic.

Mealy and Moore Machines A Mealy state machine has outputs that are a function of the current state AND the primary inputs. A Mealy state machine has outputs that are a function of the current state AND the primary inputs. A Moore state machine has outputs that are a function of the current state only. A Moore state machine has outputs that are a function of the current state only. A combined Mealy/Moore state machine has both. A combined Mealy/Moore state machine has both. Numerous FSM ‘dialects’ exist in design tools. Numerous FSM ‘dialects’ exist in design tools.

State Table InputAInputHold Current State Next State OutputY_MeOutputY_Mo 0X X X X XX X XX

State Encoding Sequential (“binary”) Sequential (“binary”) –Simple assignment Gray Gray –Assigns states by the minimum logic difference in the state transition graph. –I.e., assign adjacent codes to adjacent states –Reduces the amount of logic needed to decode each state. Johnson Johnson –Only one bit changes. One-hot One-hot –One bit in the state register for each state. –A large number of flip-flops, but no decoding for states. –Can result in smaller and faster FSMs, especially for ASICs with large amounts of sequential logic relative to combinational logic resources.

State Encoding (Example) NumberSequentialGrayJohnsonOne-Hot

State Diagram XX/0 00/1 0X/1 1X/1 0X/0 1X/0 XX/0 10/1 X1/

Circuit Implementation of FSM Combinational part Combinational part –compute next state and output given inputs and current state Sequential part Sequential part –use registers to store state codes –update state registers at each clock cycle

How to Describing a FSM and its circuit implementation in Verilog HDL?

Blocking and Non-blocking assignments “ <= “ : (non-blocking assignment): “ <= “ : (non-blocking assignment): –synchronized to clock (time unit) edge, concurrent = (blocking assignment): = (blocking assignment): –propagates immediately, sequential

Example: Blocking assignment “ = “ module swap; reg a, b, temp; (a or b) begin temp = a; a= b; b =temp; endendmodule

Example: Non-blocking assignment “ <= “ module swap; reg a, b; (a or b) begin a <= b; b <= a; endendmodule

intra and inter assignment #3 a <= b; a <= #3 b;

General Rules for Blocking and Non-blocking assignments <= (non-blocking assignment): synchronized to clock (time unit) edge, concurrent <= (non-blocking assignment): synchronized to clock (time unit) edge, concurrent = (blocking assignment):propagates immediately, sequential = (blocking assignment):propagates immediately, sequential # # (blocking delay) # RHS # RHS (non-blocking delay) Any of the four (2 X 2) possible combinations is allowed. Any of the four (2 X 2) possible combinations is allowed.

Example 1: module assign1; reg a,b,c,d; reg a,b,c,d; initial begin initial begin a = 0; b = 0; c = 0; d = 0; a = 0; b = 0; c = 0; d = 0; $monitor($time,,”a = %d, b =%d, c = %d, d = %d”, a,b,c,d); $monitor($time,,”a = %d, b =%d, c = %d, d = %d”, a,b,c,d); #20 $finish(2); #20 $finish(2); end end always begin always begin b = ~d; b = ~d; a = #2 b;//non-blocking delay c = ~c; #3 d <= c;//blocking delay end endendmodule

Example 2: module assign2; reg a, b, c, d; reg a, b, c, d; initial begin initial begin a = 0; b = 0; c = 0; d = 0; $monitor($time,,”a=%d, b=%d, c=%d, d=%d”,a,b,c,d); #20 $finish(2); end end always begin always begin b = ~b; #2 a = b;//blocking delay c = ~c; d <= #3 c;//non-blocking delay end endendmodule

Concurrent Execution clock) x = y; z = ~z;

HDL Coding Style for FSM Typically the synchronous portion is simply the state <= next_state assignment. Typically the synchronous portion is simply the state <= next_state assignment. The next_state portion is done in a purely combinational block (or multiple blocks). The next_state portion is done in a purely combinational block (or multiple blocks). –This is best done using a case statement rather than an if/else tree. –Defaults are easily set and excepted by unique cases.

FSM Verilog Behavior modeling Combinational part Combinational part (inputs or current states) begin case (current state) state1: next state =....; output = … ; output = … ; state2: … …end Sequential part Sequential part –cyclic behavior and edge detection –use non-blocking assignment for sequential behavior (posedge clk) begin current state <= next state; end

Generate CLOCK signal in Testbench module testbench; reg clk; parameter half_cycle = 50; initial begin clk = 0; … #350 $finish; end always begin #half_cycle clk = ~clk; endendmodule

Resets Using an asynchronous reset Using an asynchronous reset –Ensures that the state machine is always initialized to a known valid state. –No need to decode any unused current state values and thus minimizes next state logic. Using a synchronous reset or no reset Using a synchronous reset or no reset –Cannot predict initial state. –Must decode all states in the next state logic. –Can be a win if the next state logic is small compared to the additional size of the reset HW.

Assignment: Design a 4-bit counter with 1-bit input to control increase/decrease, 1 bit to reset to zero, and it should be synchronized. Design a 4-bit counter with 1-bit input to control increase/decrease, 1 bit to reset to zero, and it should be synchronized. –design the counter using FSM. Draw the state transition table/graph –design the counter using a while loop –design the counter using a for loop –design the counter using only if statement