Different encodings generate different circuits

Similar documents
Finite State Machine (FSM)

Synchronous Sequential Circuit Design. Digital Computer Design

Chapter 3. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 3 <1>

Synchronous Sequential Logic

Chapter 3. Chapter 3 :: Topics. Introduction. Sequential Circuits

CPE100: Digital Logic Design I

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 7 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Week-5. Sequential Circuit Design. Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA.

Ch 7. Finite State Machines. VII - Finite State Machines Contemporary Logic Design 1

CprE 281: Digital Logic

CPE100: Digital Logic Design I

Models for representing sequential circuits

Synchronous Sequential Circuit Design. Dr. Ehab A. H. AL-Hialy Page 1

UNIVERSITY OF BOLTON SCHOOL OF ENGINEERING BENG (HONS) ELECTRICAL & ELECTRONICS ENGINEERING EXAMINATION SEMESTER /2017

CPE100: Digital Logic Design I

Sequential Circuit Design

Digital Logic and Design (Course Code: EE222) Lecture 19: Sequential Circuits Contd..

EECS Components and Design Techniques for Digital Systems. FSMs 9/11/2007

The Design Procedure. Output Equation Determination - Derive output equations from the state table

Synchronous Sequential Circuit Design

Lecture 17: Designing Sequential Systems Using Flip Flops

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

ENGG 1203 Tutorial _03 Laboratory 3 Build a ball counter. Lab 3. Lab 3 Gate Timing. Lab 3 Steps in designing a State Machine. Timing diagram of a DFF

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

Sequential Synchronous Circuit Analysis

Sequential Logic. Rab Nawaz Khan Jadoon DCS. Lecturer COMSATS Lahore Pakistan. Department of Computer Science

ELCT201: DIGITAL LOGIC DESIGN

Chapter 4 Part 2 Sequential Circuits

ELEC Digital Logic Circuits Fall 2014 Sequential Circuits (Chapter 6) Finite State Machines (Ch. 7-10)

Synchronous Sequential Logic Part I. BME208 Logic Circuits Yalçın İŞLER

CS221: Digital Design. Dr. A. Sahu. Indian Institute of Technology Guwahati

King Fahd University of Petroleum and Minerals College of Computer Science and Engineering Computer Engineering Department

COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

Sequential Circuit Analysis

15.1 Elimination of Redundant States

ELE2120 Digital Circuits and Systems. Tutorial Note 9

Sequential vs. Combinational

Synchronous Sequential Logic Part I

Problem Set 9 Solutions

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

Digital Circuits ECS 371

ELCT201: DIGITAL LOGIC DESIGN

Lecture 14: State Tables, Diagrams, Latches, and Flip Flop

EEE2135 Digital Logic Design

Synchronous Sequential Circuit

Digital Electronics Sequential Logic

Digital Logic Design - Chapter 5

Chapter 6 Introduction to state machines

Finite State Machine. By : Ali Mustafa

Sequential Circuits Sequential circuits combinational circuits state gate delay

Sequential logic and design

Appendix B. Review of Digital Logic. Baback Izadi Division of Engineering Programs

3. Complete the following table of equivalent values. Use binary numbers with a sign bit and 7 bits for the value

Fundamentals of Computer Systems

Lecture (08) Synchronous Sequential Logic

State Machines ELCTEC-131

14.1. Unit 14. State Machine Design

Fundamentals of Computer Systems

Synchronous Sequential Logic. Chapter 5

Final Exam. ECE 25, Spring 2008 Thursday, June 12, Problem Points Score Total 90

EE 209 Logic Cumulative Exam Name:

Lecture 10: Synchronous Sequential Circuits Design

Mealy & Moore Machines

Digital Design. Sequential Logic

University of Minnesota Department of Electrical and Computer Engineering

EET 310 Flip-Flops 11/17/2011 1

Fundamentals of Digital Design

EGR224 F 18 Assignment #4

Latches. October 13, 2003 Latches 1

Written reexam with solutions for IE1204/5 Digital Design Monday 14/

Parity Checker Example. EECS150 - Digital Design Lecture 9 - Finite State Machines 1. Formal Design Process. Formal Design Process

Clocked Synchronous State-machine Analysis

Department of Electrical & Electronics EE-333 DIGITAL SYSTEMS

Lecture 3 Review on Digital Logic (Part 2)

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

