Finite State Machine (FSM)

Similar documents
Synchronous Sequential Circuit Design. Digital Computer Design

CPE100: Digital Logic Design I

Different encodings generate different circuits

Chapter 3. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 3 <1>

Chapter 3. Chapter 3 :: Topics. Introduction. Sequential Circuits

Sequential Synchronous Circuit Analysis

Lecture 10: Synchronous Sequential Circuits Design

Sequential logic and design

CPE100: Digital Logic Design I

EXPERIMENT Traffic Light Controller

Sequential Circuit Design

CE1911 LECTURE FSM DESIGN PRACTICE DAY 1

Finite State Machine. By : Ali Mustafa

Ch 7. Finite State Machines. VII - Finite State Machines Contemporary Logic Design 1

FSM model for sequential circuits

EGR224 F 18 Assignment #4

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

Models for representing sequential circuits

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

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

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

Clocked Synchronous State-machine Analysis

COE 202: Digital Logic Design Sequential Circuits Part 3. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

CprE 281: Digital Logic

EEE2135 Digital Logic Design

COE 328 Final Exam 2008

FYSE420 DIGITAL ELECTRONICS

Lecture 8: Sequential Networks and Finite State Machines

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

UNIVERSITY OF WISCONSIN MADISON

Synchronous Sequential Circuit Design. Dr. Ehab A. H. AL-Hialy Page 1

COE 202: Digital Logic Design Sequential Circuits Part 3. Dr. Ahmad Almulhem ahmadsm AT kfupm Phone: Office:

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

Lab #10: Design of Finite State Machines

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

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

BER KELEY D AV IS IR VINE LOS AN GELES RIVERS IDE SAN D IEGO S AN FRANCISCO

Synchronous Sequential Circuit Design

CPE100: Digital Logic Design I

or 0101 Machine

Chapter 4 Part 2 Sequential Circuits

Digital Design. Sequential Logic

Clocked Sequential Circuits UNIT 13 ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS. Analysis of Clocked Sequential Circuits. Signal Tracing and Timing Charts

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

Synchronous Sequential Logic

Digital Logic Design - Chapter 5

Mealy & Moore Machines

The Design Procedure. Output Equation Determination - Derive output equations from the state table

CSE140: Digital Logic Design Registers and Counters

Example: vending machine

Final Exam. ECE 25, Spring 2008 Thursday, June 12, Problem Points Score Total 90

EECS150 - Digital Design Lecture 23 - FSMs & Counters

14.1. Unit 14. State Machine Design

For smaller NRE cost For faster time to market For smaller high-volume manufacturing cost For higher performance

Homework #4. CSE 140 Summer Session Instructor: Mohsen Imani. Only a subset of questions will be graded

EECS150 - Digital Design Lecture 18 - Counters

EECS150 - Digital Design Lecture 18 - Counters

CSE 140 Midterm 2 Tajana Simunic Rosing. Spring 2008

Lecture 13: Sequential Circuits, FSM

Shift Register Counters

State and Finite State Machines

Last lecture Counter design Finite state machine started vending machine example. Today Continue on the vending machine example Moore/Mealy machines

State & Finite State Machines

EECS150 - Digital Design Lecture 17 - Sequential Circuits 3 (Counters)

Generalized FSM model: Moore and Mealy

ELE2120 Digital Circuits and Systems. Tutorial Note 9

Chapter 15 SEQUENTIAL CIRCUITS ANALYSIS, STATE- MINIMIZATION, ASSIGNMENT AND CIRCUIT IMPLEMENTATION

ECE380 Digital Logic. Synchronous sequential circuits

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

Chapter 6 Introduction to state machines

Digital Electronics Sequential Logic

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 7 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Fundamentals of Digital Design

ENGG 1203 Tutorial_9 - Review. Boolean Algebra. Simplifying Logic Circuits. Combinational Logic. 1. Combinational & Sequential Logic

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

ENGG 1203 Tutorial. Solution (b) Solution (a) Simplification using K-map. Combinational Logic (II) and Sequential Logic (I) 8 Feb Learning Objectives

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

CSE140: Components and Design Techniques for Digital Systems. Midterm Information. Instructor: Mohsen Imani. Sources: TSR, Katz, Boriello & Vahid

Lecture 13: Sequential Circuits, FSM

Design of Datapath Controllers

6. Finite State Machines

