Digital Logic Design
Digital Logic Design
Registers
• A register is a group of flip- flops.
– Each flip- flop stores one bit of data; n flip- flops are
required to store n bits of data.
– There are several different types of registers available
commercially.
– The simplest design is a register consisting only of flip-
flops, with no other gates in the circuit.
• Loading the register – transfer of new data into the
register.
• The flip- flops share a common clock pulse (frequently
using a buffer to reduce power requirements).
• Output could be sampled at any time.
• Clearing the flip-flop (placing zeroes in all its bit) can be
done through a special terminal on the flip- flop.
1
4-bit Register
I0 D Q A0
Clock C
I1 D Q A1
C
I2 D Q A2
C
I3 D Q A3
C
Clear
2
4-bit Register With Parallel Load
Load
D Q A0
I0 C
D Q A1
I1 C
D Q A2
I2 C
D Q A3
I3 C
Clock
Shift Registers
3
4-Bit Shift Register
Serial
Serial Output
Input D Q D Q D Q D Q
C C C C
Clock
Serial Transfer
• A digital system is operating in a serial mode when
information is transferred and manipulated one bit at
a time, with bits transferred out of the source register
into the destination register.
• This is different from parallel transfer where all the
bits of a register are transferred at once.
• Serial transfer of information from register A to
register B is done with shift registers, where the serial
output from register A serves as the serial input for
register B.
4
Serial Transfer From Register A to Register B
SI Shift SO SI Shift SO
Register A Register B
CLK CLK
Clock
Shift
control
Clock
Shift
control
CLK
T1 T2 T3 T4
After T1 1 1 0 1 1 0 0 1
After T2 1 1 1 0 1 1 0 0
After T3 0 1 1 1 0 1 1 0
After T4 1 0 1 1 1 0 1 1
5
Serial Addition
• While operations are usually parallel because it is
faster, serial operations require less equipment.
• Serial addition can demonstrate this point, allowing
us to perform addition with a single full adder and our
two addends stored in a pair of shift registers, with
the carry-out going into a D-type flip-flop (and going
back in as the carry-in).
• Initially, register A and the carry flip-flop are cleared
to 0.
• The augend is initially placed in register B and serial
addition is used to place it into register A.
• The sum is placed in shift register A, replacing the
augend.
Serial Adder
Shift SI SO
control Shift
x
CLK Register A S
y FA
z C
Serial SI
Shift SO
input Q
Register B D
Clear
6
Redesigning the Serial Adder
• We will use a pair of shift registers whose
outputs will be x and y respectively. These are
corresponding bits of the addends.
• S is the sum bit produced and a flip-flop will
hold the carry bit as the flip-flop’s state Q.
• We will implement it using a JK flip-flop
7
Karnaugh Map for JQ
xy
Q
00 01 11 10
0 1
1 X X X X
JQ = xy
0 X X X X
1 1
JQ = x’y’ = (x + y)’
8
Karnaugh Map for S
xy
Q
00 01 11 10
0 1 1
1 1 1
S=x ⊕ y⊕Q
Serial Adder
Shift SI SO = x
control Shift
CLK Register A
Serial SI
Shift SO = y
input
Register B
C
K
Clear
9
Bi-directional Shift Registers
• A shift register that can shift in one direction is
called a unidirectional shift register.
• A shift register that can shift in either direction
is called a bi-directional shift register.
• Some shift register also allow for the simple
transfer of data.
10
Function Table For General Shift Register
S1 S0 Register
operation
0 0 No change
0 1 Shift Right
(down)
1 0 Shift Left (up)
1 1 Parallel load
S0
S1 4X1
D Q
0 MUX A1
1 C
2
I1 3
S0
S1 4X1 D Q
0 MUX
A2
1 C
2
I2 3
S0 D Q A3
S1 4X1
0 MUX C
1
Serial Input 2
I3 3
Clock
11
Counters
• A register that goes through a prescribed
sequences of states upon the application of an
input pulse is called a counter.
• The input pulse may be a clock pulse or may
have some other origin.
• A counter that goes through a binary sequence
is called a binary counter.
• An n-bit binary counter uses n flip-flops and
can count from 0 to 2 n-1.
Ripple Counters
• Counters are either ripple counters or
synchronous counters.
• In synchronous counters, all flip-flops receive
the common clock pulse; therefore they change
at the same time.
• In ripple counters, the output of one flip-flop is
used as a source for triggering others.
12
4-Bit Ripple Counter Using T-Type Flip-flop
A3 A2 A1 A0
R R R R
T C T C T C T C
Logic-1
Reset
Count
A3 A2 A1 A0
R R R R
J C K J C K J C K J C K
Logic-1
Reset
Count
13
4-Bit Ripple Counter Using D-Type Flip-flop
A3 A2 A1 A0
R R R R
D C D C D C D C
Reset
Count
14
BCD Ripple Counter
• A binary-coded decimal ripple counter will return to 0 after it
reaches 9, this necessarily changes the logic
Q8 Q4 Q2 Q1
J C K J C K J C K J C K
Logic-1
Count
Q8 Q4 Q2 Q1 Q8 Q4 Q2 Q1 Q8 Q4 Q2 Q1
15
Binary Counters
J Q A0
Count C
Enable K
J Q A1
C
K
J Q A2
C
K
J Q A3
C Output
K carry
Clock
16
Up-Down Binary Counter
• A count-down binary counter will go through binary
states in reverse order.
• E.g., a 4-bit count-down binary counter will start at
0000, go to 1111, then 1110, and so on down to 0000.
• As in regular counters, the least significant bit is
always complemented. But higher bits are
complemented only if the lower bits are all 0.
• We can design a counter that can go in either
direction, depending on the control inputs.
A1
T
C
A2
T
C
A3
T
C
Clock
17
BCD Counter
• BCD counters only go through states 0000 to
0001 up to 1001.
• The pattern is as regular as binary counter, so
we must go through the design process.
Q8 Q4 Q2 Q1 Q8 Q4 Q2 Q1 y TQ 8 TQ 4 TQ 2 TQ 1
0 0 0 0 0 0 0 1 0 0 0 0 1
0 0 0 1 0 0 1 0 0 0 0 1 1
0 0 1 0 0 0 1 1 0 0 0 0 1
0 0 1 1 0 1 0 0 0 0 1 1 1
0 1 0 0 0 1 0 1 0 0 0 0 1
0 1 0 1 0 1 1 0 0 0 0 1 1
0 1 1 0 0 1 1 1 0 0 0 0 1
0 1 1 1 1 0 0 0 0 1 1 1 1
1 0 0 0 1 0 0 1 0 0 0 0 1
1 0 0 1 0 0 0 0 1 1 0 0 1
1 0 1 0 X X X X 0 X X X X
1 0 1 1 X X X X 0 X X X X
1 1 0 0 X X X X 0 X X X X
1 1 0 1 X X X X 0 X X X X
1 1 1 0 X X X X 0 X X X X
1 1 1 1 X X X X 0 X X X X
18
Q2 Q1
Karnaugh Map For TQ8
Q8 Q4 00 01 11 10
00
01 1
11 X X X X
10 1 X X
TQ8 = Q8 Q1 + Q4 Q2 Q1
Q2 Q1
Karnaugh Map For TQ4
Q8 Q4 00 01 11 10
00 1
01 1
11 X X X X
10 X X
TQ4 = Q2 Q1
19
Q2 Q1
Karnaugh Map For TQ2
Q8 Q4 00 01 11 10
00 1 1
01 1 1
11 X X X X
10 X X
TQ2 = Q8 ’Q1
Q2 Q1
Karnaugh Map For TQ1
Q8 Q4 00 01 11 10
00 1 1 1 1
01 1 1 1 1
11 X X X X
10 1 1 X X
TQ1 = 1
20
4-Bit Counter With Parallel Load &
Synchronous Clear
• Counters often need to be preset with a pre-
specified value before counting begins.
• We also need the capability of clearing all bits
simultaneously.
↑ 0 0 0 No change
↑ 0 0 1 Increment
count
↑ 0 1 X Load inputs I0
through I3
↑ 1 X X Clear outputs
21
4-bit counter with parallel
Load load & synchronous clear
Count J Q
I0
A0
C
K
I1 J Q A1
C
K
J Q A2
I2
C
K
I3 J Q A3
C
K
Clock
Clear
22
State Table For Counter With Unused States
Present State Next State Flip-flop Inputs
A B C A B C JA KA JB KB JC KC
0 0 0 0 0 1 0 X 0 X 1 X
0 0 1 0 1 0 0 X 1 X X 1
0 1 0 1 0 0 1 X X 1 0 X
0 1 1 1 0 0 X X X X X X
1 0 0 1 0 1 X 0 0 X 1 X
1 0 1 1 1 0 X 0 1 X X 1
1 1 0 0 0 0 X 1 X 1 0 X
1 1 1 0 0 0 X X X X X X
BC
00 01 11 10
A
0 X X X X
KA = B
1 X 1
23
Karnaugh Maps for J B and KB
BC
00 01 11 10
A
0 1 X X
JB = C
1 1 X X
BC
00 01 11 10
A
0 X X X 1
KB = 1
1 X X X 1
BC
00 01 11 10
A
0 X 1 X X
KC = 1
1 X 1 X X
24
State Diagram For Counter With
Unused States
000 110
001 110
010 101
100 110
C C C
J K J K J K
Clock
Logic 1
25
Ring Counter
• Computers need timing signals that indicate
the sequence in which certain operations will
take place.
• These can be generated by ring counters,
circular shift registers with only one flip-flop
set at any time.
• The alternative to a 4-bit ring counter is a 2-bit
counter that goes through 4 distinct states and
uses a decoder.
Shift T0 T1 T2 T3
right T0 T1 T2 T3
Count
enable 2-bit counter
26
Sequence of Timing Signals From the
Ring Counter
CLK
T0
T1
T2
T3
A B C E
D D D D
C C C C
A’ B’ C’ E’
CLK
27
State Table For Switch-tail Counter
Flip-flop Outputs
Johnson Counters
A B C E
D D D D
C C B’ C C’ C
A’ E’
CLK
Seq. # 1 2 3 4 5 6 7 8
28