Finite State Machines. Binary encoded state machines –The number of flip-flops is the smallest number m such that 2 m  n, where n is the number of states.

Slides:



Advertisements
Similar presentations
Basic Finite State Machines 1. 2 Finite State Machines Binary encoded state machines –The number of flip-flops is the smallest number m such that 2 m.
Advertisements

10/14/2005Caltech1 Reliable State Machines Dr. Gary R Burke California Institute of Technology Jet Propulsion Laboratory.
Copyright 2001, Agrawal & BushnellVLSI Test: Lecture 261 Lecture 26 Logic BIST Architectures n Motivation n Built-in Logic Block Observer (BILBO) n Test.
Give qualifications of instructors: DAP
Circuits require memory to store intermediate data
Finite State Machine Chapter 10 RTL Hardware Design by P. Chu.
L18 – VHDL for other counters and controllers. Other counters  More examples Gray Code counter Controlled counters  Up down counter  Ref: text Unit.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
CS 151 Digital Systems Design Lecture 25 State Reduction and Assignment.
Contemporary Logic Design Sequential Case Studies © R.H. Katz Transparency No Chapter #7: Sequential Logic Case Studies 7.1, 7.2 Counters.
Embedded Systems Hardware:
Dr. Turki F. Al-Somani VHDL synthesis and simulation – Part 3 Microcomputer Systems Design (Embedded Systems)
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design Finite State.
ENEE 408C Lab Capstone Project: Digital System Design Fall 2005 Sequential Circuit Design.
Embedded Systems Hardware: Storage Elements; Finite State Machines; Sequential Logic.
ELEN 468 Advanced Logic Design
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts,
ENGIN112 L25: State Reduction and Assignment October 31, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 25 State Reduction and Assignment.
Sequential Circuit  It is a type of logic circuit whose output depends not only on the present value of its input signals but on the past history of its.
A presentation on Counters
Lecture #5 In this lecture we will introduce the sequential circuits.
EE345: Introduction to Microcontrollers Register and Counters Prof. Ahmad Abu-El-Haija.
Lecture 27 Counters Give qualifications of instructors: DAP
Dr. H.v.d.Biggelaar / Mar3-Ver2 / 1 Engineering Technology Dr. H.v.d.Biggelaar March 22, 2000 State Machines in VHDL.
System Arch 2008 (Fire Tom Wada) /10/9 Field Programmable Gate Array.
Chapter 10 State Machine Design. 2 State Machine Definitions State Machine: A synchronous sequential circuit consisting of a sequential logic section.
12004 MAPLDSynthesis Issues Synthesis Issues Demonstrated with a Simple Finite State Machine Using Gray Codes.
George Mason University ECE 545 – Introduction to VHDL ECE 545 Lecture 5 Finite State Machines.
CprE / ComS 583 Reconfigurable Computing
FORMAL VERIFICATION OF ADVANCED SYNTHESIS OPTIMIZATIONS Anant Kumar Jain Pradish Mathews Mike Mahar.
EEE515J1_L5-1/8 EEE515J1 ASICs and DIGITAL DESIGN Designing FSMs Ian McCrumRoom 5D03B Tel: voice.
1 CSE370, Lecture 15 Lecture 15 u Logistics n HW5 due this Friday n HW6 out today, due Friday Feb 20 n I will be away Friday, so no office hour n Bruce.
More Digital circuits. Ripple Counter The most common counter The problem is that, because more than one output is changing at once, the signal is glichy.
ENG241 Digital Design Week #8 Registers and Counters.
Synthesis Of Fault Tolerant Circuits For FSMs & RAMs Rajiv Garg Pradish Mathews Darren Zacher.
Module : FSM Topic : types of FSM. Two types of FSM The instant of transition from the present to the next can be completely controlled by a clock; additionally,
DLD Lecture 26 Finite State Machine Design Procedure.
Digital Logic Design.
Introduction to VHDL Simulation … Synthesis …. The digital design process… Initial specification Block diagram Final product Circuit equations Logic design.
Lecture 7 Chap 9: Registers Instructors: Fu-Chiung Cheng ( 鄭福炯 ) Associate Professor Computer Science & Engineering Tatung University.
VHDL Discussion Finite State Machines
VHDL Discussion Finite State Machines IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology 1.
VHDL Discussion Sequential Sytems. Memory Elements. Registers. Counters IAY 0600 Digital Systems Design Alexander Sudnitson Tallinn University of Technology.
Introduction to ASIC flow and Verilog HDL
1 COMP541 State Machines – 2 Registers and Counters Montek Singh Feb 11, 2010.
04/26/20031 ECE 551: Digital System Design & Synthesis Lecture Set : Introduction to VHDL 12.2: VHDL versus Verilog (Separate File)
Digital System Design using VHDL
Modulo-N Counters According to how they handle input transitions –Synchronous –Asynchronous.
03/31/031 ECE 551: Digital System Design & Synthesis Lecture Set 8 8.1: Miscellaneous Synthesis (In separate file) 8.2: Sequential Synthesis.
ENG241 Digital Design Week #7 Sequential Circuits (Part B)
A4 1 Barto "Sequential Circuit Design for Space-borne and Critical Electronics" Dr. Rod L. Barto Spacecraft Digital Electronics Richard B. Katz NASA Goddard.
A Simplified Approach to Fault Tolerant State Machine Design for Single Event Upsets Melanie Berg.
ECE DIGITAL LOGIC LECTURE 21: FINITE STATE MACHINE Assistant Prof. Fareena Saqib Florida Institute of Technology Fall 2015, 11/24/2015.
RTL Hardware Design by P. Chu Chapter 9 – ECE420 (CSUN) Mirzaei 1 Sequential Circuit Design: Practice Shahnam Mirzaei, PhD Spring 2016 California State.
1 Modeling Synchronous Logic Circuits Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
1 Modeling of Finite State Machines Debdeep Mukhopadhyay Associate Professor Dept of Computer Science and Engineering NYU Shanghai and IIT Kharagpur.
EMT 351/4 DIGITAL IC DESIGN Verilog Behavioral Modeling  Finite State Machine -Moore & Mealy Machine -State Encoding Techniques.
LAB #6 Sequential Logic Design (Flip Flops, Shift Registers)
Week #7 Sequential Circuits (Part B)
Registers and Counters
Introduction Introduction to VHDL Entities Signals Data & Scalar Types
Sequential circuits and Digital System Reliability
VHDL (VHSIC Hardware Description Language)
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Lecture #5 In this lecture we will introduce the sequential circuits.
Figure 8.1. The general form of a sequential circuit.
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
ECE 448 Lecture 6 Finite State Machines State Diagrams, State Tables, Algorithmic State Machine (ASM) Charts, and VHDL code ECE 448 – FPGA and ASIC Design.
CSE 370 – Winter Sequential Logic-2 - 1
Presentation transcript:

