CS251 - Computer Organization
Computer Science 251
Computer Organization

Dickinson College
Fall Semester 1999
Grant Braught


Class #9 - Boolean Algebra and Logic Simplification

Motivation for Logic Simplification:
       Consider an Odd Number Detector (Similar to the even number detector from last class...)

How would you build a circuit to compute this function?
Using the methods from the last class:
       Express the function as a truth table.
       Express the truth table as an SOP expression.
       Create a circuit from the SOP expression.

What does the truth table for a 3 bit Odd Number Detector Look Like?
As follows: A B C | E --------+-- 0 0 0 | 0 0 0 1 | 1 0 1 0 | 0 0 1 1 | 1 1 0 0 | 0 1 0 1 | 1 1 1 0 | 0 1 1 1 | 1 What is the straight forward SOP expression that we can generate from this truth table?
As follows: _ _ _ _ E = A B C + A B C + A B C + A B C What does the circuit implementation of this expression look like?
As follows: How long will it take to compute E using this circuit?
4.5ns + 7.5ns + 7.0ns = 19.0ns.
       4.5ns for the NOT gates.
       7.5ns for the AND gates.
       7.0ns for the OR gate.

Is there an easier way to express E?
Yes, E = C
What does this circuit look like?
It is trivial... Just a wire!
Which way would you want to build the circuit?
The second way, I hope!
Why?
It uses less gates!

Using less gates has several possible advantages:
       Cheaper - Less gates cost less money.
       Smaller - Uses less space on a chip.
       More reliable - Less gates means less opportunities for failure.
       Faster??? Maybe but not always.

This gives us several ways to evaluate our circuits:
       Size/Cost: Measured by number of gates.
       Speed: Time measured using the gate propagation delays.

Using a SOP expression does not necessarily give us the best implementation.
       Sometimes you can have a flash of inspiration and see a simpler expression...
       Sometimes you can't!
            This is where Boolean Algebra comes in...



Boolean Algebra Identities: Name: AND form: OR form: ---------------------------------------------------------------------------- Identity 1 A = A 0 + A = A Null 0 A = 0 1 + A = 1 Idempotent A A = A A + A = A _ _ Inverse A A = 0 A + A = 1 Commutative A B = B A A + B = B + A Associative (A B) C = A (B C) (A + B) + C = A + (B + C) Distributive A + (B C) = (A + B)(A + C) A (B + C) = A B + A C Absorption A (A + B) = A A + A B = A ___ _ _ _____ _ _ DeMorgan's A B = A + B A + B = A B To get started let's prove some of these laws:

Identity and Null should be pretty obvious.

Idempotent: A A*A A+A ----------- 0 0 0 1 1 1        We can see from the truth table that A = A*A and A = A+A this proves the Idempotent identity.

Inverse: _ _ _ A A A*A A+A -------------- 0 1 0 1 1 0 0 1        Again, the truth table verifies the Inverse law.

Distributive OR: A B C B+C A(B+C) AB AC AB+AC ------------------------------- 0 0 0 0 0 0 0 0 0 0 1 1 0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1 0 0 0 0 1 0 0 0 0 0 0 0 1 0 1 1 1 0 1 1 1 1 0 1 1 1 0 1 1 1 1 1 1 1 1 1        Since the A(B+C) and AB + AC columns agree in all possible cases the identity must be true.

We could repeat this for every one of these identities but it could get tricky.
       It would get pretty tedious.
       Instead we'll do some direct proofs using the identities.

Absorption +: A + A B = A A 1 + A B = A Identity AND (Technically there is a commutative step here too!) A (1 + B) = A Distributive OR A 1 = A Null OR A = A Identity AND Absorption AND: A (A + B) = A A A + A B = A Distributive OR A + A B = A Idempotent AND A = A Absorption OR So to prove that two expressions are equivalent we have several techniques:
       Exhaustive: Build truth tables.
       Direct Proof: Use already proven identities to prove others.
       Combination:
            Use identites to simplify the expressions
            Build a truth table for the simpler expressions.



Logic Simplification:
       Consider the Even Number Detector from earlier: _ _ _ _ E = A B C + A B C + A B C + A B C _ _ _ E = A (B C + B C) + A (B C + B C) Distributive OR _ _ _ E = A C (B + B) + A C (B + B) Distributive OR _ E = A C (1) + A C (1) Inverse OR _ E = A C + A C Identity AND _ E = C A + C A Commutative AND _ E = C (A + A) Distributive OR E = C (1) Inverse OR E = C Identity AND        Which verifies our flash of inspiration!
            If you have such an flash of inspiration in the project you should always verify it formally!