Professional Documents
Culture Documents
Number of Flip-Flops
30
20
10
0 0 10 20 30 40 50
Number of States
Basic Finite State Machines 9
10
11
Lockup States
Sample State Machine
Reset
One
Two
Basic Finite State Machines 12
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 => When One => When Two => When Three => End Case; End If; 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; 13
Enumeration
State State State State <= <= <= <= One; Two; Three; Home;
Lockup States
A Synthesized One-Hot Implementation
14
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.
Basic Finite State Machines 15
Lockup States
Yet Another Synthesized One-Hot Implementation (free product)
Modified one-hot state machine (reset logic omitted) for a 4-state, twophase, 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 flipflop set per state, presenting a non-recoverable SEU hazard.
Basic Finite State Machines 16
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.
Basic Finite State Machines 17
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.
Basic Finite State Machines 18
Home Ping
Four
One
19
Lockup States
Binary Encoding
Type Signal StateType Is ( Home, One, Two, Three , Four); 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.
Basic Finite State Machines 20
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).
Basic Finite State Machines 21
Issue: How To Protect FSMs Against Transient Errors (SEUs and MEUs):
Illegal State Detection Adding Error Detection and Correction (EDAC) Circuitry
22
Binary Code
23
Gray Code
Illegal Transition Detection
inputs Next State Logic State Bit Register outputs
Bit-wise XOR
>1 logic 1
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.
Basic Finite State Machines 24
Programmable Gate Arrays," R. Katz, et. al., IEEE Transactions on Nuclear Science, December, 1999. Basic Finite State Machines
SEU
Modified One Hot Coding Note: Sometimes used by synthesis when one hot FSM specified. Modified one hot codings use one less flip-flop.
Basic Finite State Machines 27
29
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
Basic Finite State Machines 30
Block C
Block D
Block A Block B
Block C
Block D
31
32
Optimized
Yes, the designer used this point to synchronize signals and drive a motor. The short circuit was bad.
Basic Finite State Machines 33
35
Reports of replication Is the state assignment one that you asked for? Sometimes the synthesizer thinks it knows best.
36
Look and think. Do not rely on these tools to do your thinking for you.
39