Digital Design. Sequential Logic

Similar documents
Sequential logic and design

Synchronous Sequential Logic

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

Topic 8: Sequential Circuits

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

ELCT201: DIGITAL LOGIC DESIGN

FYSE420 DIGITAL ELECTRONICS

Synchronous Sequential Circuit Design. Digital Computer Design

Sequential vs. Combinational

Sequential Synchronous Circuit Analysis

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

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

EEE2135 Digital Logic Design

Sequential Circuit Design

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

Sequential Logic Circuits

Computers also need devices capable of Storing data and information Performing mathematical operations on such data

CPE100: Digital Logic Design I

Topic 8: Sequential Circuits. Bistable Devices. S-R Latches. Consider the following element. Readings : Patterson & Hennesy, Appendix B.4 - B.

Reg. No. Question Paper Code : B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER Second Semester. Computer Science and Engineering

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

Different encodings generate different circuits

ALU, Latches and Flip-Flops

Sequential Circuits Sequential circuits combinational circuits state gate delay

CSE140: Components and Design Techniques for Digital Systems. Midterm Information. Instructor: Mohsen Imani. Sources: TSR, Katz, Boriello & Vahid

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

Digital Electronics Sequential Logic

L4: Sequential Building Blocks (Flip-flops, Latches and Registers)

Finite State Machine (FSM)

Chapter 4. Sequential Logic Circuits

Time Allowed 3:00 hrs. April, pages

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

Models for representing sequential circuits

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

Overview of Chapter 4

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

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

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

Introduction EE 224: INTRODUCTION TO DIGITAL CIRCUITS & COMPUTER DESIGN. Lecture 6: Sequential Logic 3 Registers & Counters 5/9/2010

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

Topics for Lecture #9. Button input processor

Gates and Flip-Flops

Chapter 7. Synchronous Sequential Networks. Excitation for

CprE 281: Digital Logic

CPE100: Digital Logic Design I

Chapter 6. Synchronous Sequential Circuits

Lecture 3 Review on Digital Logic (Part 2)

Integrated Circuits & Systems

ECE 341. Lecture # 3

Design of Datapath Controllers

LOGIC CIRCUITS. Basic Experiment and Design of Electronics

Chapter 7 Sequential Logic

6. Finite State Machines

Digital Logic Design. Midterm #2

EE141- Spring 2007 Digital Integrated Circuits

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

SYNCHRONOUS SEQUENTIAL CIRCUITS

Vidyalankar S.E. Sem. III [ETRX] Digital Circuits and Design Prelim Question Paper Solution

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

I. Motivation & Examples

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

Timing Constraints in Sequential Designs. 63 Sources: TSR, Katz, Boriello & Vahid

Finite State Machine. By : Ali Mustafa

Digital Design 2010 DE2 1

DIGITAL LOGIC CIRCUITS

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Fundamentals of Computer Systems

Problem Set 9 Solutions

CPE100: Digital Logic Design I

Fundamentals of Digital Design

Lecture 10: Synchronous Sequential Circuits Design

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

FSM Optimization. Counter Logic Diagram Q1 Q2 Q3. Counter Implementation using RS FF 10/13/2015

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

Philadelphia University Student Name: Student Number:

Example: vending machine

University of Toronto Faculty of Applied Science and Engineering Edward S. Rogers Sr. Department of Electrical and Computer Engineering

Fundamentals of Computer Systems

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

Sequential Logic Optimization. Optimization in Context. Algorithmic Approach to State Minimization. Finite State Machine Optimization

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI

Digital Circuits and Systems

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

Philadelphia University Faculty of Engineering

Chapter 14 Sequential logic, Latches and Flip-Flops

Department of Electrical & Electronics EE-333 DIGITAL SYSTEMS

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

Analysis and Design of Sequential Circuits: Examples

Unit II Chapter 4:- Digital Logic Contents 4.1 Introduction... 4

Let s now begin to formalize our analysis of sequential machines Powerful methods for designing machines for System control Pattern recognition Etc.

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

Sample Test Paper - I

EECS150 - Digital Design Lecture 23 - FSMs & Counters

Chapter 5 Synchronous Sequential Logic

