Lecture 14 Finite state machines

Similar documents
Lecture 10: Synchronous Sequential Circuits Design

Synchronous Sequential Circuit Design

Introduction to Digital Logic

CSCI 2150 Intro to State Machines

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

Sequential Circuit Analysis

Sequential Logic (3.1 and is a long difficult section you really should read!)

ELE2120 Digital Circuits and Systems. Tutorial Note 10

Different encodings generate different circuits

or 0101 Machine

Latches. October 13, 2003 Latches 1

Computers also need devices capable of Storing data and information Performing mathematical operations on such data

EET 310 Flip-Flops 11/17/2011 1

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

Chapter 14 Sequential logic, Latches and Flip-Flops

Chapter 6 Introduction to state machines

Analysis of Clocked Sequential Circuits

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

Sequential Circuits Sequential circuits combinational circuits state gate delay

COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

Logical design of digital systems

ELCT201: DIGITAL LOGIC DESIGN

CprE 281: Digital Logic

Sequential Circuit Design

Philadelphia University Student Name: Student Number:

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

ELE2120 Digital Circuits and Systems. Tutorial Note 9

ECE380 Digital Logic. Synchronous sequential circuits

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

Week-5. Sequential Circuit Design. Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA.

Chapter 5 Synchronous Sequential Logic

ELCT201: DIGITAL LOGIC DESIGN

Gates and Flip-Flops

Q: Examine the relationship between X and the Next state. How would you describe this circuit? A: An inverter which is synched with a clock signal.

14.1. Unit 14. State Machine Design

CSEE W3827 Fundamentals of Computer Systems Homework Assignment 3

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

11.1 As mentioned in Experiment 10, sequential logic circuits are a type of logic circuit where the output of

State Graphs FSMs. Page 1

L10 State Machine Design Topics

Digital Circuit Engineering

Written reexam with solutions for IE1204/5 Digital Design Monday 14/

Philadelphia University Student Name: Student Number:

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

CSEE W3827 Fundamentals of Computer Systems Homework Assignment 3 Solutions

State Machines ELCTEC-131

Read this before starting!

Memory Elements I. CS31 Pascal Van Hentenryck. CS031 Lecture 6 Page 1

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

Digital Circuit Engineering

Learning Objectives:

Sequential Synchronous Circuit Analysis

Fundamentals of Digital Design

Sequential Logic. Road Traveled So Far

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

15.1 Elimination of Redundant States

Digital Electronics Final Examination. Part A

Counters. We ll look at different kinds of counters and discuss how to build them

Chapter 3 Digital Logic Structures

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Digital Logic Design - Chapter 5

Sequential Logic Circuits

Lecture 17: Designing Sequential Systems Using Flip Flops

Roger L. Tokheim. Chapter 8 Counters Glencoe/McGraw-Hill

Laboratory Exercise #11 A Simple Digital Combination Lock

Digital Logic Appendix A

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

CPE100: Digital Logic Design I

CE1911 LECTURE FSM DESIGN PRACTICE DAY 1

Introduction to Karnaugh Maps

Finite State Machine (FSM)

Sequential Logic Design: Controllers

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

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

CARLETON UNIVERSITY. Deparment of Electronics ELEC 2607 Switching Circuits January 19, Overview;

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

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

Chapter 4. Sequential Logic Circuits

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

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

Let s now begin to formalize our analysis of sequential machines Powerful methods for designing machines for System control Pattern recognition Etc.

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

Synchronous Sequential Logic Part I. BME208 Logic Circuits Yalçın İŞLER

CE Optimized State Machines

Logic Design II (17.342) Spring Lecture Outline

Asynchronous sequence circuits

CSE370 HW6 Solutions (Winter 2010)

Sequential Logic. Handouts: Lecture Slides Spring /27/01. L06 Sequential Logic 1

State and Finite State Machines

Read this before starting!

DESIGN AND IMPLEMENTATION OF ENCODERS AND DECODERS. To design and implement encoders and decoders using logic gates.

Review for B33DV2-Digital Design. Digital Design

Sequential Logic. Rab Nawaz Khan Jadoon DCS. Lecturer COMSATS Lahore Pakistan. Department of Computer Science

Section 001. Read this before starting!

Random Number Generator Digital Design - Demo

ELEC Digital Logic Circuits Fall 2014 Sequential Circuits (Chapter 6) Finite State Machines (Ch. 7-10)

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra

Synchronous Sequential Logic

Finite State Machine. By : Ali Mustafa

Exercise booklet - Logic

Transcription:

