How to Design a Sequential Counter

Similar documents
RS flip-flop using NOR gate

Section 6.8 Synthesis of Sequential Logic Page 1 of 8

Chapter 9 Counters. Clock Edge Output Q 2 Q 1 Q

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

RS flip-flop using NOR gate

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

EE292: Fundamentals of ECE

Flip-Flops and Sequential Circuit Design

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

`COEN 312 DIGITAL SYSTEMS DESIGN - LECTURE NOTES Concordia University

CPS311 Lecture: Sequential Circuits

ASYNCHRONOUS SEQUENTIAL CIRCUIT CONCEPTS

MC9211 Computer Organization

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).

Chapter 5: Synchronous Sequential Logic

Chapter 4. Logic Design

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

Digital Logic Design Sequential Circuits. Dr. Basem ElHalawany

Unit 11. Latches and Flip-Flops

Contents Circuits... 1

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

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

1. a) For the circuit shown in figure 1.1, draw a truth table showing the output Q for all combinations of inputs A, B and C. [4] Figure 1.

1.b. Realize a 5-input NOR function using 2-input NOR gates only.

Department of CSIT. Class: B.SC Semester: II Year: 2013 Paper Title: Introduction to logics of Computer Max Marks: 30

Registers & Counters. Logic and Digital System Design - CS 303 Erkay Savaş Sabanci University

Other Flip-Flops. Lecture 27 1

Digital Logic Design I

Lecture 8: Sequential Logic

CHAPTER 4: Logic Circuits

Chapter 5 Sequential Circuits

Synchronous Sequential Logic

ELCT201: DIGITAL LOGIC DESIGN

6. Sequential Logic Flip-Flops

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

Digital Circuits ECS 371

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

Chapter 11 State Machine Design

Lecture 11: Synchronous Sequential Logic

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

UNIT IV. Sequential circuit

EET2411 DIGITAL ELECTRONICS

Asynchronous (Ripple) Counters

Department of Electrical and Computer Engineering Mid-Term Examination Winter 2012

Chapter 8 Sequential Circuits

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

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

Agenda. EE 260: Introduction to Digital Design Counters and Registers. Asynchronous (Ripple) Counters. Asynchronous (Ripple) Counters

Decade Counters Mod-5 counter: Decade Counter:

Sri Vidya College of Engineering And Technology. Virudhunagar Department of Electrical and Electronics Engineering

Registers and Counters

Chapter 5 Synchronous Sequential Logic

MODEL QUESTIONS WITH ANSWERS THIRD SEMESTER B.TECH DEGREE EXAMINATION DECEMBER CS 203: Switching Theory and Logic Design. Time: 3 Hrs Marks: 100

Chapter. Synchronous Sequential Circuits

Review of digital electronics. Storage units Sequential circuits Counters Shifters

UNIT-3: SEQUENTIAL LOGIC CIRCUITS

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

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

Registers and Counters

Digital Circuit And Logic Design I. Lecture 8

Digital Circuit And Logic Design I

Rensselaer Polytechnic Institute Computer Hardware Design ECSE Report. Lab Three Xilinx Richards Controller and Logic Analyzer Laboratory

Synchronous Sequential Logic. Chapter 5

Synchronous Sequential Logic

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

Sequential Logic Circuits

Registers & Counters. BME208 Logic Circuits Yalçın İŞLER

CHAPTER 4: Logic Circuits

Synchronous Sequential Logic

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

Dr.Mohamed Elmahdy Winter 2015 Eng.Yasmin Mohamed. Problem Set 6. Analysis and Design of Clocked Sequential Circuits. Discussion: 7/11/ /11/2015

Registers, Register Transfers and Counters Dr. Fethullah Karabiber

DIGITAL TECHNICS. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute

CHAPTER1: Digital Logic Circuits

Vignana Bharathi Institute of Technology UNIT 4 DLD

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

Dr. Shahram Shirani COE2DI4 Midterm Test #2 Nov 19, 2008

DALHOUSIE UNIVERSITY Department of Electrical & Computer Engineering Digital Circuits - ECED 220. Experiment 4 - Latches and Flip-Flops

Sequential Logic and Clocked Circuits

ECE 301 Digital Electronics

In this lecture we will work through a design example from problem statement to digital circuits.

Chapter 5 Sequential Circuits

Logic. Andrew Mark Allen March 4, 2012

10.1 Sequential logic circuits are a type of logic circuit where the output of the circuit depends not only on

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

DIGITAL CIRCUIT LOGIC UNIT 11: SEQUENTIAL CIRCUITS (LATCHES AND FLIP-FLOPS)

Chapter 5 Sequential Circuits

R13 SET - 1 '' ''' '' ' '''' Code No: RT21053

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

LATCHES & FLIP-FLOP. Chapter 7

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

Chapter 3. Boolean Algebra and Digital Logic

To design a sequential logic circuit using D-Flip-flop. To implement the designed circuit.

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

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

ELCT201: DIGITAL LOGIC DESIGN

Chapter 2. Digital Circuits

Chapter 3 Unit Combinational

Chapter 3: Sequential Logic Systems

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

Transcription:

How to Design a Sequential ounter harles. ameron, DR, USN January 6, 2005 ontents 1 Introduction 2 2 Specifying the ount Sequence 2 3 Generating a State Table 2 4 Minimizing the Logic Using Karnaugh Maps 4 5 Implementing the Design Using D-Flip-flops 4 6 Implementing the Design Using JK-Flip-flops 5 7 Implementing the Design Using T-Flip-flops 7 8 omparison of the Three Implementations 9 List of Figures 1 Implementation of the Synchronous ounter Using D-Flip-flops. 4 2 Implementation of the Synchronous ounter Using JK-Flip-flops. 6 3 Implementation of the Synchronous ounter Using T-Flip-flops.. 8 List of Tables 1 Initial State Table.......................... 2 2 State Table Including Next States................. 3 3 State Table Including D-Flip-flop Inputs Required........ 3 4 Karnaugh Maps for D-Flip-flop Implementation.......... 4 5 ctivation Table for a JK-Flip-flop................. 5 6 State Table Including JK-Flip-flop Inputs Required........ 5 7 Karnaugh Maps for Implementing f Using JK-Flip-flops..... 6 8 ctivation Table for a T-Flip-flop.................. 7 1

9 State Table Including T-Flip-flop Inputs Required........ 7 10 Karnaugh Maps for Implementing f Using T-Flip-flops...... 8 1 Introduction The purpose of this document is to illustrate the design process for implementing a sequential circuit to generate an arbitrary sequence of output numbers. The restriction imposed for simplicity is that a number appear only once in the sequence and that the sequence is repeated indefinitely. We also illustrate a means for initializing the counter to an arbitrary initial state using switches or pushbuttons. 2 Specifying the ount Sequence desired sequence can come from nearly any approach. From the point of view of this article, it is completely arbitrary. Our example will specify a 3-bit number sequence which, in decimal, is 5, 7, 3, 2, and 6, repeated indefinitely. In binary this is 101, 111, 011, 010, and 110. 3 Generating a State Table To start with, write all the numbers from 0 to 2 n 1 in a column and place their binary equivalents beside them, as shown in Table 1. We shall label the binary bits,, and. These represent the bits of the 3-bit number from most significant bit to least significant bit. For some of these rows, we care urrent State 0 0 0 0 1 0 0 1 2 0 1 0 3 0 1 1 4 1 0 0 5 1 0 1 6 1 1 0 7 1 1 1 Table 1: Initial State Table what state the counter goes to next. We ll assume that for any states not in the list 5, 7, 3, 2, and 6 that we do not care about what follows them. This rests on the belief that these states will never occur. We can cause them not to occur by initializing the counter to one of the states in the list say, 5 or 6 and trusting 2

that no gamma rays will strike the counter and put it into one of the forbidden (undesirable) states. The next step in the process, then, is to expand our table to specify the next states, as shown in Table 2. For example, looking at line 5, we see that the next state should be 7, or 111 in binary. Similarly, in row 7 we see that the next state should be a 3, or 011 in binary. urrent State Next State 0 0 0 0 1 0 0 1 2 0 1 0 6 1 1 0 3 0 1 1 2 0 1 0 4 1 0 0 5 1 0 1 7 1 1 1 6 1 1 0 5 1 0 1 7 1 1 1 3 0 1 1 Table 2: State Table Including Next States The next step is to add in the signals needed to force the flip-flops to assume the desired values. This is particularly easy to do with D-flip-flops since the D-input of a D-flip-flop is exactly the same as the value we want the flip-flop to take on. urrent State Next State Flip-flop ontrols D D D 0 0 0 0 1 0 0 1 2 0 1 0 6 1 1 0 1 1 0 3 0 1 1 2 0 1 0 0 1 0 4 1 0 0 5 1 0 1 7 1 1 1 1 1 1 6 1 1 0 5 1 0 1 1 0 1 7 1 1 1 3 0 1 1 0 1 1 Table 3: State Table Including D-Flip-flop Inputs Required We now have a specification for the control signals we need. There are three functions to implement: D, D, and D. 3

4 Minimizing the Logic Using Karnaugh Maps We need three Karnaugh maps, one for each of the functions D, D, and D. D 0 1 01 1 0 11 1 0 D = + D 0 1 01 1 1 11 0 1 D = + D 0 1 01 0 0 11 1 1 D = Table 4: Karnaugh Maps for D-Flip-flop Implementation 5 Implementing the Design Using D-Flip-flops n implementation for the equations derived in Table 4 appears in Figure 1. D D D LK LK LK LK D = + D = + D = Figure 1: Implementation of the Synchronous ounter Using D-Flip-flops 4

6 Implementing the Design Using JK-Flip-flops To change the design from one using D-flip-flops to one using JK-flip-flops requires considering what it takes to force a JK-flip-flop from one state to another. Table 5 shows this. Output States Inputs Required old new J K 0 0 0 0 1 1 1 0 1 1 1 0 Table 5: ctivation Table for a JK-Flip-flop We can use this information to fill in the columns of a revised state table. Whereas Table 3 showed the control signals required to operate D-flip-flops, Table 6 shows the control signals required to operate JK-flip-flops. There are twice as many control signals because each flip-flop now has two control signals, not just one. This is unappealing superficially but the extra investment in functions often results in less complex logic circuitry. However, we won t find out unless we go through the design process. urrent State Next State Flip-flop ontrols J K J K J K 0 0 0 0 1 0 0 1 2 0 1 0 6 1 1 0 1 0 0 3 0 1 1 2 0 1 0 0 0 1 4 1 0 0 5 1 0 1 7 1 1 1 0 1 0 6 1 1 0 5 1 0 1 0 1 1 7 1 1 1 3 0 1 1 1 0 0 Table 6: State Table Including JK-Flip-flop Inputs Required In Table 7 the controls of Table 6 have been placed in Karnaugh maps to facilitate obtaining minimal logic equations, shown below each Karnaugh map. Figure 2 shows our implementation of the synchrounous counter using JKflip-flops. ircuitry to permit the state to be initialized to 101 2 = 5 10 has been added using the preset and clear functions of these JK-flip-flops. The input of flip-flop, the input of flip-flop, and the input of flip-flop are asserted whenever the ST RT signal is applied, forcing the binary value 101 2 into the three-flip-flop counter immediately, without waiting for a high-going LOK-transition. Otherwise these inputs are tied to ground via resistor R. 5

J 0 1 01 1 0 11 10 J = K 0 1 01 11 0 1 10 0 K = J 0 1 01 11 J = 1 K 0 1 01 0 0 11 1 0 10 K = J 0 1 01 0 11 1 10 J = K 0 1 01 1 11 0 10 0 K = Table 7: Karnaugh Maps for Implementing f Using JK-Flip-flops V STRT R J LK K J LK K J LK K LK Figure 2: Implementation of the Synchronous ounter Using JK-Flip-flops. ircuitry to put the counter into state 101 2 = 5 10 has been added using the preset and set functions of these JK-flip-flops. 6

The other three asynchronous inputs are never asserted, so they are always tied to ground. These are the inputs of flip-flops and and the input of flip-flop. 7 Implementing the Design Using T-Flip-flops To change the design from one using D-flip-flops or JK-flip-flops to one using T-flip-flops requires considering what it takes to force a T-flip-flop from one state to another. Table 8 shows this. Output States Inputs Required old new T 0 0 0 0 1 1 1 0 1 1 1 0 Table 8: ctivation Table for a T-Flip-flop We can use this information to fill in the columns of a revised state table. Whereas Table 3 showed the control signals required to operate D-flip-flops, Table 9 shows the control signals required to operate T-flip-flops. There are just as many control signals because, as with D-flip-flops, each flip-flop has only one control signal, not two as was the case with JK-flip-flops. urrent State Next State Flip-flop ontrols T T T 0 0 0 0 1 0 0 1 2 0 1 0 6 1 1 0 1 0 0 3 0 1 1 2 0 1 0 0 0 1 4 1 0 0 5 1 0 1 7 1 1 1 0 1 0 6 1 1 0 5 1 0 1 0 1 1 7 1 1 1 3 0 1 1 1 0 0 Table 9: State Table Including T-Flip-flop Inputs Required In Table 10 the controls of Table 9 have been placed in Karnaugh maps to facilitate obtaining minimal logic equations, shown below each Karnaugh map. Figure 3 shows our implementation of the synchrounous counter using T- flip-flops. ircuitry to permit the state to be initialized to 110 2 = 6 10 has been added using the preset and clear functions of these T-flip-flops. Note that we initialize the counter in the JK-flip-flop implementation to 5 10, not 6 10. This 7

T 0 1 01 1 0 11 0 1 10 0 T = + T 0 1 01 0 0 11 1 0 T = + T 0 1 01 0 1 11 1 0 10 0 T = + Table 10: Karnaugh Maps for Implementing f Using T-Flip-flops V R STRT T LK T LK T LK LK + + + Figure 3: Implementation of the Synchronous ounter Using T-Flip-flops. s with the JK-flip-flop implementation, this implementation contains circuitry to put the counter into an initial state. In this case, we chose an initial state 110 2 = 6 10, just to illustrate that any initial state is easy to obtain. s before, we use the asynchronous preset and clear functions of these flip-flops, with the difference that these are now T-flip-flops, not JK-flip-flops. lso, we have made the asynchronous inputs active-low inputs rather than active-high inputs to illustrate what is needed to accommodate this change. Since the term appears twice, we can simply use the output of the gate that computes it in the two places it is required. 8

change is simply to show that it is easy to start with any desired initial state, as long as it is in the list of desired states. lso, the flip-flops used here have active-low asynchronous inputs, not active-high asynchronous inputs as our JKflip-flops did. Thus the input of flip-flop, the input of flip-flop, and the input of flip-flop are asserted whenever the ST RT signal is applied, forcing the binary value 110 2 into the three-flip-flop counter immediately, without waiting for a high-going LOK-transition. Otherwise these inputs are tied to V via resistor R. The other three asynchronous inputs are never asserted, so they are always tied to V. These are the inputs of flip-flops and and the input of flip-flop. Our implementation shows that we have eliminated one 2-input ND gate by noting that the term is needed as part of both T and T. We can compute it once and apply it in the two places it is needed, saving a gate. 8 omparison of the Three Implementations comparison of the control-signal logic in the three implementations of the synchronous counter shows which designs require the most circuitry. Generally, more circuitry requires more debugging effort and so is to be avoided. This comparison shows an unusual result: the JK-flip-flop implementation takes two 2-input ND gates, compared to two 2-input OR gates for the D-flipflop implementation. This is unusual because the use of JK-flip-flops usually leads to fewer input gates, not the same number or more. The comparison also reveals another unusual result: the T-flip-flop implementation takes substantially more gates than either of the other two implementations. It requires four 2-input ND gates, three 2-input OR gates, and one 3-input ND gate. It is more common for T-flip-flop implementations to be simpler than their corresponding D-flip-flop implementations. In general, there is no way to predict which of several possible equivalent implementations will be most economical unless this kind of detailed design is done. Here, we could pick either the D-flip-flop or the JK-flip-flop implementation as the most economical, at least in the sense that they require less debugging and less hardware. 9