Appendix A: Digital Logic. Principles of Computer Architecture. Principles of Computer Architecture by M. Murdocca and V. Heuring

Review for B33DV2-Digital Design. Digital Design

LOGIC CIRCUITS. Basic Experiment and Design of Electronics. Ho Kyung Kim, Ph.D.

Digital Logic Appendix A

Chapter 4 Part 2 Sequential Circuits

S.Y. Diploma : Sem. III [CO/CM/IF/CD/CW] Digital Techniques

Transcription:

Principles Of igital esign Chapter 6 Sequential Logic

Chapter preview Boolean algebra 3 Logic gates and flip-flops 3 Finite-state machine 6 Logic design techniques 4 Sequential design techniques 6 Binary system and data representation 2 Combinational components 5 Storage components 7 Generalized finite-state machines 8 Register-transfer design 8 Processor components 9 Copyright 24-25 by aniel. Gajski 2

Sequential components Sequential components contain memory elements The output values of sequential components depend on the input values and the values stored in the memory elements The values in the memory elements define the state of sequential components Example : Ring counter that starts the answering machine after 4 rings Sequential components can be ()asynchronous or (2) synchronous Asynchronous sequential components change their state and output values as a response to change in input values Synchronous sequential components change their state and output values at fixed points of time defined by the clock signal Copyright 24-25 by aniel. Gajski 3

Clock signal Clock period Clock width Rising edge Falling edge Clock period ( measured in micro or nanoseconds ) is the time between successive transitions in the same direction Clock frequency ( measured in MHz or GHz ) is the reciprocal of clock period Clock width is the time interval during which clock is equal to uty cycle is the ratio of the clock width and clock period Clock signal is active high if the changes occur at the rising edge or during the clock width Clock signal is active low otherwise Copyright 24-25 by aniel. Gajski 4

SR-latch ( NOR implementation ) SR-latch has two states: () set state (Q=) and (2) reset state (Q=) S Q S R Q Q (next) Q (next) (hold) (hold) (reset) R Logic schematic Q Truth table (set) (?) S R Q 2.8.4 2.8.4.4 Undefined.4 Q.4 2.8.4 2.8.4 Undefined Copyright 24-25 by aniel. Gajski t t t 2 t 3 t 4 t 5 t 6 Timing diagram 5 t 7 t 8 t 9 t

SR-latch ( NAN implementation ) S.4 Q S R Q Q (next) Q (next) (?) (set) (reset) R.4 Q (hold) (hold) Logic schematic Truth table S R Q.4 2.8 2.8.4.4.4 Undefined Q 2.8.4 2.8.4.4 Undefined t t t 2 t 3 t 4 t 5 t 6 t 7 t 8 t 9 t Copyright 24-25 by aniel. Gajski Timing diagram 6

Gated SR-latch S C R Q Q Graphic symbol Control signal C activates the latch R C S Logic schematic Q Q C S R Q Q(next) NA (inactive) (inactive) (hold) (hold) (reset) (set) (?) Truth table reset state set state reset state C S R Q 4. 2. 4. 2. t t t 2 t 3 t 4 t 5 t 6 t 7 t 8 t 9 t t t 2 t 3 Copyright 24-25 by aniel. Gajski Timing diagram 7 t setup t hold

Gated -latch C Q Q C Q Q C Q Q(next) Graphic symbol Logic schematic Truth table C reset state set state reset state Q 4. 2. 4. 3. Setup time is minimum time inputs must be stable before C Hold time is minimum time inputs must be stable after C Q follows while C is asserted as long as satisfies setup and hold time restrictions Copyright 24-25 by aniel. Gajski t t t 2 t 3 t 4 t 5 t 6 t 7 t 8 t 9 t setup t hold t setup t hold t setup t hold Timing diagram 8

Flip Flops Latches are level-sensitive since they respond to input changes during clock width. Latches are difficult to work with for this reason. Flip-Flops respond to input changes only during the change in clock signal. They are easy to work with though more expensive than latches. Two styles of flip-flops are available. () master-slave (MS) (2) edge-triggered (ET) Copyright 24-25 by aniel. Gajski 9