Lecture 14 Finite state machines Finite state machines are the foundation of nearly all digital computation. The state diagram captures the desired system behavior A formulaic process turns this diagram into state table and then into a logic circuit. The example in these notes is taken from All About Circuits at http://www.allaboutcircuits.com/vol_4/chpt_11/5.html. See this site for additional explanations. http://en.wikipedia.org/wiki/finite-state_machine 140

From goal to states Intellectually most difficult step Goal: A circuit which sends a single high pulse when a button is pressed. Slightly tricky bit: The button could be held down for many clock cycles, but the circuit must not send out another pulse until the button is released and pressed again. So there are 3 states the circuit might be in: Waiting for button to be pressed Pressed! Sending out pulse Waiting for button to be released 141

State diagram Add transitions Now connect these states with arrows that indicate how the button value would move the system from state to state. These transitions will occur each clock cycle. Also define the starting (entering) state Not pressed You can only stay in this state one cycle since all transitions lead away. Start Waiting for button press. Send Low Pressed Not pressed Pressed! Send High Each state includes what to do for both button conditions. Not pressed Waiting for button release. Send Low Pressed Pressed If button release happens in the clock period immediately following the press event. 142

Turn it into numbers Boolean states and transitions Number states Wait, button not pressed, sending low = 00 Active, sending high = 01 Wait, button pressed, sending low = 10 Button pressed/not = 1/0 Send High/Low = 1/0 0 The state of the circuit, encoded as a 2 bit number. Will need flip-flops to remember this value. 1 Start 00 01 0 0 1 The button value. 0 10 0 1 The output of the circuit. 1 143

Create the state table 3 states 2 button values = 6 rows. Name variables State = A,B Input button = I Sent output = Y I AB Construct a state table that captures design Each row is one transition (arrow on diagram) Inputs are states and button condition at one time Outputs are circuit output and next state 3 input variables (A,B,I) 3 output variables (A next, B next,y) Y Don t care 144

Add flip-flops The circuit needs to remember what state it is in. This is a job for a flip-flop. J K Func Q next 0 0 Hold Q 0 1 Reset 0 1 0 Set 1 1 1 Toggle Q We need one for each of A,B. Add to state table as more outputs Four possible conditions of A/B and A next /B next Row A/B A/B next JK function J K 1A 0 0 Reset or Hold 0 X 4A 0 1 Set or Toggle 1 X 3B 1 0 Reset or Toggle X 1 6A 1 1 Set or Hold X 0 145

Karnaugh maps! J A = BI K A = I J B = AI K B = 1 Y = AB 146

Create the circuit Assuming no bounce I J A = BI Note use of ~Q for logic where ~A needed. K A = I Y = AB J B = AI K B =1 Clock The system will wait in state A,B,Y = 0,0,0 When the button is pressed, it will go to A,B,Y = 0,1,1 for one clock cycle. If the button is immediately released, the system will return to A,B,Y = 0,0,0. If the button is held, the system will go to A,B,Y = 1,0,0 until the button is released, then it will go to A,B,Y = 0,0,0 147

Quiz 14.1 Q: For the state diagram shown, what are the initial states and conditions that cause the turnstile to be unlocked A: State = locked, transition = coin B: State = locked, transition = push C: State = unlocked, transition = coin D: A and B E: A and C No matter what state you are in, if you put in a coin, the next state is unlocked. Why would somebody put a coin into an unlocked turnstile??? It doesn t matter. If the designer didn t plan for this condition, the device could freeze up and the London underground could come to a halt. Bad. 148

Quiz 14.2 Q: Assume the state is labeled locked=0 and unlocked=1. Assume the input is labeled push = 0 and coin = 1. Which is a row in the state table? A: Current = 0, Input = 0, Next = 1 B: Current = 1, Input = 0, Next = 1 C: Current = 0, Input = 1, Next = 0 D: Current = 1, Input = 1, Next = 0 E: Current = 0, Input = 0, Next = 0 Only locked, push = locked is a valid state transition. 149

Quiz 14.3 Q: Consider the state table row: Current = 0, Input = 1, Next = 1. Only one JK flip flop will be required for this device. What are the optimal J and K values to use in the design to implement this transition? A: J = 0, K = 0. B: J = 0, K = 1. C: J = 1, K = 0. D: J = 1, K = 1. E: J = 1, K = X. Reading from the JK flip flop truth table, if we start in 0 and want to end in 1, we can either set (J=1,K=0) or toggle (J=1, K=1), so E is the best choice. Both C and D would work, but are not optimal because X s on the Karnaugh map help us reduce the circuit implementation. 150