State Machines ELCTEC-131

Similar documents
Different encodings generate different 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

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

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

Lecture 13: Sequential Circuits, FSM

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

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

EXPERIMENT Traffic Light Controller

Synchronous Sequential Circuit Design. Digital Computer Design

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

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

ELCT201: DIGITAL LOGIC DESIGN

Synchronous Sequential Circuit

Lecture 13: Sequential Circuits, FSM

Finite State Machine (FSM)

Vidyalankar S.E. Sem. III [CMPN] Digital Logic Design and Analysis Prelim Question Paper Solution

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

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

CprE 281: Digital Logic

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

Preparation of Examination Questions and Exercises: Solutions

ELCT201: DIGITAL LOGIC DESIGN

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

FSM model for sequential circuits

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

Latches. October 13, 2003 Latches 1

CS/COE1541: Introduction to Computer Architecture. Logic Design Review. Sangyeun Cho. Computer Science Department University of Pittsburgh

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

Lab 3 Revisited. Zener diodes IAP 2008 Lecture 4 1

DE58/DC58 LOGIC DESIGN DEC 2014

Logic Design II (17.342) Spring Lecture Outline

Lecture 14 Finite state machines

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

Chapter 3 Digital Logic Structures

Lecture 17: Designing Sequential Systems Using Flip Flops

Digital Circuits ECS 371

Synchronous Sequential Circuit Design

COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

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

Sequential Circuit Analysis

CPE100: Digital Logic Design I

6 Synchronous State Machine Design

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

Ch 9. Sequential Logic Technologies. IX - Sequential Logic Technology Contemporary Logic Design 1

CPE100: Digital Logic Design I

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

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

14.1. Unit 14. State Machine Design

COE 328 Final Exam 2008

Chapter 14 Sequential logic, Latches and Flip-Flops

EET 310 Flip-Flops 11/17/2011 1

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

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

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

CSCI 2150 Intro to State Machines

Logic design? Transistor as a switch. Layered design approach. CS/COE1541: Introduction to Computer Architecture. Logic Design Review.

Chapter 6 Introduction to state machines

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

Digital Fundamentals

CE1911 LECTURE FSM DESIGN PRACTICE DAY 1

Fundamentals of Digital Design

MATC DIGITAL ELECTRONICS LAB ASYNCHRONOUS RIPPLE COUNTERS

UNIVERSITY OF WISCONSIN MADISON

Chapter 4 Part 2 Sequential Circuits

Digital Control of Electric Drives

Lab #10: Design of Finite State Machines

CS/COE0447: Computer Organization

Delhi Noida Bhopal Hyderabad Jaipur Lucknow Indore Pune Bhubaneswar Kolkata Patna Web: Ph:

S.Y. Diploma : Sem. III [CO/CM/IF/CD/CW] Digital Techniques

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

Menu. Part 2 of 3701: Sequential Digital Machines Latches and Flip-Flops: >S-R latches >D latches >T latches. Comb. n. Logic. m Q.

Sequential Logic Circuits

Time Allowed 3:00 hrs. April, pages

CPS 104 Computer Organization and Programming Lecture 11: Gates, Buses, Latches. Robert Wagner

Review for Final Exam

Synchronous Sequential Logic

L10 State Machine Design Topics

Overview of Chapter 4

CSE370 HW6 Solutions (Winter 2010)

10/12/2016. An FSM with No Inputs Moves from State to State. ECE 120: Introduction to Computing. Eventually, the States Form a Loop

Appendix A: Digital Logic. Principles of Computer Architecture. Principles of Computer Architecture by M. Murdocca and V. Heuring

Digital Logic Design - Chapter 5

LECTURE 28. Analyzing digital computation at a very low level! The Latch Pipelined Datapath Control Signals Concept of State

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

CS/COE0447: Computer Organization

Sequential logic and design

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

Synchronous Sequential Logic. Chapter 5

Chapter 4. Sequential Logic Circuits

State & Finite State Machines

Review for B33DV2-Digital Design. Digital Design

Practice Final Exam Solutions

Chapter 7. Sequential Circuits Registers, Counters, RAM

Lecture 10: Synchronous Sequential Circuits Design

Sequential Logic Design: Controllers

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

Introduction to Digital Logic

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

Digital Fundamentals

Chapter 9 Asynchronous Sequential Logic

Transcription:

State Machines ELCTEC-131

Switch Debouncer A digital circuit that is used to remove the mechanical bounce from a switch contact. When a switch is closed, the contacts bounce from open to closed to cause false transitions. A simple debouncer is a cross-coupled NAND Latch. 2/15/2010 2009 Richard Lokken 2

Switch Debouncer 2/15/2010 2009 Richard Lokken 3

Unused States Some modulus counters, such as MOD- 10, have states that are not used in the counter sequence. The MOD-10 Counter would have 6 unused states (1010, 1011.1111) based on 4-bits. 2/15/2010 2009 Richard Lokken 4

Unused States An FSM can also have unused states, such as an SM, with only 5 bubbles in the state diagram (5-states). This FSM still requires 3 bits to represent these states so there will be 3 unused states. These unused states can be treated as don t cares (X) or assigned to a specific initial state. 2/15/2010 2009 Richard Lokken 5

State Diagram 2/15/2010 2009 Richard Lokken 6

Unused States Example Slide A five-variable state diagram is shown in the previous slide, with unused states assigned to the initial state = Start. The normal state sequence is Start Wait1 Wait2 Pulse1 Pulse2 and then back to Start. Any other states cause a transition back to Start. 2/15/2010 2009 Richard Lokken 7

