Академический Документы
Профессиональный Документы
Культура Документы
Chapter 4
LOGIC CIRCUITS
� Logic Circuits: Combinational and Sequential
� Combinational Circuits
⚫ A combinational circuit consists of logic gates whose
outputs at any time are determined from only the
present combination of inputs.
� Sequential Circuits
⚫ A sequential circuits employ storage elements and logic
gates.
⚫ The outputs are a function of the inputs and the
state of the storage elements.
⚫ The state of the storage elements, in turn, is a function
of the previous inputs (and the previous state).
COMBINATIONAL CIRCUITS
Or
A B C F F2 T T T F
0 0 0 2 ´ 1 2 3 1
0 0 1 0 1 0 0 0 0
0 1 0 0 1 1 0 1 1
0 1 1 0 1 1 0 1 1
1 0 0 1 0 1 0 0 0
1 0 1 0 1 1 0 1 1
1 1 0 1 0 1 0 0 0
1 1 1 1 0 1 0 0 0
1 0 1 1 0 1
DESIGN PROCEDURE
� Given a problem statement:
⚫ Determine the number of inputs and outputs
⚫ Derive the truth table
⚫ Simplify the Boolean expression for each output
⚫ Produce the required circuit and verify it
Example:
Design a circuit to convert a “BCD” code to “Excess 3”
code
⮚ 4-bits ⮚ 4-bits
⮚ 0-9 values
? ⮚ Value+3
DESIGN PROCEDURE
BCD-TO-EXCESS 3 CONVERTER
C C
A B C D w x y z
0 0 0 0 0 0 1 1 1 1 1
0 0 0 1 0 1 0 0 1 1 1 1
x x x x B x x x x B
0 0 1 0 0 1 0 1 A 1 1 x x
A 1 x x
0 0 1 1 0 1 1 0 D D
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0 w = A+BC+BD x = B’C+B’D+BC’D’
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0 C C
1 0 0 0 1 0 1 1
1 1 1 1
1 0 0 1 1 1 0 0 1 1 1 1
1 0 1 0 x x x x x x x x B x x x x B
A 1 x x A 1 x x
1 0 1 1 x x x x
1 1 0 0 x x x x D D
1 1 0 1 x x x x
1 1 1 0 x x x x y = C’D’+CD z = D’
1 1 1 1 x x x x
DESIGN PROCEDURE
BCD-TO-EXCESS 3 CONVERTER
A B C D w x y z
0 0 0 0 0 0 1 1
0 0 0 1 0 1 0 0
0 0 1 0 0 1 0 1
0 0 1 1 0 1 1 0
0 1 0 0 0 1 1 1
0 1 0 1 1 0 0 0
0 1 1 0 1 0 0 1
0 1 1 1 1 0 1 0
1 0 0 0 1 0 1 1
1 0 0 1 1 1 0 0
1 0 1 0 x x x x
1 0 1 1 x x x x
1 1 0 0 x x x x
1 1 0 1 x x x x w = A + B(C+D) y = (C+D)’ + CD
1 1 1 0 x x x x x = B’(C+D) + B(C+D)’ z = D’
1 1 1 1 x x x x
DECODERS
� A decoder is a combinational circuit that converts binary
information from n input lines to an 2n unique output lines.
� 1-to-2-Line Decoder
DECODERS
Only one
� Extract “Information” from the code lamp will
� Binary Decoder turn on
⚫ Example: 2-bit Binary Number
1
x1 0 0
Binary
0 0
x0 Decoder
0
DECODERS
� 2-to-4 Line Decoder
Decoder Y3
I1
Binary
Y2
Y1
I0
Y0
I1 I0 Y3 Y2 Y1 Y0
0 0 0 0 0 1
0 1 0 0 1 0
1 0 0 1 0 0
1 1 1 0 0 0
DECODERS
� 3-to-8 Line Decoder
Y7
Y6
Y5
Decoder
I2
Binary
Y4
I1
Y3
I0
Y2
Y1
Y0
DECODERS
� “Enable” Control
Y3
I1 Decoder
Binary
Y2
I0
Y1
E
Y0
E I1 I 0 Y3 Y2 Y1 Y0
0 x x 0 0 0 0
1 0 0 0 0 0 1
1 0 1 0 0 1 0
1 1 0 0 1 0 0
1 1 1 1 0 0 0
DECODERS
� Active-High / Active-Low
I1 I0 Y3 Y2 Y1 Y0 I 1 I 0 Y 3 Y2 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
1 1 1 0 0 0 1 1 0 1 1 1
Y3 Y3
Decoder
I1 I1 Decoder
Binary
Binary
Y2 Y2
Y1 Y1
I0 I0
Y0 Y0
DECODERS
DECODERS I2 I1 I0
� Expansion
I2 I1 I0 Y7 Y6 Y5 Y4 Y3 Y2 Y1 Y0
Y3 Y7
Decoder
0 0 0 0 0 0 0 0 0 0 1 I0
Binary
Y2 Y6
0 0 1 0 0 0 0 0 0 1 0 I1
0 1 0 0 0 0 0 0 1 0 0 Y1 Y5
E
0 1 1 0 0 0 0 1 0 0 0 Y0 Y4
1 0 0 0 0 0 1 0 0 0 0
1 0 1 0 0 1 0 0 0 0 0 Y3
Decoder
I0
Binary
1 1 0 0 1 0 0 0 0 0 0 Y2 Y3
I1
1 1 1 1 0 0 0 0 0 0 0 Y1 Y2
E
Y0 Y1
Y0
IMPLEMENTATION USING DECODERS
Binary
� Each output is a minterm Decoder
� All minterms are produced Y7
� Sum the required minterms Y6
Y5
x I2
Example: Full Adder Y4
y I1
S(x, y, z) = ∑(1, 2, 4, 7) z Y3
I0
C(x, y, z) = ∑(3, 5, 6, 7) Y2
Y1
Y0
S C 18 / 65
ENCODERS
� Does reverse operation to decoder
� An encoder has 2n (or fewer) input lines and n output
lines
� Constraint – only one input is active at a time
ENCODERS
� Octal-to-Binary Encoder (8-to-3) I7
I6
I7 I6 I5 I4 I3 I2 I1 I0 Y2 Y1 Y0
Encoder
0 0 0 0 0 0 0 1 0 0 0 I5 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
0 1 0 0 0 0 0 0 1 1 0 I0
1 0 0 0 0 0 0 0 1 1 1
PRIORITY ENCODERS
� Encoder with priority function
⚫ Multiple inputs may be true simultaneously
⚫ Higher priority input gets the precedence
PRIORITY ENCODERS
� 4-Input Priority Encoder I3 V
Encoder
Priority
I2 Y1
I3 I 2 I1 I 0 Y1 Y0 V
I1 Y0
0 0 0 0 x x 0 I0
0 0 0 1 0 0 1
0 0 1 x 0 1 1
0 1 x x 1 0 1
1 x x x 1 1 1
MULTIPLEXERS
� A multiplexer is a combinational circuit that selects one of
many input lines (2n) and directs it to its single output line.
� There are n selection lines whose bit combinations
determine which input is selected.
MULTIPLEXERS
� 4-to-1 MUX
I0
I1
MUX Y
I2
I3 S1 S0
S1 S0 Y
0 0 I0
0 1 I1
1 0 I2
1 1 I3
FUNCTION IMPLEMENTATION USING
MUX
� (n+1) variable function can be implemented with 2n x 1
MUX
� Simplify the function in sum of minterms form
� Among (n+1) variables, n variables are used as selector
and one variable is connected with input lines
f(A, B, C, D, E, …..)
Input Selectors
Procedure 1
IMPLEMENTATION USING
MULTIPLEXERS:
PROCEDURE 1
F(A, B, C) = ∑(1, 3, 5, 6)
Steps:
1. Choose the selector variables.
Lets choose,
• B, C as selector S1 and S0
• A as input line
2. In the first row, list the name of the input lines of the
multiplexers horizontally
3. In the second row, list the minterms where A is
complemented
4. In the third row, list the minterms where A is
uncomplemented
IMPLEMENTATION USING
MULTIPLEXERS:
PROCEDURE 1
F(A, B, C) = ∑(1, 3, 5, 6)
Steps:
5. Circle the minterms for which the function outputs 1
6. Fourth row presents the multiplexer inputs
• If the two minterms in a column are not circled, apply 0 to the
corresponding multiplexer input
• If the two minterms in a column are circled, apply 1 to the
corresponding multiplexer input
• If the bottom minterm is circled and the top is not circled,
apply A to the corresponding multiplexer input
• If the top minterm is circled and the bottom is not circled,
apply A’ to the corresponding multiplexer input
IMPLEMENTATION USING
MULTIPLEXERS:
PROCEDURE 1
� F(A, B, C) = ∑(1, 3, 5, 6)
0 I0
MUX input line I0 I1 I2 I3
1 I1
4x1 MUX
A’ 0 1 2 3 I2
I3 S1 S0
A 4 5 6 7
Input values 0 1 A A’
A B C
IMPLEMENTATION USING
MULTIPLEXERS:
PROCEDURE 1
� F(A, B, C) = ∑(1, 3, 5, 6)
What if A, B are the selectors and C goes to input line?
I0
MUX input line I0 I1 I2 I3
I1
4x1 MUX
C’ 0 2 3 6 I2
I3 S1 S0
C 1 3 5 7
Input values C C C C’
C A B
Procedure 2
IMPLEMENTATION USING
MULTIPLEXERS:
PROCEDURE 2
� Steps:
1. Complete the truth table from the SOP.
2. The first n – 1 variables in the table are applied to the
selection inputs of the multiplexer.
3. For each combination of the selection variables, we
evaluate the output as a function of the last variable.
4. Apply these values to the data input in proper order.
IMPLEMENTATION USING
MULTIPLEXERS:
PROCEDURE 2
� Example F(x, y) = ∑(0, 1, 3)
x y F
1 I0
0 0 1 1 I1
MUX Y F
0 1 1 0 I2
1 0 0 1 I3 S1 S0
1 1 1
x y
IMPLEMENTATION USING
MULTIPLEXERS:
PROCEDURE 2
� Example F(x, y, z) = ∑(1, 2, 6, 7)
x y z F
0 I0
0 0 0 0 1 I1
0 0 1 1 1 I2
0 1 0 1 0 I3 MUX Y F
0 1 1 0 0
I4
1 0 0 0 0
1 I5
1 0 1 0 I6
1
1 1 0 1 I7 S2 S1 S0
1 1 1 1
x y
z
IMPLEMENTATION USING
MULTIPLEXERS:
PROCEDURE 2
� F(x, y, z) = ∑(1, 2, 6, 7)
x y z F
0 0 0 0 z I0
0 0 1 1 F=z z I1
F
MUX Y
0 1 0 1 0 I2
0 1 1 0 F=z 1 I3 S1 S0
1 0 0 0
F=0 x
1 0 1 0
1 1 0 1 y
F=1
1 1 1 1
35 / 65
IMPLEMENTATION USING
MULTIPLEXERS:
PROCEDURE 2
� 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
0 0 1 1 1 F=D D
0 1 0 0 1 I2
F=D 0
0 1 0 1 0 I3 MUX Y F
0 1 1 0 0 0
0 1 1 1 0 F=0 I4
1 0 0 0 0 D
1 0 0 1 0 F=0 1 I5
1 0 1 0 0
1 0 1 1 1 F=D 1 I6
1 1 0 0 1
F=1 I7 S2 S1 S0
1 1 0 1 1
1 1 1 0 1
1 1 1 1 1 F=1 A B C
PROCEDURE 1 VS PROCEDURE 2
� Among the function variables, if the first or some middle
variable other than the last one is to be used in input line
then procedure 1 is preferable.
MULTIPLEXER EXPANSION
4-TO-1 MUX USING 2-TO-1 MUX
I0
I1 S1 S0 Y
0 0 I0
0
Y 0 1 I1
1 1 0 I2
I2 1 1 I3
I3
S1 S0
MULTIPLEXER EXPANSION
4-TO-1 MUX USING 2-TO-1 MUX
I0
I1 S1 S0 Y
0 0 I0
0
Y 0 1 I1
1 1 0 I2
I2 1 1 I3
I3
S1 S0
MULTIPLEXER EXPANSION
4-TO-1 MUX USING 2-TO-1 MUX
I0
I1 S1 S0 Y
0 0 I0
0
Y 0 1 I1
1 1 0 I2
I2 1 1 I3
I3
S1 S0
MULTIPLEXER EXPANSION
4-TO-1 MUX USING 2-TO-1 MUX
I0
I1 S1 S0 Y
0 0 I0
0
Y 0 1 I1
1 1 0 I2
I2 1 1 I3
I3
S1 S0
MULTIPLEXER EXPANSION
4-TO-1 MUX USING 2-TO-1 MUX
I0
I1 S1 S0 Y
0 0 I0
0
Y 0 1 I1
1 1 0 I2
I2 1 1 I3
I3
S1 S0
MULTIPLEXER EXPANSION
8-TO-1 MUX USING DUAL 4-TO-1 MUX
I0 I0
I1 I1
MUX Y
I2 I2
I3 I3 S1 S0
I0
MUX Y Y
I1
I0 S
I4 I1
I5 MUX Y
I2
I6 I3 S1 S0
I7
1 0 0
S2 S1 S0
MULTIPLEXERS
� Quad 2-to-1 MUX:
Four 2x1 MUX can be used simultaneously
A3 I0
B3 MUX Y
I1 S A3
A2
A1
A2 I0
MUX Y
Y3
A0
B2 I1 S MUX 2
Y
B3 Y1
B2 Y0
I0 B1
MUX Y
I1 S B0 S E
A1
B1
I0
MUX Y
I1 S
S
MULTIPLEXERS
� Quad 2-to-1 MUX
A3 I0
B3 MUX Y
I1 S
A2 I0
MUX Y
B2 I1 S
I0
MUX Y
I1 S
A1
B1
I0
MUX Y
I1 S
S Active High Enable:
A0 E The output is enabled
B0 when E=0
MULTIPLEXERS
� Quad 2-to-1 MUX
A3 I0
B3 MUX Y
I1 S
A2 I0
MUX Y
B2 I1 S
I0
MUX Y
I1 S
A1
B1
I0
MUX Y
I1 S
S
Active Low Enable:
A0 E The output is enabled
B0 when E=0
DEMULTIPLEXERS
� A circuit receives information from a single line and
directs it to one of 2n possible output lines.
Y3 S1 S0 Y3 Y2 Y1 Y0
Y 0 0 0 0 0 I
I DeMUX 2
Y1 0 1 0 0 I 0
S1 S0 Y0 1 0 0 I 0 0
1 1 I 0 0 0
DEMULTIPLEXERS / DECODERS
� A decoder with enable input can function as a
demultiplexer
Y3
I1 Decoder
Binary
Y2
I0
Y1
E
Y0
E I1 I0 Y3 Y2 Y1 Y0
0 x x 0 0 0 0
1 0 0 0 0 0 1
1 0 1 0 0 1 0
1 1 0 0 1 0 0
1 1 1 1 0 0 0
DEMULTIPLEXERS
Y3
Y
I DeMUX 2
Y1
S1 S0 Y0
I S1 S 0 Y3 Y2 Y1 Y0
0 x x 0 0 0 0
1 0 0 0 0 0 1
S1
1 0 1 0 0 1 0
S0
1 1 0 0 1 0 0 I
1 1 1 1 0 0 0
Z=impedance
THREE-STATE GATES
� Tri-State Buffer
C A Y
0 x Hi-Z
A Y
1 0 0
1 1 1
C
A Y
� Tri-State Inverter
C
THREE-STATE GATES
2-TO-1-LINE MUX
C Y
I0
0 I0
Y
1 I1
I1
C (Selector)
THREE-STATE GATES
4-TO-1-LINE MUX
I3
E S1 S0 Y
I2 0 x x 0
INPUTS
Y 1 0 0 I0
1 0 1 I1
I1
1 1 0 I2
1 1 1 I3
I0
Y3
Decoder
S1 I1
Selectors
Binary
Y2
S0 I0
Y1
E E
Y0
BINARY ADDER
� The most basic arithmetic operation is the addition of two
binary digits.
C
y
BINARY ADDER x
y S
z FA
� Full Adder C
⚫ Adds 1-bit plus 1-bit plus 1-bit x
⚫ Produces Sum and Carry + y
y + z
x y z C S
0 0 0 0 0 0 1 0 1 ───
0 0 1 0 1 x 1 0 1 0 C S
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
1 0 1 1 0 0 0 1 0
1 1 0 1 0 x 0 1 1 1
z
1 1 1 1 1
C = xy + xz + yz
BINARY ADDER
� Full Adder
S = xy'z'+x'yz'+x'y'z+xyz = x ⊕ y ⊕ z
C = xy + xz + yz
x
S S
x
y y
C
z
z C
BINARY ADDER
� Full Adder
x S
y HA HA
z C
x
S
y
C
z
BINARY ADDER
x3x2x1x0 y3y2y1y0
c3 c2 c1 .
+ x 3 x2 x 1 x 0
Carry
Cy Binary Adder C0 + y 3 y2 y 1 y 0
Propagate
Addition ────────
Cy S3 S2 S1 S0
S3S2S1S0
x3 x2 x1 x0
y3 y2 y1 y0
0
FA FA FA FA
C4 C3 C2 C1
S3 S2 S1 S0
FOUR-BIT BINARY ADDER
� Carry bits must “ripple” through each stage of a multi-bit
adder before the output settles down to the correct result.
�Carry Propagate Pi = Ai ⊕ Bi
�Carry Generate Gi = Ai Bi
�Si = Pi ⊕ Ci
�Ci+1 = Gi + Ci Pi
CARRY LOOKAHEAD LOGIC
OVERFLOW
INPUTS OUTPUTS
FA FA FA FA
Carry C4 C3 C2 C1
S3 S2 S1 S0
x3 x2 x1 x0
� 2’s Complement Numbers y3 y2 y1 y0
0
FA FA FA FA
Overflow C4
S3
C3
S2
C2
S1
C1
S0
DECIMAL ADDER
� A decimal adder requires a minimum of 9 inputs
� and 5 outputs
⚫ 1 digit requires 4-bit
⚫ Input: 2 digits + 1-bit carry
⚫ Output: 1 digit + 1-bit carry
� BCD adder
⚫ Perform the addition of two decimal digits in BCD,
together with an input carry from a previous stage
⚫ The output sum cannot be greater than 19 (9+9+1)
BCD ADDER
+ x 3 x2 x1 x 0
� 4-bits plus 4-bits + y3 y2 y1 y0
� Operands and Result: 0 to 9 ────────
X +Y x3 x2 x1 x0 y3 y2 y1 y0 Sum Cy S3 S2 S1 S0 Cy S3 S2 S1 S0
0+0 0 0 0 0 0 0 0 0 =0 0 0 0 0 0
0+1 0 0 0 0 0 0 0 1 =1 0 0 0 0 1
0+2 0 0 0 0 0 0 1 0 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TIPILIER
BINARY MULTIPILIER
MAGNITUDE COMPARATOR
� Compare 4-bit number to 4-bit number
⚫ 3 Outputs: < , = , >
⚫ Expandable to more number of bits
A3A2A1A0 B3B2B1B0
Magnitude
Comparator