Upload
khangminh22
View
0
Download
0
Embed Size (px)
Citation preview
ELCT201: DIGITAL LOGIC DESIGN
Lecture 11
Following the slides of Dr. Ahmed H. Madian
Prof. Dr. Eng. Tallal El-Shabrawy, [email protected]
Dr. Eng. Wassim Alexan, [email protected]
ΩΩΩ 1441Ω ΨΨ±Ω
Spring 2020
COURSE OUTLINE
1. Introduction
2. Gate-Level Minimization
3. Combinational Logic
4. Synchronous Sequential Logic
5. Registers and Counters
6. Memories and Programmable Logic
2
LECTURE OUTLINE
β’ Counters β’ Definition and Introduction
β’ Binary Ripple Counters
β’ π FF-based
β’ π· FF-based
β’ Synchronous Counters
β’ Up Counters
β’ Down Counters
β’ Unused States
β’ Design Problems
3
COUNTERS: A DEFINITION
4
β’ A register that goes through a prescribed sequence of states upon the application of input pulses is called a counter
β’ The input pulses may be clock pulses, or they may originate from some external source and occur at a fixed interval of time or at random
β’ The sequence of states may follow the binary number sequence or any other sequence of states
000 β 001 β 010 β 011 β 100 β 101 β β―
000 β 010 β 100 β 000 β 010 β 100 β β―
COUNTERS: INTRODUCTION
5
β’ A counter that follows the binary number sequence is called a binary counter
β’ An π βbit binary counter consists of π FFs and can count from 0 through 2π β 1
β’ Counters are available in 2 categories:
β’ Ripple counters
β’ Synchronous counters
COUNTERS: INTRODUCTION
6
β’ In a ripple counter, a FF output transition serves as a source for triggering other FFs
β’ This means that the πΆ input of some or all FFs are triggered, not by the common clock pulses, but rather by the transition that occurs in other FF outputs
β’ In a synchronous counter, the πΆ inputs of all FFs receive the common clock
BINARY RIPPLE COUNTERS
7
β’ A binary ripple counter consists of a series connection of complementing FFs, with the output of each FF connected to the πΆ input of the next higher order FF (see next slide)
β’ The FF holding the least significant bit receives the incoming count pulses
β’ The output of the first FF is always the complement of its input
β’ The π inputs of all the FFs in the first counter are permanently connected to πΏππππ 1, making each FF complement if the signal in its πΆ input goes through a negative transition
β’ The negative transition occurs when the output of the previous FF to which πΆ is connected goes from 1 to 0
8
πΏππππ 1
π ππ ππ‘
π΄3
π΄2
π΄1
π΄0
π ππ ππ‘
πΆππ’ππ‘
π΄3
π΄2
π΄1
π΄0
But what if we are interested
in building a counter that
counts down? How can we
modify the current logic
diagrams to achieve this new
target?
πΆππ’ππ‘
9
BINARY RIPPLE COUNTERS: BONUS QUESTION
β’ How many flip-flops will be complemented in a 10 βbit binary ripple counter to reach the next count after the following counts?
a. 1001100111
b. 0011111111
c. 1111111111
SYNCHRONOUS COUNTERS
10
β’ In a synchronous binary counter, the FF controlling the least significant bit is complemented with every clock cycle
β’ Any other FF will only complement its stored bit when all the bits in the lower significant positions are equal to 1
β’ For example, if the present state of a 4 βbit counter is π΄3π΄2π΄1π΄0 = 0011, the next count is 0100
β’ π΄0 is always complemented. π΄1 is complemented because the present state of π΄0 = 1. π΄2 is only complemented if the present state of π΄1π΄0 =11. However π΄3 is not complemented, because the present state of π΄2π΄1π΄0 = 011, which does not give an all 1s condition
SYNCHRONOUS COUNTERS
11
β’ The first stage, π΄0, has its π½ and πΎ equal to 1 if the counter is enabled
β’ The other π½ and πΎ inputs are equal to 1 if all previous least significant stages are equal to 1 and the count is enabled
β’ The chain of AND gates generates the required logic for the π½ and πΎ inputs in each stage
β’ Such a counter can be extended to any number of stages, with each stage having an additional FF and an AND gate that gives an output of 1 if all previous FF outputs are 1
12 πΆππ
π΄3
π΄2
π΄1
π΄0
πΆππ’ππ‘ ππππππ 4 βBIT SYNCHRONOUS
BINARY COUNTER
ππ πππ₯π‘ π π‘πππ
Is the polarity of the clock essential in this
design? What happens if we implement this
counter with a negative edge-triggered clock?
π½πΎ πΉπΉ πβπππππ‘ππππ π‘ππ π‘ππππ
13
4 βBIT SYNCHRONOUS BINARY UP/DOWN COUNTER
So how can we design an up/down synchronous binary counter?
14 πΆππ
π΄3
π΄2
π΄1
π΄0
ππ
π·ππ€π
πΉπ’πππ‘πππ π‘ππππ
π πΉπΉ πβπππππ‘ππππ π‘ππ π‘ππππ
This is not
a mistake!
With a mode control of
10 and a current count
of 0101, what is the
next count?
With a mode control of
01 and a current count
of 0111, what is the
next count?
UNUSED STATES
15
001
010
011
100
101
000 β’ What happens if we are interested in a counter design that does not include all states (counts)?
β’ For example, here is a state diagram and a state table (next slide) for a counter that repeatedly counts from 000 to 101
β’ What should we write in the table for the couple of unused states?
UNUSED STATES
16
001
010
011
100
101
000
Present State Next State
πΈπ πΈπ πΈπ πΈπ πΈπ πΈπ
0 0 0 0 0 1
0 0 1 0 1 0
0 1 0 0 1 1
0 1 1 1 0 0
1 0 0 1 0 1
1 0 1 0 0 0
1 1 0 ? ? ?
1 1 1 ? ? ?
UNUSED STATES CAN BE DONβT CARESβ¦
17
Present State Next State
πΈπ πΈπ πΈπ πΈπ πΈπ πΈπ
0 0 0 0 0 1
0 0 1 0 1 0
0 1 0 0 1 1
0 1 1 1 0 0
1 0 0 1 0 1
1 0 1 0 0 0
1 1 0 X X X
1 1 1 X X X
β’ To reach the simplest possible
circuit, we can fill in donβt cares
for the next states
β’ This will also result in donβt cares
for the FF inputs, which might
simplify the hardware
β’ If the circuit somehow ends up in
one of the unused states
{110,111}, its behavior will
depend on exactly what the donβt
cares were filled in with
OR MAYBE WE DO CARE!
18
Present State Next State
πΈπ πΈπ πΈπ πΈπ πΈπ πΈπ
0 0 0 0 0 1
0 0 1 0 1 0
0 1 0 0 1 1
0 1 1 1 0 0
1 0 0 1 0 1
1 0 1 0 0 0
1 1 0 0 0 0
1 1 1 0 0 0
β’ To reach the safest possible circuit,
we can explicitly fill in next states for
the unused states {110,111} β’ This guarantees that even if the
circuit somehow enters an unused
state, it will eventually end up into
one of the valid states
β’ This is called a self-starting counter
001
010
011
100
101
000
110 111
DESIGN PROBLEM
19
β’ Design a sequential logic circuit that implements the following recurring sequence:
000 β 010 β 011 β 100 β 101 β 111 β 000 β β―
Assume that the circuit is a self-starting one.
20
DESIGN PROBLEM: SOLUTION
1. From the word description and the required specifications, we sketch the state diagram. Since each state consists of 3 bits, we need 3 flip-flops 010
011
100
101
111
000
001 110
Here, π FFs would be a good
choice, since we are going to
toggle some bits in every state
transition
21
DESIGN PROBLEM: SOLUTION
2. Next, we derive the state table. The present and next states are known from the state diagram. While the FF inputs are obtained with the help of the π FF excitation table or characteristic equation
22
DESIGN PROBLEM: SOLUTION
010
011
100
101
111
000
001 110
Present State Next State FF Inputs
πΈπ πΈπ πΈπ πΈπ πΈπ πΈπ π»π π»π π»π
0 0 0 0 1 0 0 1 0
0 0 1 0 0 0 0 0 1
0 1 0 0 1 1 0 0 1
0 1 1 1 0 0 1 1 1
1 0 0 1 0 1 0 0 1
1 0 1 1 1 1 0 1 0
1 1 0 0 0 0 1 1 0
1 1 1 0 0 0 1 1 1