FSM Examples. Young Won Lim 11/6/15

Similar documents
Sequential Circuit Timing. Young Won Lim 11/6/15

Finite State Machine (1A) Young Won Lim 6/9/18

Relations (3A) Young Won Lim 3/27/18

Higher Order ODE's (3A) Young Won Lim 7/7/14

Higher Order ODE's (3A) Young Won Lim 12/27/15

Expected Value (10D) Young Won Lim 6/12/17

Root Locus (2A) Young Won Lim 10/15/14

Matrix Transformation (2A) Young Won Lim 11/10/12

Example: vending machine

Detect Sensor (6B) Eddy Current Sensor. Young Won Lim 11/19/09

CT Rectangular Function Pairs (5B)

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

General CORDIC Description (1A)

Background Trigonmetry (2A) Young Won Lim 5/5/15

Fourier Analysis Overview (0A)

DFT Frequency (9A) Each Row of the DFT Matrix. Young Won Lim 7/31/10

Higher Order ODE's (3A) Young Won Lim 7/8/14

Introduction to ODE's (0A) Young Won Lim 3/9/15

General Vector Space (2A) Young Won Lim 11/4/12

Synchronous Sequential Circuit Design. Digital Computer Design

Models for representing sequential circuits

Parity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process

Finite State Machine (FSM)

Matrix Transformation (2A) Young Won Lim 11/9/12

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

Signal Functions (0B)

Separable Equations (1A) Young Won Lim 3/24/15

Complex Trigonometric and Hyperbolic Functions (7A)

Discrete Time Rect Function(4B)

Fourier Analysis Overview (0A)

Magnetic Sensor (3B) Magnetism Hall Effect AMR Effect GMR Effect. Young Won Lim 9/23/09

Down-Sampling (4B) Young Won Lim 10/25/12

Higher Order ODE's, (3A)

Line Integrals (4A) Line Integral Path Independence. Young Won Lim 10/22/12

Capacitor Young Won Lim 06/22/2017

Complex Series (3A) Young Won Lim 8/17/13

Audio Signal Generation. Young Won Lim 1/29/18

Discrete Time Rect Function(4B)

Implication (6A) Young Won Lim 3/17/18

Dispersion (3A) 1-D Dispersion. Young W. Lim 10/15/13

ODE Background: Differential (1A) Young Won Lim 12/29/15

Fourier Analysis Overview (0B)

Bayes Theorem (10B) Young Won Lim 6/3/17

Capacitor in an AC circuit

Down-Sampling (4B) Young Won Lim 11/15/12

Group & Phase Velocities (2A)

Up-Sampling (5B) Young Won Lim 11/15/12

The Growth of Functions (2A) Young Won Lim 4/6/18

Review Problem 1. should be on. door state, false if light should be on when a door is open. v Describe when the dome/interior light of the car

Propagating Wave (1B)

CSC 322: Computer Organization Lab

Chapter 6. Synchronous Sequential Circuits

Linear Equations with Constant Coefficients (2A) Young Won Lim 4/13/15

Different encodings generate different circuits

Capacitor and Inductor

Capacitor and Inductor

Group Delay and Phase Delay (1A) Young Won Lim 7/19/12

Lab #10: Design of Finite State Machines

Propositional Logic Resolution (6A) Young W. Lim 12/12/16

Definitions of the Laplace Transform (1A) Young Won Lim 1/31/15

Design of Datapath Controllers

Present Next state Output state w = 0 w = 1 z A A B 0 B A C 0 C A C 1

Digital Signal Octave Codes (0A)

EECS150 - Digital Design Lecture 23 - FSMs & Counters

Propositional Logic Resolution (6A) Young W. Lim 12/31/16

Differentiation Rules (2A) Young Won Lim 1/30/16

Complex Functions (1A) Young Won Lim 2/22/14

Line Integrals (4A) Line Integral Path Independence. Young Won Lim 11/2/12

Audio Signal Generation. Young Won Lim 2/2/18

Bayes Theorem (4A) Young Won Lim 3/5/18

Total time is: 1 setup, 2 AND, 3 XOR, 1 delay = (1*1) + (2*2) + (3*3) + (1*1) = 15ns

Phasor Young Won Lim 05/19/2015

Laboratory Exercise #8 Introduction to Sequential Logic

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING EXAMINATION SEMESTER /2017

Hamiltonian Cycle (3A) Young Won Lim 5/5/18

Resolution (7A) Young Won Lim 4/21/18

General Vector Space (3A) Young Won Lim 11/19/12

