Logic Design CS221 1 st Term 2009-2010 Boolean Algebra Cairo University Faculty of Computers and...

28
Logic Design CS221 1 st Term 2009-2010 Boolean Algebra Cairo University Faculty of Computers and Information

Transcript of Logic Design CS221 1 st Term 2009-2010 Boolean Algebra Cairo University Faculty of Computers and...

Logic DesignCS221

1st Term 2009-2010

Boolean AlgebraBoolean Algebra

Cairo University

Faculty of Computers and Information

13/10/2009 cs221 – sherif khattab 2

Administrivia http://www.fci.cu.edu.eg/~skhattab/cs221 labs:

download Atanua logic simulator from: http://atanua.org and bring it with you to the lab

download lab instructions (from course website) form groups of 3 in the lab

project: use Atanua (display, audio, motors) design a digital circuit (e.g., simple video game,

talking clock)

13/10/2009 cs221 – sherif khattab 3

Bonus Chance

Like a Bonus??Find the error in the next

slide (and in the book) before Saturday

13/10/2009 cs221 – sherif khattab 4

boolean functions input -> output binary variables (and constants) and logic

operations defined by a truth table for two variables, only 16 boolean functions

possible. why? how many possible truth tables?

for n variables, 22n boolean functions

error

13/10/2009 cs221 – sherif khattab 5

Boolean Algebra digital circuits implement Boolean functions Boolean algebra used by software tools to:

simplify circuits into cheaper yet equivalent implementations

(two-valued) Boolean algebra: elements (0, 1) operators (logic operators: AND, OR, NOT) defined

by truth tables axioms (unproved ``assumptions”)

13/10/2009 cs221 – sherif khattab 6

Boolean vs. Ordinary Algebra Differences:

x + (y ∙ z) = (x + y) ∙ (x + z) inverse complement (NOT)

Similarities: variables vs. elements

13/10/2009 cs221 – sherif khattab 7

Basic Theorems Duality:

if a statement is true using the AND operator => its dual is also true

dual: interchange AND and OR and replace 0 with 1 and 1 with 0

Example: x + x = x dual: x ∙ x = x x + 0 = x dual: x ∙ 1 = x

13/10/2009 cs221 – sherif khattab 8

Basic Axioms and Theorems

13/10/2009 cs221 – sherif khattab 9

Basic Axioms and Theorems

13/10/2009 cs221 – sherif khattab 10

Sample proof by truth table

x y xy x + xy

0 00 11 01 1

0 00 00 11 1

13/10/2009 cs221 – sherif khattab 11

Boolean Functions

F1 = x + y'z

algebraic form

truth table

logic-circuit diagram (schematic)

13/10/2009 cs221 – sherif khattab 12

Boolean function simplification truth table: one way logic form and schematic: many ways

look for simplest and cheapest reduce number of gates reduce number of inputs to gates Boolean expression simplification

13/10/2009 cs221 – sherif khattab 13

Example

F2 = x'y'z + x'yz + xy'

13/10/2009 cs221 – sherif khattab 14

Example (contd.)

F2 = x'y'z + x'yz + xy'

= x'z(y' + y) + xy' = x'z ∙ 1 + xy' = x'z + xy'

13/10/2009 cs221 – sherif khattab 15

reducing number of literals literal:

a single variable within a term un-complemented or complemented

F2 = x'y'z + x'yz + xy' (8 literals)

F2 = x'z + xy' (?? literals)

13/10/2009 cs221 – sherif khattab 16

simplification examples x(x' + y) = xx' + xy = xy

x + x'y = (x + x')(x + y) = 1(x + y) = x + y

(x + y)(x + y') = xx + xy' + xy + yy'

= x + xy' + xy + 0

= x(1 + y' + y) = x

13/10/2009 cs221 – sherif khattab 17

simplification examples xy + x'z + yz = xy + x'z + yz(x + x')

= xy + x'z + xyz + x'yz

= xy(1 + z) + x'z(1 + y)

= xy + x'z

(x + y)(x' + z)(y + z) = (x+y)(x' + z) (why?)

consensus theorem

13/10/2009 cs221 – sherif khattab 18

function complement interchange of 0's and 1's in truth table

To get function complement: get dual then complement each literal (DeMorgan's theorem)

F1'

13/10/2009 cs221 – sherif khattab 19

function complement examples F

1 = x'yz' + x'y'z

dual: (x' + y + z')(x' + y' + z)

complement literals: (x + y' + z)(x + y + z') = F1'

F2 = x(y'z' + yz)

dual: x+(y' + z')(y + z)

complement of literals: x' + (y + z)(y' + z') = F2'

13/10/2009 cs221 – sherif khattab 20

canonical and standard forms canonical forms

sum of minterms product of maxterms

standard forms sum of products product of sums

13/10/2009 cs221 – sherif khattab 21

sum of minterms (1/2) minterms (standard products)

minterms of 2 variables x and y x'y', x'y, xy', xy

2n minterms of n variables

13/10/2009 cs221 – sherif khattab 22

sum of minterms (2/2) from truth table f1 = m1 + m4 + m7

= ∑(1, 4, 7) = x'y'z + xy'z' + xyz f

2 = ??

13/10/2009 cs221 – sherif khattab 23

product of maxterms (1/2) maxterms (standard sums)

maxterms of 2 variables x and y x' + y', x' + y, x + y', x + y

2n maxterms of n variables

13/10/2009 cs221 – sherif khattab 24

product of maxterms (2/2) f1 = M

0M

2M

3M

5M

6 = ∏(0, 2, 3, 5, 6)

= (x + y + z)(x + y' + z)(x + y' + z')(x' + y + z')(x' + y' + z)

f2 = ??

13/10/2009 cs221 – sherif khattab 25

Conversion F(A, B, C) = ∑(1, 4, 5, 6, 7) 5 terms what is F in algebraic form? F(A, B, C) = ∏(0, 2, 3) 23 – 5 = 3 terms what happened?

replaced ∑ by ∏ list missing terms

13/10/2009 cs221 – sherif khattab 26

Standard forms (1/2)are canonical forms the simplest?

sum of products: ex: F

1 = y' + xy + x'yz'

two-level implementation

13/10/2009 cs221 – sherif khattab 27

Standard forms (2/2)product of sums

ex: F2 = x(y' + z)(x' + y + z')

two-level implementation

13/10/2009 cs221 – sherif khattab 28

non-standard forms ex: F

3 = AB + C(D + E)

three levels

F3 = AB + C(D + E) = AB + CD + CE

which standard form? two levels which one is better?