1 / 25

Simplifying Boolean Expressions

Simplifying Boolean Expressions. In this session we examine various ways of simplifying Boolean expressions, in particular, the use of Karnaugh maps. p. p  q. q. A Boolean (0,1) model for .

bryant
Download Presentation

Simplifying Boolean Expressions

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Simplifying Boolean Expressions In this session we examine various ways of simplifying Boolean expressions, in particular, the use of Karnaugh maps.

  2. p p q q A Boolean (0,1) modelfor  • p = T or F q = T or F (T = on; F = off)p=T, q= T, p  q = T  T = T ;p= T, q= F , p  q = T  F = T ; p= F, q= T, p  q = F  T = T;p= F, q= F, p  q = F  F = F • p = 0 or 1 q = 0 or 1 1 1 1  1 = 1 1 0 1  0 = 1 0 1 0  1 = 1 0 0 0  0 = 0 The "arithmetic" looks likea special addition p+q

  3. p p q q A Boolean (0,1) modelfor  • p = T or F q = T or F (T = on; F = off)p=T, q= T, p  q = T  T = T ;p= T, q= F , p  q = T  F = F ; p= F, q= T, p  q = F  T = F;p= F, q= F, p  q = F  F = F • p = 0 or 1 q = 0 or 1 1 1 1  1 = 1 1 0 1  0 = 0 0 1 0  1 = 0 0 0 0  0 = 0 The "arithmetic" looks likemultiplication pq

  4. p  p A Boolean (0,1) modelfor  • p = T or F (T = on; F = off)p= T ,  p = F ;p= F ,  p= T ; • p = 0 or 1 1 0 0 1 It is (1 - p) p'

  5. Analysing a simple circuit • In terms of logic clearly we have  p  q p=T, q= T,  p  q = F  T = F ;p= T, q= F ,  p  q = F  F = F ; p= F, q= T,  p  q = T  T = T ;p= F, q= F,  p  q = T  F = F • 1 1 0  1 = 0 1 0 0  0 = 0 0 1 1  1 = 1 0 0 1  0 = 0 p'q

  6. Finding the Boolean expression for a circuit • In terms of logical operators: (p  q)   (p  q)  (p+q)(pq)'  (p  q)  (p q)  (p+q)(p'+q')  (p(p q))  (q(pq) p(p'+q')+q(p'+q')  ((pp)(p q)) ((qp)(qq)) pp'+pq'+qp'+qq' (c(pq))((qp)c)  0 +pq'+qp'+ 0  (pq)(qp) pq'+qp'(the symmetric difference)

  7. Convention • We will leave out the multiplication sign, , and assume that multiplication is executed before addition +. Thus we shall writep q + r for (p  q) + rbut we will continue to write(p  q)  rsince it is not usual to give  precedence over 

  8. Some laws of Boolean Algebra • x x' = 0 • x'' = x • (x + y)' = x'y' (xy)'= x'+y' • x +1 = 1 x +0 = x • x 1 = xx 0 = 0 • x+(xy) = x x (x+y)= x • 0' = 11' = 0 • x x = x [x(1-x) = x- xx = 0]

  9. The algebra

  10. "Simplifying" Boolean Expressions • Using the axioms and derived laws: • xz'+x'y+(yz)' = xz'+x'y+y'+z' = xz'+1z'+x'y+y' = (x+1)z' +x'y+y' = 1z' + x'y'' + y' = z'+(x+y')'+y' = z' + ((x+y')y)' = z' + (xy+y'y)' = z'+ (xy+0)' = z'+(xy)' = x'+y'+z' = (xyz)' • (Identical to logic reductions but in different, more compact, notation.)

  11.  "Simplifying" • x'y+y'= x'y'' + y' = (x+y')'+y'= ((x+y')y)' = (xy+0)' = (xy)'= x'+y' • andxy'+ y= x+ y=yx'+ x=x'y+ x(cf Grossmanp.144)

  12. Picking out when f is "true" • Consider the tablex y f (x,y) 1 1 1 xy = 1 1 0 1 xy' = 1 0 1 1 x'y = 1 0 0 0If any one of the three cases is true then f is true, or,f (x,y,z) = xy + xy' + x'y=(x+x')y+xy'=y+xy'= x+ y • [Recall that 1+1 = 1] Consider the tablex y f (x,y) 1 1 1 xy = 1 1 0 0 0 1 0 0 0 0In only one case is f is true : f (x,y,z) = xy The sum of minterms is the disjunctive normal form. (Not necessarily the simplest form.)

  13. Minterms are the products of factors, one for each variable, which return 1 for each particular case where f = 1 e.g. the minterms to right arexyzw, xyz'w', xy'zw, xy'z'w', x'y'zw and x'y'z'w x y z w f(x,y,z,w)1 1 1 1 1 xyzw1 1 1 0 01 1 0 1 01 1 0 0 1 xyz'w'1 0 1 1 1 xy'zw1 0 1 0 01 0 0 1 01 0 0 0 1 xy'z'w'0 1 1 1 00 1 1 0 0 0 1 0 1 00 1 0 0 00 0 1 1 1 x'y'zw0 0 1 0 00 0 0 1 1 x'y'z'w0 0 0 0 0 Minterms

  14. The Disjunctive Normal Form • The disjunctive normal form for a Boolean function is the sum of its minterms. • In the previous example, the disjunctive normal form isf(x,y,z,w) = xyzw+xyz'w'+xy'zw+ xy'z'w' + + x'y'zw + x'y'z'w • It is not necessarily the simplest expression for the function.

  15. Karnaugh map for f (x,y) • Suppose the disjunctive normal form for f (x,y) is xy+x'y+xy'. In the table:y y' x 1 1 x' 1 0the 1 entries identify the presence of minterms. Boxing in rows and columns of 1's identifies minterms with common factors. Since x+x=x :xy+x'y+xy' = xy+x'y+xy+xy'=(x+x')y+x(y+y')=x+y which we can deduce from the diagram.

  16. Karnaugh map for f (x,y,z) • The table is set up as below (order of columns is important):yz y'z y'z' yz' x 1 0 0 1 • x' 0 1 0 1 • We search for four 1's in a row four 1's in a square -- assuming right and left edges are adjacent two adjacent 1's in a row or column -- " single 1's • in that order. Loops may overlap and all 1's must be covered, hopefully with as few loops as possible with loops as large as possible.

  17. f (x,y,z) = xyz + xyz' +x'y'z + x'yz' • The Karnaugh map isshown aboveand is boxed accordingly. From the two-loops we get y and yz' and from the single 1, x'y'z. Thus our simplification is xy + yz' + x'y'z

  18. Karnaugh map for f (x,y,z,w) • The table is set up as below (order of rows and columns is important):zw z'w z'w' zw' xy 1 0 0 0 x'y 0 1 0 0x'y' 1 1 0 1xy' 1 0 0 1 • We search for eight 1's in four by two or two by four rectangles four 1's in a row or a column (top and bottom, left and right are adjacent four 1's in a square two adjacent 1's in a row or column single 1's

  19. f (x,y,z,w)= xyzw + x'yz'w + x'y'zw + x'y'z'w + x'y'zw' + xy'zw + xy'zw' • The table is set up as below (order of rows and columns is important):zw z'w z'w' zw' xy 1 0 0 0 x'y 0 1 0 0x'y' 1 1 0 1xy' 1 0 0 1 • The reduction isy'z + xzw + x'z'w

  20. The "don't care" option • Occasionally the function table does not list all possible inputs, possibly because some will never occur e.g. x = (a>b) y = (a<b) will never have the inputs 1 1 or 0 0.In these cases we can place a d in the Karnaugh map and include it in a loop if desirable or ignore it if preferred.

  21. Writing any given expression in disjunctive normal form • Note that x + y is not in disjunctive normal form. To obtain that form we re-write it as x(y+y') + y(x+x') = xy + xy' + xy + x'y = xy + xy'+ x'y(as obtained earlier from the function table). • Apply the same procedure, together with distributive and deMorgan laws (etc) to any expression to bring it to disjunctive normal form.

  22. f (x,y,z) = (xy)'z + (x'z +z')y • To write f in disjunctive normal form: (xy)'z + (x'z +z')y = (x'+y')z + x'yz + yz'= x'z + y'z + x'yz + yz'= x'(y+y')z + (x+x')y'z + x'yz + (x+x')yz'= x'yz+x'y'z + xy'z+x'y'z + x'yz + xyz'+x'yz'= xyz'+ xy'z + x'yz+x'y'z + x'yz'

  23. Adding two bits again • The input/output tables for adding two bits are:x y sum x y carry0 0 0 0 0 0 1 0 1 1 0 0 0 1 1 0 1 0 1 1 0 1 1 1 • Exercise: produce a pair of circuits to do it.

  24. Adding three bits again • The input/output tables for adding three bits are: x y z sum x y z carry0 0 0 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 1 0 1 0 0 1 0 0 1 1 0 0 0 0 1 1 0 0 1 1 1 Exercise: 1 0 1 0 1 0 1 1 produce a pair1 1 0 0 1 1 0 1 of circuits to do it 1 1 1 1 1 1 1 1

  25. What’s the big idea ? • Logical reductions can be achieved by analysis of the Boolean expressions that describe them using the laws of logic and Karnaugh maps or truth tables or the Venn diagrams that represent those tables geometrically.

More Related