Chapter 5. Introduction

Similar documents
analysis with T flip-flops Follow the same procedure for JK flip-flops next state is determined by characteristic table or characteristic equation

Chapter 5 Synchronous Sequential Logic

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

Synchronous Sequential Logic

Chapter 5: Synchronous Sequential Logic

WEEK 10. Sequential Circuits: Analysis and Design. Page 1

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

Part II. Chapter2: Synchronous Sequential Logic

EECS 3201: Digital Logic Design Lecture 9. Ihab Amer, PhD, SMIEEE, P.Eng.

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

Digital Logic Design I

Chapter 5 Synchronous Sequential Logic

Sequential Logic Circuits

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

Synchronous Sequential Logic. Chapter 5

Synchronous Sequential Logic

Synchronous Sequential Logic

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

EECS150 - Digital Design Lecture 19 - Finite State Machines Revisited

Chapter. Synchronous Sequential Circuits

Lecture 11: Synchronous Sequential Logic

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

Chapter 5 Synchronous Sequential Logic

CHAPTER 4: Logic Circuits

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

CHAPTER 4: Logic Circuits

MC9211 Computer Organization

Logic Design. Flip Flops, Registers and Counters


2 Sequential Circuits

Unit-5 Sequential Circuits - 1

ELCT201: DIGITAL LOGIC DESIGN

Finite State Machine Design

Introduction to Sequential Circuits

Unit 11. Latches and Flip-Flops

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

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

ELCT201: DIGITAL LOGIC DESIGN

Synchronous Sequential Logic

`COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

Combinational / Sequential Logic

Chapter 5 Sequential Circuits

Introduction to Microprocessor & Digital Logic

ELCT201: DIGITAL LOGIC DESIGN

Experiment 8 Introduction to Latches and Flip-Flops and registers

Other Flip-Flops. Lecture 27 1

CHAPTER1: Digital Logic Circuits

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

Multiplexor (aka MUX) An example, yet VERY useful circuit!

EECS150 - Digital Design Lecture 15 Finite State Machines. Announcements

Lecture 8: Sequential Logic

MODULE 3. Combinational & Sequential logic

CS8803: Advanced Digital Design for Embedded Hardware

CHAPTER 6 COUNTERS & REGISTERS

D Latch (Transparent Latch)

Computer Architecture and Organization

ECE 341. Lecture # 2

Principles of Computer Architecture. Appendix A: Digital Logic

Synchronous Sequential Logic

Asynchronous (Ripple) Counters

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

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

Flip-Flops and Sequential Circuit Design

Chapter 5 Sequential Circuits

Section 6.8 Synthesis of Sequential Logic Page 1 of 8

INTRODUCTION TO SEQUENTIAL CIRCUITS

Chapter 8 Sequential Circuits

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

Unit 9 Latches and Flip-Flops. Dept. of Electrical and Computer Eng., NCTU 1


Engr354: Digital Logic Circuits

Chapter 3 Unit Combinational

Module -5 Sequential Logic Design

UNIT IV. Sequential circuit

More design examples, state assignment and reduction. Page 1

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

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

Sequential Design Basics

The basic logic gates are the inverter (or NOT gate), the AND gate, the OR gate and the exclusive-or gate (XOR). If you put an inverter in front of

The reduction in the number of flip-flops in a sequential circuit is referred to as the state-reduction problem.

The word digital implies information in computers is represented by variables that take a limited number of discrete values.

Logic Design II (17.342) Spring Lecture Outline

CPS311 Lecture: Sequential Circuits

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

Introduction to Computer Engineering EECS dickrp/eecs203/

6. Sequential Logic Flip-Flops

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

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

problem maximum score 1 28pts 2 10pts 3 10pts 4 15pts 5 14pts 6 12pts 7 11pts total 100pts

Chapter Contents. Appendix A: Digital Logic. Some Definitions

LATCHES & FLIP-FLOP. Chapter 7

Universidad Carlos III de Madrid Digital Electronics Exercises

ELE2120 Digital Circuits and Systems. Tutorial Note 7

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

CSE Latches and Flip-flops Dr. Izadi. NOR gate property: A B Z Cross coupled NOR gates: S M S R Q M

ECE 301 Digital Electronics

EE292: Fundamentals of ECE

LAB #4 SEQUENTIAL LOGIC CIRCUIT

Counters

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

Transcription:

Chapter 5 Synchronous Sequential Logic Chapter 5 Introduction Circuits require memory to store intermediate data Sequential circuits use a periodic signal to determine when to store values. A clock signal can determine storage times Clocksignals are periodic Single bit storage element is a flip flop A basic type of flip flop is a latch Latches are made from logic gates NAND, NOR, AND, OR, Inverter Chapter 5 2

Synchronous vs. Asynchronous Synchronous sequential circuit is a system whose behavior can be defined from the knowledge of its signal at discrete instants of time Asynchronous sequential circuit is a system whose behavior can be defined from the knowledge of its signals at any point of time Chapter 5 3 Synchronous Sequential Circuit Inputs Combinational circuit Next state Flip Flops Outputs Present state Timing signal (clock) Clock a periodic external event Clock synchronizes when when current current state state changes happen keeps (input) keeps system system well-behaved makes makes it it easier easier to to design design and and build build Chapter large large 5 systems 4 2

Cross Coupled Inverters State State 2 What if there is an inverter in the feedback path? Chapter 5 5 R (reset) S (set) SR Latch using NOR Q Q S R Q Q Set Reset Stable S-R latch made from cross-coupled NORs If Q =, set state If Q =, reset state Usually S= and R= S= and R= generates unpredictable results Chapter 5 6 3

SR latch using NAND S R Q Q S R Q Q Disallowed Set Reset Store Latch made from cross-coupled NANDs Sometimes called S -R latch Usually S= and R= S= and R= generates unpredictable results Chapter 5 7 SR Latch Chapter 5 8 4

SR Latch with Control Input Occasionally, desirable to avoid latch changes C = disables all latch state changes Control signal enables data change when C = Right side of circuit same as ordinary S-R latch. Chapter 5 9 SR Latch with Control Input R Q C S Q Outputs change when C is low: RESET and SET Otherwise: HOLD Chapter 5 5

D Latch D C X S Q Q Y R Chapter 5 D Latch One wat to avoid the indeterminate state in the SR latch when both S and R are This is done by inverting S and having the inverted S as R. As long as C=, no change. If C= D is delivered to Q and D to Q C D Q Q X Q Q Chapter 5 2 6

Symbols Setting and resetting is done using logical signal Chapter 5 3 Flip-Flops The state of the latch or flip-flop is switched by a change in the control input, this is called a trigger The D latch with pulses in its control input. As long as the pulse input is, any changes in the D input is transferred to the output. When the state of the latch changes, if the control pulse is still at logic, any changes to the input (possible a feedback from the output) will change the output. Because of this, the output of a latch can not be applied directly to the input of this or other latches Chapter 5 4 7

Flip-Flop A better way is if the flip-flop is triggered during the transition of the control input. A clock pulse goes through 2 transitions, -> and ->. The first is called ve edge, the second is positive edge. There are two ways to implement this, either by using master-salve or by special design of the circuit. Chapter 5 5 Edge-Triggered Flip-Flop (Master-Slave) Any changes in the input can affect only Y as long as CLK=; After CLK=, Y propagates to Q, byt the master is locked. Chapter 5 6 8

D-Type Positive-Edge-triggered Flip-Flop CLK D S R Q Q Q Q Chapter 5 7 Edge-triggered Flip-Flop Lo-Hi edge Hi-Lo edge Chapter 5 8 9

J-K Flip-Flop Created from D flop J sets K resets J=K= -> invert output J K CLK Q Q Q Q TOGGLE Chapter 5 9 Positive Edge Triggered T Flip-Flop Created from D flop T= -> keep current K resets T= -> invert current T C Q Q Q Q TOGGLE Chapter 5 2

Characteristic Tables Characteristic tables Describes the operation of the flip-flop in a tabular form JK Flip Flop J K Q(t+) Q(t) D Flip Flop D Q(t+) F Flip Flop T Q(t+) Q(t) Q (t) Q (t) Chapter 5 2 Characteristic Equation For D Flip-Flop Q(t+)=D For JK Flip-Flop Q(t+)=JQ + K Q For T Flip-Flop Q(t+)=T Q = TQ + T Q Chapter 5 22

Analysis of Clocked Sequential Circuits State equation, state table State diagram: states are represented by circuits, transitions by arcs labeled I/O Flip-Flop Equations: Chapter 5 23 Analysis x D Q Q D D D Q Q Q Q Q Q y Output equation State equations Clk y(t) = x(t)q (t)q (t) Q (t+) = D (t) = x(t)q (t) Q (t+) = D (t) = x(t) + Q (t) Chapter 5 24 2

State Table Sequence of outputs, inputs, and flip flop states enumerated in state table Present state indicates current value of flip flops Next state indicates state after next rising clock edge Output is output value on current clock edge State Table Present State Next State Output x= x= x= x= Q (t) Q (t) Q (t+) Q (t+) Chapter 5 25 State Table All possible input combinations enumerated All possible state combinations enumerated Separate columns for each output value. Sometimes easier to designate a symbol for each state. Let: s = s = s 2 = s 3 = Present State s s s 2 s 3 Next State Output x= x= x= x= s s 2 s 2 s 2 s s 3 s 2 s 3 Chapter 5 26 3

State Diagram Present State Next State Output x= x= x= x= / / / / / / / / Chapter 5 27 State Diagram Each state has two arrows leaving One for x = and one for x = Unlimited arrows can enter a state Note use of state names in this example Easier to identify / / s s / s 2 / / / / s 3 / Chapter 5 28 4

Flip-Flop Input Equations Boolean expressions which indicate the input to the flip flops. x D Q Q D D D Q Q Q Q Q Q y Clk D Q = xq D Q = x + Q Format implies type of flop used Chapter 5 29 Analysis with D Flip-Flop Chapter 5 3 5

J-K Flip-Flop J K J K CLK Chapter 5 3 J-K Flip Flop Present Input Next Flip-Flop Inputs A B X A B J A K A J B K B Chapter 5 32 6

J-K Flip-Flop Chapter 5 33 Mealy and Moore Models Mealy model: the output is a function of both the present state and the input. Moore model: The output is a function of the present state only. In a Moore model, the output is synchronized with the clock (since it changes only if the state changes). In a Mealy model the output may change if the input changes during the clock cycle. Chapter 5 34 7

HDL For Sequential Circuits Chapter 5 35 Behavioral Modeling iitial begin clock= b; repeat(3) # clock = ~clock end initial begin clock = b; #3 $finish; end; always # clock=~clock; Chapter 5 36 8

Behavioral Modeling One ways to use always statement always @ (A or B or reset) What fellows will be done if any changes in A, B, or reset, Or, we can use Always @ (posedge clock or negedge reset) Chapter 5 37 Behavioral Modeling Blocking assignmnet B=A; C=B+; A is assigned to B, and the new value is incremented Non-blocking assignment B<=A; C<=B+; Incrementing old value of A, because assignment is done after all the values in the block are done Chapter 5 38 9

Flip-Flops and Latches //Description od D latch module D_Latch (Q,D,control); output Q; input D, control; reg Q; always @ (control or D) if (control) Q=D; endmodule //D Flip-Flop module D_FF(Q, D, CLK); output Q; input D, CLK; reg Q; always @ (posedge CLK) Q=D; endmodule Chapter 5 39 Flip-Flops and Latches //D Flip-Flop with Asynchronous reset module DFF(Q,D,CLK,RST); output Q; input D, CLK,RST; reg always @(posedge CLK or negedge RST); if(~rst) Q= b; else Q=D; endmodule Only if RST= can posedge clock event synchronously D->Q Chapter 5 4 2

Other Types of Flip-Flop //F Flip-Flop (using D) Module TFF(Q,T,CLK,RST); Output Q; Input T,CLK,RST; Wire DT; Assign DT=Q^T; DFF TF(Q,DT,CLK,RST); endmodule //JK Flip-Flop (using D) Module JKFF(Q,T,CLK,RST); Output Q; Input JK,CLK,RST; Wire JK; Assign JK=(J&~Q) (~k&q); DFF JK(Q,JK,CLK,RST); endmodule Chapter 5 4 Other Types of Flip-Flop //Functional Description of JK Flip-Flop Module JK_FF(J,K,CLK,Q,Qnot); output Q,Qnot; input J,K,CLK; reg Q; assign Qnot=~Q allways @ (posedge CLK) case ({J,K}) 2 b: Q=Q; 2 b: Q= b; 2 b: Q= b; 2 b: Q=~Q; endcase endmodule Chapter 5 42 2

State Diagram //Mealy state diagram module Mealy_Model(x,y,CLK,RST); input x,clk,rst; output y; reg y; reg [:] Prstate, Nxtstate; parameter S=2 b, s=2 b, s2=2 b, S3=2 b; always @ (posedge CLK or negedge RST) if(~rst) Prstate = S; else Prstate=Nxtstate; always @ (Prstate or x) case(prstate) S: if(x) Nxtstate = S; else Nxtstate = S; S: if (x) Nxtstate = S3; else Nxtstate = S; S2: if (x) Nxtstate = S; else Nxtstate = S2; always @ (Prstate or x) case(prstate) s: y=; S: if (x) y= b; else y= b; S2: if (x) y=/b; else y= b; S3: if (x) y= b; else y= b; endcsde endmodule endcase S3: if(x) Nxtstate = S2; else Nxtstate = S; Chapter 5 43 State Diagram //Moore state diagram module Mealy_Model(x,AB,CLK,RST); input x,clk,rst; output [:]AB;; reg [:] State; parameter S=2 b, s=2 b, s2=2 b, S3=2 b; always @ (posedge CLK or negedge RST) if(~rst) Prstate = S; else Prstate=Nxtstate; always @ (Prstate or x) case(prstate) S: if(~x) State = S; else State = S; S: if (x) State = s2; else State = S3; S: if (x) State = S3; else State = S2; endcase assign AB=State; endmodule S: if(x) State = S; else State = S3; Chapter 5 44 22

Structural Description //Figure 5-2 in the text book module TCircuit(x,y,A,B,CLK,RST); input x. CLK, RST; output y,a,b; wire TA,TB; //Flip-Flop input equation assign TB=x, TA=x & B; assign y = A & B; // Instantiate 2 ff s T_FF BF (B,TB,CLK,RST); T_FF AF (A,TA,CLK,RST); endmodule Chapter 5 45 Structural Description //test fixture for the previous design module testtff; reg x, CLK, RST; wire y,a,b; TCircuit (x,y,a,b,clk,rst); initial begin RST=; CLK=; #5 RST = ; repeat (6); #5 CLK= ~CLK; end initial begin x=; #5 x=; repeat (8); # x=~x end; endmodule Chapter 5 46 23

State Reduction and Assignment In this part, we study some properties of the sequential circuits in order to reduce the number of gates or flip-flops. If we have m flip-flops, we can have up tp 2 m states. Thus reducing the number of states, may result in reduction of the number of flip-flops. Sometimes, we care only about the output produced by a specific input sequence, while in others (counters) the states are important (considered as the output). Chapter 5 47 State Reduction and Assignment There are infinite number of sequences that could be applied to the circuit, producing some output. Two circuits (may have different states) will produce the same output for the same input are considered equivalent (from the input output point of view). We want to find a way to reduce the number of states and keeping the same input-output equivalence. Chapter 5 48 24

State Reduction State a a b c d e f g f g Input Output Chapter 5 49 State reduction next state Output Present State x= x= x= x= a a b b c d c a d d e f e a f f g f g a f look for any two state that go to the same next state and have the same output for both input combination (states g and e), remove one and replace it by the other Chapter 5 5 25

State reduction next state Output Present State x= x= x= x= a a b b c d c a d d e f e a f f e f States d and f are equivalent Chapter 5 5 State reduction next state Output Present State x= x= x= x= a a b b c d c a d d e d e a d Chapter 5 52 26

State Assignment In this stage, you have to map states to binary numbers. You can use any mapping scheme. binary Gray code one-hot (more flip-flops) Chapter 5 53 Design Procedure From the word description Derive the state diagram Reduce the number of states if necessary Assign Binary values to states. Obtain the binary-coded state table Choose the type of flip-flop Derive the simplified flip-flop input and output equations Draw the logic diagram Chapter 5 54 27

Design Design a circuit that detects three or more consecutive ones. S S S 2 S 3 Chapter 5 55 Present State State table for sequence detector Input Next State Output A B x A B y Chapter 5 56 28

Synthesis with D Flip-Flops Construct the state table A ( t + ) = B ( t + ) = D D A B y = = = AB Ax Ax + D D y ( A, B, x ) = A B Bx ( A, B, X ) = ( A, B, x ) = ABx + B ' x ( 6, 7 ) ABX ABX ( 3,5, 7 ) (,5, 7 ) Chapter 5 57 Synthesis with D Flip-Flops Chapter 5 58 29

Synthesis with J-K Flip-Flop With J-K flip-flop, it is not as easy as D, since the output is not the same as the previous input, we need an excitation table Q(t) Q(t+) J K X X X X Q(t) Q(t+) T Chapter 5 59 Present State Synthesis with J-K Flip-Flop Input Next State Output A B x A B y JA KA JB KB X X X X X X X X X X X X X X X X Chapter 5 6 3

Synthesis with J-K Flip Flop Chapter 5 6 Synthesis with J-K Flip-Flop Chapter 5 62 3

Example: Odd Number of s Assert output whenever input bit stream has odd # of 's Reset Even [] Odd [] Present State Input Next State Output State Diagram Note: Present state and output are the same value Chapter 5 63 Odd Number of s Example: Odd Parity Checker Next State/Output Functions NS = PS xor PI; OUT = PS Input CLK \Reset NS D Q PS/Output Q R Input Clk Output Chapter 5 64 32

Vending Machine Deliver package of gum after 5 cents deposited Single coin slot for dimes, nickels No change Design the FSM using combinational logic and flip flops Coin Sensor N D Reset Vending Machine FSM Open Gum Release Mechanism Clk Chapter 5 65 Vending Machine Reset N 5 D N D N, D 5 [open] Reuse states whenever possible Present State 5 5 Inputs D N X X Next State 5 X 5 5 X 5 5 X 5 Output Open X X X Symbolic State Table Chapter 5 66 33

State encoding Present State Q Q Inputs D N Next State D D X X X X X X X X Output Open X X X X Chapter 5 67 Vending Machine Q Q D N Q Q Q D N Q Q Q D N Q D N D N D N Q K-map for D D =D+Q +NQ Q K-map for D D =NQ +NQ +Q N + DQ Q Q Q K-map for Open Chapter 5 68 34

Vending Machine Q D Q D Q CLK D R Q Q Q N N Q Reset OPEN Q N Q N D CLK D R Q Q Q Q Reset Q D Chapter 5 69 3-bit Binary Counter Chapter 5 7 35

3-Bit Binary Counter Present State Next State F-F Inputs A 2 A A A 2 A A T A2 T A T A Chapter 5 7 3-Bit Binary Counter Chapter 5 72 36

3-Bit Binary Counter Chapter 5 73 Example (Mealy vs. Moore) Design a circuit that asserts its output for one cycle for every change in the input from to We will try two different approaches. Compare between them Chapter 5 74 37

Solution IN= ZERO OUT= CHANGE OUT= IN= IN= ONE OUT= IN= IN= ZERO CHANGE ONE IN PS NS OUT IN= Chapter 5 75 ZERO CHANGE ONE IN PS NS OUT Solution IN IN PS - - PS - - NS = IN PS NS = IN NS FF PS OUT IN PS - - OUT= PS PS IN NS FF PS Chapter 5 76 38

IN= OUT= IN= OUT= ZERO IN= OUT= Solution 2 Let ZERO=, ONE= IN PS NS OUT NS = IN, OUT = IN PS ONE IN= OUT= IN NS FF PS OUT Chapter 5 77 Comparison IN PS PS OUT Chapter 5 78 39

Comparison IN PS OUT Output may not be high long enough to be of any use Chapter 5 79 Comparison CLK IN OUT (solution A) OUT (solution B) Chapter 5 8 4