ECE 341. Lecture # 3

Counters. We ll look at different kinds of counters and discuss how to build them

BER KELEY D AV IS IR VINE LOS AN GELES RIVERS IDE SAN D IEGO S AN FRANCISCO

Simplify the following Boolean expressions and minimize the number of literals:

Overview of Chapter 4

Sequential Logic Circuits

Chapter 7 Sequential Logic

EECS150 - Digital Design Lecture 23 - FSMs & Counters

Chapter 14 Sequential logic, Latches and Flip-Flops

Chapter 5 Synchronous Sequential Logic

Lecture 7: Logic design. Combinational logic circuits

State Graphs FSMs. Page 1

Digital Control of Electric Drives

I. Motivation & Examples

State & Finite State Machines

Homework #4. CSE 140 Summer Session Instructor: Mohsen Imani. Only a subset of questions will be graded

ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN. Week 9 Dr. Srinivas Shakkottai Dept. of Electrical and Computer Engineering

Analysis of Clocked Sequential Circuits

ASYNCHRONOUS SEQUENTIAL CIRCUITS

Lecture 14 Finite state machines

CHW 261: Logic Design

6. Finite State Machines

ELE2120 Digital Circuits and Systems. Tutorial Note 10

11.1 As mentioned in Experiment 10, sequential logic circuits are a type of logic circuit where the output of

Chapter 4. Sequential Logic Circuits

Transcription:

FSM State Encoding Different encodings generate different circuits no easy way to find best encoding with fewest logic gates or shortest propagation delay. Binary encoding: K states need log 2 K bits i.e., for four states, 00, 01, 10, 11 One-hot encoding One state bit per state each state bit stored in one flip-flop. Only one state bit HIGH at once for 4 states, 0001, 0010, 0100, 1000 Requires more flip-flops Often next state and output logic is simpler So fewer gates are required. Chapter 3 <53>

Example: one-hot encoding Divide-by-3 counter: output Y is HIGH for one clock cycle out of every 3 cycles. Chapter 3 <54> 54

state transition table. output table. state transition with binary encodings state transition with one-hot encodings Chapter 3 <55> 55

state transition with binary encodings state transition with one-hot encodings output table. Chapter 3 <56> 56

Circuits with binary encoding and one-hot encoding Chapter 3 <57> 57

FSM Design Procedure 1. Identify inputs and outputs 2. Sketch state transition diagram 3. Write state transition table 4. Select state encodings 5. For Moore machine: a. Rewrite state transition table with state encodings b. Write output table 5. For a Mealy machine: Rewrite combined state transition and output table with state encodings 6. Write Boolean equations for next state and output logic 7. Sketch the circuit schematic Chapter 3 <58>

Moore vs. Mealy FSM Alyssa P. Hacker has a snail that crawls down a paper tape with 1 s and 0 s on it. The snail smiles whenever the last two digits it has crawled over are 01. Design Moore and Mealy FSMs to compute when the snail should smile. input? a sequence of bits output? smile or not. states? consider both Moore or Mealy Chapter 3 <59>

State Transition Diagrams Moore FSM Reset 0 1 S0 1 0 0 S1 0 0 1 S2 1 Draw first the success path to find out how many states are needed. Chapter 3 <60>

State Transition Diagrams Mealy FSM Reset 0/0 S0 1/0 0/0 S1 1/1 Mealy Digital Design FSM: and Computer arcs Architecture: indicate ARM input/output Edition 2015 Chapter 3 <61>

State Transition Diagrams Moore FSM Reset 0 1 S0 0 1 0 S1 0 0 1 S2 1 Mealy FSM Reset 0/0 S0 1/0 0/0 S1 1/1 Mealy FSM: arcs indicate input/output Chapter 3 <62>

Moore FSM State Transition Table Current State Inputs Next State S 1 S 0 A S' 1 S' 0 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 State Encoding S0 00 S1 01 S2 10 Moore FSM Reset 0 1 six arcs corresponds to six rows in the state transition table. S0 0 1 0 S1 0 Chapter 3 <63> 0 1 S2 1

Moore FSM State Transition Table Current State Inputs Next State State Encoding S 1 S 0 A S' 1 S' 0 0 0 0 0 1 0 0 1 0 0 0 1 0 0 1 0 1 1 1 0 S0 00 S1 01 S2 10 1 0 0 0 1 1 0 1 0 0 S 1 = S 0 A S 0 = A Chapter 3 <64>

