i_hate_digital_logic
i_hate_digital_logic
• The 3-variable K-
map
Implicants, Prime implicants and
Essential Prime implicants
Implicants: An implicant is a product/minterm term in Sum of
Products (SOP) or sum/maxterm term in Product of Sums (POS)
of a Boolean function.
Prime Implicants: A group of squares or rectangles made up of a
bunch of adjacent minterms which is allowed by the definition
of K-Map are called prime implicants(PI) i.e. all possible groups
formed in K-Map.
Essential Prime Implicants: These are those subcubes(groups)
that cover at least one minterm that can’t be covered by any
other prime implicant. Essential prime implicants(EPI) are those
prime implicants that always appear in the final solution.
Seven-Segment Decoder a
w x y z abcdefg
w a
0 0 0 0 1111110 b
0 0 0 1 0110000 x c f b
? d g
0 0 1 0 1101101 y e
0 0 1 1 1111001 z f
g
0 1 0 0 0110011 e c
0 1 0 1 1011011 BCD code
0 1 1 0 1011111
0 1 1 1 1110000 y d
1 0 0 0 1111111 1 1 1
1 0 0 1 1111011 1 1 1
1 0 1 0 xxxxxxx x x x x
x
1 0 1 1 xxxxxxx w 1 1 x x
1 1 0 0 xxxxxxx z
1 1 0 1 xxxxxxx
1 1 1 0 xxxxxxx a = w + y + xz + x’z’ b=...
c=...
1 1 1 1 xxxxxxx
d=...
12 / 65
Binary• Half
AdderAdder x
x S
HA + y
• Adds 1-bit plus 1-bit y C ───
• Produces Sum and Carry C S
x y C S
0 0 0 0
x S
0 1 0 1
1 0 0 1
1 1 1 0 y C
13 / 65
x
Binary• Full
Adder
Adder x S
+ y
+ z
• Adds 1-bit plus 1-bit plus 1-bit y FA
z C ───
• Produces Sum and Carry C S
y
x y z C S 0 1 0 1
0 0 0 0 0 x 1 0 1 0
0 0 1 0 1 z
0 1 0 0 1 S = xy'z'+x'yz'+x'y'z+xyz = x y z
0 1 1 1 0 y
1 0 0 0 1 0 0 1 0
1 0 1 1 0 x 0 1 1 1
1 1 0 1 0 z
1 1 1 1 1 C = xy + xz + yz 14 / 65
• Carry propagation
• The sum and the output carry of any stage cannot be
produced until the input carry occurs; this causes a time
delay in the addition process,
• (A1, B1, C1) → C2 → C3 → C4 → (C5, S4)
15 / 65
Magnitude Comparator
• Compare 4-bit number to 4-bit number
x3 = A3 B3 + A3 B3 A3A2A1A0 B3B2B1B0
x2 = A2 B2 + A2 B2
Magnitude
x1 = A1 B1 + A1 B1 Comparator
x0 = A0 B0 + A0 B0
A<B A=B A>B
( A = B) = x3 x2 x1 x0
( A B) = A3 B3 + x3 A2 B2 + x3 x2 A1 B1 + x3 x2 x1 A0 B0
( A B) = A3 B3 + x3 A2 B2 + x3 x2 A1 B1 + x3 x2 x1 A0 B0
16 / 65
Decoders
• Binary (2-to-4 Line) Decoder
Y3
y3 Y2
Decoder
I1
Binary
y2
y1 Y1
I0 y0
Y0
I1 I 0 Y3 Y2 Y1 Y0
I1
0 0 0 0 0 1 I0
0 1 0 0 1 0
Y3 = I1 I 0 Y2 = I1 I 0
1 0 0 1 0 0
1 1 1 0 0 0 Y1 = I1 I 0 Y0 = I1 I 0
17 / 65
Decoders
• Y3
Y3
Decoder
I1 Y2
Binary
Y2
I0 Y1
E Y1
Y0
Y0
E I1 I0 Y 3 Y2 Y1 Y0
0 x x 0 0 0 0
I1
1 0 0 0 0 0 1 I0
E
1 0 1 0 0 1 0
1 1 0 0 1 0 0
1 1 1 1 0 0 0
18 / 65
Decoders
• Active-High / Active-Low
I1 I0 Y 3 Y 2 Y 1 Y 0 I1 I0 Y 3 Y 2 Y 1 Y 0
0 0 0 0 0 1 0 0 1 1 1 0
0 1 0 0 1 0 0 1 1 1 0 1
1 0 0 1 0 0 1 0 1 0 1 1
Y3
1 1 1 0 0 0 1 1 0 1 1 1
Y2
Y1
Y3 Y3
Decoder
Decoder
I1 I1
Binary
Binary
Y2 Y2 Y0
Y1 Y1
I0 Y0 I0 Y0 I1
I0
19 / 65
Decoders
• 3-to-8 Line Decoder Y7 = I 2 I1 I 0
Y6 = I 2 I1 I 0
Y7 Y5 = I 2 I1 I 0
Y6
Y5 Y4 = I 2 I1 I 0
Decoder
Binary
I2 Y4 Y3 = I 2 I1 I 0
I1 Y3
I0 Y2 Y2 = I 2 I1 I 0
Y1 Y1 = I 2 I1 I 0
Y0
Y0 = I 2 I1 I 0
I2
I1
I0
20 / 65
Encoders
• Put “Information” into code Only one
• 2^N- input and N – output input
• For 2^N inputs, all out put will be high or low switch
should be
activated
at a time
1
x1
x3 x2 x1 y1 y0
x2 y1 0 0 0 0 0
2 Binary
Encoder 0 0 1 0 1
y0 0 1 0 1 0
x3
3 1 0 0 1 1
21 / 65
Encoders
• Octal-to-Binary Encoder (8-to-3)
I7
I7 I6 I5 I4 I3 I2 I1 I0 Y2 Y1 Y0 I6
I5
Encoder
0 0 0 0 0 0 0 1 0 0 0 Y2
Binary
0 0 0 0 0 0 1 0 0 0 1 I4 Y1
0 0 0 0 0 1 0 0 0 1 0 I3 Y0
0 0 0 0 1 0 0 0 0 1 1 I2
0 0 0 1 0 0 0 0 1 0 0 I1
0 0 1 0 0 0 0 0 1 0 1 I0
0 1 0 0 0 0 0 0 1 1 0 I7
1 0 0 0 0 0 0 0 1 1 1 I6 Y2
I5
Y2 = I 7 + I 6 + I 5 + I 4 I4
I3 Y1
Y1 = I 7 + I 6 + I 3 + I 2 I2
I1
Y0 = I 7 + I 5 + I 3 + I1 I0 Y0
22 / 65
Implementation Using Multiplexers
(8:1)
• Example
F(x, y, z) = ∑(1, 2, 6, 7)
0 I0
x y z F 1 I1
0 0 0 0 1 I2
0 0 1 1 0 I3
Y F
0 1 0 1 0 I4 MUX
0 1 1 0 0 I5
1 I6
1 0 0 0
1 I7
1 0 1 0 S2 S1 S0
1 1 0 1
1 1 1 1 x y z
23 / 65
Implementation Using Multiplexers
(8:1)
• Example
F(A, B, C, D) = ∑(1, 3, 4, 11, 12, 13, 14, 15)
A B C D F
0 0 0 0 0
F=D
D I0
0 0 0 1 1
0 0 1 0 0
D I1
F=D
0 0 1 1 1 D I2
0 1 0 0 1
0 1 0 1 0
F=D 0 I3
0 MUX Y F
0 1 1 0 0
F=0 I4
0 1 1 1 0 D
1 0 0 0 0
I5
1 0 0 1 0 F=0 1 I6
1 0 1 0 0
1 0 1 1 1
F=D 1 I7
1 1 0 0 1 S2 S1 S0
F=1
1 1 0 1 1
1 1 1 0 1 F=1
1 1 1 1 1 A B C
24 / 65
Example of Dynamic Hazard
25
Example of Static 1 Hazard
28
Logic Family
29
Logic Family
30
Logic Family
31
Logic Family
32
Logic Family
33
Logic Family
34
Logic Family
35
Latches
• SR Latch
S R Q
R Q Q0 No change
0 0
0 1 0 Reset
1 0 1 Set
S Q 1 1 Q=Q’=0 Invalid
S S’ R’ Q
Q Invalid
0 0 Q=Q’=1
0 1 1 Set
Q 1 0 0 Reset
R Q0 No change
1 1
36
Flip-flop
• A flip-flop is a bistable (two stable states) logic
circuit that can store only one bit at a time, either a 1
or a 0.
• The output of a flip-flop indicates which bit it is
storing.
• An edge-triggered flip-flop changes state either at
the positive edge (rising edge) or at the negative
edge (falling edge) of the clock pulse and is sensitive
to its inputs only at this transition of the clock.
37
Truth Table of D flip-flop
39
T flip-flop
• The T flip-flop or Toggle flip-flop changes output
state at every active clock edge if the input T = 1.
• If T = 0, the output stays the same.
• T flip-flops are often used as counters.
40
Timing Diagram of D flip-flop with PRESET and CLEAR
inputs
• When active-LOW PRESET = 0, the output of D flip-flop is SET (Q=1).
• When active-LOW CLEAR = 0, the output of D flip-flop is RESET or
CLEAR (Q=0).
• When active-LOW CLEAR and PRESET are both HIGH, normal
synchronous operation of D flip-flop takes place.
41
Flip-Flop Characteristic Equations
D Q D Q(t+1)
0 0 Q(t+1) = D
Q 1 1
J K Q(t+1)
J Q 0 0 Q(t)
0 1 0 Q(t+1) = JQ’ + K’Q
K Q 1 0 1
1 1 Q’(t)
T Q T Q(t+1)
0 Q(t) Q(t+1) = T Q
Q
1 Q’(t)
42
Asynchronous binary counter by negative-edge-triggered flip-flops
• We have to reverse the connections.
• Up count: Q output of present flip-flop is connected to T input of following flip-
flop.
• Down count: Q’ output of present flip-flop is connected to T input of following
flip-flop.
• Again, for counting up, a RESET is required and for counting down, a SET is
required before the counting starts.
• Note that counting sequence, propagation delay, and time period T are the same
as positive-edge-triggered cases for counting up and down.
FF0 Q0 FF1 Q1 FF0 Q0 FF1 Q1
Q Q Q Q
CLK T T CLK T T
Count
Control FF0 Q0 FF1 Q1 FF(n-2) Qn-2 FF(n-1) Qn-1
T Q T Q T Q T Q
CLK C C C C
CLR CLR CLR CLR
CLR
•Total delay time (called cumulative delay) from CLK
CLK to Qn-1 is n. Q0
•Total number of different states of the counter is 2n. Q1
•The period of Qn-1 waveform is 2nT, where T is the
period of clock signal. Qn-2
•If Q0 is the LSB (least significant bit) and Qn-1is Qn-1
the MSB (most significant bit), the maximum count tPHL tPD
in decimal is 2n - 1.
• A synchronous counter is one in which all the flip-flops in the counter are
clocked at the same time by a common clock pulse.
• Note that only JK or clocked T flip-flop is used because hold and toggle
modes are need for the counter operation.
45
• Counters can be connected in cascade to achieve higher-modulus
operation. Cascading means that the last-stage output of one counter
drives the input of the next counter. e.g.
Mod-10
47
• The shift register may be operated in four modes: serial in and serial out,
Basic types of data movement in shift registers
parallel in and serial out, serial in and parallel out, or parallel in and parallel
out as shown in Fig below. The rotation modes are used to generate binary
sequence continuously.
Data in
Data
in
48