Erroneous shifting with -latches Erroneous operation is possible with level-sensitive latches Q 4./3. C Q 2 4./3. C Q 3 4./3. C Y Logic schematic Q 4. 3. Q 2 4. 3. Q 3 4. 3. t 2 t t t 3 t 4 t 5 t 7 Timing diagram Note: Low-to-high delay is 4.ns. High-to-low delay is 3.ns. t 6 Copyright 24-25 by aniel. Gajski

Master-slave slave flip-flop flop In a MS flip-flop is sampled and stored at the rising edge (low-to-high) of the signal Master latch Q m 4./3. C Slave latch Q s 4./3. C Q Logic schematic Q m 4. 3. 5. 3. Q s 4. 3. 4. t t 3 t 4 t 5 t 7 t 8 t 9 t t 2 t 6 Copyright 24-25 by aniel. Gajski Timing diagram

Shifting with master-slave slave flip-flops flops Master-slave flip-flops Q n 4./3. C Q s 4./3. C Master-slave flip-flops Q 2n 4./3. C Q 2s 4./3. C Master-slave flip-flops Q 3n 4./3. C Q 3s 4./3. C Y Logic schematic Q m 4. 3. Q s 4. 3. Q 2m 5. 4. Q 2s 4. 3. Q 3m 5. 4. Q 3s 4. Copyright 24-25 by aniel. Gajski t t t 2 t 3 t 4 t 5 t 6 t 7 Timing diagram 2

Edge-triggered flip-flop flop Set latch A S R Output latch B Reset latch Logic schematic Q Q A 2.8 2.8 4.2 2.8 S.4.4.4.4 R.4.4 B.4.4 2.8.4 Q 2.8 4.2 Copyright 24-25 by aniel. Gajski t t t 2 t 3 t 5 t 6 Timing diagram 3 t 4 t 7 t 8 t 9

Flip-flop types Flip-flop name Flip-flop symbol Characteristic table Characteristic equation Excitation table SR S Q R Q S R Q(next) Q NA Q(next)=S+R Q SR= Q Q(next) S R JK J Q K Q J K Q(next) Q Q Q(next)=JQ +K Q Q Q(next) J K Q Q Q(next) Q(next)= Q Q(next) T T Q Q T Q(next) Q Q Q(next)=TQ +T Q Q Q(next) T Note: For master-slave and edge-triggered flip-flops data inputs must satisfy Copyright 24-25 by aniel. Gajski set-up and hold time constraints. 4

State diagrams for different flip-flops flops Flip-flop name State diagram SR S,R=, S,R=, Q= Q= S,R=, S,R=, J,K=, or, J,K=, J,K=, JK Q= Q= J,K=, or, = = Q= Q= = T T= = T= Q= Q= T= T= Copyright 24-25 by aniel. Gajski 5

A latch and flip-flop flop with asynchronous inputs CLR C Q Q PRS Q C Q CLR PRS latch Graphic symbol PRS Set latch A S Q PRS Q R Q C Q CLR B Output latch Graphic symbol CLR Reset latch Copyright 24-25 by aniel. Gajski Edge-triggered flip-flop 6

Graphic symbols for flip-flops flops with asynchronous inputs Flip-flop name SR JK Flip-flop symbol Preset S Q R Q Clear Preset J Q K Q Clear Preset Q Q Clear Preset T T Q Q Clear Copyright 24-25 by aniel. Gajski 7

Analysis of sequential logic Excitation equations are Boolean expressions of the flip-flop inputs. Next-state equations are Boolean expressions representing the next value of the flip- flop outputs. Next-state table ( similar to next-state equations ) gives the next value of flip-flop outputs for each input value and state of flip-flops. Analysis of a sequential circuit is a procedure that produces the nextstate table, state diagram and timing diagram from the logic schematic of the circuit. The analysis gives the answer to the following questions: (a) What is the next state? (b) What is the output? (c) What is the function of the circuit? Copyright 24-25 by aniel. Gajski 8

