Presentation is loading. Please wait.

Presentation is loading. Please wait.

Boolean Functions 1 ECE 667 ECE 667 Synthesis and Verification of Digital Circuits Boolean Functions Basics Maciej Ciesielski Univ.

Similar presentations


Presentation on theme: "Boolean Functions 1 ECE 667 ECE 667 Synthesis and Verification of Digital Circuits Boolean Functions Basics Maciej Ciesielski Univ."— Presentation transcript:

1 Boolean Functions 1 ECE 667 ECE 667 Synthesis and Verification of Digital Circuits Boolean Functions Basics Maciej Ciesielski ciesiel@ecs.umass.edu Univ. of Massachusetts, Amherst Slides adopted (with permission) from A. Kuehlmann, UC Berkeley 2003

2 Boolean Functions 2 Outline Boolean function representation –Boolean space, cubes, cover –SoP, truth tables –Canonicity Operations on Boolean functions –Cofactoring, Shannon expansion –Quantification Basic theorems –Quine’s theorem –Fundamental theorem, tautology Properties, special functions –Symmetry, unateness –Incompletely specified Boolean functions Two-level logic minimization –Recursive factorization (heuristic, espresso) –Exact method (Quine McCluskey)

3 Boolean Functions 3 The Boolean Space B n B = { 0,1}, B 2 = {0,1} X {0,1} = {00, 01, 10, 11}, etc. B0B0B0B0 B1B1B1B1 B2B2B2B2 Karnaugh Maps:Boolean Spaces: B3B3B3B3 B4B4B4B4

4 Boolean Functions 4 x2x2 x1x1 = on-set minterm (f = 1) = off-set minterm (f = 0)

5 Boolean Functions 5 On-set, Off-set, Tautology Literal x 1 represents the logic function f, where f = {x| x 1 = 1} Literal x 1 represents the logic function g where g = {x| x 1 = 0} x1x1 x3x3 x2x2 f = x 1 x1x1 x2x2 x3x3 Notation: x’ = x = on-set minterm (f = 1) = off-set minterm (f = 0)

6 Boolean Functions 6 Set of Boolean Functions There are 2 n vertices in input space B n There are 2 2 n distinct logic functions. –Each subset of vertices is a distinct logic function: f  B n x1x1 x2x2 x3x3 Truth Table or Function Table : X 1 x 2 x 3 F 0 0 0 1 0 0 1 0 0 1 0 1 1 0 1 0 0 1 1 0 1 1 0 1 1 1 1 0

7 Boolean Functions 7 Boolean Operations - AND, OR, COMPLEMENT Given two Boolean functions : f : B n  B g : B n  B AND operation f  g = {x | f(x)=1  g(x)=1} The OR operation f  g = {x | f(x)=1  g(x)=1} The COMPLEMENT operation (^f or f’ ) f’ = {x | f(x) = 0}

8 Boolean Functions 8 Cofactor and Quantification Given a Boolean function: f : B n  B, with the input variables (x 1,x 2,…,x i,…,x n ) Positive Cofactor of function f w.r.t variable x i f xi = f(x i =1) Negative Cofactor of f w.r.t variable x i f xi’ = f(x i =0) Existential Quantification of function f w.r.t variable x i,  x i f = f xi  f xi’ Universal Quantification of function f w.r.t variable x i,  x i f = f xi  f xi’

9 Boolean Functions 9 Representations of Boolean Functions We need representations for Boolean Functions for two reasons: –to represent and manipulate the actual circuit we are “synthesizing” –as mechanism to do efficient Boolean reasoning Forms to represent Boolean Functions –Truth table –List of cubes: Sum of Products, Disjunctive Normal Form (DNF) –List of conjuncts: Product of Sums, Conjunctive Normal Form (CNF) –Binary Decision Tree, Binary Decision Diagram –Boolean formula –Boolean network Canonicity – which forms are canonical?

