Counters are sequential circuits which "count" through a specific state sequence.



Similar documents
Chapter 7. Registers & Register Transfers. J.J. Shann. J. J. Shann

Counters & Shift Registers Chapter 8 of R.P Jain

Module 3: Floyd, Digital Fundamental

DIGITAL COUNTERS. Q B Q A = 00 initially. Q B Q A = 01 after the first clock pulse.

WEEK 8.1 Registers and Counters. ECE124 Digital Circuits and Systems Page 1

Digital Logic Design Sequential circuits

Experiment # 9. Clock generator circuits & Counters. Eng. Waleed Y. Mousa

Counters and Decoders

Digital Logic Design. Basics Combinational Circuits Sequential Circuits. Pu-Jen Cheng

Design Example: Counters. Design Example: Counters. 3-Bit Binary Counter. 3-Bit Binary Counter. Other useful counters:

Asynchronous Counters. Asynchronous Counters

Contents COUNTER. Unit III- Counters

ETEC 2301 Programmable Logic Devices. Chapter 10 Counters. Shawnee State University Department of Industrial and Engineering Technologies

Lecture 8: Synchronous Digital Systems

DIGITAL ELECTRONICS. Counters. By: Electrical Engineering Department

To design digital counter circuits using JK-Flip-Flop. To implement counter using 74LS193 IC.

BINARY CODED DECIMAL: B.C.D.

Asynchronous counters, except for the first block, work independently from a system clock.

ASYNCHRONOUS COUNTERS

Flip-Flops, Registers, Counters, and a Simple Processor

Combinational Logic Design Process

ENEE 244 (01**). Spring Homework 5. Due back in class on Friday, April 28.

Take-Home Exercise. z y x. Erik Jonsson School of Engineering and Computer Science. The University of Texas at Dallas

