Sei sulla pagina 1di 59

Digital Logic Design

Chapter 6
Registers and Counters

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
• The common clock
• input triggers all
flip‐flops on the
positive edge of each
pulse

• Binary data available


at the four inputs are
transferred into the
register.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Registers

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
FIGURE 6.2 Four‐bit register with parallel load

Use a Load Control to change


register contents

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Serial transfer from register A to register B

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Table 6.1 Serial‐Transfer Example

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Serial Adder

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
FIGURE 6.5 Serial adder

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Design of a Serial Adder

• First, we assume that two shift registers are


available to store the binary numbers to be
added serially.
• The serial outputs from the registers are
designated by x and y.
• The sequential circuit has the two inputs, x
and y,
• that provide a pair of significant bits, an
output S that generates the sum bit, and
flip‐flop Q for storing the carry.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Design of a Serial Adder

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
State Equations

• The two flip‐flop input equations and the


output equation can be simplified by
means of maps to

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
FIGURE 6.6 Second form of serial adder

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Until Now
• Registers with parallel loading
• Shift registers
• Serial Inputs

A register capable of shifting in one direction only is a


unidirectional shift register.
One that can shift in both directions is a bidirectional shift
register.
If the register has both shifts and parallel‐load capabilities, it is
referred to as a universal shift register.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Universal Shift Register Continued…

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Universal Shift Register Block Diagram

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Table 6.3 Function Table for the Register of Fig. 6.7

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Universal Shift Register

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Counter Types

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Ripple Counter

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Table 6.4 Binary Count Sequence

• The least significant bit, A0,


is complemented with each
count pulse input.
• Every time that A0 goes
from 1 to 0, it complements
A1.
• Every time that A1 goes
from 1 to 0, it complements
A2.
• Every time that A2 goes
from 1 to 0, it complements
A3
• and so on for any other
higher order bits of a ripple
counter.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
4 bit Binary Up Counter Timing Diagram

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
T FF implementation

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
JK FF implementation

J = k =1 is Toggle State for JK Flip Flop

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
D FF implementation

Q’ is fed back into D to achieve


Toggle State

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
BCD Counter

• A decimal counter follows a sequence of


10 states and returns to 0 after the count
of 9.
• Such a counter must have at least four
flip‐flops to represent each decimal digit
• A decimal counter is similar to a binary
counter, except that the state after 1001
(the code for decimal digit 9) is 0000 (the
code for decimal digit 0).
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
FIGURE 6.9 State diagram of a decimal BCD counter

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
• A should toggle at every
clock input

• B should toggle every


time A goes from 1 to 0
unless D is 1

• C toggles every time B


goes from 1 to 0

• D is 0 as long as C or B is
0.

• When Both C and D = 1,


D toggles when A goes
from 1 to 0

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
FIGURE 6.10 BCD ripple counter

• A should toggle at every


clock input

• B should toggle every


time A goes from 1 to 0
unless D is 1

• C toggles every time B


goes from 1 to 0

• D is 0 as long as C or B is
0.

• When Both C and D = 1,


D toggles when A goes
from 1 to 0

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
BCD Counter – Alternate implementation

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
• The BCD counter discussed previously was a decade counter, since it
counts from 0 to 9.
• To count in decimal from 0 to 99, we need a two‐decade counter. To
count from 0 to 999, we need a three‐decade counter.
• Multiple decade counters can be constructed by connecting BCD
counters in cascade, one for each decade.
• A three‐decade counter is shown in the figure above.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Synchronous Counters

• Synchronous counters are different from


ripple counters in that clock pulses are
applied to the inputs of all flip‐flops.
• A common clock triggers all flip‐flops
simultaneously, rather than one at a time in
succession as in a ripple counter.
• The decision whether a flip‐flop is to be
complemented is determined from the values
of the data inputs, such as T or J and K at the
time of the clock edge.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Synchronous Binary Counter

• In a synchronous binary
counter, the flip‐flop in the
least significant position
is complemented with
every pulse

• A flip‐flop in any other


position is complemented
when all the bits in the
lower significant
positions are equal to 1 .

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Synchronous Binary Counter

If present state of flip flop is 0011


• A0 is always
complemented.
• A1 is complemented
because the present state
of A0 = 1.
• A2 is complemented
because the present state
of A1A0 = 11.
• However, A3 is not
complemented, because
the present state of
A2A1A0 = 011, which
does not give an all 1’s
condition

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Synchronous Binary Counter

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
FIGURE 6.12 Four‐bit synchronous binary counter

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Synchronous Up Down Binary Counter

• A synchronous countdown binary counter


goes through the binary states in reverse
order, from 1111 down to 0000 and back
to 1111 to repeat the count.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Synchronous Up Down Binary Counter

• The bit in the least


significant position is
complemented with each
pulse.

• A bit in any other position


is complemented if all
lower significant bits are
equal to 0.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Synchronous Up Down Binary Counter

For example, the next state after


the present state of 0100 is 0011.

• The least significant bit is


always complemented.

• The second significant bit is


complemented because the
first bit is 0.

• The third significant bit is


complemented because the
first two bits are equal to 0.

• But the fourth bit does not


change, because not all lower
significant bits are equal to 0.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
FIGURE 6.13
Four‐bit up–down
binary counter

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Synchronous BCD counter

• A BCD counter counts in binary‐coded decimal from


0000 to 1001 and back to 0000.
• Because of the return to 0 after a count of 9, a BCD
counter does not have a regular pattern, unlike a straight
binary count.
• To derive the circuit of a BCD synchronous counter, it is
necessary to go through a sequential circuit design
procedure.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Table 6.5 State Table for BCD Counter

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Synchronous BCD counter

• The flip‐flop input equations can be simplified


by means of maps.
• The unused states for minterms 10 to 15 are
taken as don’t‐care terms.
• The simplified functions are
TQ1 = 1
TQ2 = Q8Q1
TQ4 = Q2Q1
TQ8 = Q8Q1 + Q4Q2Q1
y = Q8Q1
• The circuit can easily be drawn with four T
flip‐flops, five AND gates, and one OR gate

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Binary Counter with Parallel Load

• Counters employed in digital systems quite often require a


parallel‐load capability for transferring an initial binary
number into the counter prior to the count operation.
• When equal to 1, the input load control disables the count
operation and causes a transfer of data from the four data
inputs into the four flip‐flops.
• If both control inputs are 0, clock pulses do not change the
state of the register.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Table 6.6 Function Table for the Counter of Fig. 6.14

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Only 2 bit load circuit for analysis
Output states are currently 00
Load 01 into outputs
Make load = 1, Count =0.

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
Input to flip flops determines output on
next clock pulse

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
FIGURE 6.15 Two ways to achieve a BCD counter
using a counter with parallel load
• Detect sequence 1001 and make • Detect sequence 1010 and make
Load=1 Clear=1
• Inputs are all 0s which when loaded
into the circuit clear all outputs

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.
• End of Chapter 6
• End of Course 

Digital Design: With an Introduction to the Verilog HDL, 5e Copyright ©2013 by Pearson Education, Inc.
M. Morris Mano • Michael D. Ciletti All rights reserved.

Potrebbero piacerti anche