10 Boolean Functions 10 Boolean Formula A Boolean formula is defined as an expression with the following syntax: formula ::= ‘(‘ formula ‘)’ | |formula “+” formula(OR operator) |formula “  ” formula(AND operator) | ^ formula(complement) Example: f = (x 1  x 2 ) + (x 3 ) + ^^(x 4  (^x 1 )) typically the “  ” is omitted and the ‘(‘ and ‘^’ are simply reduced by priority, e.g. f = x 1 x 2 + x 3 + x 4 ^x 1

11 Boolean Functions 11 Cubes A cube is defined as the product (AND) of a set of literal functions (“conjunction” of literals). Example: C = x 1 x’ 2 x 3 represents the following logic function f = (x 1 =1)(x 2 =0)(x 3 =1) Other examples of cubes: x1x1 x2x2 x3x3 c = x 1 x1x1 x2x2 x3x3 f = x 1 x 2 x1x1 x2x2 x3x3 f = x 1 x 2 x 3 = on-set minterm (f = 1) = off-set minterm (f = 0)

12 Boolean Functions 12 Set of Cubes – SoP vs Cover A function can be represented by a sum of cubes: f = ab + ac + bc Since each cube is a product of literals, this is a “sum of products” (SOP) representation A SOP can be thought of as a set of cubes F (a cover of f ). F = {ab, ac, bc} Definition: cover F of function f = set of implicants that cover all minterms of function f Cover is non-unique, e.g., F 1 ={ab, ac, bc} and F 2 ={abc, a’bc, ab’c, abc’} are some of possible covers of Boolean function f = ab + ac + bc.

13 Boolean Functions 13 Cover minimization c a bc ac ab b = on-set minterm (f = 1) = off-set minterm (f = 0) = don’t care-set minterm (f = x) Two-level minimization seeks a minimum size cover (least number of cubes). Reason: minimize number of product terms in PLA Note: each onset minterm is “covered” by at least one of the cubes and none of the offset minterms is covered.

14 Boolean Functions 14 PLAs - Multiple Output Functions A PLA is a function f : B n  B m represented in SOP form Each distinct cube appears only once in the AND-plane, and can be shared by (multiple) outputs in the OR-plane, e.g., cube abc. f2f2 f3f3 f1f1 n=3, m=3 aabbcc abc f 1 f 2 f 3 10- 1 - - -11 1 - - 0-0 - 1 - 111 - 1 1 00- - - 1 Personality Matrix AND plane OR plane

15 Boolean Functions 15 Irredundant Cubes bc ac ab c a b bc ac not covered, so ab is irredundant F \ {ab}  f Definition: Let F = {c 1, c 2, …, c k } be a cover for f, i.e. f =  i k =1 c i A cube c i  F is irredundant if F \ {c i }  f A cover is irredundant if all its cubes are irredundant. Example: f = ab + ac + bc

16 Boolean Functions 16 Prime, Essential, Irredundant Definition: A cube is prime if it is not contained in any other cube. A cover is prime if all its cubes are prime. Definition: A prime of f is essential if it contains a minterm that is not contained by any other prime. Example: f = abc + b’d + c’d is prime and irredundant. abc is essential since abcd’  abc but not in the other cubes abc bd cd d a c b abcd abcd’

17 Boolean Functions 17 Prime and Irredundant Covers Example: f = abc + b’d + c’d is prime and irredundant. abc bd cd d a c b abcd abcd’ Why is abcd not an essential vertex of abc? What is an essential vertex of abc? What other cube is essential? What prime is not essential?

18 Boolean Functions 18 Implicants Formally: cube C  f is an implicant of f –It is called implicant since C = 1  f = 1 –In an n-dimensional Boolean space B n, an implicant with n literals is a minterm. Prime implicants Essential implicants Irredundant implicants are defined similarly as for cubes.

19 Boolean Functions 19 Quine’s Theorem Importance of having prime cubes: minimum SOP solution can be composed of prime cubes only Theorem (Quine): There exists a minimum cover that is prime Given initial cover for F = (f,d,r), find a minimum cover G of primes where: f  G  f+d G is a prime cover of F ; f = on-set, r = off-set, d = don’t care set

20 Boolean Functions 20 Shannon (Boole) Cofactors Let f : B n  B be a Boolean function, and x= (x 1, x 2, …, x n ) the variables in the support of f. The cofactor f a of f w.r.t literal a=x i or a=x’ i is: f x i (x 1, x 2, …, x n ) = f (x 1, …, x i-1, 1, x i+1,…, x n ) f x’ i (x 1, x 2, …, x n ) = f (x 1, …, x i-1, 0, x i+1,…, x n Computation of cofactors is a fundamental operation in Boolean reasoning Shannon (Boole) expansion f = x f x + x’ f x’

21 Boolean Functions 21 Generalized Cofactor The generalized cofactor f C of f by a cube C is f with the fixed values indicated by the literals of C, Eg. if C= x 1 x’ 4 x 6 f C is just the function f restricted to the subspace where x 1 =x 6 =1 and x 4 =0. As a function, f C does not depend on x 1,x 4 or x 6 anymore (However, we still consider f C as a function of all n variables, it just happens to be independent of x 1,x 4 and x 6 ). x 1 f  f x 1 Example: f = ac + a’c, af = ac, f a =c

22 Boolean Functions 22 Cofactor of Cover Definition: The cofactor of a cover F is the sum of the cofactors of each of the cubes of F. Given the cover The cofactor of the cover is simply Note: If F={c 1, c 2,…, c k } is a cover of f, then F c = {(c 1 ) c, (c 2 ) c,…, (c k ) c } is a cover of f c. { c i }

23 Boolean Functions 23 Definition: The cofactor C x j of a cube C with respect to a literal x j is C if x j and x’ j do not appear in C C\{x j } if x j appears positively in C, i.e. x j  C  if x j appears negatively in C, i.e. x j ’  C Example 1:C = x 1 x’ 4 x 6 C x 2 = C (x 2 and x’ 2 do not appear in C ) C x 1 = x’ 4 x 6 (x 1 appears positively in C) C x 4 =  (x 4 appears negatively in C) Example 2: F = abc + b’d + c’d F b = ac + c’d (Just drop b everywhere and delete cubes containing literal b) Cofactor of Cubes

24 Boolean Functions 24 Fundamental Theorem Theorem: Let c be a cube and f a function. Then c  f  f c  1. Proof. We use the fact that x f x = x f, and f x is independent of x. If : Suppose f c  1. Then cf =f c c = c. Thus, c  f. f c

25 Boolean Functions 25 Proof (cont.) Only if. Assume c  f Then c  cf = cf c. But f c is independent of literals i  c. If f c  1, then  m  B n, f c (m)=0. We will construct a m’ from m and c in the following manner: m i ’=m i, if x i  c and x i  c, m i ’=1, if x i  c, m i ’=0, if x i  c. i.e., we made the literals of m’ agree with c, i.e. m’  c  c(m’)=1 Also, f c is independent of literals x i,x i  c  f c (m’) = f c (m) = 0  f c (m’) c(m’)= 0 contradicting c  cf c. m m= 000 m’= 101 m’ C=xz

26 Boolean Functions 26 Application of Containment Test: Application of Containment Test: c  F

27 Boolean Functions 27 Extra slides

28 Boolean Functions 28 Prime and Essential Implicants Quine’s Theorem (Willard Quine, 1908 – 2000, Harvard Univ.): –Boolean function can be implemented with only prime implicants (but other solutions exist) –The number of such implicants is minimum Essential prime implicant –Prime implicant that covers a minterm that is not covered by any other prime implicant

29 Boolean Functions 29 Essential Prime Implicants Example: F=  (0,1,2,6,8,9,10,14) Essential implicants : –Implicant 1 =  (0,1,8,9) –Implicant 2 =  (2,6,14,10) Non-essential implicant:  (0,2,8,10)

30 Boolean Functions 30 Don’t Cares : Incompletely Specified Functions Output of function is irrelevant for some inputs –Input might never occur –Input is invalid Function is incompletely specified –Multiple completely specified functions can implement it Karnaugh map is marked with ‘x’ for don’t cares –Output can be set to 1 or 0 (hence “don’t care”) –Choose most convenient output –Maximize block size Specification of don’t care conditions: –Function: F(w,x,y,z) =  (1,3,7,11,15) –Don’t cares: d(w,x,y,z) = ∑(0,2,5)

31 Boolean Functions 31 Incompletely Specified Functions Design a logic function that determines if a BCD digit is divisible by 3 –Find minimum SOP logic implementation What are the possible inputs for this function? –Only (0000) 2  (1001) 2 are used –Other inputs are not valid What should we do with invalid inputs? –“Don’t care” –Output can take any value F(A,B,C,D) = AD + B’CD + BCD’ + A’B’C’D’

32 Boolean Functions 32 Example with Don’t Cares Minimization example: –F(w,x,y,z) =  (1,3,7,11,15) and d(w,x,y,z) =  (0,2,5) Solution is non-unique


Download ppt "Boolean Functions 1 ECE 667 ECE 667 Synthesis and Verification of Digital Circuits Boolean Functions Basics Maciej Ciesielski Univ."

Similar presentations


Ads by Google