Lecture 12: State Machines

Similar documents
Lecture 8: Sequential Logic

Logic Design II (17.342) Spring Lecture Outline

Experiment # 4 Counters and Logic Analyzer

IS1500 (not part of IS1200) Logic Design Lab (LD-Lab)

(Refer Slide Time: 2:05)

California State University, Bakersfield Computer & Electrical Engineering & Computer Science ECE 3220: Digital Design with VHDL Laboratory 7

In this lecture we will work through a design example from problem statement to digital circuits.

ECE 301 Digital Electronics

CPSC 121: Models of Computation Lab #5: Flip-Flops and Frequency Division

Logisim: A graphical system for logic circuit design and simulation

D Latch (Transparent Latch)

Chapter 7 Counters and Registers

CPSC 121: Models of Computation Lab #5: Flip-Flops and Frequency Division

Sequential Logic Notes

CprE 281: Digital Logic

Lecture 10: Programmable Logic

Encoders and Decoders: Details and Design Issues

Lecture 11: Synchronous Sequential Logic

Chapter 6. Flip-Flops and Simple Flip-Flop Applications

Laboratory Exercise 7

COMP sequential logic 1 Jan. 25, 2016

Other Flip-Flops. Lecture 27 1

ECE 331 Digital System Design

ECE 301 Digital Electronics

Previous Lecture Sequential Circuits. Slide Summary of contents covered in this lecture. (Refer Slide Time: 01:55)

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

Sequential Logic. E&CE 223 Digital Circuits and Systems (A. Kennings) Page 1

Analysis of Clocked Sequential Circuits

Rensselaer Polytechnic Institute Computer Hardware Design ECSE Report. Lab Three Xilinx Richards Controller and Logic Analyzer Laboratory

Laboratory 1 - Introduction to Digital Electronics and Lab Equipment (Logic Analyzers, Digital Oscilloscope, and FPGA-based Labkit)

55:131 Introduction to VLSI Design Project #1 -- Fall 2009 Counter built from NAND gates, timing Due Date: Friday October 9, 2009.

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Sequential Circuits

Laboratory Exercise 7

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

ELCT201: DIGITAL LOGIC DESIGN

Logic Design ( Part 3) Sequential Logic- Finite State Machines (Chapter 3)

Chapter 6 Digital Circuit 6-5 Department of Mechanical Engineering

Digital Circuit And Logic Design I. Lecture 8

Digital Circuit And Logic Design I

Problems with D-Latch

CprE 281: Digital Logic

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Sequential Circuits

Altera s Max+plus II Tutorial

The reduction in the number of flip-flops in a sequential circuit is referred to as the state-reduction problem.

EECS 427 Discussion 1

UNIT IV. Sequential circuit

CHAPTER 4 RESULTS & DISCUSSION

Digital Logic Design ENEE x. Lecture 19

CprE 281: Digital Logic

Figure 1 shows a simple implementation of a clock switch, using an AND-OR type multiplexer logic.

CprE 281: Digital Logic

Advanced Devices. Registers Counters Multiplexers Decoders Adders. CSC258 Lecture Slides Steve Engels, 2006 Slide 1 of 20

Software Engineering 2DA4. Slides 9: Asynchronous Sequential Circuits

Digital Circuits ECS 371

ECE 341. Lecture # 2

Digital Logic & Computer Design CS Professor Dan Moldovan Spring Chapter 3 :: Sequential Logic Design

ASYNCHRONOUS COUNTER CIRCUITS

Chapter 3. Boolean Algebra and Digital Logic

Experiment # 12. Traffic Light Controller

Debugging of Verilog Hardware Designs on Altera s DE-Series Boards. 1 Introduction. For Quartus Prime 15.1

(Refer Slide Time: 1:45)

Flip-Flops. Because of this the state of the latch may keep changing in circuits with feedback as long as the clock pulse remains active.

Latches, Flip-Flops, and Registers. Dr. Ouiem Bchir

Practice Homework Problems for Module 3

EECS 373 Design of Microprocessor-Based Systems

Activity Sequential Logic: An Overview

PLTW Engineering Digital Electronics Course Outline

EET 1131 Lab #10 Latches and Flip-Flops

Digital Electronics Course Outline

Synchronous Sequential Logic

Sequential Design Basics

CMSC 313 Preview Slides