Analysis of a sequential circuit Example: Modulo-4 4 counter Problem: erive the state table and state diagram for the sequential ential circuit represented by the schematic below. Cnt Q Q Cnt= Q Q = Cnt= Q Q = Cnt= Logic schematic Q Q = Cnt Q = Cnt Q + Cnt Q Cnt= Cnt= Q Q = Cnt= State diagram Cnt= Q Q = = Cnt Q + Cnt Q Q + Cnt Q Q Clock cycle Clock cycle 2 Clock cycle 3 Clock cycle 4 Excitation equation Q (next) = = Cnt Q + Cnt Q Q (next) = = Cnt Q + Cnt Q Q + Cnt Q Q Next-state equation Cnt Cnt= PRESENT STATE Q Q NET STATE Q (next) Q (next) Q Copyright 24-25 by aniel. Gajski Cnt= State table Cnt= 9 Q t t t 2 t 3 t 4 t 5 Timing diagram

Analysis of a Moore-type modulo-4 4 counter Example: Moore-type modulo-4 4 counter Problem: erive the state and output tables and the state diagram for the sequential circuit given by the schematic below. = Cnt Q = Cnt Q + Cnt Q = Cnt Q + Cnt Q Q + Cnt Q Q Excitation equation Q (next) = = Cnt Q + Cnt Q Q (next) = = Cnt Q + Cnt Q Q + Cnt Q Q Y = Q Q Next-state and output equation Logic schematic PRESENT STATE NET STATE OUTPUTS Q Q Q (next) Q (next) Y Cnt= Cnt= Copyright 24-25 by aniel. Gajski State and output table 2

Analysis of a Moore type modulo-4 4 counter Cnt= Cnt= Q Q = Y= Cnt= Q Q = Y= Cnt= Cnt= Cnt= Cnt= Q Q = Y= Cnt= Q Q = Y= State diagram Cnt Q Q Y t t t 2 t 3 t 4 Timing diagram t 5 Copyright 24-25 by aniel. Gajski 2

Analysis of a Mealy-type modulo-4 4 counter Example: Mealy-type modulo-4 4 counter Problem: erive the state/output table and the state diagram for the sequential ential Cnt circuit given below. Q Y = Cnt Q = Cnt Q + Cnt Q Q = Cnt Q + Cnt Q Q + Cnt Q Q Excitation equation Q (next) = = Cnt Q + Cnt Q Q Q (next) = = Cnt Q + Cnt Q Q + Cnt Q Q Q Y = Cnt Q Q Logic schematic Copyright 24-25 by aniel. Gajski Next-state and output equation PRESENT STATE Q Q NET STATE /OUTPUTS Q (next) Q (next)/y Cnt= Cnt= / / / / / / / / State and output table 22

Analysis of a Mealy-type modulo-4 4 counter Cnt=/Y= Q Q = Cnt=/Y= Q Q = Cnt=/Y= Cnt=/Y= Cnt=/Y= Cnt=/Y= Q Q = Cnt=/Y= Q Q = Cnt=/Y= State diagram Clock cycle Clock cycle 2 Clock cycle 3 Clock cycle 4 Cnt Q Q Y Copyright 24-25 by aniel. Gajski t t t 2 t 3 t 4 t 5 Timing diagram 23

Analysis procedure for sequential circuits Logic schematic erive excitation equations erive next-state and output equations 2 Generate next-state and output tables 3 Generate state diagram 4 evelop timing diagram 5 Simulate logic schematic 6 Copyright 24-25 by aniel. Gajski 24

Finite-state machine model I A Q,, Q m Y O A k Y n The finite state machine ( FSM ) can be defined abstractly as the quintuple < S, I, O, f, h> where S, I, and O represent a set of states, set of inputs and a set of outputs, respectively, and f and h represent the next-state and the output functions. f : S x I S h : S x I O ( Mealy-type ) S O ( Moore-type ) S = Q x Q 2 x x Q m, I = A x A 2 x x A k, O = Y x Y 2 x x Y n, Copyright 24-25 by aniel. Gajski 25

