1 Lecture 22 State encoding  One-hot encoding  Output encoding State partitioning.

Slides:



Advertisements
Similar presentations
ENGIN112 L23: Finite State Machine Design Procedure October 27, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 23 Finite State Machine.
Advertisements

General Sequential Design
Finite State Machines (FSMs)
VIII - Working with Sequential Logic © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite state machine optimization State minimization  fewer.
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
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
No. 9-1 Chapter #9: Finite State Machine Optimization.
CS 151 Digital Systems Design Lecture 37 Register Transfer Level
CS 151 Digital Systems Design Lecture 25 State Reduction and Assignment.
Sequential Circuit Design
CS 300 – Lecture 3 Intro to Computer Architecture / Assembly Language Sequential Circuits.
Dr. Turki F. Al-Somani VHDL synthesis and simulation – Part 3 Microcomputer Systems Design (Embedded Systems)
Give qualifications of instructors: DAP
Contemporary Logic Design Finite State Machine Design © R.H. Katz Transparency No Chapter #8: Finite State Machine Design Finite State.
Sequential Circuit Design
Spring 2002EECS150 - Lec15-seq2 Page 1 EECS150 - Digital Design Lecture 15 - Sequential Circuits II (Finite State Machines revisited) March 14, 2002 John.
Contemporary Logic Design FSM Optimization © R.H. Katz Transparency No Chapter #9: Finite State Machine 9.4 Choosing Flip-Flops 9.5 Machine Partitioning.
VII - Finite State Machines © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite State Machines Sequential circuits  primitive sequential elements.
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.
Overview Part 1 - Storage Elements and Sequential Circuit Analysis
1 Lecture 15 Registers Counters Finite State Machine (FSM) design.
Lecture 17 General finite state machine (FSM) design
Lecture 10 Topics: Sequential circuits Basic concepts Clocks
Clocked Synchronous State Machine Design
SEQUENTIAL CIRCUITS Introduction
IKI c-Synthesis of Sequential Logic Bobby Nazief Semester-I The materials on these slides are adopted from: Prof. Daniel Gajski’s transparency.
Elevator Controller We’re hired to design a digital elevator controller for a four-floor building st try: Design a counter that counts up.
Lecture 5 Key Locker using FPGA 2007/10/05 Prof. C.M. Kyung.
VII - Finite State Machines © Copyright 2004, Gaetano Borriello and Randy H. Katz 1 Finite State Machines (FSM) Sequential circuits  primitive sequential.
Lecture 18 More Moore/Mealy machines.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 5 – Sequential Circuits Part 2 – Sequential.
CPEN Digital System Design Chapter 5 - Sequential Circuits Sequential Circuit Design C. Gerousis © Logic and Computer Design Fundamentals, 4 rd Ed.,
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.
9-1 Introduction Chapter #9: Finite State Machine Optimization.
Computer Organization & Programming Chapter 5 Synchronous Components.
1 CSE370, Lecture 18 Lecture 20 u Logistics n HW6 due Wednesday n Lab 7 this week (Tuesday exception) n Midterm 2 Friday (covers material up to simple.
CSIE.NCTU, DL-6-1 Basic Design Approach of FSM Six Step Process 1. Understand the statement of the Specification 2. Obtain an abstract specification of.
DLD Lecture 26 Finite State Machine Design Procedure.
1 Finite State Machines (FSMs) Now that we understand sequential circuits, we can use them to build: Synchronous (Clocked) Finite State Machines Finite.

1 COMP541 Finite State Machines - 1 Montek Singh Sep 22, 2014.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Logic Design Dr. Oliver Faust.
1 COMP541 Sequential Logic – 2: Finite State Machines Montek Singh Feb 29, 2016.
1 CSE370, Lecture 24 Lecture 26 u Logistics n HW8 due Friday n Ant extra credit due Friday n Final exam a week from today, 12/8 8:30am-10:20am here n Review.
Finite state machine optimization
Finite state machine optimization
© Copyright 2004, Gaetano Borriello and Randy H. Katz
Sequential logic design principles
Lecture 26 Logistics Last lecture Today HW8 due Friday
Lecture 27 Logistics Last lecture Today: HW8 due Friday
COMP541 Sequential Logic – 2: Finite State Machines
Lecture 27 Logistics Last lecture Today: HW8 due Friday
CSE 370 – Winter Sequential Logic - 1
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 24 Logistics Last lecture Today HW7 back today
Lecture 20 Logistics Last lecture Today Graded HW back today
Lecture 20 Logistics Last lecture Today HW6 due Wednesday
Lecture 23 Logistics Last lecture Today HW8 due Wednesday, March 11
Lecture 17 Logistics Last lecture Today HW5 due on Wednesday
Lecture 18 Logistics Last Lecture Today HW6 due today Midterm 2
Lecture 18 Logistics Last lecture Today HW5 due today (with extra 10%)
Lecture 22 Logistics Last lecture Today HW7 is due on Friday
ECE 352 Digital System Fundamentals
Lecture 22 Logistics Last lecture Today HW7 is due on Friday
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 4: Finite State Machines
Presentation transcript:

1 Lecture 22 State encoding  One-hot encoding  Output encoding State partitioning

2 FSM design FSM design procedure 1. State diagram 2. State-transition table 3. State minimization 4. State encoding 5. Next-state logic minimization 6. Implement the design

3 Usual example 15 cents for a cup of coffee Doesn’t take pennies or quarters Doesn’t provide any change Vending Machine FSM N D Reset Clock Open Coin Sensor Release Mechanism

4 After state minimization symbolic state table presentinputsnextoutput stateDNstateopen 0¢00 0¢0 01 5¢0 1010¢0 11–– 5¢00 5¢0 0110¢0 1015¢0 11–– 10¢0010¢0 0115¢0 1015¢0 11–– 15¢––15¢1 0¢ Reset 5¢ N N N + D 10¢ D 15¢ [open] D D' N' 1

5 How many state encodings? Assume n state bits and m states  2 n ! / (2 n – m)! possible encodings Example: 3 state bits, 4 states, 1680 possible state assignments Which encoding is best?  Want to pick state encoding strategy that results in optimizing your criteria FSM size (amount of logic and number of FFs) FSM speed (depth of logic and fan-in/fan-out) FSM ease of design or debugging

6 State encoding strategies No guarantee of optimality  An intractable problem Most common strategies  Binary (sequential) – number states as in the state table  Random – computer tries random encodings  Heuristic – rules of thumb that seem to work well e.g. Gray-code – try to give adjacent states (states with an arc between them) codes that differ in only one bit position  One-hot – use as many state bits as there are states  Output – use outputs to help encode states  Hybrid – mix of a few different ones (e.g. One-hot + heuristic)

7 One-hot encoding One-hot: Encode n states using n flip- flops  Assign a single “1” for each state Example: 0001, 0010, 0100, 1000  Propagate a single “1” from one flip-flop to the next All other flip-flop outputs are “0”

8 One-hot variants The inverse: One-cold encoding  Assign a single “0” for each state Example: 1110, 1101, 1011, 0111  Propagate a single “0” from one flip-flop to the next All other flip-flop outputs are “1”

9 One-hot variants “almost one-hot” encoding (modified one-hot encoding)  Use no-hot (000…0) for the initial (reset state)  Assumes you never revisit the reset state till reset again

10 One-hot encoding Often the best/convenient approach for FPGAs  FPGAs have many flip-flops Draw FSM directly from the state diagram  + One product term per incoming arc  - Complex state diagram  complex design  - Many states  many flip flops

11 Vending machine – – –– – – – –– – – – –– – 1000 – – present state inputs next state output Q 3 Q 2 Q 1 Q 0 D N D 3 D 2 D 1 D 0 open 0¢0¢ Reset 5¢5¢ N N N + D 10¢ D 15¢ [open] D D' N' 1

12 Designing from state diagram 0¢0¢ Reset 5¢5¢ N N N + D 10¢ D 15¢ [open] D D' N' 1 D 0 = Q 0 D’N’ D 1 = Q 0 N + Q 1 D’N’ D 2 = Q 0 D + Q 1 N + Q 2 D’N’ D 3 = Q 1 D + Q 2 D + Q 2 N + Q 3 OPEN = Q 3

13 Output encoding Reuse outputs as state bits  Why create new functions when you can use outputs?  Bits from state assignments are the outputs for that state Take outputs directly from the flip-flops Yields small circuits for most FSMs

14 Output encoding Combinational Logic Storage Elements Outputs State OutputsState Inputs Inputs

15 FSM partitioning Break a large FSM into two or more smaller FSMs  Less states in each partition Simpler minimization and state assignment Smaller combinational logic Shorter critical path  But more logic overall

16 Example Partition into two halves C1 C2 C3 C4C5 S1 S3 S2 S6 S4 S5

17 Introduce idle states SA and SB handoff control between machines C1 C2 C5S2 S6 S4 S5 SB C1S1 C3S2+ C4S3 (C1S1+ C3S2+ C4S3+ C5S2)’ C4 S1 S3 S2 SA C2S6 C3+C5 (C2S6)’ C1 C2 C3 C4C5 S1 S3 S2 S6 S4 S5

18 Partitioning rules S1 S6 C1 SAS1 C1 S1 S6 C2 SAS1 C2S6 Rule #1: Source-state transformation Replace by transition to idle state (SA) Rule #2: Destination state transformation Replace with exit transition from idle state

19 Partitioning rules S2 S3 S5 S4 C4 C5 C3 S2 S3 SA C3+C5 C4 S5 S4 C5S2 SB C3S2 + C4S3 SAS1 C2S6 Rule #3: Multiple transitions with same source or destination Source  Replace by transitions to idle state (SA) Destination  Replace with exit transitions from idle state Rule #4: Hold condition for idle state “OR exit conditions and invert”

20 Example D U S0 S2 S1 S5 S3 S4 U U U U U D D D D D

21 Example Count sequence S 0, S 1, S 2, S 3, S 4, S 5  S 2 goes to S A and holds, leaves after S 5  S 5 goes to S B and holds, leaves after S 2  Down sequence is similar DS0 U S5 S3 S4 U UUS2 D DD SB (DS0+ US2)’ DS3 U S0 S2 S1 U U US5 D D D SA (DS3 + US5)’

22 Example DS3 U S0 S2 S1 U U US5 D D D SA (DS3 + US5)’ DS0 U S5 S3 S4 U UUS2 D DD SB (DS0+ US2)’ D U S0 S2 S1 S5 S3 S4 U U U U U D D D D D Compare behavior on UUUUUU:

23 Example 4-state machines need 2 state bits each – total 4 state bits  Enough to represent 16 states, though the combination of the two FSMs has only 6 different configurations Why do this?  Each FSM may be much simpler to think about (and design logic for) than the original FSM (not here, though)  Essential to do this partitioning for large FSMs

24 Minimize communication Ideal world: Two machines handoff control  Separate I/O, states, etc. Real world: Minimize handoffs and common I/O  Minimize number of state bits that cross boundary