Finite State Machines

Binary encoded state machines –The number of flip-flops is the smallest number m such that 2 m  n, where n is the number of states in the machine. –Next state logic equations are dependent on all of the flip-flops in the implementation. Natural for CPLD’s, where CPLD’s have high fan-in logic gates. –There may be unused states.

Finite State Machines Gray encoded state machines –Similar to binary encoded state machines. –State sequence has the property that only one output changes when sequencing between states. –Can have lower power –Can be asynchronously sampled in some systems. –There may be unused states.

Finite State Machines One-Hot Finite State Machines –One flip-flop for each state in the machine –Normal operation has exactly one flip-flop set; all other flip-flops reset. –Next state logic equations for each flip-flop depend solely on a single state (flip-flop) and external inputs. –Natural for FPGAs, which don’t have high fan- in logic gates and an abundance of flip-flops.] –There will be unused states

Finite State Machines Modified One-Hot Finite State Machines –n-1 flip-flops for an n-state machine –Normal operation has zero or one flip-flop set The all zero’s state is a legitimate state –There will be unused states

Finite State Machines Linear Feedback Shift Register (LFSR) –The number of flip-flops is the smallest number m such that 2 m  n, where n is the number of states in the machine. –Shift register with XOR feedback –Maximal length shift registers can have 2 m -1 states. –Can modify the circuit to support 2 m states.

Finite State Machines Example Linear Feedback Shift Register Two or four taps

Finite State Machines Johnson Ring Counter –Also called twisted-ring or Mobius counter –For n flip-flops, it will have 2n states. –Shift register with inverted feedback –Unmodified, it will have unused states –Can modify the circuit to support 2n-1 states.

Encoding Efficiency: Binary vs. One Hot

Finite State Machines CAE Tools - Synthesizers –Generates logic to implement a function, guided by the user. –Typically does not generate logic for either fault detection or correction, important for military and aerospace applications.

Finite State Machines Lockup State –A state or sequence of states outside the normal flow of the FSM that do not lead back to a legal state.

Lockup States Sample State Machine Home Ping One Two Three Reset

Library IEEE; Use IEEE.Std_Logic_1164.All; Entity Onehot_Simple_Act Is Port ( Clk : In Std_Logic; Reset : In Std_Logic; Ping : Out Std_Logic ); End Onehot_Simple_Act; Library IEEE; Use IEEE.Std_Logic_1164.All; Architecture Onehot_Simple_Act of Onehot_Simple_Act Is Type StateType Is ( Home, One, Two, Three ); Signal State : Statetype; Begin M: Process ( Clk, Reset ) Begin If ( Reset = '1' ) Then State <= Home; Else If Rising_Edge (Clk) Then Case State Is When Home => State <= One; When One => State <= Two; When Two => State <= Three; When Three => State <= Home; End Case; End If; End Process M; O: Process (State) Begin If (State = Home) Then Ping <= '1'; Else Ping <= '0'; End If; End Process O; End Onehot_Simple_Act; Enumeration Next-state Logic All states “covered”

