380 likes | 600 Views
ELEC1700 Computer Engineering 1 Week 4 Monday lecture Boolean algebra Semester 1, 2013. Boolean algebra. Boolean algebra Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation. Boolean algebra. George Boole
E N D
ELEC1700Computer Engineering 1Week 4 Monday lectureBoolean algebra Semester 1, 2013
Boolean algebra Boolean algebra Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation
Boolean algebra George Boole British mathematician and philosopher. An Investigation of the Laws of Thought on Which are Founded the Mathematical Theories of Logic and Probabilities (1854) Claude Shannon American electrical engineer. First to apply Boole’s work to design of logic circuits (1937) • Boolean algebra is the mathematics of digital systems • deals with values 0 and 1, and just three operations: addition, multiplication, and complement
Boolean operations Boolean addition Boolean multiplication Complement 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 1 0 · 0 = 0 0 · 1 = 0 1 · 0 = 0 1 · 1 = 1 0’ = 1 1’ = 0 Boolean addition differs from binary addition! There is no carry in Boolean addition
Boolean operations Boolean addition Boolean multiplication Complement 0 + 0 = 0 0 + 1 = 1 1 + 0 = 1 1 + 1 = 1 0 · 0 = 0 0 · 1 = 0 1 · 0 = 0 1 · 1 = 1 0’ = 1 1’ = 0 OR AND NOT
Sums and products Sum terms are generated by OR gates • Examples of sum terms: A+BA+B’A+B+C’ • Variables are symbols representing Boolean values 0,1 • A, B and C are variables • Literals are variables or complement of variables • A, B’ and C’ are literals
Sums and products • Boolean addition is the same as the OR function, so… • sum term is 1 if one or more of the literals are 1 • sum term is 0 only if each literal is 0 Example:Determine the values of the variables A,B,C,D that make the sum term A+B’+C+D’ = 0 Literals A, B’, C and D’ must all equal zero if sum=0 A = B’ = C = D’ = 0 A=0, B=1, C=0, D=1
Sums and products Product terms are generated by AND gates A X B Remember: A·B often written simply as AB • Examples of product terms: ABAB’ABC’ • Example: Determine the values of the variables • A,B,C,D that make the product term AB’CD’ = 1 • Literals A, B’, C and D’ must all equal 1 if product=1 • A = B’ = C = D’ = 1 A=1, B=0, C=1, D=0
Boolean algebra Boolean algebra Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation
Commutative laws The order in which variables are ORed makes no difference For addition: A + B = B + A The order in which variables are ANDed makes no difference For multiplication: A · B = B · A
Associative laws For addition: A + (B + C) = (A + B) + C A(BC) = (AB)C For multiplication:
Distributive law Expresses the process of factoring A(B + C) = AB + AC
8.A · A = 0 = 9.A = A Rules of Boolean algebra • Rules 1–9 from definitions of AND, OR and NOT • Rules 10–12 derived from simpler rules and three laws 1. A + 0 = A 7.A · A = A 2.A + 1 = 1 3.A · 0 = 0 4.A · 1 = A 10. A + AB = A 5.A + A = A 11. A + AB = A + B 6.A + A = 1 12. (A + B)(A + C) = A + BC
A couple of the simpler rules A + 0 = A • A variable ORed with 0 is always equal to the variable • A · 1 = A • A variable ANDed with 1 is always equal to the variable
Proving rules 10–12 • Rule 10: A + AB = A A + AB = A·1 + AB Rule 4: A·1 = A = A(1 + B) Factoring (Distributive Law) = A·1 Rule 2: 1+B = 1 = A Rule 4: A·1 = A Complete the following truth table, and hence prove A+AB=A A B AB A+AB ------------------------------------- 0 0 0 1 1 0 1 1
Proving rules 10–12 • Rule 11: A + A’B = A+B A + A’B = (A + AB) + A’B Rule 10: A = A+AB = (AA + AB) + A’B Rule 7: A = AA = AA + AB + AA’ + A’B Rule 8: adding AA’=0 = (A+A’)(A+B) Factoring = 1·(A+B) Rule 6: A+A’=1 = A+B Rule 4: drop the 1
Proving rules 10–12 • Rule 12: (A+B)(A+C) = A + BC Complete the following truth table & prove (A+B)(A+C) = A+BC A B C A+B A+C (A+B)(A+C) BC A+BC -------------------------------------------------------------------------------------- 0 0 0 0 0 1 0 1 0 0 1 1 1 0 0 1 0 1 1 1 0 1 1 1
Duality Principle • Any Boolean equality remains valid if we exchange: 1 ↔0 AND ↔OR • This explains why rules 1–8 appear in pairs Example: Apply the duality principle to Rule 1: A+0 = A A + 0 = A → A · 1 = A (Rule 4)
Boolean algebra Boolean algebra Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation
De Morgan’s Theorem A · B = A + B A + B = A · B • Extends to more than two variables • Example: • Each variable can also represent a combination of other variables • Example:
Applying De Morgan’s Theorem Use De Morgan’s theorem to simplify the expression
Boolean algebra Boolean algebra Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation
Boolean expression for a logic circuit • Begin at the circuit inputs and work towards final output • Write expression for each gate output
Constructing a truth table for a logic circuit 0 0 0 0 0 0 0 Truth table A B C D A(B+CD) --------------------------------------------- 0 0 0 0 0 0 0 0 1 ... ... 1 1 1 1 ... I do NOT recommend using this method to construct the truth table! It’s far too slow
Constructing a truth table for a logic circuit • A·(B+C·D)=1 • Equals 1 only if A=1 and B+C·D=1 • So expression equals 0 for top half of truth table, where A=0 • B+C·D=1 • Equals 1 when B=1 or C·D=1 or both • B=1 and C·D=0 → B C D=100,101,110 • B=0 and C·D=1 → B C D=011 • B=1 and C·D=1 → B C D=111 • We can now fill in the truth table quickly Use of “standard forms” will simplify the creation of a truth table from logic expression
A B C D A·(B+C·D) ------------------------------------------------------------- 0 0 0 0 0 0 0 0 1 0 0 0 1 0 0 0 0 1 1 0 0 1 0 0 0 0 1 0 1 0 0 1 1 0 0 0 1 1 1 0 1 0 0 0 0 1 0 0 1 0 1 0 1 0 0 1 0 1 11 1 1 0 01 1 1 0 11 1 1 1 01 1 1 1 11 A=0 B=0 and C·D=1 B=1 and C·D=0 B=1 and C·D=1
Boolean algebra Boolean algebra Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation
Standard forms All Boolean expressions can be converted into either of two standard forms: • Sum-of-products (SOP) form • Product-of-sums (POS) form • Makes the following much easier and systematic: • Evaluation • Simplification • Implementation SOP this week; POS in week 5 Truth table from Boolean expression Fewer gates for same function Logic gates to implement expression
Sum-of-products (SOP) Sum-of-products (SOP) expressions are product terms summed by Boolean addition Examples: The following expressions are not in SOP form: Remember: “summed” by Boolean addition means OR-ed together
AND/OR implementation of SOP SOP expressions simply require ORing outputs of AND gates Domain of a Boolean expression is the set of variables in the expression Example: domain of the expression for X in the figure above is A, B, C, D
Conversion to SOP form Any logic expression can be changed to SOP form simply by applying Boolean algebra Convert the following expression to SOP form:
Standard SOP form Standard SOP expression All variables in the domain appear in each product term in the expression Example: The following expression is not in standard SOP form: Why not? Missing or in first term, and missing or in second term Product terms involving all variables in the domain are called minterms
Conversion to standard SOP form Product terms missing variables can always be expanded to standard form using Boolean algebra rules and Example: First term is missing the variable C
Truth tables from standard SOP expressions • Truth table: list of all possible input combinations and corresponding output (0 or 1) • Place a 1 in output column for each input combination that makes the standard SOP expression a 1 • 0 in remaining rows A B C X product term ---------------------------------- 0 0 0 1 0 0 1 1 0 1 0 0 0 1 1 0 1 0 0 0 1 0 1 0 1 1 0 0 1 1 1 1
Boolean algebra Boolean algebra Laws and rules De Morgan’s theorem Analysis of logic circuits Standard forms Project 1 preparation
Project 1 preparation At the start of each tutorial session, the class will be given a Boolean expression involving 4 variables (A,B,C,D) by the tutor Project 1 Marked by demonstration to tutor in week 5 tutorial class 5 parts, each of equal value: Expand given expression to sum-of-products (SOP) form Create truth table for expression Expand SOP into standard SOP form Implement original expression in Logisim using gates Enter SOP expression into Logisim, and confirm that the resulting truth table produced by Logisim matches your truth table in part b)
Project 1— sample question Expand to SOP: Truth table: Z=1 only for ABCD=0101,0111,1101 Standard SOP: Logisim circuit: In Logisim: Project > Analyze Circuit enter expression at Expression tab view truth table at Table tab Week04Mon_projectdemo.circ