Digital Systems Based on Principles and Applications of Electrical Engineering/Rizzoni (McGraw Hill

Chapter 8. Sequential Circuits for Registers and Counters

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute. 2nd (Spring) term 2012/2013

Counters. Present State Next State A B A B

Flip-Flops and Sequential Circuit Design. ECE 152A Winter 2012

Flip-Flops and Sequential Circuit Design

Operating Manual Ver.1.1

Digital Electronics Part I Combinational and Sequential Logic. Dr. I. J. Wassell

Sequential Logic. (Materials taken from: Principles of Computer Hardware by Alan Clements )

CHAPTER IX REGISTER BLOCKS COUNTERS, SHIFT, AND ROTATE REGISTERS

Cascaded Counters. Page 1 BYU

Systems I: Computer Organization and Architecture

Lesson 12 Sequential Circuits: Flip-Flops

Latches, the D Flip-Flop & Counter Design. ECE 152A Winter 2012

Modeling Sequential Elements with Verilog. Prof. Chien-Nan Liu TEL: ext: Sequential Circuit

CHAPTER 11 LATCHES AND FLIP-FLOPS

Chapter 5. Sequential Logic

Sequential Logic Design Principles.Latches and Flip-Flops

DEPARTMENT OF INFORMATION TECHNLOGY

DIGITAL TECHNICS II. Dr. Bálint Pődör. Óbuda University, Microelectronics and Technology Institute 5. LECTURE: REGISTERS AND RELATED

Upon completion of unit 1.1, students will be able to

CpE358/CS381. Switching Theory and Logical Design. Class 10

Chapter 4 Register Transfer and Microoperations. Section 4.1 Register Transfer Language

IE1204 Digital Design F12: Asynchronous Sequential Circuits (Part 1)

ECE380 Digital Logic

EXPERIMENT 8. Flip-Flops and Sequential Circuits

Memory Elements. Combinational logic cannot remember

DM74LS169A Synchronous 4-Bit Up/Down Binary Counter

DM74LS191 Synchronous 4-Bit Up/Down Counter with Mode Control

exclusive-or and Binary Adder R eouven Elbaz reouven@uwaterloo.ca Office room: DC3576

Having read this workbook you should be able to: recognise the arrangement of NAND gates used to form an S-R flip-flop.

SEQUENTIAL CIRCUITS. Block diagram. Flip Flop. S-R Flip Flop. Block Diagram. Circuit Diagram

Design: a mod-8 Counter

3.Basic Gate Combinations

The string of digits in the binary number system represents the quantity

Binary full adder. 2-bit ripple-carry adder. CSE 370 Spring 2006 Introduction to Digital Design Lecture 12: Adders

Gray Code Generator and Decoder by Carsten Kristiansen Napier University. November 2004

Digital Electronics Detailed Outline

Registers & Counters

Copyright Peter R. Rony All rights reserved.

EE 42/100 Lecture 24: Latches and Flip Flops. Rev B 4/21/2010 (2:04 PM) Prof. Ali M. Niknejad

Binary Adders: Half Adders and Full Adders

Chapter 9 Latches, Flip-Flops, and Timers

(1) /30 (2) /30 (3) /40 TOTAL /100

Engr354: Digital Logic Circuits

CSE140: Components and Design Techniques for Digital Systems

CS311 Lecture: Sequential Circuits

LAB #4 Sequential Logic, Latches, Flip-Flops, Shift Registers, and Counters

Lab 1: Study of Gates & Flip-flops

COMBINATIONAL and SEQUENTIAL LOGIC CIRCUITS Hardware implementation and software design

Set-Reset (SR) Latch

DATA SHEET. HEF40193B MSI 4-bit up/down binary counter. For a complete data sheet, please also download: INTEGRATED CIRCUITS

6-BIT UNIVERSAL UP/DOWN COUNTER

Napier University. School of Engineering. Electronic Engineering A Module: SE42205 Digital Design

1.1 The 7493 consists of 4 flip-flops with J-K inputs unconnected. In a TTL chip, unconnected inputs

DM54161 DM74161 DM74163 Synchronous 4-Bit Counters

74F168*, 74F169 4-bit up/down binary synchronous counter

List of Experiment. 8. To study and verify the BCD to Seven Segments DECODER.(IC-7447).

INTEGRATED CIRCUITS. For a complete data sheet, please also download:

Lecture-3 MEMORY: Development of Memory:

Layout of Multiple Cells

United States Naval Academy Electrical and Computer Engineering Department. EC262 Exam 1

The components. E3: Digital electronics. Goals:

PROGETTO DI SISTEMI ELETTRONICI DIGITALI. Digital Systems Design. Digital Circuits Advanced Topics

ECE232: Hardware Organization and Design. Part 3: Verilog Tutorial. Basic Verilog

NOTE: The Flatpak version has the same pinouts (Connection Diagram) as the Dual In-Line Package.


54191 DM54191 DM74191 Synchronous Up Down 4-Bit Binary Counter with Mode Control

8254 PROGRAMMABLE INTERVAL TIMER

1. True or False? A voltage level in the range 0 to 2 volts is interpreted as a binary 1.

(Refer Slide Time: 00:01:16 min)

74AC191 Up/Down Counter with Preset and Ripple Clock

Let s put together a Manual Processor

7. Latches and Flip-Flops

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

74LS193 Synchronous 4-Bit Binary Counter with Dual Clock

Transcription:

Counters Counters are sequential circuits which "count" through a specific state sequence. They can count up, count down, or count through other fixed sequences. Two distinct types are in common usage: Ripple Counters Clock connected to the flip-flop clock input on the LSB bit flip-flop For all other bits, a flip-flop output is connected to the clock input, thus circuit is not truly synchronous! Output change is delayed more for each bit toward the MSB. Resurgent because of low power consumption Synchronous Counters Clock is directly connected to the flip-flop clock inputs Logic is used to implement the desired state sequencing

Ripple Counter How does it work? When there is a positive edge on the clock input of A, A complements The clock input for flip-flop B is the complemented output of flip-flop A CP A B Clock Clock Reset When flip A changes from 1 to 0, there is a positive edge on the clock input of B causing B to complement 0 1 2 3 0 1 D D A B

Ripple Counter (continued) The arrows show the cause-effect relationship from the prior slide The corresponding sequence of states B 0 1 2 3 0 1 (B,A) = (0,0), (0,1), (1,0), (1,1), (0,0), (0,1), Each additional bit, C, D, behaves like bit B, changing half as frequently as the bit before it. For 3 bits: (C,B,A) = (0,0,0), (0,0,1), (0,1,0), (0,1,1), (1,0,0), (1,0,1), (1,1,0), (1,1,1), (0,0,0), CP A

Ripple Counter (continued) These circuits are called ripple counters because each edge sensitive transition (positive in the example) causes a change in the next flip-flop s state. The changes ripple upward through the chain of flip-flops, i. e., each transition occurs after a clock-to-output delay from the stage before.

Ripple Counter (continued) Starting with C = B = A = 1, equivalent to (C,B,A) = 7 base 10, the next clock increments the count to (C,B,A) = 0 base 10. In fine timing detail: The clock to output delay t PHL causes an increasing delay from clock edge for each stage transition. Thus, the count ripples from least to most significant bit. For n bits, total worst case delay is n t PHL. CP 1 A 1 B 1 t PHL t PHL t phl 0 0 0 C 1 0

Synchronous Counters To eliminate the "ripple" effects, use a common clock for each flip-flop and a combinational circuit to generate the next state. For an up-counter, use an incrementer A3 Incrementer S3 D3 Q3 A2 S2 D2 Q2 A1 S1 D1 Q1 A0 S0 D0 Q0 Clock

Synchronous Counters (continued) Internal details Incrementer Internal Logic XOR complements each bit AND chain causes complement of a bit if all bits toward LSB from it equal 1 Count Enable Forces all outputs of AND chain to 0 to hold the state Carry Out Added as part of incrementer Connect to Count Enable of additional 4-bit counters to form larger counters Count enable EN D C D C D C D C Clock (a) Logic Diagram-Serial Gating Q 0 Q 1 Q 2 Q 3 Carry output CO

Synchronous Counters (continued) Carry chain series of AND gates through which the carry ripples Yields long path delays Called serial gating EN Q 0 Q 1 C 1 Replace AND carry chain with ANDs in parallel Reduces path delays Called parallel gating Like carry lookahead Lookahead can be used on COs and ENs to prevent long paths in large counters Symbol for Synchronous Counter CTR 4 EN Q 0 Q 1 Q 2 Q 3 CO Symbol Q 2 C 2 Q 3 C 3 CO Logic Diagram-Parallel Gating

Other Counters Counters: Down Counter - counts downward instead of upward Up-Down Counter - counts up or down depending on value a control input such as Up/Down Parallel Load Counter - Has parallel load of values available depending on control input such as Load Divide-by-n (Modulo n) Counter Count is remainder of division by n; n may not be a power of 2 Count is arbitrary sequence of n states specifically designed state-by-state Includes modulo 10 which is the BCD counter

Counter with Parallel Load Add path for input data enabled for Load = 1 Add logic to: disable count logic for Load = 1 disable feedback from outputs for Load = 1 enable count logic for Load = 0 and Count = 1 The resulting function table: Load Count D 0 D 1 D 2 D C D C D Q 0 Q 1 Q 2 Load Count Action C 0 0 Hold Stored Value 0 1 Count Up Stored Value 1 X Load D D 3 D C Q 3 Clock Carry Output CO

Design Example: Synchronous BCD Use the sequential logic model to design a synchronous BCD counter with D flip-flops Input combinations 1010 through 1111 are don t cares Current State Q8 Q4 Q2 Q1 Next State Q8 Q4 Q2 Q1 0 0 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 0 1 0 0 0 1 0 1 0 1 0 1 0 1 1 0 0 1 1 0 0 1 1 1 0 1 1 1 1 0 0 0 1 0 0 0 1 0 0 1 1 0 0 1 0 0 0 0

Synchronous BCD (continued) Use K-Maps to two-level optimize the next state equations: D1 = Q1 D2 = Q8Q2Q1+ Q2Q1 D4 = Q4Q2Q1+ Q4Q2+ Q4Q1 D8 = Q8Q1 + Q4Q2Q1 The logic diagram can be draw from these equations An asynchronous or synchronous reset should be added What happens if the counter is perturbed by a power disturbance or other interference and it enters a state other than 0000 through 1001?

Synchronous BCD (continued) Find the actual values of the six next states for the don t care combinations from the equations Find the overall state diagram to assess behavior for the don t care states (states in decimal) Present State Q8 Q4 Q2 Q1 Next State Q8 Q4 Q2 Q1 1 0 1 0 1 0 1 1 1 0 1 1 0 1 0 0 1 1 0 0 1 1 0 1 1 1 0 1 0 1 0 0 1 1 1 0 1 1 0 1 1 1 1 1 1 0 0 0 8 7 D1 = Q1 D2 = Q8Q2Q1+ Q2Q1 D4 = Q4Q2Q1+ Q4Q2+ Q4Q1 D8 = Q8Q1 + Q4Q2Q1 9 6 15 11 10 0 5 13 14 1 4 12 2 3

Synchronous BCD (continued) For the BCD counter design, if an invalid state is entered, return to a valid state occurs within two clock cycles Is this adequate? If not: Is a signal needed that indicates that an invalid state has been entered? What is the equation for such a signal? Does the design need to be modified to return from an invalid state to a valid state in one clock cycle? Does the design need to be modified to return from a invalid state to a specific state (such as 0)? The action to be taken depends on: the application of the circuit design group policy

Counting Modulo N The following techniques use an n-bit binary counter with asynchronous or synchronous clear and/or parallel load: Detect a terminal count of N in a Modulo-N count sequence to asynchronously Clear the count to 0 or asynchronously Load in value 0 Detect a terminal count of N - 1 in a Modulo-N count sequence to Clear the count synchronously to 0 Detect a terminal count of N - 1 in a Modulo-N count sequence to synchronously Load in value 0 Detect a terminal count and use Load to preset a count of the terminal count value minus (N - 1) Alternatively, custom design a modulo N counter as done for BCD

Counting Modulo 7: Synchronously Load on Terminal Count of 6 A synchronous 4-bit binary counter with a synchronous load and an asynchronous clear is used to make a Modulo 7 counter Use the Load feature to detect the count "6" and load in "zero". This gives a count of 0, 1, 2, 3, 4, 5, 6, 0, 1, 2, 3, 4, 5, 6, 0,... Using don t cares for states above 0110 0 0 0 0 Clock Reset D3 Q3 D2 Q2 D1 Q1 D0 Q0 CP LOAD CLEAR

Counting Modulo 6: Synchronously Preset 9 on Reset and Load 9 on Terminal Count 14 A synchronous, 4-bit binary counter with a synchronous Load is to be used to make a Modulo 6 counter. Use the Load feature to preset the count to 9 on Reset and detection of count 14. Reset 1 0 0 1 Clock 1 D3 Q3 D2 Q2 D1 Q1 D0 Q0 CP LOAD CLEAR This gives a count of 9, 10, 11, 12, 13, 14, 9, 10, 11, 12, 13, 14, 9, If the terminal count is 15 detection is usually built in as Carry Out (CO)

Example 4: Design a modulo-8 up-counter which counts in the way specified below, use J-K FF 18

Example 4: TRUTH TABLE present state next state 19

Example 4: Gray code counter Y3 20

Example 4: Gray code counter Y2 21

Example 4: Gray code counter Y1 22

Objective: Eliminate redundant states Reduce the number of states in the state table to the minimum. Remove redundant states Use don t cares effectively Reduction to the minimum number of states reduces The number of F/Fs needed Reduces the number of next states that has to be generated Reduced logic. 23

An example circuit A sequential circuit has one input X and one output Z. The circuit looks at the groups of four consecutive inputs and sets Z=1 if the input sequence 0101 or 1001 occurs. The circuit returns to the reset state after four inputs. Design the Mealy machine. X = 0101 0010 1001 0100 Z = 0001 0000 0001 0000 2012 - Joanne DeGroat, ECE, OSU 24

Elimination of Redundant States When first setting up the state table, we will not be overly concerned with inclusion of extra states, and when the table is complete, we will eliminate any redundant states. /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /1 /0 /1 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 State diagram

State table Set up a table for all the possible input combinations For the two sequences when the last bit is a 1 return to reset with Z=1. 2012 - Joanne DeGroat, ECE, OSU

Note on state table generation When generated by looking at all combinations of inputs the state table is far from minimal. First step is to remove redundant states. There are states that you cannot tell apart Such as H and I both have A with Z=0 as output. State H is equivalent to State I and state I can be removed from the table. Examining table shows states K, M, N and P are also the same they can be deleted. States J and L are also equivalent. 2012 - Joanne DeGroat, ECE, OSU

Reduction continued Having made these reductions move up to the D E F G section where the next state entries have been changed. Note that State D and State G are equivalent. State E is equivalent to F. The result in a reduced state table. 2012 - Joanne DeGroat, ECE, OSU 28

The result Reduced state table and graph Original 15 states reduced 7 states 2012 - Joanne DeGroat, ECE, OSU

Elimination of Redundant States Design a binary checker that has in input a sequence of BCD numbers and for every four bits (LSB order) has output 0 if the number is 0 N 9 and 1 if 10 N 15 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /0 /1 /0 /1 /0 /1 /0 /1 /0 /1 State diagram

Elimination of Redundant States Design a binary checker that has in input a sequence of BCD numbers and for every four bits (LSB order) has output 0 if the number is 0 N 9 and 1 if 10 N 15

Elimination of Redundant States 0,1 0/0 1/0 8,9 2,3,4,5,6,7 0/0 1/1 10,11,12,13,14,15 A 0/0 1/0 0 B 0 1 C 0/0 1/0 0/0 1/0 D 0 E 2 1 F 3 G 1/0 1/0 0/0 1/0 0/0 0/0 0/0 1/0 H 0,1 State diagram I 2,3,4,5,6,7

Elimination of Redundant States 0 0 1 0 2 1 3 0,1 2,3,4,5,6,7 {D,F}, {E,G},{B,C} State table

Elimination of Redundant States 0/0 1/0 0/0 A 0/0 1/0 B 0/0 1/1 1/0 D E 0/0 1/0 0/0 1/0 H I State diagram

Equivalence Two states are equivalent is there is no way of telling them apart through observation of the circuit inputs and outputs. Formal definition: Let N 1 and N 2 be sequential circuits (not necessarily different). Let X represent a sequence of inputs of arbitrary length. Then state p in N 1 is equivalent to state q in N 2 iff λ 1 (p,x) = λ 2 (q,x) for every possible input sequence X. The definition is not practical to apply in practice. Theorem: Two states p and q of a sequential circuit are equivalent iff for every single input X, the outputs are the same and the next states are equivalent, that is, λ (p,x)=λ (q,x) and δ (p,x)=δ(q,x) where λ (p,x) is the output given present state p and input X, and δ (p,x) is the next state given the present state p and input X. So the outputs have to be the same and the next states equivalent. 2012 - Joanne DeGroat, ECE, OSU

Implication Tables A procedure for finding all the equivalent states in a state table. Use an implication table a chart that has a square for each pair of states. 2012 - Joanne DeGroat, ECE, OSU 36

Step 1 Use a X in the square to eliminate output incompatible states. 1 st output of a differes from c, e, f, and h 37

Step 1 continued Continue to remove output incompatible states 38

Now what? Implied pair are now entered into each non X square. Here a b iff d f and c h 39

Self redundant pairs Self redundant pairs are removed, i.e., in square a-d it contains a-d. 40

Next pass X all squares with implied pairs that are not compatible. Such as in a-b have d-f which has an X in it. Run through the chart until no further X s are found. 41

Final step Note that a-d is not X and is equivalent if c e, and the same for is c-e: is not X and is equivalent if a d. We can conclude that a d., i.e. and c e. 42

Reduced table Removing equivalent states. 2012 - Joanne DeGroat, ECE, OSU 43

Summary of method Construct a chart with a square for each pair of states. Compare each pair of rows in the state table. X a square if the outputs are different. If the output is the same enter the implied pairs. Remove redundant pairs. If the implied pair is the same place a check mark as i j. Go through the implied pairs and X the square when an implied pair is incompatible. Repeat until no more Xs are added. For any remaining squares not Xed, i j. 44

Another example Consider the state diagram: NEXT STATE OUTPUT Present State X=0 X=1 X=0 X=1 S0 S1 S4 0 0 S1 S1 S2 0 0 S2 S3 S4 1 0 S3 S5 S2 0 0 S4 S3 S4 0 0 S5 S1 S2 0 1

Set up Implication Chart Remove output incompatible states and indicate implied pairs NEXT STATE OUTPUT Present State X=0 X=1 X=0 X=1 S0 S1 S4 0 0 S1 S1 S2 0 0 S2 S3 S4 1 0 S3 S5 S2 0 0 S4 S3 S4 0 0 S5 S1 S2 0 1 Check implied pairs and X 1 st pass 2 nd pass In this case the state table is minimal as no state reduction can be done. 46

Implication Table (another example) Its clear that (e,d) are equivalent. And this leads (a,b) and (e,g) to be equivalent too. Finally we have [(a,b), c, (e,d,g), f ] so four states. So the original flow table can be reduced to:

Implication Table