Unused States Example Slide The Input (in1) Sequence of 101 causes the machine to advance from Start Wait1 Wait2. Then it does two unconditional transitions to Pulse1 and Pulse2. The Pulse1 and Pulse2 States generate two pulses on the Outputs (out1 and out2). 2/15/2010 2009 Richard Lokken 8

Unused States Example Slide Any unused states are given the value of Start (000) for its next state. For the FSM 3-Bit Register (FF), this generates the equations shown on the next slide. 2/15/2010 2009 Richard Lokken 9

Boolean Equations for SM D D D 2 1 0 out1 out2 = Q = Q = = = Q Q Q 2 2 2 2 2 Q Q 1 Q Q Q 1 0 Q Q 1 Q Q 1 0 0 0 0 + Q 2 in1 + Q 2 Q Q 1 1 0 Q in1 in1 2/15/2010 2009 Richard Lokken 10

Traffic Light FSM The FSM controls are for a North-South Road and an East-West road (see Figure 10.38 in textbook). This generates 3 Outputs for each road (nsr, nsy, nsg, and ewr, ewy, ewg) for the Red, Yellow, and Green Lights (Low = ON). 2/15/2010 2009 Richard Lokken 11

Requirements The cycle is controlled by an input called TIMER which controls the length of the two greenlight cycles (s0 represents the EW green; s2 represents the NS green.) When TIMER = 1, a transition from s0 to s1 or from s2 to s3 is possible. This accompanies a change from green to yellow on the active road. The light on the other road stays red. An unconditional transition follows, changing the yellow light to red on one road and the red light to green on the other. 2/15/2010 2009 Richard Lokken 12

Requirements The cycle can be set to any length by changing the signal on the TIMER input. (The yellow light will always be on for one clock pulse.) For ease of observation, we will use a cycle of ten clock pulses for any one road: 4 clocks GREEN, 1 clock YELLOW, 5 clocks RED. This can be generated by a mod-5 counter. 2/15/2010 2009 Richard Lokken 13

Logic Diagram for a Traffic Light Controller 2/15/2010 2009 Richard Lokken 14

Requirements The clock divider brings the on-board oscillator frequency down to the range of visible observation for our CPLD board. A 22-bit counter is suitable for the Altera DE-1. The clock divider is found on Blackboard or the CD in the text book. 2/15/2010 2009 Richard Lokken 15

State Diagram 2/15/2010 2009 Richard Lokken 16

Traffic Light FSM An Input called TIMER controls the length of a light cycle (TIMER = 1 causes a S0 to S1 or a S2 to S3 transition). When one light is green (S0(EW) or S2(NS)), the other is red. 2/15/2010 2009 Richard Lokken 17

Traffic Light FSM There is an unconditional timed transfer from yellow to red or red to green. A normal cycle is 4 clocks GREEN, 1 clock YELLOW, 5 clocks RED. 2/15/2010 2009 Richard Lokken 18

Traffic Controller with Walk Signal The machine resets to North-South red and East-West green (s0) and remains in this state until the TIMER input goes HIGH. Both walk signals are off. The machine transitions to s1 when TIMER = 1. East-West goes yellow 2/15/2010 2009 Richard Lokken 19

Requirements If the machine is in s1 and the North- South walk switch has not been pressed, the machine goes to s2. North-South is green for four clocks, until Timer = 1. East-West is red and both walk signals are off. The machine goes to s3 when TIMER = 1. Outputs are NS yellow and EW red. Walk signals are off. 2/15/2010 2009 Richard Lokken 20

Requirements If the machine is in s1 and the North-South walk switch has been pressed, the machine goes to a new state, s4, which behaves exactly the same as s2, except that the NS walk signal is now on. As long as TIMER = 0, the machine remains in s4, with North-South light green and East-West light red. When TIMER = 1, s4 makes a transition to s3. In this transition, the walk signal turns off and the latch reset output (NS_WALK_RESET) goes LOW for one clock pulse. Outputs are NS yellow and EW red. 2/15/2010 2009 Richard Lokken 21

Requirements If the machine is in s3 and the EW walk switch has not been pressed, the machine makes a transition to s0. Outputs are NS red and EW green. Walk signals are off. 2/15/2010 2009 Richard Lokken 22

Requirements If the machine is in s3 and the EW walk switch has been pressed, this is stored as the HIGH state of a latch output. This is sensed at input EW_WALK_SW on the state machine and there is a transition to s5. This behaves the same as s0, except that the EW walk signal is on. As long as TIMER = 0, the machine stays in s5, with outputs North-South red and East-West green. When TIMER = 1, the machine makes a transition to s1. The walk signal turns off and a LOW pulse on EW_WALK_RESET resets the EW latch. The outputs are now NS red and EW yellow. 2/15/2010 2009 Richard Lokken 23

Requirements Draw the modified state diagram for the controller. 2/15/2010 2009 Richard Lokken 24

Implementation Implement the modified design entirely in VHDL. For the D flip-flops, use the DFF component in Quartus II primitives library. In order to use the DFF primitives, the file requires the following two lines at the beginning: LIBRARY altera; USE altera.maxplus2.all; A VHDL component declaration for the latch can be found in the Quartus II Help menu under Primitives. 2/15/2010 2009 Richard Lokken 25

Logic Diagram for a Traffic Light Controller with a Walk Signal 2/15/2010 2009 Richard Lokken 26

2/15/2010 2009 Richard Lokken 27