FSM model of modulo-4 4 counter ( Moore ) Cnt Q Q Copyright 24-25 by aniel. Gajski Logic schematic Q Q = Cnt Q = Cnt Q + Cnt Q = Cnt Q + Cnt Q Q + Cnt Q Q Excitation equation Q (next) = = Cnt Q + Cnt Q Q (next) = = Cnt Q + Cnt Q Q + Cnt Q Q PRESENT STATE Q Q Next-state equation NET STATE Q (next) Q (next) Cnt= State table Cnt= 26 PRESENT STATE S S S 2 S 3 NET STATE ( SxI S ) i i S S S S 2 S 2 S 3 S 3 S OUTPUTS (S O) FSM model of modulo-4 counter Note: Output is dependent only on the state of FSM. O O O O

FSM model of modulo-4 4 counter ( Mealy ) Cnt Q Y Q Q Q PRESENT STATE NET STATE(SxI S)/ OUTPUT(SxI O) i i Logic schematic = Cnt Q = Cnt Q + Cnt Q = Cnt Q + Cnt Q Q + Cnt Q Q Excitation equation Q (next) = = Cnt Q + Cnt Q Q (next) = = Cnt Q + Cnt Q Q + Cnt Q Q Y = Cnt Q Q Next-state and output equations PRESENT STATE Q Q Copyright 24-25 by aniel. Gajski NET STATE /OUTPUTS Q (next) Q (next)/y Cnt= / / / / State and output table Cnt= / / / / 27 S S S 2 S 3 S /O S /O S /O S 2 /O S 2 /O S 3 /O S 3 /O S /O FSM model of modulo-4 counter Note: Output is dependent on the state and the input of the FSM.

Finite-state state-machine implementations State-based Input-based Copyright 24-25 by aniel. Gajski 28

Synthesis procedure for sequential logic esign description or timing diagram evelop state diagram Generate next-state and output tables Minimize states Encode inputs, states, outputs erive next-state and output equations Choose memory elements erive excitation equations Optimize logic implementation erive logic schematic and timing diagrams Simulate logic schematic Verify functionality and timing Copyright 24-25 by aniel. Gajski 29

State diagram for a modulo-3 3 up/down counter Example: Modulo-3 3 up-down counter Problem: erive the state diagram for an up-down, modulo-3 3 counter. The counter has two inputs: count enable (C) and count direction (). When C=, the counter will count in the direction specified by, and it will stop counting when C=. the counter will count up when = and down when =. The counter has one output Y which will be asserted when the counter reaches 2 while counting up, or when it reaches s while counting down. C Modulo-3 up/down counter Counter symbol Y Partial state diagram (up and down counting) C= C= C= C= C= u u u 2 C= C= C= C= C= C= C= C= C= d d d 2 Copyright 24-25 by aniel. Gajski Partial state diagram (changing direction) 3 C= C= C= C= Final state diagram

State minimization State minimization reduces the number of states, and therefore, number of flip-flops needed to implemented the circuit. State minimization is based on the concept of behavioral equivalence which states that two FSM are equivalent if they produce the same sequence of output symbols for every sequence of input symbols. More formally, two states, s j and s k in an FSM are said to be equivalent, s j s k, iff the following two conditions are true. Condition : Both states s j and s k produce the same output symbol for every input symbol i: that is, h (s j,i) = h (s k,i); Condition 2: Both states have equivalent next sates for every input symbol i : that is, h (s j,i) = h (s k,i); Minimization procedure:. partition states into equivalence classes 2. construct new FSM with one state for each equivalence class Copyright 24-25 by aniel. Gajski 3

State reduction for modulo-3 3 counter Example: State reduction Problem: erive the minimal-state FSM for the modulo-3 3 counter. PRESENT STATE NET STATE / OUTPUT C= C= C= u u / u / d / 2 u u / u / 2 d / u 2 u 2 / u / d / d d / u / d / 2 d d / u / 2 d / d 2 / u / d / d 2 PRESENT STATE s NET STATE / OUTPUT C= C= C= s / s / s s / s / 2 s 2 / s / s 2 Initial next-state/output table s 2 / s / s / Partition into arrays with the same output Partition into arrays with the same next state C = C = ( u, u, u 2, d, d, d 2 ) G = (u, d ) G = (u, d ) G 2 = (u 2, d 2 ) G G G G G 2 G 2 G G G 2 G 2 G G G 2 G 2 G G G G Partitioning into equivalence classes Output values Next states Final next-state/output table Copyright 24-25 by aniel. Gajski 32

