Professional Documents
Culture Documents
I1 A1
When clear=1, the rising edge of the
D Q
clock (the active clock edge), results in R
I3 D Q A3
R
clock clear
We might want to prevent the transfer of data from input to output even though the
active clock edge arrives.
We can do this by feeding the register outputs back to the inputs and adding some
additional logic to control the register operation.
D Q A0
I0
R
D Q A1
I1
R
D Q A2
I2
R
D Q A3
I3
R
When load=1, the data inputs reach the D-input of the flip-flop.
When the active clock edge arrives, the data gets transferred, or loaded, to the
register output.
When load=0, the data output of each flip-flop is fed back to its D-input.
When the active clock edge arrives, the data input gets transferred to the
register output, but since the values are the same for all flip-flops, the register
holds its current value.
In our previous example of parallel load, the AND/OR gates are working as a
multiplexer – the load signal is the multiplexer control line.
Might want a register that can shift data serially in a direction… This type of
register is called a shift register.
serial serial
in out
D Q D Q D Q D Q
R R R R
clock
clear
As active clock edges arrive, the data present at the serial input gets transferred
towards the serial output – so, data gets shifted to the right one bit at a time as
clock edges arrive.
Perhaps we want a more general circuit – e.g., we want to be able to clear the
register, load the register, and perform both a shift right and a shift left
operation.
We can do this by adding addition logic in front of each flip-flop in the register:
We need to make sure the correct data is present at the D-input to each flip-
flop to perform each operation correctly according to the settings on the
register control lines.
00
I0 01 D Q A0
10
11 R
00
I1 01 D Q A1
10
11 R
00
I2 01 D Q A2
10
11 R
00
I3 01 D Q A3
10
11 R
Registers are covered in Chapter 6, Sections 6.1 and 6.2 of the course textbook.
The triggering signal could be the clock signal, or some other signal.
Ripple counters consist of a series of flip-flops where the output Q of one flip-flop
is used (somehow) as the clock for the next flip-flop.
It is the lack of a common clock signal for each flip-flop that makes the counter
asynchronous.
A type of ripple counter that has n-bits, and can count in binary from 0 to 2n -1
and repeat.
A0 always flips…
A1 flips with A0 goes 1 ! 0…
A2 flips with A1 goes 1 ! 0…
Etc…
So, the i-th bit complements the (i+1)-th bit when it goes 1 ! 0.
T Q A1
R
T Q A2
R
T Q A3
R
clear
BINARY UP COUNTERS:
Should be able to take our previous example and construct a binary ripple down
counter…
It takes time for the output to change once the active clock edge arrives.
Because of this, it can take a lot of time for the higher order bits to change
(remember that the i-th bit output is used as the clock for the (i+1)-th bit).
count
A0
A1
A2
A3
So, the FF outputs do not change at the same time due to the ripple effect in the
clock inputs. We would like FF outputs to change simultaneously.
Binary ripple counters are covered in Chapter 6, Sections 6.3 of the course
textbook.
Different from ripple counters in that (the same) clock pulses are applied to the
clock inputs of all flip-flops simultaneously.
It is the application of the same clock signal to all flip-flops that makes the counter
synchronous.
We can design synchronous counters just like the design of clocked sequential
circuits… state diagram, state table, flip-flop selection, etc…
We can short-cut and avoid K-Maps to make the up counter if we see that:
A0 is always toggling…
A1 toggles if A0 is 1…
A2 toggles if A0, A1 are 1…
A3 toggles if A0, A1, A2 are 1…
So, we can draw the circuit directly, but first we will add an enable signal.
If enable=1, then the circuit should behave normally and count up.
enable T Q A0
R
T Q A1
R
T Q A2
R
T Q A3
R
next
stage
clock clear
We can short-cut and avoid K-Maps to make the down counter if we see that:
A0 is always toggling…
A1 toggles if A0 is 0…
A2 toggles if A0, A1 are 0…
A3 toggles if A0, A1, A2 are 0…
So, we can draw the circuit directly, but first we will add an enable signal.
If enable=1, then the circuit should behave normally and count down.
down T Q A0
R
T Q A1
R
T Q A2
R
T Q A3
R
next
stage
clock clear
up
T Q A0
down
R
T Q A1
R
T Q A2
R
T Q A3
R
clock clear
Have both logic for up count and down count; up has priority (it disables down).
Often useful to have a counter that we can load with a “starting” count.
This requires adding another control line (load) and data inputs:
load
up
down
L D U
I0 T Q A0
R
I1 T Q A1
R
I2 T Q A2
R
I3 T Q A3
R
clock clear
All of the previous counters could have been built using DFF or JKFF.
Making sure that the correct inputs get to the flip-flop to perform a specific
function (input equations will change depending on flip-flop type!!!)
Making sure that control priority disables the effect of other control lines (e.g.,
parallel load “turns off” up/down count signals.
E.g.,
I0 A0
I1 A1
I2 A2
I3 A3
CLR
UP
Sometimes we don’t want to count through the entire sequence of binary numbers.
We can use additional circuitry to detect our maximum count number and use a
parallel load to restart the counting.
0 I0 A0
0 I1 A1
0 I2 A2
0 I3 A3
1 CLR
1 UP
CLK
LOAD
Synchronous Binary Counters (Up, Down, Parallel Load, Etc.) and Modulo Counters
are covered in Chapter 6, Sections 6.4 of the course textbook.
Often we will have an n-bit counter that does not count through all 2n possible values.
E.g., when we “power up” the circuit, or perhaps due to “noise” elsewhere in the
circuit, we might accidentally find the output of our counter is an unexpected
value…
We are only concerned with the states involved with the count sequence; we will
consider the unused states later…
T Q
A0
R
T Q
A1
R
T Q
A2
R
We can now ask what would happen if we accidentally found ourselves in one of the
unused states.
Assume the state is an unused state, evaluate flip-flop inputs to see what the next
output state will be…
Can draw a state diagram showing both the used and unused states:
111 011
If it accidentally enters into an unused state, it will return to the normal count
sequence after the next active clock edge.
111 011
In this case, if the counter accidentally enters an unused state, it will never return
to the correct count sequence.
We should likely redesign such a counter, forcing unused states to have a next
state in the normal count sequence.
We can add additional detection circuitry in order to generate the disjoint timing
signals like a ring counter.
With a Johnson Counter, we can get 2n non-overlapping timing signals using n flip-
flops and some extra 2-input AND gates.
IMPORTANT: This section also describes some other types of counters (Switch-
Tail and Johnson Counters).