Moore FSM Output Table Current State Output S 1 S 0 Y 0 0 0 0 1 0 1 0 1 Y = S 1 Chapter 3 <65>

Mealy FSM State Transition & Output Table Current State Input Next State Output S 0 A S' 0 Y 0 0 1 0 0 1 0 0 1 0 1 0 1 1 0 1 S 0 = A Y = S 0 A State Encoding S0 0 S1 1 Mealy FSM Reset 0/0 S0 1/0 0/0 S1 1/1 Chapter 3 <66>

Moore FSM Schematic A CLK S' 1 S 1 Y S' 0 S 0 r Reset S 1 = S 0 A S 0 = A Y = S 1 Chapter 3 <67>

Mealy FSM Schematic A CLK S' 0 S 0 Y r Reset S 0 = A Y = S 0 A Chapter 3 <68>

Moore & Mealy Timing Diagram Cycle 1 Cycle 2 Cycle 3 Cycle 4 Cycle 5 Cycle 6 Cycle 7 Cycle 8 Cycle 9 Cycle 10 Cycle 11 CLK Reset A S Y S 0 1 0 1 1 0 1 1 1 Moore Machine?? S0 S1 S2 S1 S2 S0 S1 S2 S0 Mealy Machine?? S0 S1 S0 S1 S0 S1 S0 Y Chapter 3 <69>

More on Flip-Flops Chapter 3 <70> 70

SR Latch NOR and NAND implementations S (set) SR latch Q R (reset) Q S=0, R=0, then Q=Q prev S=1, R=1, then Q=0, Q =0 S=1, R=1, then Q=Q prev Active low v.s. active high. They can be used for both implementations. Reset can also be called CLEAR. 71

Variations of Flip-Flop (recall homework) JK flip-flop: when JK=11, toggles: 1à0, 0à1 T flip-flop: Toggles on every rising clock edge Equivalent to JK FF with inputs tied together C J K Q next 0 x x No change 1 0 0 No change 1 0 1 0 (reset) 1 1 0 1 (set) 1 1 1 Q current C T Q next 0 x No change 1 0 No change 1 1 Q current C=1 in the above tables means rising edge. C=0 in the above tables means LOW. 72

Characteristic tables & equations D Q(t+1) Operation 0 0 Reset 1 1 Set J K Q(t+1) Operation 0 0 Q(t) No change 0 1 0 Reset 1 0 1 Set 1 1 Q (t) Complement T Q(t+1) Operation 0 Q(t) No change 1 Q (t) Complement Q(t+1) = D Q(t+1) = K Q(t) + JQ (t) Q(t+1) = T Q(t) + TQ (t) = T Å Q(t) Q(t) current state; Q(t+1) next state. Or sometimes, we use Q for current state; Q + for next state. 73

Summary of three FFs X X X X

Example, partial state transition table, and its wavedrom code. {signal: [ { name: "Clock", wave: '0101010101', node: '...'}, {name: 'X', wave: '01...', node: '.a...'}, {name: 'Q_1*', wave: '0...1.', node: '..b.f..'}, {name: 'Q_0*', wave: '0.1.0.', node: '..c.g.'}, {name: 'Q_1', wave: '0...1', node: '...d...'}, {name: 'Q_0', wave: '0..1.0', node: '...e...'}, ], edge: ['a~>b', 'a~>c', 'b~>d', 'c~>e','d~>f', 'e~>g',] } http://wavedrom.com/editor.html Chapter 3 <75> 75

TimingAnalyzer Demo to draw timing diagram Chapter 3 <76> 76

More on FSM Design Recall the procedure: 1. Identify inputs and outputs 2. Sketch state transition diagram 3. Write state transition table 4. Select state encodings 5. For Moore machine: a. Rewrite state transition table with state encodings b. Write output table 5. For a Mealy machine: Rewrite combined state transition and output table with state encodings 6. Write Boolean equations for next state and output logic 7. Sketch the circuit schematic Chapter 3 <77>

Example: Chapter 3 <78> 78

Chapter 3 <79> 79

Example: A snail smiles whenever she slides over the pattern 1101 or the pattern 1110. Then, draw a combined state transition and output table with binary encodings Chapter 3 <80> 80

Chapter 3 <81> 81

