Chapter 7 The Design of Sequential Systems.

Slides:



Advertisements
Similar presentations
These slides incorporate figures from Digital Design
Advertisements

State-machine structure (Mealy)
A. Abhari CPS2131 Sequential Circuits Most digital systems like digital watches, digital phones, digital computers, digital traffic light controllers and.
Classification of Digital Circuits  Combinational. Output depends only on current input values.  Sequential. Output depends on current input values and.
Sequential Circuits1 DIGITAL LOGIC DESIGN by Dr. Fenghui Yao Tennessee State University Department of Computer Science Nashville, TN.
Multiplexors Sequential Circuits and Finite State Machines Prof. Sin-Min Lee Department of Computer Science.
Module 12.  In Module 9, 10, 11, you have been introduced to examples of combinational logic circuits whereby the outputs are entirely dependent on the.
CSCE 211: Digital Logic Design. Chapter 6: Analysis of Sequential Systems.
Sequential Logic Design with Flip-flops
ECE 331 – Digital System Design Introduction to and Analysis of Sequential Logic Circuits (Lecture #20) The slides included herein were taken from the.
ECE 331 – Digital System Design State Reduction and State Assignment (Lecture #22) The slides included herein were taken from the materials accompanying.
CSCE 211: Digital Logic Design
Overview Sequential Circuit Design Specification Formulation
Logic and Computer Design Fundamentals Registers and Counters
Sequential Circuits Problems(I) Prof. Sin-Min Lee Department of Mathematics and Computer Science Algorithm = Logic + Control.
Asynchronous and Synchronous Counters
A presentation on Counters
Digital Computer Design Fundamental
Synchronous Sequential Logic Part II
CSCE 211: Digital Logic Design Chin-Tser Huang University of South Carolina.
Chap 4. Sequential Circuits
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Charles Kime & Thomas Kaminski © 2008 Pearson Education, Inc. (Hyperlinks are active in View Show mode) Chapter 5 – Sequential Circuits Part 2 – Sequential.
1 Lecture 22 Sequential Circuits Analysis. 2 Combinational vs. Sequential  Combinational Logic Circuit  Output is a function only of the present inputs.
© 2009 Pearson Education, Upper Saddle River, NJ All Rights ReservedFloyd, Digital Fundamentals, 10 th ed Digital Fundamentals Tenth Edition Floyd.
Introduction to State Machine
CHAPTER 8 - COUNTER -.
Digital Logic of Computer Engineering KKU.1 Chapter 5 Sequential Systems Latches and Flip-flops Synchronous Counter Asynchronous.
1 State Reduction Goal: reduce the number of states while keeping the external input-output requirements unchanged. State reduction example: a: input 0.
1Sequential circuit design Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA by Erol Sahin and Ruken Cakici.
Counters.
Learning to Design Counters
Sahar Mosleh PageCalifornia State University San Marcos 1 More on Flip Flop State Table and State Diagram.
ENG241 Digital Design Week #7 Sequential Circuits (Part B)
CHAPTER 7 DESIGNING SEQUENTIAL SYSTEMS. CE6. A system with one input x and one output z such that z = 1 iff x has been 1 for at least three consecutive.
Revision Mid 1 Prof. Sin-Min Lee Department of Computer Science.
Synchronous Counter Design
Chapter 8 Solving Larger Sequential Problems.
Chapter 6 Analysis of Sequential Systems Sequential Memory Feedback.
5 - 1 Chapter 6 Analysis of Sequential Systems Chapter 6 Analysis of Sequential Systems 6.0 Introduction  Clocked System Clock A signal that alternates.
Lecture 14 State Machines II Topics State Machine Design Resolution with Text Design with D flip-flops Design with JK Readings: Chapter 7 November 11,
Sequential Circuit Design 05 Acknowledgement: Most of the following slides are adapted from Prof. Kale's slides at UIUC, USA.
State Diagrams Tuesday, 12 September State diagram Graphical representation of a state table. –Provides the same information as a state table. –A.
Overview Part 1 - Storage Elements and Sequential Circuit Analysis
Week #7 Sequential Circuits (Part B)
SLIDES FOR CHAPTER 15 REDUCTION OF STATE TABLES STATE ASSIGNMENT
4.
Lecture 13 State Machines / ROMs
Lecture 12 Analysis of Clocked Sequential Network
SLIDES FOR CHAPTER 13 ANALYSIS OF CLOCKED SEQUENTIAL CIRCUITS
CS 352 Introduction to Logic Design
CSCE 211: Digital Logic Design
FIGURE 5.1 Block diagram of sequential circuit
CSCE 211: Digital Logic Design
Sequential Circuits Most digital systems like digital watches, digital phones, digital computers, digital traffic light controllers and so on require.
Asynchronous Inputs of a Flip-Flop
Sequential Circuit - Counter -
CSCE 211: Digital Logic Design
State Reduction and State Assignment
CSCE 211: Digital Logic Design
KU College of Engineering Elec 204: Digital Systems Design
CSCE 211: Digital Logic Design
KU College of Engineering Elec 204: Digital Systems Design
DESIGN OF SEQUENTIAL CIRCUITS
Synchronous sequential
Synchronous Sequential
ECE 352 Digital System Fundamentals
CSCE 211: Digital Logic Design
EGR 2131 Unit 12 Synchronous Sequential Circuits
Chapter5: Synchronous Sequential Logic – Part 3
Presentation transcript:

Chapter 7 The Design of Sequential Systems

Five additional Continuing Examples(CE) Chapter 7 The Design of Sequential Systems Five additional Continuing Examples(CE) CE7. A Mealy system with one input x and one output z such that z = 1 at a clock time iff x is currently 1 and was also 1 at the previous two clock times. CE8. A Moore system with one input x and one output z, the output of which is 1 iff three consecutive 0 inputs occurred more recently than three consecutive 1 inputs. CE9. A Moore system with no inputs and three outputs, that represent a number from 0 to 7, such that the outputs cycle through the sequence 0 3 2 4 1 5 7 and repeat on consecutive clock inputs.

Chapter 7 The Design of Sequential Systems CE10. A Moore system with two inputs, x1 and x2, and three outputs, z1, z2, and z3, that represent a number from 0 to 7, such that the output counts up if x1 = 0 and down if x1 = 1, and recycles if x2 = 0 and saturates if x2 = 1. Thus, the following output sequences might be seen x1 = 0, x2 = 0: 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 … x1 = 0, x2 = 1: 0 1 2 3 4 5 6 7 7 7 7 7 7 7 7 7 … x1 = 1, x2 = 0: 7 6 5 4 3 2 1 0 7 6 5 4 3 2 1 0 … x1 = 1, x2 = 1: 7 6 5 4 3 2 1 0 0 0 0 0 0 0 0 0 … CE11. A bus controller that receives requests on separate lines, R0 to R3, from four devices desiring to use the bus. It has four outputs, G0 to G3, only one of which is 1, indicating which device is granted control of the bus for that clock period

Step 1 : From a word description, determine what to be stored in Chapter 7 The Design of Sequential Systems For Larger system, Step 1 : From a word description, determine what to be stored in memory, that is, what are the possible states. Step 2 : If necessary, code the inputs and outputs in binary. Step 3 : Derive a state table or state diagram to describe the behavior of the system. Step 4 : Use state reduction techniques to find a state table that produces the same input/output behavior, but has fewer states. Step 5 : Choose a state assignment, that is, code the states in binary. Step 6 : Choose a flip flop type and derive the flip flop input maps or tables. Step 7 : Produce the logic equation and draw a block diagram (as in the case of combinational systems).

(a) (b) (c) Chapter 7 The Design of Sequential Systems P 328 q q1 q2 A B 1 C D q q1 q2 A B 1 C D q q1 q2 A B 1 C D (a) (b) (c) P 328

The second half of the table corresponds to x = 1. Chapter 7 The Design of Sequential Systems q x q1 q2 q1* q2* A B 1 C D The first half of the design truth table corresponds to the first column of the state table(x = 0). The next state is 0 0 for the first four rows, since each of the states go to state A on a 0 input. The second half of the table corresponds to x = 1. P 328

Chapter 7 The Design of Sequential Systems 6 - 7 For a Moore system, q q1 q2 z A B 1 C D A separate table for the output, since it depends only on the two state variables. P 329

Chapter 7 The Design of Sequential Systems 6 - 8 The equations, q1* = xq2 + xq1 q2* = xq’2 + xq1 z = q1q2 This SOP solution requires 4 two-input AND gates and 2 two-input OR gates. P 329

Example 7.1 Design truth table: Chapter 7 The Design of Sequential Systems 6 - 9 Example 7.1 Design truth table: x q1 q2 q1* q2* A D 1 C B q q1 q2 z A D 1 C B P 330

The resulting maps: The resulting maps: q1* = xq’1q’2 + xq1q2 Chapter 7 The Design of Sequential Systems 6 - 10 The resulting maps: 1 00 01 11 10 q1 * q1 q2 x q2* The resulting maps: q1* = xq’1q’2 + xq1q2 q2* = xq’1 + xq’2 z = q’1q2 This implementation requires an extra gate and three extra gate inputs. P 330

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 11 7.1 FLIP FLOP DESIGN TECHNIQUES The flip flop design table is most readily obtained from the state diagram. q q* Input(s) 1 For each line of the truth table equivalent of the state table, and for each flip flop. Its present value and the desired next state. 1 D P 331

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 12 7.1 FLIP FLOP DESIGN TECHNIQUES The diagram indicates that if the flip flop is in state 0 and the desired next state is also 0, the only path is D = 0. q q* D 1 When the D flip flop. Don’t separate columns in the truth table for D1 and D2. They are identical to the q1* and q2* columns. D1 = xq2 + xq1 D2 = xq’2 + xq1 P 331

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 13 7.1 FLIP FLOP DESIGN TECHNIQUES P 331

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 14 7.1 FLIP FLOP DESIGN TECHNIQUES Repeat the process for the JK flip flop. 1 JK 00 01 10 11 To go from state 0 to state 0. Two choices : J = 0 and K = 0, or J = 0 and K = 1 (J must be 0 and it does not matter what K is – K is a don’t care.) q q* J K X 1 P 332

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 15 7.1 FLIP FLOP DESIGN TECHNIQUES x q1 q2 q1* q2* J1 K1 J2 K2 X 1 The truth table for the design requires four more columns for the four flip flop inputs. P 332

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 16 7.1 FLIP FLOP DESIGN TECHNIQUES 1 00 01 11 10 J1 q1 q2 x X J2 J3 J4 The flip flop input equations are J1 = xq2 K1 = x’ z = q1q2 J2 = x K2 = x’ + q’1 This requires just 2 two-input AND gates, 1 two-input OR gate, and a NOT for x’, by far the least expensive solution. P 332

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 17 7.1 FLIP FLOP DESIGN TECHNIQUES Example 7.2 The state diagram for the SR flip flop. 1 SR 00 01 10 1 0 0 1 The resulting SR flip flop design table is q1 q* S R X 1 P 333

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 18 7.1 FLIP FLOP DESIGN TECHNIQUES Following the same technique as for JK flip flop. x q1 q2 q1* q2* S1 R1 S2 R2 X 1 P 333

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 19 7.1 FLIP FLOP DESIGN TECHNIQUES 1 00 01 11 10 S1 q1 q2 x X R1 S2 R2 The input equations are S1 = xq2 R1 = x’ z = q1q2 S2 = xq’2 R2 = x’ + q’1q2 This requires 4 two-input AND gates, 1 two-input OR gate, and 1 NOT gate for x’. P 334

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 20 7.1 FLIP FLOP DESIGN TECHNIQUES Example 7.3 The state diagram for the T flip flop. 1 T There is only one way to get from any state to any other state. q1 q* T 1 P 334

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 21 7.1 FLIP FLOP DESIGN TECHNIQUES The truth table for the system design becomes x q1 q2 q1* q2* T1 T2 1 P 335

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 22 7.1 FLIP FLOP DESIGN TECHNIQUES x x 1 1 q1 q2 q1 q2 00 00 1 01 1 01 1 1 11 1 11 1 10 1 10 1 T1 T2 The input equations are T1 = x’q1 + xq’1q2 T2 = x’q2 + xq’2 + x q’1q2 z = q1q2 This requires 4 two-input AND gates, 1 three-input AND gate, 1 two-input and 1 three-input OR gate, and 1 NOT gate for x. P 335

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 23 7.1 FLIP FLOP DESIGN TECHNIQUES The JK solution never requires more logic than either the SR or the T. All of the X’s in the SR solution are also X’s on the JK maps. The JK maps have additional don’t care. The JK flip flop would behave like a T. The relationship between the D and JK design is not quite so clear. The input equations for any flip flop are derived from the q and q* columns for that flip flop. P 336

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 24 7.1 FLIP FLOP DESIGN TECHNIQUES The shaded columns on the q1* map, together with the JK flip flop design table are used, row by row, to produce the shaded columns on the J1 and K1 maps. P 337

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 25 7.1 FLIP FLOP DESIGN TECHNIQUES To get the second column of the J1 and K1 maps. P 337

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 26 7.1 FLIP FLOP DESIGN TECHNIQUES To find J and K for flip flop q2, This same technique can be used with the other type of flip flops. P 338

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 27 7.1 FLIP FLOP DESIGN TECHNIQUES The quick method for JK flip flop design takes advantage of a property of JK flip flops. 1 00 01 11 10 J1 q1 q2 x X K1 J2 K2 x q2 x’ q2’ x q1’ x’ q1’ x’ q2 x q1 x’ q1 Half of each map contains don’t cares. Each of the 1’s on the map has a don’t care eliminate the variable involved. P 339

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 28 7.1 FLIP FLOP DESIGN TECHNIQUES Advantage of this property by utilizing the equation. q* = Jq’ + K’q when q = 0, q* = J ∙ 1 + K’ ∙ 0 = J when q = 1, q* = J ∙ 0 + K’ ∙ 1 = K’ The part of the map of q* for which that variable is 0 is the map for J and the part for which that variable is 1 is the map for K’

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 29 7.1 FLIP FLOP DESIGN TECHNIQUES The three variable map has been reduced to 2 two-variable maps, one for J and the other for K’. The variable q1 has been eliminated; that was used to choose the section of the original map. J1 = xq2 K’1 = x or K1 = x’ Be careful in using the map for K’1; the two rows are reversed, that is, the q2 = 1 row is on the top. P 339

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 30 7.1 FLIP FLOP DESIGN TECHNIQUES The q2 = 0 portion of the map consists of the first and last rows The q2 = 1 portion is made up of the middle two rows. The other methods, J2 = x K2 = x’ + q’1 It is really only necessary to plot maps of q* for each variable. P 340

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 31 7.1 FLIP FLOP DESIGN TECHNIQUES Example 7.4 The state table and the state assignment. q* z q x = 0 x = 1 A B C 1 q q1 q2 A 1 B C Following truth table (including a column with the state name) x q1 q2 q1* q2* z - X C 1 B A P 341

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 32 7.1 FLIP FLOP DESIGN TECHNIQUES The resulting maps for the output and for D flip flop inputs follow. 1 00 01 11 10 z q1 q2 x X q1 * q2 * The resulting equation z = x’ + q1q2 D1 = x’ + q’1 + q’2 D2 = xq’2 + x’q2 P 341

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 33 7.1 FLIP FLOP DESIGN TECHNIQUES x q1 q2 q1* q2* z J1 K1 K2 - X C 1 B A The equations for the flip flop inputs follow. J1 = 1 K1 = xq2 J2 = x’ K2 = x’ P 342

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 34 7.1 FLIP FLOP DESIGN TECHNIQUES Example 7.5 One larger example q* q x = 0 x = 1 z S1 S2 S3 S4 S5 1 S6 The first issue is to make a state assignment. P 342

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 35 7.1 FLIP FLOP DESIGN TECHNIQUES q A B C S1 S2 1 S3 S4 S5 S6 q A B C S1 S2 1 S3 S4 S5 S6 The first assignment just uses the first six binary number. The second assignment uses an assignment meant to reduce the combinational logic. P 342

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 36 7.1 FLIP FLOP DESIGN TECHNIQUES The left half of the map corresponds to x = 0, and the right half to x =1. Since S1 goes to S2 when x = 0, the upper left square for the maps become 0, 0, and 1. P 343

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 37 7.1 FLIP FLOP DESIGN TECHNIQUES DA = xAC’ + xBC DB = x’A + x’B + x’C DC = x’A + x’B + x’C’ + AC’ z = A + BC P 343

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 38 7.1 FLIP FLOP DESIGN TECHNIQUES Using AND and OR gates, this requires 13 gates with 30 inputs. To implement this with JK flip flops, P 344

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 39 7.1 FLIP FLOP DESIGN TECHNIQUES P 344

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 40 7.1 FLIP FLOP DESIGN TECHNIQUES The map for JA has don’t cares in the two columns for which A is 1 and the map for KA has X’s in the two columns for which A is 0. Rows of don’t cares are seen in the maps for B* and C*. JA = xBC JB = x’A + x’C JC = x’ + A KA = x’ + C KB = x KC = x + A’B’ The output does not depend on the flip flop type. z = A + BC This requires 11 gates and 22 inputs. A B C Gates Inputs D JK 13 28 29 12 27 25 26 30 11 22 P 345

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 41 7.1 FLIP FLOP DESIGN TECHNIQUES The first eight rows are completed for the output column z, since z is not a function of the input x. x A B C z A* B* C* JA KB JB JC KC S1 1 X - S6 S5 S3 S2 S4 P 346

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 42 7.1 FLIP FLOP DESIGN TECHNIQUES P 347

7.1 FLIP FLOP DESIGN TECHNIQUES Chapter 7 The Design of Sequential Systems 6 - 43 7.1 FLIP FLOP DESIGN TECHNIQUES DA = x’ DB = x’B + BC + x’AC’ DC = AB + x’C’ + {x’B or x’A’} This requires a total of 9 gates with 20 inputs. The equations of JK version. JA = x’ KA = x JB = x’AC’ KB = xC’ JC = x’ KC = B’ + xA’ x = B This requires 5 gates with 10 inputs, significantly better than the D solution.

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 44 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Counters Asynchronous counters : those that do not require a clock input. Most counters are devices with no data input, that go through a fixed sequence of states on successive clocks. The output is often just the state of the system, that is, the contents of all of the flip flops. 4-bit binary counter : one with four flip flops that cycles through the sequence 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0, 1, . . . There are really no new techniques required for this design. The state table and the truth table are the same. The flip flops are labeled D, C, B, and A, which is the common practice.

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 45 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS D C B A D* C * B* A* 1 P 348

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 46 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS DD = DC’ + DB’ + DA’ + D’CBA DC = CB’ + CA’ + C’BA DB = B’A + BA’ DA = A’ P 349

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 47 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS This solution would require 12 gates with 30 gate inputs. Exclusive-OR gates available. DD = D(C’ + B’ + A’) + D’CBA = D(CBA)’ + D’(CBA) = D CBA DC = C(B’ + A’) + C’BA = C(BA)’ + C’(BA) = C BA DB = B’A + BA’ = B A DA = A’ This would only require two AND gates and three Exclusive-OR gates. JK design, P 349

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 48 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS This produces the equations JD = KD = CBA JC = KC = BA JB = KB = A JA = KA = 1 Extend the design to 5 flip flops, counting to 31 by adding flip flop E with inputs JE = KE = DCBA P 350

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 49 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Up/down counter : one that can count in either direction, depending on a control input. Control input x : counter counts up when x = 0 and down when x = 1. x C B A C * B* A* 1 P 350

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 50 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS JA = KA = 1 JB = KB = x’A + xA’ JC = KC = x’BA + xB’A’ Just as in the case of the 4- and 5-bit up counters, this pattern continues, yielding JD = KD = x’CBA + x C’B’A’ JE = KE = x’DCBA + xD’C’B’A’ P 351

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 51 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS P 351

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 52 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Example 7.6 Design a counter that goes through some sequence of states that are not in numeric order 0, 3, 2, 4, 1, 5, 7, and repeat The cycle is 7 states; it never goes through state 6. q1 q2 q3 q1* q2* q3* 1 X P 352

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 53 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS The table is repeated below with columns for inputs to SR flip flops; use the quick method for JK flip flops. q1 q2 q3 q1* q2* q3* S1 R1 S2 R2 S3 R3 1 X P 352

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 54 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS For D flip flops Use the q1*, q2*, q3* columns. D1 = q’2q3 + q2q’3 D2 = q’1q’2q’3 + q’1q2q3 + q1q’2q3 D3 = q’2 This solution requires 4 three-input gates and 3 two-input gates. P 352

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 55 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS The maps and equations for the SR solution follow. S and R are both don’t cares for all three flip flops. P 353

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 56 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS S1 = q2’q3 + q2q3’ R1 = q2’q3’ + q2q3 = S1’ = q2’q3’ + q1q2 S2 = q1’q2’q3’ + q1q2’q3 R2 = q1q2 + q2q3’ S3 = q2’ R3 = q2 Even taking advantage of the sharing or using a NOT for R1, this requires more logic than the D solution. P 353

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 57 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS The quick method for JK flip flops, J1 = q2’q3 + q2q3’ K1 = q3’ + q2 J2 = q1’q3’ + q1q3 K2 = q1 + q3’ J3 = q2’ K3 = q2 Even taking advantage of the sharing or using a NOT for R1, this requires more logic than the D solution. P 354

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 58 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS This solution requires 8 two-input gates, although the gate for K1 could be replaced by a NOT gate and the gate for K2 could be eliminated, since by choosing the don’t cares as 1’s in both places. K1 = J1’ and K2 = J2 Example 7.6(Cont.) Assume (state 1 1 0) q1 = 1, q2 = 1, and q3 = 0 For D flip flops, D1 = q’2q3 + q2q’3 = 00 + 11 = 1 D2 = q’1q’2q’3 + q’1q2q3 + q1q’2q3 = 001 + 011 + 100 = 0 D3 = q’2 = 0 The system would go to state 4 (1 0 0) on the first clock and continue through the sequence from there.

7.2 THE DESIGN OF SYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 59 7.2 THE DESIGN OF SYNCHRONOUS COUNTERS A state diagram, showing the behavior of the system designed with D or SR flip flops, including what happens if the system starts in the unused state. Note that there are no labels on the paths, since there is no input to the system, and the output is just equal to the state. (Moore system) P 355

7.3 DESIGN OF ASYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 60 7.3 DESIGN OF ASYNCHRONOUS COUNTERS Binary counter are sometimes designed without a clock input. They are constructed from the same clocked flip flops (typically JK) as synchronous counters. But each flip flop is triggered by the transition of the previous one. 1 1 B J A J Count K K Count : when the Count signal goes from 1 to 0, flip flop A is triggered. It started out at 0 : it goes to 1 The 0 to 1 transition on the output of A, and thus on the clock input of B, has no effect. : when the next negative transition on Count occurs, A will go from 1 to 0, causing the clock input to B to do the same. P 355

7.3 DESIGN OF ASYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 61 7.3 DESIGN OF ASYNCHRONOUS COUNTERS Count A B There are two things that are different about this timing diagram form the previous ones. Since the Count signal is not necessarily a clock, it might be rather irregular. The delay from the clock is much greater : The first flip flop (A) changes shortly after the negative edge of the clock, but the second flip flop (B) does not change until somewhat after A changes. P 356

7.3 DESIGN OF ASYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 62 7.3 DESIGN OF ASYNCHRONOUS COUNTERS Note that the flip flops (BA) go through the sequence 00, 01, 10, 11, and repeat. Thus, this is a 2-bit counter. 1 1 1 1 D J C J B J A J Count K K K K P 356

7.3 DESIGN OF ASYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 63 7.3 DESIGN OF ASYNCHRONOUS COUNTERS Notice that A changes one unit of time after the trailing edge of the clock, B one unit after a trailing edge of A, C after B, and D after C. Thus, the change in D occurs 4 units after the clock. Notice also that this counter does go through the sequence 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and would continue through 11, 12, 13, 14, 15, 0, … The advantage of the asynchronous counter : the simplicity of the hardware. There is no combinational logic required. The disadvantage of the asynchronous counter : speed. The state of the system is not established until all of the flip flops have completed their transition, which, in this case, is four flip flop delays. P 357

7.3 DESIGN OF ASYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 64 7.3 DESIGN OF ASYNCHRONOUS COUNTERS Example 7.7 Design an asynchronous base-12 counter using JK flip flops with active low clears and NAND gates. The easiest way to do this is to take the 4-bit binary counter and reset it when it reaches 12. Thus, the following circuit computes (DC)’ and uses that to reset the counter. P 358

7.3 DESIGN OF ASYNCHRONOUS COUNTERS Chapter 7 The Design of Sequential Systems 6 - 65 7.3 DESIGN OF ASYNCHRONOUS COUNTERS As can be seen from the timing diagram below, the counter cycles 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, (12), 9 where it remains in state 12 for a short time. Note that there is a delay from the time that A changes to when B changes and so forth. The count is only valid after the last flip flop settles down. P 358

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 66 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Continuing Examples Although the statement of CE6 does not include the term Moore, the wording of the problem implies a Moore system. That of CE7 is a Mealy model. CE6. A system with one input x and one output z such that z = 1 iff x has been 1 for at least three consecutive clock times. x 1 z ? P 359

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 67 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS The first step in this problem is to determine what needs to be stored in memory. There are two approaches to step 1 for this problem. Store the last three inputs. Store in memory the number of consecutive 1’s. (A - none , B - one , C - two , D - three or more) q1* q2* q3* q1 q2 q3 x = 0 x = 1 z 1 P 359

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 68 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS q* q x = 0 x = 1 z A B C D 1 This approach required only four states, whereas the first approach required eight. The first approach : uses three flip flops. The second approach : uses only two flip flops. This is not of a difference. P 359

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 69 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS The next step in the design process is to reduce the state table, if possible, to one with fewer states. That is beyond the scope of this book. For the first approach, the state assignment has already been made. (flip flops q1, q2, and q3) The flip flop inputs require no logic for D flip flops. D1 = q2 D2 = q3 D3 = x For JK flip flops. J1 = q2 J2 = q3 J3 = x K1 = q’2 K2 = q’3 K3 = x’ For either type of flip flop, one AND gate is needed for z: z = q1q2q3 For the second approach, D1 = q1* = xq2 + xq1 or J1 = xq2 K1 = x D2 = q2* = xq2’ + xq1 or J2 = x K2 = x’ + q1 x = q1q2

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 70 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS CE7. A system with one input x and one output z such that z = 1 at a clock time iff x is currently 1 and was also 1 at the previous two clock times. Another way of wording this same problem is CE7#. A Mealy system with one input x and one output z such that z = 1 iff x has been 1 for three consecutive clock times.

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 71 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Two approaches for this problem. For the first approach : only store the last two inputs. (rather than three for the Moore model) q1* q2* z q1 q2 x = 0 x = 1 1 For the second approach : store in memory the number of consecutive 1’s, as follows (A - none, B - one, C - two or more) That is sufficient information since the output is 1 iff there were previously two or more 1’s and the present input is a 1. If the present input is a 0, the next state is A. P 361

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 72 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS q* z q x = 0 x = 1 A B C 1 P 361

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 73 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS A B C D Basically, the Moore model output is the same as the Mealy, but delayed by one clock period. The Mealy model has a glitch when x is still 1 in state C. The Moore model does not have any false outputs, since z depends only on the flip flops, all of which change at the same time. P 362

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 74 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Example 7.8 Design both a Moore and a Mealy system with one input x and one output z such that z = 1 iff x has been 1 for exactly three consecutive clock times. x 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 1 z-Mealy 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0* z-Moore 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 For the Mealy model, (need five states) A - none, that is, the last input was 0 B - one 1 in a row C - two 1’s in a row D - three 1’s in a row E - too many (more than 3) 1’s in a row

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 75 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS The state diagram begins like that of the previous solution. The implementation of this system requires three flip flops. P 363

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 76 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS For the Moore model, A state D to indicate exactly three 1’s. From there, it goes to E on another 1, indicating too many 1’s. State F is reached on a 0 input; it is the state with a 1 output. q* q x = 0 x = 1 z A B C D F E 1 P 363

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 77 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Example 7.9 Design a Mealy system whose output is 1 iff the input has been 1 for three consecutive clocks, but inputs are nonoverlapping. x 0 1 1 1 1 1 1 1 0 1 1 0 1 1 1 0 1 z 0 0 0 1 0 0 1 0 0 0 0 0 0 0 1 0 0 0 As in CE7, only three states are needed. P 364

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 78 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Example 7.10 Design a Mealy system where the inputs are considered in blocks of three. The output is 1 iff the input is 1 for all three inputs in a block That 1 output cannot occur until the third input is received. x 0 1 1 1 1 1 1 0 1 1 1 0 1 1 1 0 1 z 0 0 0 0 0 1 0 0 0 0 0 0 0 0 1 0 0 0 where the blocks are indicated by extra space. q* z q x = 0 x = 1 A C B E D G F 1 P 364

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 79 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS But that creates two extra states. Note that the paths out of C and of E are denoted as X/0. Input is don’t care. That path is followed and the output is 0. Notice that the next state and output sections of the last three rows of the state table are identical. P 365

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 80 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Example 7.11 Design a Mealy system whose output is 1 for every third 1 input. The initial state, A, is used for no 1’s or a multiple of three 1’s. When a 0 is received, the system stays where it is, rather than returning to the initial state, since a 0 does not interrupt the count of three 1’s. x 0 1 1 1 1 1 1 1 0 1 1 0 1 0 1 0 0 1 0 1 z 0 0 0 1 0 0 1 0 0 0 1 0 0 0 0 0 0 1 0 0 0 P 366

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 81 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Example 7.12 CE8. Design a Moore system whose output is 1 iff three consecutive 0 inputs occurred more recently than three consecutive 1 inputs. x 1 1 1 0 0 1 0 1 1 1 0 0 1 0 0 0 0 1 1 1 1 0 1 z ? ? ? 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 0 0 0 0 0 The initial state S1 P 366

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 82 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS P 367

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 83 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Example 7.13 Design a Mealy system whose output is 1 iff there have been exactly two 1’s followed by a 0 and then a 1. Assume overlapping is allowed. Assume overlapping is not allowed. When a. x 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 z 0 0 0 0 0 1 0 0 1 0 0 1 0 0 0 0 0 0 1 0 0 1 0 0 The underlines indicate the 1101 pattern. The double underline is not an acceptable pattern since it does not begin with exactly two 1’s.

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 84 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS A B C E 0/0 1/0 1/1 nowhere, last input = 0 two 1’s 0110 One 1 P 368

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 85 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS P 368

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 86 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS There are two interpretations to consider in the nonoverlapping case. The first is shown as b-1. x 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 b-1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 0 0 1 0 0 0 0 0 A second interpretation(perhaps a little far-fetched). x 0 0 1 1 0 1 1 0 1 1 0 1 1 1 0 1 1 0 1 1 0 1 b-2 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 0 0 0 1 0 0 0

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 87 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS P 369

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 88 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Example 7.14 CE11. Design a Moore model bus controller that receives requests on separate lines, R0 to R3, from four devices desiring to use the bus. It has four outputs, G0 to G3, only one of which is 1, indicating which device is granted control of the bus for that clock period. The low number device has the highest priority, if more than one device requests the bus at the same time. The bus controller has five states: A: idle, no device is using the bus B: device 0 is using the bus C: device 1 is using the bus D: device 2 is using the bus E: device 3 is using the bus

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 89 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS P 370

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 90 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS The system remains in the idle state if there are no requests. It goes to the highest priority state when there are one or more requests. If the idle period is not necessary, the state diagram becomes much more complex. q q* G0G1G2G3 R0 1 A E D C B P 371

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 91 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS A preemptive controller. Where a high-priority device will take control from a lower priority one, even if the lower priority one is still using the bus. P 371

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 92 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS P 372

7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS Chapter 7 The Design of Sequential Systems 6 - 93 7.4 DERIVATION OF STATE TABLES AND STATE DIAGRAMS q q* G0G1G2G3 R0 1 A E D C B Although the state diagram for this version would require the same 20 paths as was needed for the second version, the logic is much simpler. The condition for going to state B, from each state is 1XXX(R1), to C is 01XX(R1’R2), to D is 001X(R1’R2’R3), and to E is 0001(R1’R2’R3’R4). P 372