Course Administration

Chapter 11 State Machine Design

EECS150 - Digital Design Lecture 3 - Timing

Microcontrollers and Interfacing week 7 exercises

The word digital implies information in computers is represented by variables that take a limited number of discrete values.

INTEGRATED CIRCUITS. AN219 A metastability primer Nov 15

MC9211 Computer Organization

EE292: Fundamentals of ECE

EECS150 - Digital Design Lecture 3 Synchronous Digital Systems Review. Announcements

Dr.Mohamed Elmahdy Winter 2015 Eng.Yasmin Mohamed. Problem Set 6. Analysis and Design of Clocked Sequential Circuits. Discussion: 7/11/ /11/2015

Chapter. Synchronous Sequential Circuits

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

EEC 116 Fall 2011 Lab #5: Pipelined 32b Adder

EE 200 Problem Set 3 Cover Sheet Fall 2015

Debugging of VHDL Hardware Designs on Altera s DE2 Boards

ECEN689: Special Topics in High-Speed Links Circuits and Systems Spring 2011

CHAPTER 6 DESIGN OF HIGH SPEED COUNTER USING PIPELINING

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science

Chapter 5: Synchronous Sequential Logic

University of California at Berkeley College of Engineering Department of Electrical Engineering and Computer Science. EECS 150 Spring 2000

Traffic Light Controller

ELCT 501: Digital System Design

Digital System Design

Tutorial 11 ChipscopePro, ISE 10.1 and Xilinx Simulator on the Digilent Spartan-3E board

Part 4: Introduction to Sequential Logic. Basic Sequential structure. Positive-edge-triggered D flip-flop. Flip-flops classified by inputs

Introduction to Sequential Circuits

Digital Design, Kyung Hee Univ. Chapter 5. Synchronous Sequential Logic

CprE 281: Digital Logic

Transcription:

Lecture 12: State Machines Imagine writing the logic to control a traffic light Every so often the light gets a signal to change But change to what? It depends on what light is illuminated: If GREEN, change to YELLOW If YELLOW, change to RED If RED, change to GREEN We can think of RED, YELLOW, and GREEN as states of the traffic light The only logic we need is a set of rules for transitioning between the states Logic that can be expressed in this way is called a state machine

We can visualize the state machine as follows: Define a bit corresponding to RED, another for YELLOW, and a third for GREEN then our state machine looks like 100 RED GREEN 001 010 YELLOW

In a logic circuit, the state is represented by the values stored in a set of flip-flops with N flip-flops, there are 2 N possible states though we may not want to use all of the states for example, the state with both RED and GREEN true is not useful for a traffic light! The circuit that controls a traffic light might look something like this:

The traffic light requires only a few minutes of graphical programming but other state machines demand more complex logic Fortunately, Altera has provided an easy way for us to design any state machine we want in AHDL A state machine is a variable type in AHDL, with name MACHINE OF BITS

A text design for the traffic light might look like:

Some traffic lights may have more possible states, such as: 10000 RED RED with GREEN turn arrow 10010 01000 YELLOW RED with YELLOW turn arrow 10001 00101 GREEN Adding the new states is a simple modification to the existing design

But what if we only want the turn arrows during rush hour? i.e., we want our state machine s behavior to depend on external conditions The code to handle such a case is on the next slide:

Toward more complex designs We already found with the graphical editor that it s often easier to break a complex design into smaller units, which can be included as symbols in the.gdf file We can do a similar thing with.tdf files: From the File menu, select Create default include file Let s say we ve done this for the traffic light state machine, and want to make this part of a large program that controls traffic flow The syntax would be:

Pre-defined functions Altera provides a set of predefined include files for your convenience Among these are circuits that perform arithmetic operations on binary numbers rather than designing different circuits for every possible choice of the number of input/output bits, these functions are define with parameters that allow the user to choose such values The following slides show an example of using one of the pre-defined functions to divide two numbers

Another way to do it is to use lpm_divide in-line :

Debugging What to do if the circuit you programmed into the Altera chip isn t behaving as it s supposed to Check the outputs on a scope or multimeter Check the inputs are they at the levels you expect? Check the power and ground connections to the chip Break the circuit up into subcircuits test them one at a time until you find the problem Add extra test point outputs at key places in the circuit Search for symptoms of clock glitches setup and hold violations