830 likes | 1.35k Views
CT455: Computer Organization Boolean Algebra. Lecture 3: Boolean Algebra. Digital circuits Boolean Algebra Two-Valued Boolean Algebra Boolean Algebra Postulates Precedence of Operators Truth Table & Proofs Duality. Lecture 3: Boolean Algebra. Basic Theorems of Boolean Algebra
E N D
Lecture 3: Boolean Algebra • Digital circuits • Boolean Algebra • Two-Valued Boolean Algebra • Boolean Algebra Postulates • Precedence of Operators • Truth Table & Proofs • Duality
Lecture 3: Boolean Algebra • Basic Theorems of Boolean Algebra • Boolean Functions • Complement of Functions • Standard Forms • Minterm & Maxterm • Canonical Forms • Conversion of Canonical Forms • Binary Functions
Digital circuit inputs outputs : : High Low Digital Circuits • Digital circuit can be represented by a black-box with inputs on one side, and outputs on the other. The input/output signals are discrete/digital in nature, typically with two distinct voltages (a high voltage and a low voltage). In contrast, analog circuits use continuous signals.
Digital Circuits • Advantages of Digital Circuits over Analog Circuits: • more reliable (simpler circuits, less noise-prone) • specified accuracy (determinable) • but slower response time (sampling rate) • Important advantages for two-valued Digital Circuit: • Mathematical Model – Boolean Algebra • Can help design, analyse, simplify Digital Circuits.
Boolean Algebra What is an Algebra? (e.g. algebra of integers) set of elements (e.g. 0,1,2,..) set of operations (e.g. +, -, *,..) postulates/axioms (e.g. 0+x=x,..) • Boolean Algebra named after George Boole who used it to study human logical reasoning – calculus of proposition. • Events : trueor false • Connectives : a OR b; a AND b, NOT a • Example: Either “it has rained” OR “someone splashed water”, “must be tall” AND “good vision”.
Boolean Algebra Later, Shannon introduced switching algebra (two-valued Boolean algebra) to represent bi-stable switching circuit.
Sometimes denoted by ’, for example a’ x y x y x x+y x' Two-valued Boolean Algebra • Set of Elements: {0,1} • Set of Operations: { ., + , ¬ } x.y Signals: High = 5V = 1; Low = 0V = 0
Boolean Algebra Postulates A Boolean algebra consists of a set of elements B, with two binary operations {+} and {.} and a unary operation {'}, such that the following axioms hold: • Commutative laws: • A + B = B + A • A . B = B . A
Boolean Algebra Postulates • Associative laws: (A + B) + C = A + (B + C) = A + B + C • (A . B) . C = A .( B . C) = A . B . C • Distributive laws: • A . (B + C) = (A . B) + (A . C) • A + (B . C) = (A + B) . (A + C)
Boolean Algebra Postulates • Complement: For every x in B, there exists an element x' in B such that • x + x' = 1 • x . x' = 0
Precedence of Operators • To lessen the brackets used in writing Boolean expressions, operator precedence can be used. • Precedence (highest to lowest): ' . + • Examples: a . b + c = (a . b) + c b' + c = (b') + c a + b' . c = a + ((b') . c)
Precedence of Operators • Use brackets to overwrite precedence. • Examples: a . (b + c) (a + b)' . c
Rules for Boolean Algebra 1. A + 0 = A 9. (A’)’ = A 2. A + 1 = 1 10. A + AB = A 3. A . 0 = 0 11. A + A’B = A+ B 4. A . 1 = A 12. (A + B)(A + C) = A+BC 5. A + A = A 6. A + A’ = 1 7. A . A = A 8. A . A’ = 0
10. A + AB = A A + AB = A(1 + B) DISTRIBUTIVE LAW = A . 1 RULE 2 = ARULE 4
Theorem 10 (Absorption) • (a) a + ab = a (b) a(a + b) = a • Examples: • (X + Y) + (X + Y)Z = X + Y [T4(a)] • AB'(AB' + B'C) = AB' [T4(b)]
11. A + A’B = A+ B A + A’B = (A + AB) + A’B = (AA + AB) + A’B = AA + AB + AA’ + A’B = (A + A’)(A + B) = 1. (A + B) = ( A + B)
Theorem 11 • (a) a + a'b = a + b (b) a(a' + b) = ab • Examples: • B + AB'C'D = B + AC'D [T11(a)] • (X + Y)((X + Y)' + Z) = (X + Y)Z [T11(b)]
11. A + A’B = A+ B เปลี่ยนเป็นรูปอื่นๆได้ A + A’B’ = A+ B’ A’ + AB = A+ B A + A’BC = A+ BC (AB)’ + ABCD = (AB)’+ CD
12. (A + B)(B + C) = AA+ AC + AB + BC = A+ AC + AB + BC = A(1+C) + AB + BC = A.1 + AB + BC = A(1+B) +BC = A.1 +BC = A . BC
Theorem • (a) ab + ab' = a (b) (a + b)(a + b') = a • Examples: • ABC + AB'C = AC [T6(a)] • (W' + X' + Y' + Z')(W' + X' + Y' + Z)(W' + X' + Y + Z')(W' + X' + Y + Z) • = (W' + X' + Y')(W' + X' + Y + Z')(W' + X' + Y + Z) • = (W' + X' + Y')(W' + X' + Y) • = (W' + X')
Theorem 7 • (a) ab + ab'c = ab + ac (b) (a + b)(a + b' + c) = (a + b)(a + c) • Examples: • wy' + wx'y + wxyz + wxz' = wy' + wx'y + wxy + wxz' [T7(a)] • = wy' + wy + wxz'[T7(a)] • = w + wxz' [T7(a)] • = w [T7(a)] • (x'y' + z)(w + x'y' + z') = (x'y' + z)(w + x'y') [T7(b)]
Basic Theorems of Boolean Algebra 6. DeMorgan. (a) (x + y)' = x'.y' (b) (x.y)' = x' + y' 7. Consensus. (a) x.y + x'.z + y.z = x.y + x'.z (b) (x+y).(x'+z).(y+z) = (x+y).(x'+z)
Laws of Boolean Algebra X Y X Y X + Y X•Y 0 0 1 1 1 1 0 1 1 0 0 0 1 0 0 1 0 0 1 1 0 0 0 0 X Y X Y X•Y X + Y 0 0 1 1 1 1 0 1 1 0 1 1 1 0 0 1 1 1 1 1 0 0 0 0 DeMorgan's Law (X + Y)' = X' Y' NOR is equivalent to AND with inputs complemented (X Y)' = X' + Y' NAND is equivalent to OR with inputs complemented DeMorgan's Law can be used to convert AND/OR expressions to OR/AND expressions or NAND/NAND expression Example: Z = A' B' C + A' B C + A B' C + A B C’ AND - OR = {(A’B’C)’ (A’BC)’ (AB’C)’ (ABC’)’ } ‘ NAND - NAND Z' = (A + B + C') (A + B' + C') (A' + B + C') (A' + B' + C)
Theorem 8 (DeMorgan's Theorem) (a) (a + b)' = a'b' (b) (ab)' = a' + b' • Generalized DeMorgan's Theorem (a) (a + b + … z)' = a'b' … z' (b) (ab … z)' = a' + b' + … z' • Examples: • (a + bc)' = (a + (bc))' = a'(bc)' [T8(a)] = a'(b' + c') [T8(b)] = a'b' + a'c'[P5(b)] • Note: (a + bc)' ¹ a'b' + c'
More Examples for DeMorgan's Theorem • (a(b + z(x + a')))' = a' + (b + z(x + a'))' [T8(b)] = a' + b' (z(x + a'))' [T8(a)] = a' + b' (z' + (x + a')') [T8(b)] = a' + b' (z' + x'(a')') [T8(a)] = a' + b' (z' + x'a) [T3] = a' + b' (z' + x') [T5(a)] • (a(b + c) + a'b)' = (ab + ac + a'b)' [P5(b)] = (b + ac)' [T6(a)] = b'(ac)' [T8(a)] = b'(a' + c') [T8(b)]
Truth Table • Provides a listing of every possible combination of inputs and its corresponding outputs. • Example (2 inputs, 2 outputs):
Switching Functions • Switching algebra: Boolean algebra with the set of elements K = {0, 1} • If there are n variables, we can define switching functions. • Sixteen functions of two variables (Table 2.3): • A switching function can be represented by a table as above, or by a switching expression as follows: • f0(A,B)= 0, f6(A,B) = AB' + A'B, f11(A,B) = AB + A'B + A'B' = A' + B, ... • Value of a function can be obtained by plugging in the values of all variables: The value of f6 when A = 1 and B = 0 is: = 0 + 1 = 1.
Truth Tables (1) • Shows the value of a function for all possible input combinations. • Truth tables for OR, AND, and NOT (Table 2.4):
Truth Tables (2) • Truth tables for f(A,B,C) = AB + A'C + AC' (Table 2.5)
Truth Table • Example (3 inputs, 2 outputs):
Proof using Truth Table • Can use truth table to prove by perfect induction. • Prove that: x . (y + z) = (x . y) + (x . z) (i) Construct truth table for LHS & RHS of above equality. (ii) Check that LHS = RHS Postulate is SATISFIED because output column 2 & 5 (for LHS & RHS expressions) are equal for all cases.
Basic Theorems of Boolean Algebra • Apart from the axioms/postulates, there are other useful theorems. 1. Idempotency. (a) x + x = x (b) x . x = x Proof of (a): x + x = (x + x).1 (identity) = (x + x).(x + x') (complementarity) = x + x.x' (distributivity) = x + 0 (complementarity) = x (identity)
Basic Theorems of Boolean Algebra 2. Null elements for + and . operators. (a) x + 1 = 1 (b) x . 0 = 0 3. Involution.(x')' = x 4. Absorption. (a) x + x.y = x (b) x.(x + y) = x 5. Absorption (variant). (a) x + x'.y = x+y (b) x.(x' + y) = x.y
Basic Theorems of Boolean Algebra • Theorem 4a (absorption) can be proved by: x + x.y = x.1 + x.y (identity) = x.(1 + y) (distributivity) = x.(y + 1) (commutativity) = x.1 (Theorem 2a) = x (identity) • By duality, theorem 4b: x.(x+y) = x • Try prove this by algebraic manipulation.
Boolean Functions • Boolean function is an expression formed with binary variables, the two binary operators, OR and AND, and the unary operator, NOT, parenthesis and the equal sign. • Its result is also a binary value. • We usually use . for AND, + for OR, and ' or ¬ for NOT. Sometimes, we may omit the . if there is no ambiguity.
Boolean Functions • Examples: F1= x.y.z' F2= x + y'.z F3=(x'.y'.z)+(x'.y.z)+(x.y') F4=x.y'+x'.z From the truth table, F3=F4. Can you also prove by algebraic manipulation that F3=F4?
Simplifying logic expressions Chapter 3: Boolean Algebra/Logic Gates
EXAMPLE • A(A+B) = AA + AB • = A + AB • = A(1 + B) • = A • A(A’ + B) = AA’ + AB • = AB • ( AB + A’B’)’ = (A’ + B’)(A + B) • = A’A + A’B + AB’ + BB’ • = AB’ + A’B
X = ABC + ABC’ = AB ( C + C’) = AB.1 = AB A = X(X’YZ + X’YZ’) = XX’YZ + XX’YZ’ = 0.YZ + 0.YZ’ = 0 Chapter 3: Boolean Algebra/Logic Gates
EXAMPLE AB’ + A’B = AB’+AA’+A’B+BB’ = A(B’+A’) + B(A’+B’) = (A’+B’)(A+B) = (AB)’(A+B)
EXAMPLE Y = AB + A’B +A’B’ Y = B(A + A’) +A’B’ Y = B.1 +A’B’ Y = B +A’B’ Y = B +A’
W = AB(A’C + B) = ABA’C + ABB = 0.BC + AB = 0 + AB = AB Chapter 3: Boolean Algebra/Logic Gates
Z = ( X.Y) + [( X’ . ( Y + X )] Z = ( X.Y) + [( X’.Y) + (X.X’)] Z = ( X.Y) + [( X’.Y) + (0)] Z = ( X.Y) + ( X’.Y) Z = Y. ( X + X’) Z = Y. 1 Z = Y
Z = ( X.Y’) + [( X . Y ) + Y’ )] Z = [( X . Y’ ).(X . Y )] + [( X . Y’ ) + Y’ )] Z = [( X . X ).(Y . Y’ )] + [ X . (Y’ + Y’ )] Z = [( X . X ).( 0 )] + [ X . (Y’ + Y’ )] Z = 0 + [ X . Y’] Z = X . Y’
Z = X + X’.Y + Y’.X’ Z = X + X’. (Y + Y’) Z = X + X’. (1) Z = 1
Z = X( X’ + Y )(Y’ + X’) Z = (X.X’ + XY )( Y’ + X’ ) Z = ( 0 + XY)( Y’ + X’ Z = XY( Y’ + X’) Z = XYY’ + XYX’ Z = 0 + 0
Z = w( y + w )( x + y + w ) = (wy + ww)( x + y + w ) = (wy + w)( x + y + w ) = (w + wy)( x + y + w ) = w( x + y + w ) = wx + wy + ww = wx + ( wy + w ) = wx + ( w + wy) = wx + w = w + wx = w Chapter 3: Boolean Algebra/Logic Gates
Simplify AB + BC(B + C) AB + BBC + BCC AB + BC + BC AB + BC B( A + C) AB(A + B’C +C) ABA + ABB’C + ABC AB + ABB’C + ABC AB + ABC AB(1 + C) AB