ECE/Comp Sci 352 Digital Systems Fundamentals. Charles R. Kime Section 2 Fall Logic and Computer Design Fundamentals

Digital Signal Octave Codes (0A)

Laboratory Exercise #11 A Simple Digital Combination Lock

CLTI System Response (4A) Young Won Lim 4/11/15

Probability (10A) Young Won Lim 6/12/17

Audio Signal Generation. Young Won Lim 2/2/18

Propositional Logic Logical Implication (4A) Young W. Lim 4/11/17

EECS 270 Midterm 2 Exam Answer Key Winter 2017

CSE 320: Spartan3 I/O Peripheral Testing

Group Velocity and Phase Velocity (1A) Young Won Lim 5/26/12

Digital Signal Octave Codes (0A)

Digital Logic and Design (Course Code: EE222) Lecture 19: Sequential Circuits Contd..

Signals and Spectra (1A) Young Won Lim 11/26/12

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

ENGG 1203 Tutorial _03 Laboratory 3 Build a ball counter. Lab 3. Lab 3 Gate Timing. Lab 3 Steps in designing a State Machine. Timing diagram of a DFF

Digital Signal Octave Codes (0A)

Implication (6A) Young Won Lim 3/12/18

CSE 140 Midterm 3 version A Tajana Simunic Rosing Spring 2015

Introduction to ODE's (0P) Young Won Lim 12/27/14

CT Correlation (2A) Young Won Lim 9/9/14

Surface Integrals (6A)

