CS8803: Advanced Digital Design for Embedded Hardware

Similar documents
CS8803: Advanced Digital Design for Embedded Hardware

CHAPTER 4: Logic Circuits

Digital Design, Kyung Hee Univ. Chapter 5. Synchronous Sequential Logic

CPS311 Lecture: Sequential Circuits

Chapter 5 Synchronous Sequential Logic

CHAPTER 4: Logic Circuits

Combinational vs Sequential

Sequential Logic Circuits

2 Sequential Circuits

Sequential Circuits. Output depends only and immediately on the inputs Have no memory (dependence on past values of the inputs)

D Latch (Transparent Latch)

Chapter 6. Flip-Flops and Simple Flip-Flop Applications

Chapter 4. Logic Design

Logic Design. Flip Flops, Registers and Counters

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District UNIT-III SEQUENTIAL CIRCUITS

Chapter 5: Synchronous Sequential Logic

Unit 11. Latches and Flip-Flops

Combinational / Sequential Logic

UNIT III. Combinational Circuit- Block Diagram. Sequential Circuit- Block Diagram

Advanced Digital Logic Design EECS 303

Experiment 8 Introduction to Latches and Flip-Flops and registers

Synchronous Sequential Logic

IT T35 Digital system desigm y - ii /s - iii

Logic and Computer Design Fundamentals. Chapter 7. Registers and Counters

Chapter 5 Sequential Circuits

MC9211 Computer Organization

Objectives. Combinational logics Sequential logics Finite state machine Arithmetic circuits Datapath

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

Computer Architecture and Organization

Logic Design II (17.342) Spring Lecture Outline

Software Engineering 2DA4. Slides 9: Asynchronous Sequential Circuits

UNIT IV. Sequential circuit

Digital Circuit And Logic Design I. Lecture 8

Digital Circuit And Logic Design I

Part II. Chapter2: Synchronous Sequential Logic

Read-only memory (ROM) Digital logic: ALUs Sequential logic circuits. Don't cares. Bus

Flip-Flops. Because of this the state of the latch may keep changing in circuits with feedback as long as the clock pulse remains active.

The outputs are formed by a combinational logic function of the inputs to the circuit or the values stored in the flip-flops (or both).

MODULE 3. Combinational & Sequential logic

cascading flip-flops for proper operation clock skew Hardware description languages and sequential logic

Section 6.8 Synthesis of Sequential Logic Page 1 of 8

BUSES IN COMPUTER ARCHITECTURE

1. Convert the decimal number to binary, octal, and hexadecimal.

Introduction. NAND Gate Latch. Digital Logic Design 1 FLIP-FLOP. Digital Logic Design 1

Name Of The Experiment: Sequential circuit design Latch, Flip-flop and Registers

More on Flip-Flops Digital Design and Computer Architecture: ARM Edition 2015 Chapter 3 <98> 98

Sequential Logic. Analysis and Synthesis. Joseph Cavahagh Santa Clara University. r & Francis. TaylonSi Francis Group. , Boca.Raton London New York \

Chapter 3. Boolean Algebra and Digital Logic

Digital Fundamentals: A Systems Approach

Problems with D-Latch

EMT 125 Digital Electronic Principles I CHAPTER 6 : FLIP-FLOP

B.Tech CSE Sem. 3 15CS202 DIGITAL SYSTEM DESIGN (Regulations 2015) UNIT -IV

CHAPTER1: Digital Logic Circuits

Chapter 8 Sequential Circuits

Lecture 11: Synchronous Sequential Logic

(CSC-3501) Lecture 7 (07 Feb 2008) Seung-Jong Park (Jay) CSC S.J. Park. Announcement

Synchronous Sequential Logic

Flip-Flops and Sequential Circuit Design

Digital Logic Design I

Sequencing. Lan-Da Van ( 范倫達 ), Ph. D. Department of Computer Science National Chiao Tung University Taiwan, R.O.C. Fall,

Sequential logic. Circuits with feedback. How to control feedback? Sequential circuits. Timing methodologies. Basic registers

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

`COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

Sequential Circuits: Latches & Flip-Flops

Memory elements. Topics. Memory element terminology. Variations in memory elements. Clock terminology. Memory element parameters. clock.

Logic Design ( Part 3) Sequential Logic- Finite State Machines (Chapter 3)

CSE115: Digital Design Lecture 23: Latches & Flip-Flops

Vignana Bharathi Institute of Technology UNIT 4 DLD

ELCT201: DIGITAL LOGIC DESIGN

Sequential Logic. E&CE 223 Digital Circuits and Systems (A. Kennings) Page 1

DIGITAL SYSTEM FUNDAMENTALS (ECE421) DIGITAL ELECTRONICS FUNDAMENTAL (ECE422) LATCHES and FLIP-FLOPS

Switching Theory And Logic Design UNIT-IV SEQUENTIAL LOGIC CIRCUITS

UNIT-3: SEQUENTIAL LOGIC CIRCUITS

NH 67, Karur Trichy Highways, Puliyur C.F, Karur District DEPARTMENT OF INFORMATION TECHNOLOGY CS 2202 DIGITAL PRINCIPLES AND SYSTEM DESIGN

COMP2611: Computer Organization. Introduction to Digital Logic

EE292: Fundamentals of ECE

Microprocessor Design

Principles of Computer Architecture. Appendix A: Digital Logic


ECE 25 Introduction to Digital Design. Chapter 5 Sequential Circuits ( ) Part 1 Storage Elements and Sequential Circuit Analysis

Chapter 5 Synchronous Sequential Logic

YEDITEPE UNIVERSITY DEPARTMENT OF COMPUTER ENGINEERING. EXPERIMENT VIII: FLIP-FLOPS, COUNTERS 2014 Fall

Synchronous Sequential Logic. Chapter 5

ESE 570 STATIC SEQUENTIAL CMOS LOGIC CELLS. Kenneth R. Laker, University of Pennsylvania, updated 25Mar15

INTRODUCTION TO SEQUENTIAL CIRCUITS

Introduction to Sequential Circuits

Chapter 5. Introduction

CS T34-DIGITAL SYSTEM DESIGN Y2/S3

SEQUENTIAL LOGIC. Satish Chandra Assistant Professor Department of Physics P P N College, Kanpur

Lecture 8: Sequential Logic

ELEN Electronique numérique

Chapter 1: Switching Algebra Chapter 2: Logical Levels, Timing & Delays. Introduction to latches Chapter 9: Binary Arithmetic

ECE 341. Lecture # 2

Final Exam review: chapter 4 and 5. Supplement 3 and 4

Chapter. Synchronous Sequential Circuits

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

CS61C : Machine Structures

P U Q Q*

EECS150 - Digital Design Lecture 15 Finite State Machines. Announcements

A Review of logic design

Transcription:

CS883: Advanced Digital Design for Embedded Hardware Lecture 4: Latches, Flip-Flops, and Sequential Circuits Instructor: Sung Kyu Lim (limsk@ece.gatech.edu) Website: http://users.ece.gatech.edu/limsk/course/cs883

Copyright 2, 23 MD Ciletti 75 STORAGE ELEMENTS: R-S LATCH Storage elements are used to store information in a binary format (e.g. state, data, address, opcode, machine status). Storage elements may be clocked or unclocked. Two types: level-sensitive, edge-sensitive Example: R-S latch (Unclocked) The state of an R-S latch is dependent on the value of its R and S inputs. R Q S' Q Note: Avoid applying to a R-S Nor latch, and to an R'S' Nand latch. The circuit is unstable and oscillation will result. S Q' R' Q' S R Q next Q' next Q Q' Hold Reset S' R' Q next Q' next Not Allowed Set Set Not Allowed Q Q' Reset Hold

CHAPTER VII-8 SEQUENTIAL SYSTEMS LATCHES SR LATCH (NAND GATES) LATCHES -D LATCH (WITH TG) -NAND PRIMITIVES -CONSTRUCTING A LATCH NAND gates can also be used to create a latch, this time an SR latch. R S (set) (reset) Q Q S R Q Q (after S =, R = ) (after S =, R = ) Recall: A B NAND Notice that this latch is level-sensitive. R.M. Dansereau; v..

CHAPTER VII-9 SEQUENTIAL SYSTEMS LATCHES SR LATCH (NOR GATES) LATCHES -CONSTRUCTING A LATCH -S R LATCH -NAND GATES -MIXED LOGIC EQUIV. The SR latch also uses feedback to store a bit. R (reset) S (set) Q Q S R Q Q (after S =, R = ) (after S =, R = ) Recall: A B NOR Notice that this latch is level-sensitive. R.M. Dansereau; v..

CHAPTER VII- SEQUENTIAL SYSTEMS LATCHES D LATCH (WITH SR LATCH) LATCHES -MIXED LOGIC EQUIV. -SR LATCH -NOR GATES -SR LATCH W/ CONTROL A D latch can be implemented using what is effectively the SR latch with a control line as follows. D S Q R Q Note that as long as value of D. C =, that the latch will change according to the R.M. Dansereau; v..

Copyright 2, 23 MD Ciletti 76 STORAGE ELEMENTS: TRANSPARENT LATCHES Latches are level-sensitive storage elements; data storage is dependent on the level (value ) of the input clock (or enable) signal. The output of a transparent latch changes in response to the data input while the latch is enabled. Changes at the input are visible at the output data q_out enable data enable 2 3 4 5 t sim q_out 2 3 4 5 t sim 2 3 4 5 t sim

CHAPTER VII-3 SEQUENTIAL SYSTEMS LATCHES TRANSPARENCY () LATCHES -SR LATCH W/ CONTROL -D LATCH -TIMING DIAGRAMS Latches like the D latch are termed transparent or level-sensitive. This is because, when enabled, the output follows the input. IN Transparent Latch OUT D Q Note: Transparent Q R.M. Dansereau; v..

CHAPTER VII-4 SEQUENTIAL SYSTEMS LATCHES TRANSPARENCY (2) LATCHES -D LATCH -TIMING DIAGRAMS -TRANSPARENCY The following behaviour is observed for = and =. IN Transparent Latch OUT When =, input disconnected and stored bit outputed. When =, latch acts like wire. Stored bit IN OUT IN OUT R.M. Dansereau; v..

CHAPTER VII-5 SEQUENTIAL SYSTEMS LATCH EXAMPLE PROBLEMS W/ TRANSPARENCY LATCHES -D LATCH -TIMING DIAGRAMS -TRANSPARENCY A problem with latches is that they are level-sensitive. A momentary change of input changes the value passed out of the latch. This is a problem if the input of a latch depends on the output of the same latch. Example: Design a system that flips a stored bit whenever goes high. An inexperienced engineer might design the following. How will this design behave? Transparent Latch Will the bit flip once when the signal goes high? Answer: The output will follow the input, which happens to keep changing. R.M. Dansereau; v..

CHAPTER VII-6 SEQUENTIAL SYSTEMS LATCH EXAMPLE PROBLEMS W/ TRANSPARENCY LATCHES LATCH EXAMPLE -PROB W/TRANSPARENCY Let s analyze the timing behaviour of this poor design. A B Notice that instead of the desired bit flip when =, that the input oscillates. This is because the output depends directly on the input since A and B appear to be connected by a wire. A B R.M. Dansereau; v..

CHAPTER VII-7 SEQUENTIAL SYSTEMS LATCH EXAMPLE ELIMINATING TRANSPARENCY LATCHES LATCH EXAMPLE -PROB W/TRANSPARENCY The problem with transparent, level-sensitive latches can be fixed by splitting the input and output so that they are independent. New solution: Consider the following improved design that flips a stored bit whenever goes high. This design now uses a master and a slave transparent latches to separate the input from the output. Transparent Latch Transparent Latch Master Slave R.M. Dansereau; v..

Copyright 2, 23 MD Ciletti 77 STORAGE ELEMENTS: FLIP-FLOPS Flip-flops are edge-sensitive storage elements; data storage is synchronized to an edge of a clock. The value of data stored depends on the data that is present at the data input(s) when the clock makes a transition at its active (rising or falling) edge. Example: D-type flip-flop D Q D Q Q next Characteristic equation: q next = D. clk Q' This example is active on the rising (positive) edge of the clock. clk Intermediate data transitions are ignored. D Ignored t Timing constraints (setup, hold, minimum pulse width) must be met. Q t t

Copyright 2, 23 MD Ciletti 78 MASTER-SLAVE FLIP-FLOP A master-slave configuration of two data latches samples the input during the active cycle of the clock applied to the master stage. The input is propagated to the output during the slave cycle of the clock. Master-slave implementation of a negative edge-triggered D-type flip-flop: data D Data Latch Q D Data Latch Q Q' q q' clock Master Slave Timing constraint: the output of the master stage must settle before the enabling edge of the slave stage. The master stage is enabled on the inactive edge of the clock, and the slave stage is enabled on the active edge. Timing constraints apply to the active edge.

Copyright 2, 23 MD Ciletti 79 CMOS TECHNOLOGY - MASTER-SLAVE FLIP-FLOP CMOS Transmission Gate: ~enable ~clock clock Q_bar input_sig enable output_sig D-type flip-flops in CMOS technology are formed by combining transmission gates with glue logic to form a master-slave circuit. Data Clear_bar clock ~clock clock ~clock clock ~clock Q Clear_bar clock Data Q t

Copyright 2, 23 MD Ciletti 8 CMOS TECHNOLOGY MASTER-SLAVE FLIP-FLOP (Cont.) ~clock clock clock(n- ) = data clear_ clock ~clock w w clock w3 w2 ~clock clock w4 w4 ~clock Q Q_ Master stage: output capacitor (node w2) is charged and sustained by the feedback loop. The delays of the master stage determine the setup conditions of the flipflop. clock(n+ ) = data clear_ clock ~clock w w ~clock clock w3 w2 ~clock clock w4 w4 clock ~clock Q Q_ Slave stage: The output of the slave stage is sustained while the master stage is charging. At the active edge of the flipflop, the output of the master stage charges the output of the slave stage, which is sustained by the feedback loop during the active cycle. Note: the read operation is nondestructive.

CHAPTER VII-2 SEQUENTIAL SYSTEMS FLIP-FLOPS EDGE TRIGGERED LATCH EXAMPLE FLIP-FLOPS -SINGLE BIT STORAGE A common and useful type of flip-flop are edge triggered flip-flops. Positive edge triggered flip-flops IN Transparent Latch Transparent Latch OUT Negative edge triggered flip-flops IN Transparent Latch Transparent Latch OUT R.M. Dansereau; v..

CHAPTER VII-22 SEQUENTIAL SYSTEMS FLIP-FLOPS NEGATIVE EDGE TRIGGERED LATCH EXAMPLE FLIP-FLOPS -SINGLE BIT STORAGE -EDGE TRIGGERED The output C, which is also the bit stored, appears to change on the negative edge of the transitions. IN A B C Transparent Latch Transparent Latch A B C OUT R.M. Dansereau; v..

CHAPTER VII-23 SEQUENTIAL SYSTEMS FLIP-FLOPS POSITIVE EDGE TRIGGERED FLIP-FLOPS -SINGLE BIT STORAGE -EDGE TRIGGERED -NEG. EDGE TRIGGERED The output C, which is also the bit stored, appears to change on the positive edge of the transitions. IN A B C Transparent Latch Transparent Latch A B C OUT R.M. Dansereau; v..

Copyright 2, 23 MD Ciletti 83 BUILDING BLOCKS: THREE-STATE DEVICES Three-state devices provide high-impedance interface devices. x_in y_out x_in y_out x_in y_out x_in y_out en en en en x_in en y_out x_in en y_out x_in en y_out x_in en y_out Hi-Z Hi-Z Hi-Z Hi-Z Hi-Z Hi-Z Hi-Z Hi-Z Typical applications: i/o pad and bus isolation. rcv_data inbound_dat a 32 register 32 32 reg_to_bus data_to_from_bus send_data

BUILDING BLOCKS: BUSSES Copyright 2, 23 MD Ciletti 85 Busses provide parallel datapaths and control interfaces and between functional units. Synchronous and asynchronous busses Handshaking protocols are required for coherent communication Key Issues: Bus Contention and Arbitration Example: Register-to-Register transfer on a 4- bit datapath. CLK IE_b_ OE_b_ IE_b_ OE_b_ IE CLK OE IE CLK OE D3 D2 D D O3 O2 O O D3 D2 D D O3 O2 O O DB3 DB2 DB DB OE_b_3 IE_b_ IE_b_2 OE_b_2 IE CLK OE D3 D2 D D O3 O2 O O CLK DB 4 IE_b_3 OE_b_3 IE CLK OE D3 D2 D D O3 O2 O O Register outputs are internally three-stated. Data Bus

SEQUENTIAL MACHINES (p 8) Copyright 2, 23 MD Ciletti 86 Sequential machines, also called finite state machines, are characterized by an input/output relationship in which the value of the outputs at a given time depend on the history of the applied inputs as well as their present value. Example: A machine that is to count the number of s in a serially transmitted frame of bits. The history of the inputs applied to a sequential machine is represented by the state of the machine, and requires hardware elements that store information, i.e. requires memory to store the state of the machine as an encoded binary word. All sequential machines require feedback that allows the next state of the machine to be determined from the present state and inputs. Inputs Next State forming Logic Next State (NS) Memory Feedback of present state Present State (PS) Outputs The set of states of a sequential machine is always finite, and the number of states is determined by the number of bits that represent the state.

SEQUENTIAL MACHINES (Cont.) Copyright 2, 23 MD Ciletti 87 Sequential machines may be asynchronous or synchronous (clocked). The state transitions of a (edge-triggered) flip-flop-based synchronous machine are synchronized by the active edge (i.e. rising or falling) of a common clock. State changes give rise to changes in the combinational logic that determines the next state and the output of the machine. period Falling edge Rising edge A lower bound on the cycle time (period) of the machine's clock is set by the requirement that the period of the clock must be long enough to allow all transients activated by an a transition of the clock to settle at the outputs of the combinational logic before the next active edge occurs.

SEQUENTIAL MACHINES (Cont.) Copyright 2, 23 MD Ciletti 88 The inputs to the flip-flops must remain stable for a sufficient interval before and after the active edge of the clock. The former constraint establishes an upper bound on the longest path through the circuit, which constrains the latest allowed arrival of data. The latter constraint imposes a lower bound on the shortest path through the combinational logic that is driving the storage device. It constrains the earliest time at which data from the previous cycle could be overwritten. Together, these constraints ensure that valid data is stored. Otherwise, timing violations may occur at the inputs to the flip-flops, with the result that invalid data is stored. In an edge-triggered clocking scheme, the clock isolates a storage register's inputs from its output, thereby allowing feedback without race conditions. The outputs of a state machine controls the synchronous datapath operations and register operations of more general digital machine.

Copyright 2, 23 MD Ciletti 89 FINITE STATE MACHINES Synchronous (i.e. clocked) finite state machines (FSMs) have widespread application in digital systems, e.g. as datapath controllers in computational units and processors. Synchronous FSMs are characterized by a finite number of states and by clock-driven state transitions. Mealy Machine: The next state and the outputs depend on the present state and the inputs. Moore Machine: The next state depends on the present state and the inputs, but the output depends on only the present state.

FINITE STATE MACHINES (Cont.) Copyright 2, 23 MD Ciletti 9 Mealy machine Inputs Next State and Output Combinational Logic State Register Outputs clock Moore machine Inputs Next State Combinational Logic State Register Output Combinational Logic Outputs clock

CHAPTER VIII-9 FINITE STATE MACHINES STATE DIAGRAMS PATTERN DETECT EXAMPLE STATE DIAGRAMS -PROPERTIES -STATE DIAGRAM EX. -BIT FLIPPER EX. Suppose we want a sequential system that has the following behaviour Input: xt () {, } Output: zt () {, } Function: zt () = if x( t 3t, ) = otherwise Effectively, the system should output a when the last set of four inputs have been. For instance, the following output z(t) is obtained for the input x(t) t 23456789... xt () zt ()??? R.M. Dansereau; v..

CHAPTER VIII- FINITE STATE MACHINES STATE DIAGRAMS PATTERN DETECT EXAMPLE STATE DIAGRAMS -STATE DIAGRAM EX. -BIT FLIPPER EX. -PATTERN DETECT EX. The following state diagram gives the behaviour of the desired pattern detector. Consider S to be the initial state, S when first symbol detected (), S 2 when subpattern detected, and when subpattern detected. / / S 3 / S S / S / 2 S 3 / / / R.M. Dansereau; v..

CHAPTER VIII- FINITE STATE MACHINES STATE TABLES INTRODUCTION STATE DIAGRAMS -STATE DIAGRAM EX. -BIT FLIPPER EX. -PATTERN DETECT EX. State tables also express a systems behaviour and consists of Present state The present state of the system, typically given in binary encoded form or with S k. So, a state of S 5 in our state diagram with states would be represented as since we require 4 bits. Inputs Whatever external inputs used to cause the state transitions. Next state The next state, generally in binary encoded form. Outputs Whatever outputs, other then the state, for the system. Note that there would be no outputs in a Moore machine. R.M. Dansereau; v..

CHAPTER VIII-4 FINITE STATE MACHINES STATE TABLES PATTERN DETECT EXAMPLE STATE TABLES -INTRODUCTION -BIT FLIPPER EX. -TRANSLATE DIAGRAM If we consider the pattern detection example previously discussed, the following would be the state table. Present State Input Next State Output P P X N N Z S S S S S 2 S 2 S 3 S 3 or or or or or or or or S S S or or or S 2 or S 3 or S 2 or S or S or R.M. Dansereau; v..

CHAPTER VIII-5 FINITE STATE MACHINES STATE TABLES TRANSLATE TO DIAGRAM STATE TABLES -BIT FLIPPER EX. -TRANSLATE DIAGRAM -PATTERN DETECT EX. If given a state table, the state diagram can be developed as follows. Determine the number of states in the table and draw a state circle corresponding to each one. Label the circle with the state name for a Mealy machine. Label the circle with the state name/output for a Moore machine. For each row in the table, identify the present state circle and draw a directed arc to the next state circle. Label the arc with the input/output pair for a Mealy machine. Label the arc with the input for a Moore machine. R.M. Dansereau; v..

CHAPTER VIII-7 FINITE STATE MACHINES SEQ. CIRCUITS FROM STATE TABLE STATE TABLES SEQUENTIAL CIRCUITS -INTRODUCTION The procedure for developing a logic circuit from a state table is the same as with a regular truth table. Generate Boolean functions for each external outputs using external inputs and present state bits each next state bit using external inputs and present state bits Use Boolean algebra, Karnaugh maps, etc. as normal to simplify. Draw a register for each state bit. Draw logic diagram components connecting external outputs to external inputs and outputs of state bit registers (which have the present state). Draw logic diagram components connecting inputs of state bits (for next state) to the external inputs and outputs of state bit registers (which have the present state). R.M. Dansereau; v..

CHAPTER VIII-8 FINITE STATE MACHINES SEQ. CIRCUITS PATTERN DETECT EXAMPLE STATE TABLES SEQUENTIAL CIRCUITS -INTRODUCTION -DEVEL. LOGIC CIRCUITS Following the procedure outlined, Boolean functions for the pattern detector state table can be formed using Karnaugh maps as follows. X P P X P P X P P N N Z N = XP + XP P N = XP P + XP P + XP P = XP P + XP ( P ) Z = XP P R.M. Dansereau; v..

CHAPTER VIII-2 FINITE STATE MACHINES SEQ. CIRCUITS PATTERN DETECT EXAMPLE SEQUENTIAL CIRCUITS -INTRODUCTION -DEVEL. LOGIC CIRCUITS -PATTERN DETECT EX. The following logic circuit implements the pattern detect example. N P φ φ 2 N P φ φ 2 X Z R.M. Dansereau; v..

CHAPTER VIII-3 FINITE STATE MACHINES FSM EXAMPLES EXAMPLE #2 SEQUENTIAL CIRCUITS FSM EXAMPLES -EXAMPLE # A sequential circuit is defined by the following Boolean functions with input X, present states P, P, and P 2, and next states N, N, and N 2. N 2 = XP ( P ) + XP ( P ) N = P 2 N = P Z = XP P 2 Derive the state table. Derive the state diagram. R.M. Dansereau; v..

CHAPTER VIII-32 FINITE STATE MACHINES FSM EXAMPLES EXAMPLE #2 SEQUENTIAL CIRCUITS FSM EXAMPLES -EXAMPLE # -EXAMPLE #2 The state table is formed as follows. Present State Input Next State Output P 2 P P X N 2 N N Z R.M. Dansereau; v..

CHAPTER VIII-33 FINITE STATE MACHINES FSM EXAMPLES EXAMPLE #2 SEQUENTIAL CIRCUITS FSM EXAMPLES -EXAMPLE # -EXAMPLE #2 The state diagram can be drawn as follows. / / / / S S S 2 S 3 / / / / / / / / S 4 S 5 S 6 S 7 / / / / R.M. Dansereau; v..

Copyright 2, 23 MD Ciletti 9 MEALY FINITE STATE MACHINE - EXAMPLE A serially-transmitted BCD (842 code) word is to be converted into an Excess-3 code. An Excess-3 code word is obtained by adding 3 to the decimal value and taking the binary equivalent. Excess-3 code is self-complementing [Wakerly, p. 8], i.e. the 9's complement of a code word is obtained by complementing the bits of the word. Decimal 8-4-2- Excess-3 Digit Code Code (BCD) 2 3 4 5 6 7 8 9

Copyright 2, 23 MD Ciletti 92 MEALY FINITE STATE MACHINE - EXAMPLE (Cont.) The serial code converter is described by the state transition graph of a Mealy FSM. State Transition Graph input / output / S_ / S_ / S_2 / S_3 S_4 /, / / /, / / S_5 S_6 /, / / Next State/OutputTable next state/output state input S_ S_ / S_2 / S_ S_3 / S_4 / S_2 S_4 / S_4 / S_3 S_5 / S_5 / S_4 S_5 / S_6 / S_5 S_ / S_ / S_6 S_ / - / - The vertices of the state transition graph of a Mealy machine are labeled with the states. The branches are labeled with () the input that causes a transition to the indicated next state, and (2) with the output that is asserted in the present state for that input. The state transition is synchronized to a clock. The state table summarizes the machine's behavior in tabular format.

Copyright 2, 23 MD Ciletti 93 DESIGN OF A FINITE STATE MACHINE - EXAMPLE (Cont.) To design a D-type flip-flop realization of a FSM having the behavior described by a state transition graph, () select a state code, (2) encode the state table, (3) develop Boolean equations describing the input of a D-type flip-flop, and (4) using K-maps, optimize the Boolean equations. Next State/Output Table next state/output state input S_ S_ / S_2 / S_ S_3 / S_4 / S_2 S_4 / S_4 / S_3 S_5 / S_5 / S_4 S_5 / S_6 / S_5 S_ / S_ / S_6 S_ / - / - State Assigment q q 2 q S_ S_ S_6 S_4 S_2 S_5 S_3 Encoded Next state/ Output Table state next state output q 2 q q q + 2 q + q + input input S_ S_ S_2 S_3 S_4 S_5 S_6 - - - - - -

Copyright 2, 23 MD Ciletti 94 DESIGN OF A FINITE STATE MACHINE - EXAMPLE (Cont.) q B in q 2 q S_ S_ S_ S_ x S_6 S_6 S_4 S_4 S_5 S_5 S_3 S_3 x x S_2 q + = q ' S_2 q B in q 2 q S_ S_ S_ S_ x S_6 S_6 S_4 S_4 S_5 S_5 S_3 S_3 x x S_2 q + = q S_2 Note: We will optimize the equations individually. In general - this does not necessarily produce the optimal (area, speed) realization of the logic. We'll address this when we consider synthesis. q B in q 2 q S_ S_ S_ x x x S_ S_6 S_6 S_4 S_4 S_5 S_5 S_3 S_3 S_2 S_2 q B in q 2 q x x x S_ S_ S_ S_ S_6 S_6 S_4 S_4 S_5 S_5 S_3 S_3 S_2 S_2 q + 2 = q 'q 'B in + q 2 'q B in ' + q 2 q q q + 2 = q 'q 'B in + q 2 'q B in ' + q 2 q q + q 2 = q 'q 'B in q 2 'q B in ' q 2 q q q + 2 = q 'q 'B in q 2 'q B in ' q 2 q q q 2 + = q 'q 'B in + q 2 'q B in ' + q 2 q q B out = q 2 'B in ' + q 2 B in

Copyright 2, 23 MD Ciletti 95 DESIGN OF A FINITE STATE MACHINE - EXAMPLE (Cont.) Realization of the sequential BCD-to-Excess-3 code converter (Mealy machine):

Copyright 2, 23 MD Ciletti 96 DESIGN OF A FINITE STATE MACHINE - EXAMPLE (Cont.) Simulation results for Mealy machine: B_in B_out Note: s3 = 2