(Synchronous) Finite State Machines

Slides:



Advertisements
Similar presentations
CS1Q Computer Systems Lecture 12 Simon Gay. Lecture 12CS1Q Computer Systems - Simon Gay 2 Design of Sequential Circuits The systematic design of sequential.
Advertisements

Give qualifications of instructors: DAP
State Machine Design.
Sequential Circuits1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
Circuits require memory to store intermediate data
CS 151 Digital Systems Design Lecture 25 State Reduction and Assignment.
Sequential Circuit Design
LAB 3 – Review of the Assignment. -- Clarifications Vikram Murali. TA : CSE 140L Prof. CK Cheng.
Introduction to CMOS VLSI Design Lecture 14: CAMs, ROMs, and PLAs Credits: David Harris Harvey Mudd College (Material taken/adapted from Harris’ lecture.
CAMs, ROMs, and PLAs. 2 Outline  Content-Addressable Memories  Read-Only Memories  Programmable Logic Arrays.
11/10/2004EE 42 fall 2004 lecture 301 Lecture #30 Finite State Machines Last lecture: –CMOS fabrication –Clocked and latched circuits This lecture: –Finite.
Spring 2002EECS150 - Lec15-seq2 Page 1 EECS150 - Digital Design Lecture 15 - Sequential Circuits II (Finite State Machines revisited) March 14, 2002 John.
Lecture 20: CAMs, ROMs, PLAs. CMOS VLSI DesignCMOS VLSI Design 4th Ed. 20: CAMs, ROMs, and PLAs2 Outline  Content-Addressable Memories  Read-Only Memories.
ECE 301 – Digital Electronics Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #17)
ECE 331 – Digital Systems Design Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #19)
ENGIN112 L25: State Reduction and Assignment October 31, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 25 State Reduction and Assignment.
Lecture 10 Topics: Sequential circuits Basic concepts Clocks
Clocked Synchronous State Machine Design
Digital Computer Design Fundamental
1 COMP541 State Machines Montek Singh Feb 8, 2012.
Introduction to Sequential Logic Design Finite State-Machine Design.
1 Lecture 22 Sequential Circuits Analysis. 2 Combinational vs. Sequential  Combinational Logic Circuit  Output is a function only of the present inputs.
Announcements Assignment 8 posted –Due Friday Dec 2 nd. A bit longer than others. Project progress? Dates –Thursday 12/1 review lecture –Tuesday 12/6 project.
Introduction to State Machine
State Machines The first problem set is now online! (Due on Jan. 31st, 2011)
Chapter 3 Digital Logic Structures. 3-2 Combinational vs. Sequential Combinational Circuit always gives the same output for a given set of inputs  ex:
Lecture 5. Sequential Logic 2 Prof. Taeweon Suh Computer Science Education Korea University 2010 R&E Computer System Education & Research.
Digital Logic Design Lecture # 19 University of Tehran.
1 Finite State Machines (FSMs) Now that we understand sequential circuits, we can use them to build: Synchronous (Clocked) Finite State Machines Finite.
VHDL Discussion Finite State Machines
VHDL Discussion Finite State Machines IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
Digital System Design using VHDL
1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
COMBINATIONAL AND SEQUENTIAL CIRCUITS Guided By: Prof. P. B. Swadas Prepared By: BIRLA VISHVAKARMA MAHAVDYALAYA.
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.

Introduction to CMOS VLSI Design Lecture 14: CAMs, ROMs, and PLAs
Introduction to CMOS VLSI Design Lecture 14: CAMs, ROMs, and PLAs
ANALYSIS OF SEQUENTIAL CIRCUITS
COMP541 Sequential Logic – 2: Finite State Machines
Typical Timing Specifications
Lecture 23 Logistics Last lecture Today HW7 due Friday Lab8 going on
KU College of Engineering Elec 204: Digital Systems Design
Instructor: Alexander Stoytchev
Hakim Weatherspoon CS 3410 Computer Science Cornell University
CSE 370 – Winter Sequential Logic - 1
Lecture 15 Logistics Last lecture Today HW4 is due today
Lecture 24 Logistics Last lecture Today HW7 due today
Lecture 23 Logistics Last lecture Today HW7 due Friday Lab8 going on
KU College of Engineering Elec 204: Digital Systems Design
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Guest Lecture by David Johnston
Lecture 21 Logistics Last lecture Today HW7 due Wednesday
CSE 370 – Winter Sequential Logic-2 - 1
ECE 352 Digital System Fundamentals
Lecture 24 Logistics Last lecture Today HW7 due today
Lecture 20 Logistics Last lecture Today Graded HW back today
ECE 352 Digital System Fundamentals
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
ECE 352 Digital System Fundamentals
Lecture 20: CAMs, ROMs, PLAs
ECE 352 Digital System Fundamentals
Announcements Assignment 7 due now or tommorrow Assignment 8 posted
Finite State Machine Continued
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 19 A bigger FSM example: Hungry Robot Ant in Maze.
Introduction to CMOS VLSI Design Lecture 18: CAMs, ROMs, and PLAs
Presentation transcript:

(Synchronous) Finite State Machines Great -Theory! Finally! Some ENGINEERING! Lab 2 is due tonight

Our New Machine State Registers Combinational Logic Engineered cycles k k State Registers Current State Combinational Logic Clock m Input Output Engineered cycles Works only if dynamic discipline obeyed Remembers k bits for a total of 2k unique combinations Acyclic graph Obeys static discipline Can be exhaustively enumerated by a truth table of 2k+m rows and k+n output columns

Must Respect Timing Assumptions! New State Current State Combinational Logic Clock Output Input Questions: Constraints on TCD for the logic? Minimum clock period? Setup, Hold times for Inputs? We know how fast it goes… But what can it do?

A simple sequential circuit… Lets make a digital binary Combination Lock: Specification: One input ( “0” or “1”) One output (“Unlock” signal) UNLOCK is 1 if and only if: Last 4 inputs were the “combination”: 0110 Lock How many registers are needed?

Abstraction du jour: Finite State Machines Clocked FSM A FINITE STATE MACHINE has k STATES S1 … Sk (one is “initial” state) m INPUTS I1… Im n OUTPUTS O1… On Transition Rules s’(s, I) for each state s and input I Output Rules Out(s) for each state s

State Transition Diagram Why do these go to S0 and S01? Heavy circle Means INITIAL state Designing our lock … Need an initial state; call it SX. Must have a separate state for each step of the proper entry sequence Must handle other (erroneous) entries NAME of state OUTPUT when in this state INPUT causing transition

Yet Another Specification All state transition diagrams can be described by truth tables… Binary encodings are assigned to each state (a bit of an art) The truth table can then be simplified using the reduction techniques we learned for combinational logic The assignment of codes to states can be arbitrary, however, if you choose them carefully you can greatly reduce your logic requirements.

MOORE Machine: Outputs on States MEALY Machine: Outputs on Transitions Valid State Diagrams MOORE Machine: Outputs on States MEALY Machine: Outputs on Transitions Arcs leaving a state must be: (1) mutually exclusive can’t have two choices for a given input value (2) collectively exhaustive every state must specify what happens for each possible input combination. “Nothing happens” means arc back to itself.

Now put it in Hardware! ROM 16x4 4 inputs → 24locations each location supplies 4 bits unlock IN ROM 16x4 Current state Next state We assume inputs are synchronized with clock… 3 Trigger update periodically (“clock”)

Discrete State, Time Two design choices: (1) outputs only depend on state (Moore) (2) outputs depend on inputs + state (Mealy) s state bits →2s possible states

Asynchronous Inputs - I Our example assumed a single clock transition per input. What if the “button pusher” is unaware of, or not synchronized with, the clock? What if each button input is an asynchronous 0/1 level? How do we prevent a single button press, e.g., from making several transitions? Lock But what About the Dynamic Discipline? Use intervening states to synchronize button presses!

FSM Party Games ROM What can you say about the number of states? Same question: Here's an FSM. Can you discover its rules? ROM m States n States

What’s My Transition Diagram? 0=OFF, 1=ON? "1111" = Surprise! If you know NOTHING about the FSM, you’re never sure! If you have a BOUND on the number of states, you can discover its behavior: K-state FSM: Every (reachable) state can be reached in < k steps. BUT ... states may be equivalent!

FSM Equivalence ARE THEY DIFFERENT? NOT in any practical sense! They are EXTERNALLY INDISTINGUISHABLE, hence interchangeable. FSMs EQUIVALENT iff every input sequence yields identical output sequences. ENGINEERING GOAL: HAVE an FSM which works... WANT simplest (ergo cheapest) equivalent FSM.

Lets build an Ant SENSORS: antennae L and R, each 1 if in contact with something. ACTUATORS: Forward Step F, ten-degree turns TL and TR (left, right). GOAL: Make our ant smart enough to get out of a maze like: STRATEGY: "Right antenna to the wall"

Lost in space Action: Go forward until we hit something. LOST “lost” is the initial state

Bonk! Action: Turn left (CCW) until we don’t touch anymore LOST RCCW

A little to the right… Action: Step and turn right a little, look for wall LOST RCCW Wall1

Then a little to the left Action: Step and turn left a little, till not touching (again) LOST RCCW Wall2 Wall1

Dealing with corners Action: Step and turn right until we hit perpendicular wall Wall2 LOST RCCW Wall1 Corner

Equivalent State Reduction Observation: Si ≡ Sj if States have identical outputs; AND Every input →equivalent states. Reduction Strategy: Find pairs of equivalent states, MERGE them. Wall2 LOST RCCW Wall1 Corner

An Evolutionary Step Merge equivalent states Wall1 and Corner into a single new, combined state. Wall2 LOST RCCW Wall1 Behaves exactly as previous (5-state) FSM, but requires half the ROM in its implementation!

Building the Transition Table LOST RCCW

Implementation Details LOST RCCW WALL1 WALL2 Complete Transition table

Ant Schematic

Roboant® Maze selection FSM state table Plan view of maze Simulation controls Status display Featuring the new Mark-II ant: can add (M), erase (E), and sense (S) marks along its path.

Housekeeping issues… Initialization? Clear the memory? inputs ROM or gates outputs Initialization? Clear the memory? Unused state encodings? waste ROM (use PLA or gates) what does it mean? can the FSM recover? Choosing encoding for state? Synchronizing input changes with state update? STATE NEXT IN CLK Now, that’s a funny looking state machine

Are we just big, hairy FSMs? Twisting you Further… MORE THAN ANTS: Swarming, flocking, and schooling can result from collections of very simple FSMs PERHAPS MOST PHYSICS: Cellular automata, arrays of simple FSMs, can more accurately model fluilds than numerical solutions to PDEs WHAT IF: We replaced the ROM with a RAM and have outputs that modify the RAM? ... You'll see FSMs for the rest of your life! (Every computer we have built so far is just an FSM) Are we just big, hairy FSMs? I transition therefore I am