Combinational logic Switches Basic logic and truth tables Logic functions Boolean algebra Proofs by re-writing and by perfect induction Winter 200 CSE370 - II - Boolean Algebra Switches: basic element of physical implementations Implementing a simple circuit (arrow shows action if wire changes to ): A Z close switch (if A is or asserted) and turn on light bulb (Z) A Z open switch (if A is 0 or unasserted) and turn off light bulb (Z) Z A Winter 200 CSE370 - II - Boolean Algebra 2
Switches (cont d) Compose switches into more complex ones (Boolean functions): AND A B Z A and B A OR Z A or B B Winter 200 CSE370 - II - Boolean Algebra 3 Switching networks Switch settings determine whether or not a conducting path exists to light the light bulb To build larger computations use the light bulb (output of the network) to set other switches (inputs to another network) Winter 200 CSE370 - II - Boolean Algebra 4
Transistor networks Modern digital systems are designed in CMOS technology MOS stands for Metal-Oxide on Semiconductor C is for complementary because there are both normally-open and normally-closed switches MOS transistors act as voltage-controlled switches similar, though easier to work with than relays. Winter 200 CSE370 - II - Boolean Algebra 5 MOS transistors MOS transistors have three terminals: drain, gate, and source they act as switches in the following way: if the voltage on the gate terminal is (some amount) higher/lower than the source terminal then a conducting path will be established between the drain and source terminals G G S D S D n-channel open when voltage at G is low closes when: voltage(g) > voltage (S) + ε p-channel closed when voltage at G is low opens when: voltage(g) < voltage (S) ε Winter 200 CSE370 - II - Boolean Algebra 6
Most digital logic is CMOS 0V Logic 0.8V Logic 0V.8V.8V 0V 0.3µm.8V.8V Mark Bohr Intel 0V 0V Winter 200 CSE370 - II - Boolean Algebra 7 Multi-input logic gates CMOS logic gates are inverting Easy to implement NAND, NOR, NOT while AND, OR, and Buffer are harder Claude Shannon 938.8V.8V.8V.8V Z Z 0 0 0 0 0 Z Z 0V 0V Winter 200 CSE370 - II - Boolean Algebra 8
Possible logic functions of two variables There are 6 possible functions of 2 input variables: in general, there are 2**(2**n) functions of n inputs F 6 possible functions (F 0 F 5 ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 and xor or = nor not ( or ) not not nand not ( and ) Winter 200 CSE370 - II - Boolean Algebra 9 Minimal set of functions Can we implement all logic functions from NOT, NOR, and NAND? For example, implementing and is the same as implementing not ( nand ) In fact, we can do it with only NOR or only NAND NOT is just a NAND or a NOR with both inputs tied together nor 0 0 0 nand 0 0 0 and NAND and NOR are "duals", that is, its easy to implement one using the other nand not ( (not ) nor (not ) ) nor not ( (not ) nand (not ) ) Winter 200 CSE370 - II - Boolean Algebra 0
Boolean algebra An algebraic structure consists of a set of elements B binary operations { +, } and a unary operation { } such that the following axioms hold: George Boole 854. the set B contains at least two elements: a, b 2. closure: a + b is in B a b is in B 3. commutativity: a+b= b+a a b = b a 4. associativity: a + (b + c) = (a + b) + c a (b c) = (a b) c 5. identity: a + 0 = a a = a 6. distributivity: a + (b c) = (a + b) (a + c) a (b + c) = (a b) + (a c) 7. complementarity: a + a = a a = 0 Winter 200 CSE370 - II - Boolean Algebra Logic functions and Boolean algebra Any logic function that can be expressed as a truth table can be written as an expression in Boolean algebra using the operators:, +, and, are Boolean algebra variables 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ( ) + ( ) 0 0 0 0 0 0 0 0 0 0 0 0 0 ( ) + ( ) = 0 0 0 Boolean expression that is true when the variables and have the same value and false, otherwise¾¾ Winter 200 CSE370 - II - Boolean Algebra 2
Axioms and theorems of Boolean algebra identity. + 0 = D. = null 2. + = 2D. 0 = 0 idempotency: 3. + = 3D. = involution: 4. ( ) = complementarity: 5. + = 5D. = 0 commutativity: ti it 6. + = + 6D. = associativity: 7. ( + ) + Z = + ( + Z) 7D. ( ) Z = ( Z) distributivity: 8. ( + Z) = ( ) + ( Z) 8D. + ( Z) = ( + ) ( + Z) Winter 200 CSE370 - II - Boolean Algebra 3 Axioms and theorems of Boolean algebra (cont d) uniting: 9. + = 9D. ( + ) ( + ) = absorption: 0. + = 0D. ( + ) =. ( + ) = D. ( ) + = + factoring: 2. ( + ) ( + Z) = 2D. + Z = Z + ( + Z) ( + ) concensus: 3. ( ) + ( Z) + ( Z) = 3D. ( + ) ( + Z) ( + Z) = + Z ( + ) ( +Z) de Morgan s: 4. ( + +...) =... 4D. (...) = + +... generalized de Morgan s: 5. f (, 2,..., n,0,,+, ) = f(, 2,..., n,,0,,+) Winter 200 CSE370 - II - Boolean Algebra 4
Axioms and theorems of Boolean algebra (cont d) Duality a dual of a Boolean expression is derived by replacing by +, + by, 0 by, and by 0, and leaving variables unchanged any theorem that can be proven is thus also proven for its dual! a meta-theorem (a theorem about theorems) duality: 6. + +...... generalized duality: 7. f (, 2,..., n,0,,+, ) f(, 2,..., n,,0,,+) Different than demorgan s Law this is a statement about theorems this is not a way to manipulate (re-write) expressions Winter 200 CSE370 - II - Boolean Algebra 5 Proving theorems (rewriting) Using the laws of Boolean algebra: e.g., prove the theorem: + = distributivity (8) complementarity (5) identity (D) + = ( + ) ( + ) = () () = e.g., prove the theorem: + = identity (D) distributivity (8) identity (2) identity (D) + = + + = ( + ) ( + ) = () () = Winter 200 CSE370 - II - Boolean Algebra 6
Activity Prove consensus theorem using the laws of Boolean algebra: ( ) + ( Z) + ( Z) = + Z ( ) + ( Z) + ( Z) identity ( ) + () ( Z) + ( Z) complementarity ( ) + ( + ) ( Z) + ( Z) distributivity ( ) + ( Z) + ( Z) + ( Z) commutativity ( ) + ( Z) + ( Z) + ( Z) factoring ( ) ( + Z) + ( Z) ( + ) null ( ) () + ( Z) () identity ( ) + ( Z) identity. + 0 = D. = null 2. + = 2D. 0 = 0 complementarity: 5. + = 5D. = 0 commutativity: 6. + = + 6D. = associativity: 7. ( + ) + Z = + ( + Z) 7D. ( ) Z = ( Z) distributivity: 8. ( + Z) = ( ) + ( Z) 8D. + ( Z) = ( + ) ( + Z) factoring: 2. ( + ) ( + Z) = Z + 2D. + Z = ( + Z) ( + ) Winter 200 CSE370 - II - Boolean Algebra 7 Proving theorems (perfect induction) Using perfect induction (complete truth table): e.g., de Morgan s: ( + ) = NOR is equivalent to AND with inputs complemented ( ) = + NAND is equivalent to OR with inputs complemented ( + ) 0 0 0 0 0 0 0 0 ( ) + 0 0 0 0 0 0 0 0 Winter 200 CSE370 - II - Boolean Algebra 8
A simple example: -bit binary adder Cout Cin Inputs: A, B, Carry-in Outputs: Sum, Carry-out A A A A A B B B B B S S S S S A B Cin Cout S 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 A S B Cout Cin S = A B Cin + A B Cin + A B Cin + A B Cin Cout = A B Cin + A B Cin + A B Cin + A B Cin Winter 200 CSE370 - II Boolean Algebra 9