Hello World! An Invitation to Computer Science

Lecture Slides: From Boolean Expressions to Circuits

Thursday, February 28, 2008


Key ideas from last time


Sum-of-products algorithm

Any Boolean-valued function can be described by truth table
  without meaning, we can (mindlessly) extract logic formula

  1. for each true output, generate product term (AND)
  2. combine products in a sum (OR)

Example: exclusive or

inputs  output
 x  y     f        product terms
---------------------------------------------
 F  F     F
 F  T     T        (NOT x) AND y
 T  F     T        x AND (NOT y)
 T  T     F

    f(x,y) = ((NOT x) AND y) OR (x AND (NOT y))

Example: half-adder

  inputs   outputs
   a  b     c  s      c terms    s terms
  --------------------------------------------
   0  0     0  0    
   0  1     0  1                 (NOT a) AND b
   1  0     0  1                 a AND (NOT b)
   1  1     1  0       a AND b

  sum   = a XOR b

  carry = a AND b

Principle v. practice


Insight can help


How far can we go?


Example: 1-bit greater-than

inputs  output
 a  b     g        product terms
---------------------------------------------
 0  0     0
 0  1     0        
 1  0     1        a AND (NOT b)
 1  1     0

    g(a,b) = a AND (NOT b)

Two-out-of-three example

details