02-Boolean-logic
02-Boolean-logic
Neeraj Goel
IIT Ropar
Boolean Algebra
• Boolean variable: Two values, true/false or 1/0
• Basic operations
– AND
– OR
– NOT
2. Eliminating terms
a’b + a’bc
a’c’ + bcd + a’bd
cd’ 2 6 14 10
a’ a
b’c’ 0 4 F = bc + a’c
b’c 1 5
bc 1
3 1
7
bc’ 2 6
• F(a,b,c,d)=∑m(2,3,5,7,10,11,13,14,15)
F(a,b,c) = ∑m(0,1,2,5,6,7)
0 1 2 5 6 7
P1 (0,1) a’b’ x x
P2 (0,2) a’c’ x x
P3 (1,5) b’c x x
P4 (2,6) bc’ x x
P5 (5,7) ac x x
P6 (6,7) ab x x
F = a’b’ + bc’ + ac
F(a,b,c) = ∑m(0,1,2,5,6,7)
0 1 2 5 6 7
P1 (0,1) a’b’ x x
P2 (0,2) a’c’ x x
P3 (1,5) b’c x x
P4 (2,6) bc’ x x
P5 (5,7) ac x x
P6 (6,7) ab x x
F = a’c’ + b’c + ab
F = b’c’ + cd’
A B Z
0 0 0
0 1 1
1 0 1
1 1 0 XOR Symbol
A B Z
0 0 1
0 1 0
1 0 0
1 1 1 XNOR Symbol
A B Z
0 0 1
0 1 1
1 0 1 NAND GATE Symbol
1 1 0
A B Z
0 0 1
0 1 0
1 0 0 NOR GATE Symbol
1 1 0
Not
NOT
AND OR
AND
OR
Digital Logic Design:Boolean Logic and
58
Minimization.
Application of NAND in SOP
• For example: F = AB + AC + BC
• F = ((AB + AC + BC)’ )’ = ((AB)’ . (AC)’ . (BC)’ )’
A
A
B
B
A F A F
C
C
B
B
C
C
A B Carry Sum
0 0 0 0
0 1 0 1
1 0 0 1
1 1 1 0
• Sum = A XOR B
• Carry = A AND B
Digital Logic Design:Boolean Logic and
66
Minimization.
Verilog example – structural model
Module
Primitives that can be used
Name
and, or, xor,
nand, nor, xnor
module half_adder(A, B, Sum, Carry);
not
endmodule;
assign Sum = A ^ B;
A Sum
// Sum = A XOR B; Half Adder
assign Carry = A & B; B Carry
// Carry = A AND B
endmodule;
Port binding
HA_TB
ra Sum wsum
A
Half Adder
rb B wcarry
Carry
endmodule
initial
begin
ra = 1'b0; rb = 1'b0;
#10
$display("A: %b, B: %b, Sum: %b, Carry:%b", ra, rb, wsum, wcarry);
ra = 1'b1; rb = 1'b0;
Stimulus
#10
$display("A: %b, B: %b, Sum: %b, Carry:%b", ra, rb, wsum, wcarry);
ra = 1'b0; rb = 1'b1;
#10
$display("A: %b, B: %b, Sum: %b, Carry:%b", ra, rb, wsum, wcarry);
ra = 1'b1; rb = 1'b1;
#10
$display("A: %b, B: %b, Sum: %b, Carry:%b", ra, rb, wsum, wcarry);
end
endmodule
Output
Input Delay of GATE depends on
•Type of GATE
Tp •Input transition type (0->1 or 1->0)
•Output transition type
Input •Fan in and Fan-out
Output
Maximum Gate delay can be used
Time
For analysis
Propagation Delay
B T3
T
C
F
Variation in delay cause glitches at output
Digital Logic Design:Boolean Logic and
Minimization.
Impact of large fan-in
Tp = a1Fin + a2 Fin2 + a3Fout
Tp = 4 a1 + 16 a2 + a3
Tp = 2( 2 a1 + 4 a2 + a3)