Efficient Verification of Multi-Property Designs. The benefit of wrong assumptions (E. Goldberg, M. Güdemann, D. Kroening, R.

Digital Signal Octave Codes (0A)

Transcription:

/6/5

Copyright (c) 2 25 Young W. Lim. Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version.2 or any later version published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. A copy of the license is included in the section entitled "GNU Free Documentation License". Please send corrections (or suggestions) to youngwlim@hotmail.com. This document was produced by using OpenOffice and Octave. /6/5

Latches and FF's 3 /6/5

Inputs and Outputs L B Traffic Lights - Outputs L A L B Sensor - Inputs T B T A T B L A T A T A L A T B L B 4 /6/5

States T A = L A L B L A T A = L A L B L A L B L B T B = L B L B L A L A T B = L A L A L B L B 5 /6/5

Moore State Transition Table S S T A T B S' S' S S T A T B S' X X X X X X X X S S S S T B S S T B X X X X X X X X S' = S S + S S = S + S S S T A T B S' S S T A S S T B X X X X X X X X S' = S S T A + S S T B 6 /6/5

States S S 2 L A L A L B L B S S 2 L A S S 2 L A L A =S L A =S S S S 2 L B S S 2 L B L B =S L A =S S 7 /6/5

Moore () inputs T A NextSt Compute NextSt from CurrSt, Ta, Tb T B Next State S' Current State S CurrSt This NextSt becomes a new CurrSt clk S' states : S : S : S2 : S3 S S S outputs L A L A L B L B outputs (LA/LB) : Green : Yellow : Red : X Compute NextSt CurrSt <= NextSt 8 /6/5

Moore inputs T A Inputs T A T B T B Current State S S Next State Current State S' = S + S Next States S' S S' = S S T A + S S T B S' = S + S S' = S S T A + S S T B S' S clk states : S : S : S2 : S3 outputs (LA/LB) : Green : Yellow : Red : X S S L A =S L A =S S L B =S L B =S S outputs Current State S S L A L A L Outputs B L L A =S L B B=S L A =S S L B =S S 9 /6/5

Verilog Gate Level Design - testbench `timescale ns/ps module traffic_controller_testbench; parameter cycle = 4; reg clock; always begin #(cycle/2) clock=~clock; end traffic_controller DUT (.clock(clock),.reset(reset),.ta(ta),.tb(tb),.la(la),.lb(lb) ); reg reset; reg TA, TB; wire [:] LA, LB; initial begin clock = ; reset = ; TA = ; TB = ; #; #(cycle) reset = ; #(cycle) TB = ; #(cycle) TA = ; #(cycle*3) TA = ; TB = ; #(cycle*3) TA = ; end initial begin $dumpfile("traffic.vcd"); $dumpvars(, DUT); #(cycle * ); $finish; end endmodule /6/5

Verilog Gate Level Design traffic_gate.v module traffic_controller(clock, reset, TA, TB, LA, LB); input clock, reset; input TA, TB; output [:] LA, LB; reg [:] S; wire [:] NextS; always @(posedge clock) begin: SEQ if (reset) #8 S = 2'b; else #8 S = NextS; end not #8 (Sb, S[]); not #8 (Sb, S[]); not #8 (TAb, TA); not #8 (TBb, TB); xor #8 (NextS[], S[], S[]); or #8 (NextS[], NS, NS2); and #8 (NS, Sb, Sb, TAb); and #8 (NS2, S[], Sb, TBb); buf #8 (LA[], S[]); and #8 (LA[], Sb, S[]); not #8 (LB[], S[]); and #8 (LB[], S[], S[]); endmodule /6/5

VCD Output with zero delay 2 /6/5

VCD Output with gate delays 3 /6/5

VCD Output with gate delays Output Delay 4 /6/5

Divide By N Counter reset S S Y= Y= Input: none Output: Y= every 3 cycles S2 Y= State Transition Table Curr St S S S2 Next St S S2 S Output Table Curr St S S S2 Output 5 /6/5

Encoding States State Transition Table Output Table State Transition Table Output Table Curr St Next St Curr St Output Curr St Next St Curr St Output S S S2 S S2 S S S S2 S S S2 S S2 S S S S2 S S S' S' S S Y S 2 S' S Y S S S' 2 S' S 2 S S' =S S Y =S S S' 2 =S 2 S S S Y =S 2 S S S S' =S S S' =S 2 S S S' =S 2 S S S S 2 6 /6/5

Resolution Time 7 /6/5

FF Timing (Ideal) D 3: Q 3: Inputs to FFs Outputs of FFs D 3 Q 3 D 3 Q 3 Inputs to FFs D 2 D Q 2 Q Outputs of FFs D 2 D Register Q 2 Q D Q D Q CLK 8 /6/5

Sequence of States (t) th edge (t+) th edge (t+2) th edge (t+3) th edge (t+4) th edge (t+5) th edge D 3: Inputs to FFs Q 3: Q(t) Q(t+) Q(t+2) Q(t+3) Q(t+4) Q(t+5) Outputs of FFs (t) th edge (t+) th edge (t+2) th edge (t+3) th edge (t+4) th edge (t+5) th edge D 3:?????? Find inputs to FFs Q 3: Q(t) Q(t+) Q(t+2) Q(t+3) Q(t+4) Q(t+5) which will make outputs in this sequence 9 /6/5

When NextSt becomes CurrSt Compute NextSt from CurrSt, Ta, Tb NextSt CurrSt This NextSt becomes a new CurrSt Compute NextSt CurrSt <= NextSt 2 /6/5

Finding FF Inputs D 3:?????? Inputs to FFs Q 3: Q(t) Q(t+) Q(t+2) Q(t+3) Q(t+4) Q(t+5) Outputs of FFs D 3 D 2 Q 3 Q 2 During the t th clock edge period, Compute the next state Q(t+) using the current state Q(t) and other external inputs D Q Place it to FF inputs D Q After the next clock edge, (t+) th, the computed next state Q(t+) becomes the current state Inputs 2 /6/5

Method of Finding FF Inputs D 3: Q 3: Q(t+) Q(t+2) Q(t+3) Q(t+4) Q(t+5) Q(t+6) Q(t) Q(t+) Q(t+2) Q(t+3) Q(t+4) Q(t+5) Find the boolean functions D3, D2, D, D in terms of Q3, Q2, Q, Q, and external inputs for all possible cases. Q 3 Q 2 Q Q I D 3 Q 3 Q 2 Q Q I D 3 D 3 Q 3 D 2 Q 2 D Q Q 3 Q 2 Q Q I D 3 Q 3 Q 2 Q Q I D 3 D Q Inputs 22 /6/5

State Transition D 3: Q 3: Q(t+) Q(t) Q(t+) Compute the next state using the current state and external inputs in the current clock cycle Q(t+) Q(t) Q(t+) Q(t) Q(t+) Inputs Inputs After the next clock edge, the computed next state (FF Inputs) becomes the current state (FF Outputs) 23 /6/5

Moore INPUT Next State Combinational Logic State Register Output Combinational Logic OUTPUT clock 24 /6/5

Mealy Machine INPUT Next State Combinational Logic State Register Output Combinational Logic OUTPUT clock 25 /6/5

References [] http://en.wikipedia.org/ [2] M. M. Mano, C. R. Kime, Logic and Computer Design Fundamentals, 4 th ed. [3] J. Stephenson, Understanding Metastability in FPGAs. Altera Corporation white paper. July 29. /6/5