EECS150 - Digital Design Lecture 11 - Shifters & Counters. Register Summary

Sequential Logic Optimization. Optimization in Context. Algorithmic Approach to State Minimization. Finite State Machine Optimization

FSM Examples. Young Won Lim 11/6/15

Midterm review session tomorrow 4:15 EEB125 Midterm 2 in class (45min long, starts at 10:35am) Today Abi bigger example: Hungry Robot Ant in Maze

Finite State Machines CS 64: Computer Organization and Design Logic Lecture #15 Fall 2018

State Machines ELCTEC-131

COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

State & Finite State Machines

(Boolean Algebra, combinational circuits) (Binary Codes and -arithmetics)

CSE140: Design of Sequential Logic

Design at the Register Transfer Level

Chapter 6. Synchronous Sequential Circuits

EECS150 - Digital Design Lecture 16 Counters. Announcements

L10 State Machine Design Topics

CS221: Digital Design. Dr. A. Sahu. Indian Institute of Technology Guwahati

ECE 341. Lecture # 3

Simplify the following Boolean expressions and minimize the number of literals:

Exam for Physics 4051, October 31, 2008

Preparation of Examination Questions and Exercises: Solutions

Transcription:

Finite State Machine (FSM) Consists of: State register Stores current state Loads next state at clock edge Combinational logic Computes the next state Computes the outputs S S Next State CLK Current State Next State Logic Output Logic C L Next State C L Outputs Chapter 3 <41>

Finite State Machines (FSMs) Next state determined by current state and inputs Two types of finite state machines differ in output logic: Moore FSM: outputs depend only on current state Mealy FSM: outputs depend on current state and inputs Moore FSM inputs M next state logic k next state CLK k state output logic N outputs Mealy FSM inputs M next state logic k next state CLK k state output logic N outputs Chapter 3 <42>

FSM Design Procedure 1. Identify inputs and outputs 2. Sketch state transition diagram 3. Write state transition table 4. Select state encodings 5. Rewrite state transition table with state encodings 6. Write output table 7. Write Boolean equations for next state and output logic 8. Sketch the circuit schematic Chapter 3 <43>

Bravado Blvd. FSM Example Traffic light controller Traffic sensors:, (TRUE when there s traffic) Lights:, Dining Hall Academic Ave. Labs Dorms Fields Chapter 3 <44>

FSM Design Procedure 1. Identify inputs and outputs 2. Sketch state transition diagram 3. Write state transition table 4. Select state encodings 5. Rewrite state transition table with state encodings 6. Write output table 7. Write Boolean equations for next state and output logic 8. Sketch the circuit schematic Chapter 3 <45>

FSM Black Box Inputs: CLK,,, Outputs:, CLK Note: multiple bits for output Traffic Light Controller Chapter 3 <46>

FSM Design Procedure 1. Identify inputs and outputs 2. Sketch state transition diagram 3. Write state transition table 4. Select state encodings 5. Rewrite state transition table with state encodings 6. Write output table 7. Write Boolean equations for next state and output logic 8. Sketch the circuit schematic Chapter 3 <47>

Bravado Blvd. FSM State Transition Diagram Moore FSM: outputs labeled in each state States: Circles Transitions: Arcs Dining Hall S0 Academic Ave. Labs Dorms Fields Chapter 3 <48>

Bravado Blvd. FSM State Transition Diagram Moore FSM: outputs labeled in each state States: Circles Transitions: Arcs Dining Hall S0 TA S1 Academic Labs Ave. Dorms S3 S2 Fields Chapter 3 <49>

FSM Design Procedure 1. Identify inputs and outputs 2. Sketch state transition diagram 3. Write state transition table 4. Select state encodings 5. Rewrite state transition table with state encodings 6. Write output table 7. Write Boolean equations for next state and output logic 8. Sketch the circuit schematic Chapter 3 <50>

FSM State Transition Table TA Current State Inputs Next State S S' S0 S3 S1 S2 S0 0 X S0 1 X S1 X X S2 X 0 S2 X 1 S3 X X Chapter 3 <51>

FSM State Transition Table TA Current State Inputs Next State S S' S0 S3 S1 S2 S0 0 X S1 S0 1 X S0 S1 X X S2 S2 X 0 S3 S2 X 1 S2 S3 X X S0 Chapter 3 <52>

