FSM examples.

Slides:



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

//HDL Example 8-2 // //RTL description of design example (Fig.8-9) module Example_RTL (S,CLK,Clr,E,F,A);
Counters Discussion D8.3.
Traffic light contoller using FSM
Verilog in transistor level using Microwind
CDA 3100 Recitation Week 11.
Synchronous Sequential Logic
Table 7.1 Verilog Operators.
CSE 201 Computer Logic Design * * * * * * * Verilog Modeling
//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.
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
//HDL Example 6-1 // //Behavioral description of //Universal shift register // Fig. 6-7 and Table 6-3 module shftreg.
How to get a Circuit in verilog converted to hspice, connected to the micron package models, and simulating in hspice and hsimplus.
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.
ELEN468 Lecture 101 ELEN 468 Advanced Logic Design Lecture 10 Behavioral Descriptions IV.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
Pulse-Width Modulated DAC
OUTLINE Introduction Basics of the Verilog Language Gate-level modeling Data-flow modeling Behavioral modeling Task and function.
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.
Counters Discussion 12.1 Example 33. Counters 3-Bit, Divide-by-8 Counter 3-Bit Behavioral Counter in Verilog Modulo-5 Counter An N-Bit Counter.
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.
COE 202 Introduction to Verilog Computer Engineering Department College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
FSMs in Verilog and other random things 9/27/02. FSM structure CLK STATE Next State Logic Inputs Output Logic Outputs.
D Flip-Flops in Verilog Discussion 10.3 Example 27.
1 COMP541 State Machines – 2 Registers and Counters Montek Singh Feb 8, 2007.
Verilog Descriptions of Digital Systems. Electronic Lock // // Electronic combinational lock // module lock(seg7,key, valid_key, col, row, mclk, resetL)
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.
Lecture 18 More Moore/Mealy machines.
Lab7-1 Lab 6: FSM Description Separate combinational and memory circuits –State memory uses FFs –Others are combinational 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.
TODAY’S OUTLINE Finite State Machine Exercise 1 Exercise 1 Exercise 2 Exercise 2 Exercise 3 Exercise 3 Exercise 4 Exercise 4.
DLD Lecture 26 Finite State Machine Design Procedure.
Final Project. System Overview Description of Inputs reset: When LOW, a power on reset is performed. mode: When LOW, NORMal mode selected When HIGH,
Charles Kime & Thomas Kaminski © 2004 Pearson Education, Inc. Terms of Use (Hyperlinks are active in View Show mode) Terms of Use Verilog Part 3 – Chapter.
Finite State Machine (FSM) Nattha Jindapetch December 2008.
The UNIVERSITY of NORTH CAROLINA at CHAPEL HILL State Machines Anselmo Lastra.
1 COMP541 State Machines - II Montek Singh Feb 13, 2012.
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:
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part4: Verilog – Part 2.
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 10: Data-Converter Example Spring 2009 W.
Lab5-1 張明峰 交大資工系 Lab 5: FSM and BCD counters Implement the vending machine of lab 2 A two-digit BCD counter –two BCD counters –can load data in parallel.
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 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.
Supplement on Verilog for Algorithm State Machine Chart
Figure 8.1. The general form of a sequential circuit.
Supplement on Verilog Sequential circuit examples: FSM
Pulse-Width Modulation (PWM)
Digital Logic Design Digital Design, M. Morris Mano and Michael D
HDL Compiler Unsupport (Do NOT use in your verilog code)
COMP541 State Machines Montek Singh Feb 4, 2010.
FSM MODELING MOORE FSM MELAY FSM. Introduction to DIGITAL CIRCUITS MODELING & VERIFICATION using VERILOG [Part-2]
ESE 437: Sensors and Instrumentation
Supplement on Verilog Sequential circuit examples: FSM
The Verilog Hardware Description Language
332:437 Lecture 9 Verilog Example
332:437 Lecture 9 Verilog Example
Mr. Pradeep J NATIONAL INSTITUTE OF TECHNOLOGY,
332:437 Lecture 9 Verilog Example
Presentation transcript:

FSM examples

Odd Parity Checker Design a circuit that detects whether there are an odd number of 1s in an input bit stream. Assume that the rate of inputs is 1 every clock cycle. We have input bit stream Next State will depend on current state as well as the current input

Odd Parity Checker- State Graph

Odd Parity Checker- State Table Even number of ones = State S0 = 1’b0 Odd Number of Ones = State S1 = 1’b1 Present State Input Next State Output 1

Odd Parity Checker – Next State Logic in Present State 1 1 1 1

Odd Parity Checker - Circuit

Odd Parity Checker – Verilog Code module odd_parity( in, clk, reset, Out); input in, clk, reset; output Out; reg state, next_state; wire Out; parameter S0 = 1’b0, S1 = 1’b1;

Odd Parity Checker – Verilog Code // Next State Logic always @ (in or state or reset) begin if( reset ==0) next_state =S0; else case(state) S0: begin if(in==1) next_state = S1; else next_state = S0; end S1: begin if(in ==1) next_state =S0; else next_state = S1; endcase

Odd Parity Checker – Verilog Code // State Register always @ (posedge clk or negedge reset) begin if(reset==0) state <=S0; else state <= next_state; end // Output Logic assign Out = state;

State Machine Example X=1

State Machine Example – State Table Q0 Q1 X N0 N1 1

State Machine Example – Circuit Realisation Q0 Q1 00 01 11 10 x 1 1 N1 Q0 Q1 x 00 01 11 10 1 1 N1 = x

State Machine Example – Verilog Code module state_machine(x, clk, reset, Out); input x, clk, reset; output[1:0] Out; reg[1:0] state, next_state; wire[1:0] Out; parameter S0 = 2’b00, S1 = 2’b01, S2 = 2’b10, S3 = 2’b11;

State Machine Example – Verilog Code // Next State Logic always @ (x or state or reset) begin if(reset ==0) next_state =S0; else case(state) S0: begin if(x==0) next_state = S0; else next_state = S1; end S1: begin if(x==0) next_state = S2; else next_state = S3; S2: begin S3: begin endcase

State Machine Example – Verilog Code //State Register Logic always @ (posedge clk or negedge reset) begin if(reset == 0) state <= S0; else state <= next_state; end //Output Logic assign Out = state;