Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs...
Transcript of Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs...
![Page 1: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/1.jpg)
19
Representations of Boolean Functions
Readings: 2.5,2.5.2-2.10.4
Boolean Function: F = X + YZ
Truth Table:X Y Z F0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1
Circuit Diagram:
![Page 2: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/2.jpg)
20
Why Boolean Algebra/Logic Minimization?
Logic Minimization: reduce complexity of the gate level implementation• reduce number of literals (gate inputs)
• reduce number of gates
• reduce number of levels of gates
fewer inputs implies faster gates in some technologies
fan-ins (number of gate inputs) are limited in some technologies
fewer levels of gates implies reduced signal propagation delays
number of gates (or gate packages) influences manufacturing costs
![Page 3: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/3.jpg)
21
Basic Boolean Identities:
X + 0 = X * 1 =
X + 1 = X * 0 =
X + X = X * X =
X + X = X * X =
X =
![Page 4: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/4.jpg)
22
Basic Laws
Commutative Law:X + Y = Y + X XY = YX
Associative Law:X+(Y+Z) = (X+Y)+Z X(YZ)=(XY)Z
Distributive Law:X(Y+Z) = XY + XZ X+YZ = (X+Y)(X+Z)
![Page 5: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/5.jpg)
23
Boolean Manipulations
Boolean Function: F = XYZ + XY + XYZ
Truth Table:
X Y Z F0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1
Reduce Function:
![Page 6: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/6.jpg)
24
Advanced Laws (Absorbtion)
X+XY = XY + XY = X+XY = X(X+Y) = (X+Y)(X+Y) = X(X+Y) =
![Page 7: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/7.jpg)
25
Boolean Manipulations (cont.)
Boolean Function: F = XYZ + XZ
Truth Table:X Y Z F0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1
Reduce Function:
![Page 8: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/8.jpg)
26
Boolean Manipulations (cont.)
Boolean Function: F = (X+Y+XY)(XY+XZ+YZ)
Truth Table:X Y Z F0 0 00 0 10 1 00 1 11 0 01 0 11 1 01 1 1
Reduce Function:
![Page 9: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/9.jpg)
27
DeMorgan’s Law
(X + Y) = X * Y
(X * Y) = X + Y
Example:Z = A B C + A B C + A B C + A B C
Z = (A + B + C) * (A + B + C) * (A + B + C) * (A + B + C)
DeMorgan's Law can be used to convert AND/OR expressionsto OR/AND expressions
X 0 0 1 1
Y 0 1 0 1
X 1 1 0 0
Y 1 0 1 0
X + Y X•Y
X 0 0 1 1
Y 0 1 0 1
X 1 1 0 0
Y 1 0 1 0
X + Y X•Y
![Page 10: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/10.jpg)
28
DeMorgan’s Law example
If F = (XY+Z)(Y+XZ)(XY+Z),
F =
![Page 11: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/11.jpg)
29
Boolean Equations to Circuit Diagrams
F = XYZ + XY + XYZ
F = XY + X(WZ + WZ)
![Page 12: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/12.jpg)
30
Circuit Timing Behavior
Simple model: gates react after fixed delay
A
B
C
D
E
F
0
1
0
1
AB C
D E F
![Page 13: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/13.jpg)
31
Circuit can temporarily go to incorrect states
Hazards/Glitches
Copilot Autopilot Request
Pilot Autopilot Request
Pilot in Charge? Autopilot EngagedA B
C
CAR
PIC
PAR
A
B
C
AE
![Page 14: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/14.jpg)
32
RAMRAMRAMRAMRAM
RAMRAMRAMRAMRAM
RAMRAM
Logic cells imbedded in a general routing structure
Logic cells usually contain:
6-input Boolean function calculator
Flip-flop (1-bit memory)
•
•
All features electronically (re)programmable
Field Programmable Gate Arrays (FPGAs)
![Page 15: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/15.jpg)
33
Using an FPGA
// Verilog code for 2-inputmultiplexer
module AOI (F, A, B, C, D);output F;input A, B, C, D;
assign F = ~((A & B) | (C &D));endmodule
module MUX2 (V, SEL, I, J); //2:1 multiplexeroutput V;input SEL, I, J;wire SELB, VB;
not G1 (SELB, SEL);AOI G2 (VB, I, SEL, SELB, J);not G3 (V, VB);
endmodule
// Verilog code for 2-inputmultiplexer
module AOI (F, A, B, C, D);output F;input A, B, C, D;
assign F = ~((A & B) | (C &D));endmodule
module MUX2 (V, SEL, I, J); //2:1 multiplexeroutput V;input SEL, I, J;wire SELB, VB;
not G1 (SELB, SEL);AOI G2 (VB, I, SEL, SELB, J);not G3 (V, VB);
endmodule
// Verilog code for 2-inputmultiplexer
module AOI (F, A, B, C, D);output F;input A, B, C, D;
assign F = ~((A & B) | (C &D));endmodule
module MUX2 (V, SEL, I, J); //2:1 multiplexeroutput V;input SEL, I, J;wire SELB, VB;
not G1 (SELB, SEL);AOI G2 (VB, I, SEL, SELB, J);not G3 (V, VB);
endmodule
// Verilog code for 2-inputmultiplexer
module AOI (F, A, B, C, D);output F;input A, B, C, D;
assign F = ~((A & B) | (C &D));endmodule
module MUX2 (V, SEL, I, J); //2:1 multiplexeroutput V;input SEL, I, J;wire SELB, VB;
not G1 (SELB, SEL);AOI G2 (VB, I, SEL, SELB, J);not G3 (V, VB);
endmodule
Verilog
FPGACADTools
0010101000101001010010010010011000101010001010110001010100101001010100010110001001010101010011110010010100001010100101010010010000101010101001010100101000101011010100101001010010100101001
Bitstream
Simulation
![Page 16: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/16.jpg)
34
Verilog
Programming language for describing hardware Simulate behavior before (wasting time) implementing Find bugs early Enable tools to automatically create implementation
Similar to C/C++/Java VHDL similar to ADA
Modern version is “System Verilog” Superset of previous; cleaner and more efficient
![Page 17: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/17.jpg)
35
Structural Verilog
// Verilog code for AND-OR-INVERT gate
module AOI (F, A, B, C, D);output logic F;input logic A, B, C, D;
assign F = ~((A & B) | (C & D));endmodule
// end of Verilog code
![Page 18: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/18.jpg)
36
Verilog Wires/Variables
// Verilog code for AND-OR-INVERT gate
module AOI (F, A, B, C, D);output logic F;input logic A, B, C, D;logic AB, CD, O;
assign AB = A & B;assign CD = C & D;assign O = AB | CD;assign F = ~O;
endmodule
![Page 19: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/19.jpg)
37
Verilog Gate Level
// Verilog code for AND-OR-INVERT gate
module AOI (F, A, B, C, D);output logic F;input logic A, B, C, D;logic AB, CD, O;
and a1(AB, A, B);and a2(CD, C, D);or o1(O, AB, CD);not n1(F, O);
endmodule
![Page 20: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/20.jpg)
38
// Verilog code for 2-input multiplexer
module AOI (F, A, B, C, D);output logic F;input logic A, B, C, D;
assign F = ~((A & B) | (C & D));endmodule
module MUX2 (V, SEL, I, J); // 2:1 multiplexeroutput logic V;input logic SEL, I, J;logic SELB, VB;
not G1 (SELB, SEL);AOI G2 (.F(VB), .A(I), .B(SEL), .C(SELB), .D(J));not G3 (V, VB);
endmodule
Verilog Hierarchy
AOI VB VSELBSELI
J
2-input Mux
![Page 21: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/21.jpg)
39
Verilog Testbenches
module MUX2TEST; // No ports!logic SEL, I, J, V;
initial // StimulusbeginSEL = 1; I = 0; J = 1;#10 I = 1;#10 SEL = 0; J = 0;#10 J = 1;
end
MUX2 M (.V, .SEL, .I, .J);endmodule
Sel
I
J
V
0 10 20 30
![Page 22: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/22.jpg)
40
NAND and NOR Gates
NAND Gate: NOT(AND(A, B))
NOR Gate: NOT(OR(A, B))
0 0 1 1
X Y
0 1 0 1
1 1 1 0
X NAND Y
X Y
0 0 1 1
0 1 0 1
1 0 0 0
X NOR Y
![Page 23: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/23.jpg)
41
Bubble Manipulation
DeMorgan’s Law
Simplification: CDAB
![Page 24: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/24.jpg)
42
NAND and NOR Gate Universality
NAND and NOR gates are universal can implement all the basic gates (AND, OR, NOT)
NAND NOR
NOT
AND
OR
![Page 25: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/25.jpg)
43
Converting Circuits to NAND/NOR Form
Group gates into levels, insert double inversions on alternating levels
Alternating AND/OR becomes all NAND or NOR
ABCDEF
ABCDEF
Level 1 Level 2 Level 3 Level 4
![Page 26: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/26.jpg)
44
Converting to NAND/NOR Form (cont.)
Some circuits may require internal inverters
Level 1 Level 2 Level 3
A
BC
A
BC
![Page 27: Representations of Boolean Functions€¦ · • reduce number of levels of gates fewer inputs implies faster gates in some technologies fan-ins (number of gate inputs) are limited](https://reader034.fdocuments.us/reader034/viewer/2022042208/5eab8c04484e1e7c823e49db/html5/thumbnails/27.jpg)
45
XOR and XNOR Gates
XOR Gate: Z=1 if odd # of inputs are true
XNOR Gate: Z=1 if even # of inputs are true
X Y Z0 0 00 1 11 0 11 1 0
X Y Z0 0 10 1 01 0 01 1 1
XY Z
ZXY
YX
YX