FSM Design Procedure 1. Identify inputs and outputs 2. Sketch state transition diagram 3. Write state transition table 4. Select state encodings 5. Rewrite state transition table with state encodings 6. Write output table 7. Write Boolean equations for next state and output logic 8. Sketch the circuit schematic Chapter 3 <53>

FSM Encoded State Transition Table Current State Inputs Next State S 1 S 0 S' 1 S' 0 0 0 0 X 0 0 1 X 0 1 X X 1 0 X 0 1 0 X 1 1 1 X X State Encoding S0 00 S1 01 S2 10 S3 11 Two bits required for 4 states S0 TA S1 Chapter 3 <54> S3 S2

FSM Encoded State Transition Table Current State Inputs Next State S 1 S 0 S' 1 S' 0 0 0 0 X 0 1 0 0 1 X 0 0 0 1 X X 1 0 1 0 X 0 1 1 1 0 X 1 1 0 1 1 X X 0 0 State Encoding S0 00 S1 01 S2 10 S3 11 Two bits required for 4 states S' 1 = S 1 S 0 S0 TA S1 S' 0 = S 1 S 0 + S 1 S 0 Chapter 3 <55> S3 S2

FSM Design Procedure 1. Identify inputs and outputs 2. Sketch state transition diagram 3. Write state transition table 4. Select state encodings 5. Rewrite state transition table with state encodings 6. Write output table 7. Write Boolean equations for next state and output logic 8. Sketch the circuit schematic Chapter 3 <56>

FSM Output Table Current State Outputs S 1 S 0 1 0 1 0 0 0 0 1 1 0 1 1 Output Encoding green 00 yellow 01 red 10 Two bits required for 3 outputs S0 TA S1 Chapter 3 <57> S3 S2

FSM Output Table Current State Outputs S 1 S 0 1 0 1 0 0 0 0 0 1 0 0 1 0 1 1 0 1 0 1 0 0 0 1 1 1 0 0 1 Output Encoding green 00 yellow 01 red 10 Two bits required for 3 outputs 1 = S 1 0 = S 1 S 0 1 = S 1 S0 TA S1 0 = S 1 S 0 Chapter 3 <58> S3 S2

FSM Design Procedure 1. Identify inputs and outputs 2. Sketch state transition diagram 3. Write state transition table 4. Select state encodings 5. Rewrite state transition table with state encodings 6. Write output table 7. Write Boolean equations for next state and output logic 8. Sketch the circuit schematic Chapter 3 <59>

FSM Schematic: State Register CLK S' 1 S 1 S' 0 r S 0 state register S' 1 = S 1 S 0 1 = S 1 1 = S 1 S' 0 = S 1 S 0 + S 1 S 0 0 = S 1 S 0 0 = S 1 S 0 Chapter 3 <60>

FSM Schematic: Next State Logic CLK S' 1 S 1 S' 0 r S 0 S 1 S 0 inputs next state logic state register S' 1 = S 1 S 0 S' 0 = S 1 S 0 + S 1 S 0 Chapter 3 <61>

FSM Schematic: Output Logic CLK 1 S' 1 S 1 0 S' 0 r S 0 1 S 1 S 0 0 inputs next state logic state register output logic outputs 1 = S 1 1 = S 1 0 = S 1 S 0 0 = S 1 S 0 Chapter 3 <62>

FSM Timing Diagram Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9 Cycle 10 CLK S' 1:0?? S0 (00) S1 (01) S2 (10) S3 (11) S1 (01) S0 (00) S 1:0?? S0 (00) S1 (01) S2 (10) S3 (11) S0 (00) 1:0?? Green (00) Yellow (01) Red (10) Green (00) 1:0?? Red (10) Green (00) Yellow (01) Red (10) 0 5 10 15 20 25 30 35 40 45 t (sec) S0 TA S1 S3 S2 Chapter 3 <63>

FSM State Encoding Binary encoding: i.e., for four states, 00, 01, 10, 11 One-hot encoding One state bit per state Only one state bit HIGH at once i.e., for 4 states, 0001, 0010, 0100, 1000 Requires more flip-flops Often next state and output logic is simpler Chapter 3 <64>

FSM Design Procedure 1. Identify inputs and outputs 2. Sketch state transition diagram 3. Write state transition table 4. Select state encodings 5. Rewrite state transition table with state encodings 6. Write output table 7. Write Boolean equations for next state and output logic 8. Sketch the circuit schematic Chapter 3 <65>