Lockup States A Synthesized One-Hot Implementation Typical ring counter with lockup states was synthesized.

Lockup States Another Synthesized One-Hot Implementation Note: Results depend on version of synthesis software. This circuit was synthesized with the same product used in the previous slide. Note this is a modified one-hot FSM.

Modified one-hot state machine (reset logic omitted) for a 4-state, two- phase, non-overlapping clock generator. A NOR of all flip-flop outputs and the home state being encoded as the zero vector adds robustness. Standard one-hot state machines [Q3 would be tied to the input of the first flip] have 1 flip-flop per state, with exactly one flip-flop set per state, presenting a non-recoverable SEU hazard. Lockup States Yet Another Synthesized One-Hot Implementation (free product)

Lockup States A “Safe” One-Hot Implementation (Synthesized) Reset flip-flops. Note second one is on falling edge of the clock. This implementation uses 6 flip-flops.

Lockup States A “Safe” One-Hot Implementation (Synthesized) Reset flip-flops. Note second one is on falling edge of the clock. This implementation uses 6 flip-flops.

Lockup States - Binary Encoding Home Ping One Two Three Four Three unused states. (Five, Six, Seven)

Lockup States Binary Encoding Type StateType Is ( Home, One, Two, Three, Four); Signal State : Statetype; … Case State Is … When Others => State <= Home; “When Others” refers to the logical states in the VHDL enumeration, not the physical implementation. Also, states that are not reachable can be deleted, depending on the software and settings.

Two Most Common Finite State Machine (FSM) Types Binary: Smallest m (flip-flop count) with 2m  n (state count), highest encoding efficiency. –Or Gray Coded, a re-mapping of a binary FSM One Hot: m = n, i.e., one flip-flop per state, lowest encoding efficiency. –Or Modified One Hot: m = n-1 (one state represented by 0 vector).

Issue: How To Protect FSMs Against Transient Errors (SEUs and MEUs): Illegal State Detection Adding Error Detection and Correction (EDAC) Circuitry

Binary and Gray Codes FSM State Sequences bit Reflected Gray Code Binary Code Binary sequence can have 0 (hold), 1, 2,..., n bits changing from state to state. Gray code structure ensures that either 0 (hold) or 1 bit changes from state to state. Illegal states in either type are detected in the same way, i.e., by explicit decoding.

Gray Code Illegal Transition Detection Next State Logic State Bit Register Last State Register >1 logic 1 Bit-wise XOR inputs outputs illegal transition False illegal transition indications can also be triggered by errors in the Last State Register, and doubling the number of bits doubles the probability of an SEU.

One Hot FSM Coding Many (2 n -n) unused states - not "reachable" from VHDL 2. Illegal state detection circuitry complex Parity (odd) will detect all SEUs, not MEUs Binary Code One Hot Coding 2 "The Impact of Software and CAE Tools on SEU in Field Programmable Gate Arrays," R. Katz, et. al., IEEE Transactions on Nuclear Science, December, 1999.

One Hot FSM Coding Example of Lockup One Hot FSM without protection. SEU FSM is locked up.

Modified One Hot FSM Coding One Hot Coding Modified One Hot Coding Note: Sometimes used by synthesis when one hot FSM specified. Modified one hot codings use one less flip-flop.

Modified One Hot FSM Illegal State Detection Error detection more difficult than for one hot –1  0 upsets result in a legal state. –Parity will not detect all SEUs. –If an SEU occurs, most likely the upset will be detectable Recovery from lockup sequence simple  If all 0's (NOR of state bits), then generate a 1 to first stage. –If multiple 1's (more difficult to detect), then will wait until all 1's are "shifted out."

Discuss Hamming Codes (to be included)

Is There a Best FSM Type, and Is It Best Protected Against Transient Errors By Circuit-Level or System-Level EDAC? Circuit-level EDAC –Expensive in power and mass if used to protect all circuits –Can be defeated by multiple-bit transient errors –Can be defeated by clock upset System-level EDAC –Required for hard-failure handling –Relies on inherent redundancy in system, high-level error checking, and some EDAC hardware

But It Gets Worse … Some synthesizers may “replicate” flip-flops. Block A Block B Block C Block D Block B Block C Block D Block A

And Worse... Backend software may also replicate flip- flops This can be “bad” if the flip-flop is used to synchronize an asynchronous signal.

And Yet Worse... Logic Translation/Optimization Original “Optimized” Yes, the designer used this point to synchronize signals and drive a motor. The short circuit was “bad.”

The End