Deriving the state transition diagram from a schematic A reverse process of FSM design. q Examine circuit, stating inputs, outputs, and state bits. q Write next state and output equations. q Create next state and output tables. q Reduce the next state table to eliminate unreachable states. q Assign each valid state bit combination a name. q Rewrite next state and output tables with state names. q Draw state transition diagram. q State Digital Design in words and Computer what Architecture: the ARM FSM Edition does. 2015 Chapter 3 <82> 82

The input is A 1:0 and the output is Unlock. The state bits are already labeled. This is a Moore machine because the output depends only on the state bits. Write down the next state and output equations directly: Chapter 3 <83> 83

writes down the next state and output tables from the equations. Chapter 3 <84> 84

Remove unused states and combine rows using don t cares. The S 1:0 = 11 state is never listed as a possible next state, so rows with this current state are removed. For current state S 1:0 = 10, the next state is always S 1:0 = 00, independent of the inputs, so don t cares are inserted for the inputs. Assign names to each state bit combination: S0 is S 1:0 = 00, S1 is S 1:0 = 01, and S2 is S 1:0 = 10. Chapter 3 <85> 85

Chapter 3 <86> 86

More Examples Problem 1. Analyze the following FSM. Write down the state transition and output tables, and sketch the state transition diagram. The output is Y. You should use binary state encoding, and list all possible states in your state transition table and diagram. Then, you should remove redundant states, and derive a simplified state table and diagram. 87

Problem 2. Output Y Analyze the following FSM that consists of two T flip flops and two AND gates. Write down the state transition and output tables, and sketch the state transition diagram. Note that this problem uses a T flip-flop instead of a D flip-flop in the FSM. 88

Problem 3. Design an FSM with one input A and one output Y. Y should be 1 if A has been 1 during at least three most recent consecutive clock cycles. Show your state transition diagram, encoded state transition table (you should use binary encoding), and the next state and output Boolean equations if you use D flip-flops in your FSM (as we usually do in Chapter 3 of the textbook). Problem 4. Redo the previous problem assume that you use J-K flip-flops in your FSM, instead of D flip-flops. Note that if you need two J-K flip-flops A and B, then you need to write down Boolean equations for J A, K A, J B, and K B. 89

Exercise 3.31. Analyze the FSM shown below. Write the state transition and output tables and sketch the state transition diagram. Describe in words what the FSM does. 2-<90>

Textbook exercise 3.3.1 2-<91>

Problem. Provide the Q output signal using a J-K flip-flop, which has an active low Set and an active low Reset and they are asynchronous. The asynchronous inputs take precedence over the synchronous inputs. Assume that propagation delays are negligent Chapter 3 <92> 92

Factoring State Machines Break a complex FSM into smaller interacting FSMs outputs of some machines are the inputs of some other machines Example: Modify traffic light controller to have Parade Mode. Two more inputs: P, R When assert P, i.e., P = 1, for at least one cycle, enter Parade Mode & Bravado Blvd light stays green. Once put into parade mode, controller proceeds through its usual sequence till L B turns green, then remains in that state with L B green until parade mode ends. When asserting R, i.e., R = 1, for at least one cycle, leave Parade Mode. Chapter 3 <93>

Parade FSM Step 1: Unfactored FSM P R T A T B Controller FSM L A L B Step 2: Factored FSM P R Mode FSM M Mode FSM asserts M when in parade mode. T A T B Lights FSM L A L B Controller FSM Chapter 3 <94>

Factored FSM Reset S0 L A : green L B : red T A TA S1 L A : yellow L B : red S3 L A : red L B : yellow MT B S2 L A : red L B : green Reset S0 M: 0 P P R S1 M: 1 M + T B R Lights FSM Mode FSM Chapter 3 <95>

Unfactored FSM S0, S1, S2, S3 handle normal mode. S4, S5, S6, S7 handle parade mode. Chapter 3 <96>

Compare Reset T A TA S0 L A : green L B : red S1 L A : yellow L B : red S3 L A : red L B : yellow MT B S2 L A : red L B : green Reset S0 M: 0 P P R S1 M: 1 M + T B Lights FSM Mode FSM R Reset T A TA S0 L A : green L B : red S1 L A : yellow L B : red original FSM S3 L A : red L B : yellow S2 L A : red L B : green T B Chapter 3 <97> T B