State reduction with implication table Example: State reductions with implication table. Problem: Find the minimal number of states for the FSM specified by the table t below. s s 2 s 3 s 4 s 5 <s 3,s 4 > <s 2,s 6 > <s,s 4 > s 6 s s s 2 s 3 s 4 s 5 Implication table PRESENT STATE NET STATE C= C= C= u u / u / d / 2 u u / u / 2 d / u 2 u 2 / u / d / d d / u / d / 2 d d / 2 u / 2 d / d 2 / u / d / d 2 Next-state and output table u u 2 d d <u,d 2 > Equivalence classes: <u, d > <u > <d > <u 2, d 2 > d 2 u u u 2 d d Implication table for the table above Copyright 24-25 by aniel. Gajski 33

State encoding ENCOING NUMBER 2 3 4 5 6 7 8 9 2 3 4 5 6 7 8 9 2 2 22 23 24 s s s 2 s 3 The cost and delay of FSM implementation depends on encoding of symbolic states. For example, four states can be encoded in 4!=24 different ways. There are more than n! different encodings for n states. Exploration of all encodings is impossible Thus, we use heuristics. Three different heuristics: minimum-bit change prioritized adjacency one-hot encoding Copyright 24-25 by aniel. Gajski 24 encodings of four states 34

Minimum-bit change Minimum-bit change strategy assigns codes to states so that the total number of bit changes for all state transitions is minimized. In other words, if every arc in the state diagram has a weight that is equal to the number of bits by which the source and destination encodings differ, then the optimal encoding would be the one that minimizes the sum of all these weights. Example: Two different encodings for 2-bit binary counter. s Straightforward encoding Minimum-bit-change encoding Copyright 24-25 by aniel. Gajski 35

Prioritized adjacency Prioritized adjacency strategy assigns adjacent encodings to all states with common source, common destination or common output. Highest priority is given to states with the same next state since the same next-state code will appear in adjacent entries in the Karnaugh map. The second priority is given to the next states of the same state since they also may appear adjacent in the Karnaugh map. The third priority is given to states that have the same output value for the same input value since they may be adjacent in the output map. Example: encoding based on prioritized adjacency. Copyright 24-25 by aniel. Gajski Initial state diagram Priority : (s, s 2 ) Priority 2: (s, s 2 ) Priority : (s, s ), (s 2, s 3 ) Adjacency priorities 36 /, / / / / s / Possible encoding

Hot-one one encoding Hot-one encoding is a redundant encoding with one flip-flop per state having value and others having value. The flip-flop with value reminds one of a hot-potato being passed from one hand to another. Hot-one encoding is too expensive for FSMs with large number of states. It is used only in small FSMs. Copyright 24-25 by aniel. Gajski 37

Encoding example Example: State encodings for modulo-3 3 counter. Problem: Given the up/down, modulo-3 3 counter which was specified by the minimal next-state/output table in Figure 6.8 derive the encoding that will minimize the cost and delay of the counter logic. STATE ENCOING A ENCOING B ENCOING C Q Q Q Q Q 2 Q Q S S S 2 Possible state encodings for modulo-3 counter Encoding A = Minimum-bit change/prioritized adjacency Encoding B = Simplified output logic Encoding C = Hot-one encoding Copyright 24-25 by aniel. Gajski 38

Cost/delay estimation for encoding A C Q Q Q Q Q (next), Q (next) Next-state map Q (next) = Q C +Q C +Q Q C Q (next) = Q C +Q C+Q Q C Y= Q C +Q Q C Excitation and output equations C Y Output map.4 Q (next).4 Q (next) Y.8.8.8.8 2.2 Cost (Q ) = 24 elay (Q ) = 4. 2.2 Cost (Q ) = 24 elay (Q ) = 4. Cost and delay estimation Cost (Y) = 8 elay (Y) = 3.6 Copyright 24-25 by aniel. Gajski Total cost = 66 Max. input delay = 4.ns, Max. output delay = 3.6ns 39

