Professional Documents
Culture Documents
CPS 104 Computer Organization and Programming Lecture-15: Boolean Algebra, Gates & Circuits
CPS 104 Computer Organization and Programming Lecture-15: Boolean Algebra, Gates & Circuits
CPS 104 Computer Organization and Programming Lecture-15: Boolean Algebra, Gates & Circuits
CPS104 Lec15.1
GK Spring 2004
Admin.
Homework-3 Due Feb. 23rd 11:59 pm. C++ version is posted. Start NOW!
CPS104 Lec15.2
GK Spring 2004
Software
Interface Between HW and SW Instruction Set Architecture, Memory, I/O
Digital Design
Circuit Design
Hardware
Bottom UP to CPU
CPS104 Lec15.3
GK Spring 2004
CPS104 Lec15.4
GK Spring 2004
Read Appendix B
CPS104 Lec15.5
GK Spring 2004
Boolean functions have arguments that take two values ({T,F} or {0,1}) and they return a single or a set of ({T,F} or {0,1}) value(s). Boolean functions can always be represented by a table called: Truth Table Example:
CPS104 Lec15.6
a 0 0 1 1
b 0 1 0 1
XOR(a,b) 0 1 1 0
XNOR(a,b) 1 0 0 1
CPS104 Lec15.7
a b
Gates are electronics devices that implements simple Boolean functions: Examples:
AND(a,b) a b OR(a,b)
NOT(a)
a b
XOR(a,b)
a b
NAND(a,b)
a b
NOR(a,b)
a b
XNOR(a,b)
CPS104 Lec15.8
GK Spring 2004
Boolean Expressions
Boolean algebra notation: Use: * for AND, + for OR, ~ for NOT. Using the above notation one could write boolean expressions for functions: Example:
F(A, B, C) = (A * B) + ( ~A*C)
CPS104 Lec15.9
GK Spring 2004
One can evaluate the Boolean expression with all possible argument values to construct a truth table. Example:
F(A, B, C) = (A * B) + ( ~A*C)
A
0 0 0 0 1 1 1 1
CPS104 Lec15.10
B
0 0 1 1 0 0 1 1
C
0 1 0 1 0 1 0 1
F
0 1 0 1 0 0 1 1
GK Spring 2004
Boolean expressions could be simplified by using the following rules: u A*A = A u A* 0 = 0 u A*1 = A u A*~A = 0
u u u u
A+A = A A+0 = A A+1 = 1 A+~A = 1 A*B = B*A A*(B+C) = (B+C)*A = A*B + A*C
u u
CPS104 Lec15.11
GK Spring 2004
Example: b 0 0 1 1 0 0 1 1 c 0 1 0 1 0 1 0 1 f1f2 0 1 1 1 0 0 1 0 0 0 1 0 0 1 1 1
a 0 0 0 0 1 1 1 1
CPS104 Lec15.12
GK Spring 2004
Boolean Functions Simplification f1 = ~a*~b*c + ~a*b*c + a*~b*c + a*b*c = ~a*(~b*c +b*c) +a*(~b*c+b*c) = ~a*c*(~b+b) ~a*c*(~b+b) = ~a*c + a*c = c*(~a+a) =c f2 = ~a*~b*~c + ~a*~b*c + a*b*~c + a*b*c = ~a*(~b*~c + ~b*c) + a*(b*~c + b*c) = ~a*~b(c+~c) * a*b*(~c+c) = ~a*~b + a*b
CPS104 Lec15.13
GK Spring 2004
CPS104 Lec15.14
GK Spring 2004
Example-2: b 0 0 1 1 0 1 1 c 0 1 0 1 0 0 1 f1f2 0 1 1 1 1 0 0 0 1 0 0 1 1 1
a 0 0 0 0 1 1 1
CPS104 Lec15.15
GK Spring 2004
Circuits are made from a network of gates. (function compositions). a b XOR(a,b) Example: 0 0 0 0 1 1 1 0 1 1 1 0
F = ~a*b + ~b*a
b F
CPS104 Lec15.16
GK Spring 2004
s
B Gate 1 Y = (A * S) + (B * ~S) Gate 3 A S Gate 2
CPS104 Lec15.17
GK Spring 2004
0 1
a b c d
3 2
y
C
1 0
1 0
S S0 S1
CPS104 Lec15.18
GK Spring 2004
I1 I0 Q0 Q1 Q2 Q3
Q2
0 0 0 1
1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1
Q1
1 0 1 1
Q0
CPS104 Lec15.19 I1
I0
GK Spring 2004
Full Adder
Cin a b Sum
Cout
a 0 0 0 0 1 1 1 1
b 0 0 1 1 0 0 1 1
Cin 0 1 0 1 0 1 0 1
Sum 0 1 1 0 1 0 0 1
Cout 0 0 0 1 0 1 1 1
GK Spring 2004
CPS104 Lec15.20
S3 Cout
Full Adder
S2
Full Adder
S1
Full Adder
S0
Full Adder
b3 a3
b2 a2
b1
a1
b0
a0
CPS104 Lec15.21
GK Spring 2004