Cost/delay estimation for encoding B C Q Q Q Q Q (next), Q (next) Next-state map Q (next) = Q C +Q C+Q Q C Q (next) = Q C +Q C +Q Q C Y= Q C+Q C Excitation and output equations C Y Output map.4.8 2.2 Cost (Q ) = 24 elay (Q ) = 4. Q (next).8.4.8 2.2 Q (next).8 Cost (Q ) = 24 elay (Q ) = 4. Cost and delay estimation.8 Y.4.8 Cost (Y) = 6 elay (Y) = 3.2 Copyright 24-25 by aniel. Gajski Total cost = 64 Max. input delay = 4.ns, Max. output delay = 3.2ns 4

Cost/delay estimation for encoding C Q 2 Q Q C Q 2 (next),q (next),q (next) Next-state map Q 2 Q Q Q 2 (next) = Q 2 C +Q C+Q C Q (next) = Q C +Q 2 C+Q C Q (next) = Q C +Q 2 C +Q C Y= Q C+Q 2 C Excitation and output equations Q 2 (next) Q (next) Q (next) C Y.8.8 Output map Y.4 Cost (Q ) = Cost (Q ) = Cost (Q 2 ) = 22 elay (Q ) = elay (Q ) = elay (Q ) = 3.6 Cost and delay estimation Cost (Y) = 6 elay (Y) = 3.2 Copyright 24-25 by aniel. Gajski Total cost = 82 Max. input delay = 3.6ns, Max. output delay = 3.2ns 4

Choice of memory elements Select the type of flip-flop from:, SR, JK, T SR and JK reduce the cost of input logic; but require twice as many connections. and T require single connection per flip-flop. T is suitable for counting functions since it changes output value when its input is. Copyright 24-25 by aniel. Gajski 42

Modulo-3 3 counter implementation with different flip-flops flops Example: Flip-flop selection. Problem: Given the modulo-3 3 counter with Encoding A, as specified below, select the type of flip-flop flop that will minimize the cost and/or delay of input logic. C Q Q Q (next), Q (next) Q (present) Q (next)) S R J K T Next-state table for encoding A C Q Q S,R,S,R Flip-flop excitation table S = Q C +Q Q C (cost = 8, delay = 3.6) R = Q C = (Q +C ) (cost = 4, delay =.4) S = Q C+Q Q C (cost = 8, delay = 3.6) R = Q C = (Q +C ) (cost = 4, delay =.4) Copyright 24-25 by aniel. Gajski Implementation with SR flip-flops 43

Modulo-3 3 counter with different flip-flops flops C Q Q C Q Q S,R,S,R S = Q C +Q Q C (cost = 8, delay = 3.6) J,K,J,K J = Q C +Q C = (C +Q +Q ) (cost = 2, delay = 2.4) R = Q C = (Q +C ) (cost = 4, delay =.4) K = C (cost =, delay = ) S J = Q C+Q C = (C +Q +Q ) (cost = 2, delay = 2.4) = Q C+Q Q C (cost = 8, delay = 3.6) R = Q C = (Q +C ) (cost = 4, delay =.4) K = C (cost =, delay = ) C Q Q T,T Implementation with SR flip-flops Implementation with JK flip-flops Q Q C T = Q C+Q C+Q C (cost = 22, delay = 3.6) = Q C +Q C +Q Q C (cost = 24, delay = 4.) T = Q C+Q C+Q C (cost = 22, delay = 3.6) = Q C +Q C+Q Q C (cost = 24, delay = 4.),, Implementation with T flip-flops Implementation with flip-flops Copyright 24-25 by aniel. Gajski 44

C Optimization and timing Y Input-output delays C, to to Y C, to Y to 5.4 7.6 5.6 7.4 C Q Logic schematic elay table 4. 4. 4. 4. Q Y 4. 4. 7.6 7.6 5.6 7.6 t t Copyright 24-25 by aniel. Gajski t 2 t 3 Timing diagram 45 t 4 t 5 t 6

Chapter Summary We introduced memory elements Latches (asynchronous) Flip-flops (synchronous) We presented several ways to describe memory elements Characteristic tables Characteristic equations Static diagrams Timing diagrams We described procedures for sequential logic Analysis Synthesis with FSM capture state minimization state encoding optimization and timing We defined the concept of a FSM Copyright 24-25 by aniel. Gajski 46