Computational Boolean Algebra. Pingqiang Zhou ShanghaiTech University

Size: px
Start display at page:

Download "Computational Boolean Algebra. Pingqiang Zhou ShanghaiTech University"

Transcription

1 Computational Boolean Algebra Pingqiang Zhou ShanghaiTech University

2 Announcements Written assignment #1 is out. Due: March 24 th, in class. Programming assignment #1 is out. Due: March 24 th, 11:59PM. Online open course video available at coursera By Prof. Rob Rubentar, head of CS department at UIUC 2

3 3 Online Course from UIUC

4 Karnaugh Map xy zw

5 Computational Boolean Algebra Motivation Background You ve done Boolean algebra, hand manipulations, Karnaugh maps to simplify But this is not sufficient for real designs! Example: a multiplier of two 16-bit numbers It has 32 inputs. Its Karnaugh map has 2 32 = 4,294,967,296 squares This is too big! There must be a better way 5

6 Need a Computational Approach 6 Need algorithmic, computational strategies for Boolean stuff. Need to be able to think of Boolean objects as data structures + operators What will we study? Decomposition strategies Ways of decomposing complex functions into simpler pieces. A set of advanced concepts and terms you need to be able to do this. Computational strategies Ways to think about Boolean functions that let them be manipulated by programs. Interesting applications When you have new tools, there are some useful new things to do.

7 Computational Boolean Algebra: Topics Cofactors Boolean difference Quantification Tautology 7

8 Advanced Boolean Algebra Useful Analogy to Calculus In calculus, you can represent complex functions like e x using simpler functions. If you can only use 1, x, x 2, x 3, as the pieces... turns out e x = 1 + x + x2 2! + x3 3! + It corresponds to the Taylor series expansion. f x = f 0 + f (0) 1! + f (0) 2! + f (0) 3! + Question: Anything like this for Boolean functions? Yes. It is called Shannon Expansion. 8

9 9

10 Shannon Expansion Proposed by Claude Shannon, the father of information theory. Suppose we have a function F(x 1, x 2,, x n ). Define a new function if we set one of the x i = const F(x 1, x 2,, x i = 1,, x n ) F(x 1, x 2,, x i = 0,, x n ) Example: F x, y, z = xy + x z + y( xz + F x = 1, y, z = F x, y = 0, z = y + z + y z x z z) Note: this is a new function, that no longer depends on the variable x i. 10

11 Shannon Expansion: Cofactors Turns out to be an incredibly useful idea. It is also known as Shannon cofactor with respect to x i. We write F(x 1, x 2,, x i = 1,, x n ) as F xi. We call it positive cofactor. We write F(x 1, x 2,, x i = 0,, x n ) as F x i. We call it negative cofactor. Often, just write them as F(x i = 1) and F(x i = 0). Why are these useful functions to get from F? 11

12 Shannon Expansion Theorem Why we care: Shannon Expansion Theorem Given any Boolean function F(x 1, x 2,, x n ) and pick any x i in F s inputs, F can be represented as F x 1, x 2,, x n = x i F x i = 1 + x i F(x i = 0) Proof: Consider any x 1, x 2,, x n If x i = 1 {0,1} n F, x i = 1, = F x i = 1 = 1 F x i = F(x i = 0) If x i = 0 F, x i = 0, = F x i = 0 = 0 F x i = F(x i = 0) 12

13 Shannon Expansion: Another View x 1 x i x n function F F Same as x 1 0 x n x 1 1 x i x i function F function F 0 MUX 1 F = x i F x i = 1 + x i F(x i = 0) x n 13 x i

14 Shannon Expansion: Multiple Variables Can do it on more than one variable, too. Just keep on applying the theorem on each variable. Example: Expand F x, y, z, w around x and y First, expand around x: F x, y, z, w = x F x = 1 + x F(x = 0) Then, expand cofactors F x = 1 and F x = 0 around y: F x = 1 = y F x = 1, y = 1 + y F(x = 1, y = 0) F x = 0 = y F x = 0, y = 1 + y F(x = 0, y = 0) Final result: F x, y, z, w = xy F x = 1, y = 1 + x y F x = 1, y = 0 + xy F x = 0, y = 1 + x y F(x = 0, y = 0) 14

15 Shannon Cofactors: Multiple Variables There is notation for these multiple-variable expansions as well. Shannon cofactor with respect to x i and x j : Write F(x 1,, x i = 1,, x j = 0,, x n ) as F xi x j. The same for any number of variables x i, x j, x k, Notice that order does not matter: (F x ) y = (F y ) x = F xy. 15 For the previous example: F x, y, z, w = xy F xy + x y F x y + xy F xy + x y F x y Again, remember: each of the cofactors is a function, not a number. F xy = F(x = 1, y = 1, z, w) is a Boolean function of only z and w.

16 Next Question: Properties of Cofactors What else can you do with cofactors? Suppose you have 2 functions F(X) and G(X), where X = (x 1, x 2,, x n ). Suppose you make a new function H, from F and G, say H = F H = F G, i.e., H X = F X G(X) H = F + G, i.e., H X = F X + G(X) H = F G, i.e., H X = F(X) G(X) Question: can you tell anything about H s cofactors from those of F and G? F G x = what? F x = what? 16

17 Nice Properties of Cofactors Cofactors of F and G tell you everything you need to know. Complements F x = (F x ) In English: cofactor of complement is complement of cofactor. Binary Boolean operators F G x = F x G x cofactor of AND is AND of cofactors F + G x = F x + G x cofactor of OR is OR of cofactors F G x = F x G x cofactor of XOR is XOR of cofactors Very useful! Can often help in getting cofactors of complex formulas. 17

18 Combinations of Cofactors Now consider operations on cofactors themselves. Suppose we have F(X), and get F x and F x F x F x =? F x F x =? F x + F x =? Turns out these are all useful new functions. Indeed, they even have names! Next: let s go look at these interesting, useful new functions. 18

19 Computational Boolean Algebra: Topics Cofactors Boolean difference Quantification Tautology 19

20 Calculus Revisited: Derivatives Remember how you defined derivatives? Suppose you have y = f(x). y = f(x) Defined as slope of curve as a function of point x. How to compute? df(x) dx = lim f x+δx f(x) Δx 0 Δx x 20

21 Boolean Derivatives So, do Boolean functions have derivatives? Actually, yes. Trick is how to define them... Basic idea For real-valued f(x), df dx tells how f changes when x changes. For 0,1-valued Boolean function, we cannot change x by small delta. Can only change 0 1, but can still ask how f changes with x... For Boolean function f(x), define f x = f x f x 21

22 Boolean Derivatives f x = f x f x Compare value of f when x = 0 against when x = 1. f x == 1 if and only if f(x = 0) is different from f(x = 1). f x is also known as Boolean difference. If function f is constant (f = 1 or f = 0 for all inputs), then f x = 0 for any x. 22

23 Boolean Difference Boolean difference also behaves sort of like regular derivatives... Order of variables does not matter ( f x) y = ( f y) x Derivative of XOR is XOR of derivatives (f g) = f x x g x Like addition 23

24 Boolean Difference But some things are just more complex Derivatives of (f g) and (f + g) do not work the same... Why? Because AND and OR on Boolean values do not always behave like ADDITION and MULTIPLICATION on real numbers. 24

25 Boolean Difference: Gate-Level View Consider simple examples for f x. Inverter: f = x f x = 0, f x = 1, AND: f = xy f x = y, f x = 0, OR: f = x + y f x = 1, f x = y, XOR: f = x y f x = y, f x = y, f x = f x f x = 1 f x = f x f x = y f x = f x f x = y f x = f x f x = 1 Meaning: When f x = 1, then f changes if x changes! 25

26 Interpreting the Boolean Difference a b w Combinational Logic F(a, b,, w, x) x What does F(a, b,, w, x) x = 1 mean? If you apply a pattern of inputs (a, b,, w) that makes F x = 1, then any change in x will force a change in output F. 26

27 Boolean Difference: Example a b c in 1-Bit Full Adder s c out s = a b c in c out = ab + ac in + bc in What is c out c in = 1? c out c in = 1 = a + b c out c in = 0 = ab c out c in = c out c in = 1 c out c in = 0 = a + b ab = a b Make sense? a b = 1 a b 27

28 Boolean Difference: Summary Boolean difference explains under what situations an inputchange can cause output-change for a Boolean function f. f x is another Boolean function, but it does not depend on x! It cannot, because it is made out of cofactors with respect to x, which eliminate all the x and x terms by setting them to constants. Very useful! (we will see more, later ) 28

29 Computational Boolean Algebra: Topics What you know Shannon expansion lets you decompose a Boolean function Combinations of cofactors do interesting things, e.g, the Boolean difference What you don t know Other combinations of cofactors that do useful things The big ones: Quantification operators Applications: Being able to do something impressive 29

30 Computational Boolean Algebra: Topics Cofactors Boolean difference Quantification Tautology 30

31 AND of F x and F x: Universal Quantification AND the cofactors: F xi F x i Name: Universal Quantification of function F with respect to variable x i. Represented as: x i F (x 1, x 2,, x i 1, x i+1,, x n ) x i F is a new function It does not depend on x i! sign is the for all symbol from logic. 0 x function F F x AND x F function F 1 x F x 31

32 OR of F x and F x: Existential Quantification OR the cofactors: F xi + F x i Name: Existential Quantification of function F with respect to variable x i. Represented as: x i F (x 1, x 2,, x i 1, x i+1,, x n ) x i F is a new function It does not depend on x i! sign is the there exists symbol from logic. 0 x function F F x OR x F Both x i F and x i F do not depend on x i function F 1 x F x 32

33 Quantification Notation Makes Sense 33 0 function F x function F F x 1 x F x 0 function F x function F F x 1 x F x AND OR x F When does x F(all vars except x) = 1? This input pattern of the other vars makes F = 1 for all values of x. x F When does x F(all vars except x) = 1? There exists a value of x that makes F = 1 for this input pattern of the other vars.

34 Quantification: Gate-Level View Consider simple examples for ( x f) and ( x f). Inverter: f = x f x = 0, f x = 1, x f = f x f x = 0, x f = f x + f x = 1 AND: f = xy f x = y, f x = 0, x f = f x f x = 0, x f = f x + f x = y OR: f = x + y f x = 1, f x = y, x f = f x f x = y, x f = f x + f x = 1 XOR: f = x y f x = y, f x = y, x f = f x f x = 0, x f = f x + f x = 1 Make sense? 34

35 Extends to More Variables in Obvious Way Like Boolean difference, can do with respect to more than 1 variable Suppose we have F(x, y, z, w). xy F z, w = x y F = F xy F xy F xy F x y xy F z, w = x y F = F xy + F xy + F xy + F x y Remember: ( x F), ( x F), and F x are all functions. but they are functions of all the variables except x. 35

36 Quantification Example Consider the following circuit, it adds x =0 or x =1 to a 2-bit number a 1 a 0. It s just a 2-bit adder, but instead of b 1 b 0 for the second operand, it is just 0x. It has a carry-in d and produces a carry-out c. Hence, c is function of a 1, a 0, d and x. Questions: a 1 0 a 0 x What is a 1 a 0 c x, d? A 1 B 1 A 0 B 0 What is a 1 a 0 c x, d? c adder d 36

37 Quantification Example a 1 0 a 0 x c A 1 B 1 A 0 B 0 adder d What is a 1 a 0 c x, d? A function of only x and d. Makes a 1 for values of x and d that make a carry c = 1 for all values of inputs a 1 and a 0. What is a 1 a 0 c x, d? A function of only x and d. Makes a 1 for values of x and d that make a carry c = 1 for some value of inputs a 1 and a 0, i.e., there exists some a 1 and a 0 that for this x and d, c = 1. 37

38 Quantification Example a 1 0 a 0 x c A 1 B 1 A 0 B 0 adder d c = a 1 (a 0 x + a 0 d + xd) Compute a 1 a 0 c x, d c a1 a 0 c a1 a 0 c a 1 a 0 c a 1 a 0 = 0 Compute a 1 a 0 c x, d c a1 a 0 + c a1 a 0 + c a 1 a 0 + c a 1 a 0 = x + d Need four cofactors: c a1 a 0 = x + d c a1 a 0 = xd c a 1 a 0 = 0 c a 1 a 0 = 0 38

39 Quantification Example a 1 0 a 0 x c A 1 B 1 A 0 B 0 adder d c = a 1 (a 0 x + a 0 d + xd) a 1 a 0 c x, d = 0 Make sense: No values of x and d that make c = 1 independent of a 1 and a 0 a 1 a 0 c x, d = x + d Make sense: If at least one of x and d = 1, then there exists a 1 and a 0 that let c = 1. 39

40 a b Quantification Application: Logic Network Repair Suppose that some one specified a logic block for you to implement: f a, b = ab + b but you implemented it wrong: in particular, you got ONE gate wrong. Specified ab + b f a, b a b Implemented AND?? g a, b 40 Goal Can we deduce how precisely to change this gate to restore correct function? Go with this very trivial test case to see how mechanics work...

41 MUX Network Repair a b Clever trick: Replace our suspect gate by a 4-to-1 MUX with 4 arbitrary new vars d 0, d 1, d 2, d 3. By cleverly assigning values to d 0, d 1, d 2, d 3, we can fake any gate. Question is: what are the right values of d i s so g is repaired, i.e., g = f? AND s 0 s 1?? a b g a, b AND d 0 d 1 d 2 d s 1 s 0 G a, b, d 0,, d 3 41

42 MUX Aside: Faking a Gate with a MUX You can do any function of 2 vars with one 4-to-1 multiplexor (MUX). y x s 1 s 0 x y OR 42

43 MUX Aside: Faking a Gate with a MUX You can do any function of 2 vars with one 4-to-1 multiplexor (MUX). y x s 1 s 0 x y NAND 43

44 MUX Network Repair: Using Quantification Next trick: XNOR G a, b, d 0,, d 3 f a, b. with the specification a b AND s 1 s 0 d 0 d 1 d 2 d G a, b, d 0,, d 3 z a, b, d0, d1, d2, d3 EXNOR 44 a b ab + b f a, b Note: z a, b, d 0, d 1, d 2, d 3 = 1 only when G == f.

45 Using Quantification What do we need? Values of d 0, d 1, d 2, d 3 that make z = 1 for all possible values of inputs a, b. There are values of d 0, d 1, d 2, d 3 that let ab z d 0, d 1, d 2, d 3 = 1 The above equation is universal quantification of function z with respect to a, b! Any pattern of (d 0, d 1, d 2, d 3 ) that makes ab z d 0, d 1, d 2, d 3 = 1 will do it! 45

46 MUX Network Repair via Quantification a b AND s 1 = b, s 0 = ab s 1 s 0 G = d 0 s 1 s 0 + d 1 s 1 s 0 + d 2 s 1 s 0 +d 3 s 1 s 0 d 0 d 1 d 2 d G a, b, d 0,, d 3 XNOR a b ab + b f a, b z a, b, d 0, d 1, d 2, d 3 46

47 Network Repair via Quantification As a result G a, b, d 0,, d 3 = d 0 ab + d 1 ab + d 2 b f a, b = ab + b z a, b, d 0,, d 3 = G a, b, d 0,, d 3 f a, b We want to get ab z d 0, d 1, d 2, d 3 = z a b z ab z a b z ab 47

48 Network Repair via Quantification G a, b, d 0,, d 3 = d 0 ab + d 1 ab + d 2 b f a, b = ab + b z a, b, d 0,, d 3 = G a, b, d 0,, d 3 f a, b z a b = G a b f a b = d 2 1 = d 2 z ab = G ab f ab = d 0 0 = d 0 z a b = G a b f a b = d 2 1 = d 2 z ab = G ab f ab = d 1 1 = d 1 ab z d 0, d 1, d 2, d 3 = z a b z ab z a b z ab = d 0 d 1 d 2 48

49 Network Repair via Quantification Finally, we obtain ab z d 0, d 1, d 2, d 3 = d 0 d 1 d 2 To repair, we should find values of d 0, d 1, d 2, d 3 so that ab z d 0, d 1, d 2, d 3 = 1 Not hard: d 0 = 0, d 1 = 1, d 2 = 1, d 3 = X(don t care) 49

50 MUX Network Repair Does d 0 = 0, d 1 = 1, d 2 = 1, d 3 = X work? Case 1: d 0 = 0, d 1 = 1, d 2 = 1, d 3 = 1 Specified a b AND a b ab + b f a, b d 0 d 1 d 2 d s 1 s 0 50 MUX is an OR gate. Expected!

51 MUX Network Repair Does d 0 = 0, d 1 = 1, d 2 = 1, d 3 = X work? Case 2: d 0 = 0, d 1 = 1, d 2 = 1, d 3 = 0 Specified a b AND a b ab + b f a, b d 0 d 1 d 2 d s 1 s 0 51 MUX is an XOR gate. Unexpected but works!

52 Network Repair: Summary This example is tiny... But in a real example, you have a big network 100 inputs, 50,000 gates. When the design doesn t work, it is a major hassle to go through the design to fix it. This gives a mechanical procedure to answer: Can we change 1 gate to repair? What we haven t seen yet: Computation strategy to mechanically find inputs to make ab z d 0, d 1, d 2, d 3 = 1 This computation is called Boolean Satisfiability (SAT). We will see how to solve Boolean SAT problem efficiently later. 52

53 Review Cofactors Positive cofactor: F(x 1, x 2,, x i = 1,, x n ) Negative cofactor: F(x 1, x 2,, x i = 0,, x n ) Shannon expansion theorem F x 1, x 2,, x n = x i F x i = 1 + x i F(x i = 0) Combinations of cofactors Boolean difference: f x = f x f x Another Boolean function, but it does not depend on x. Explain under what situations on other variables that an input change can cause output change for a Boolean function. Universal quantification: x f = f x f x Existential quantification: x f = f x + f x Quantification Application: Network Repair 53

54 Computational Boolean Algebra: Topics Cofactors Boolean difference Quantification Tautology 54

55 Important Example of Computation: Tautology Checking Tautology: a Boolean function is 1 for every input pattern. We are going to look at how to do tautology checking, i.e. whether a Boolean function f is 1 for every input. Why study this problem? To show a representation, i.e., a data structure, for a Boolean function f. To show an important computational strategy: recursion How hard is this problem? Very, very hard! What happens if you are given a sum-of-product expression with 50 variables and 800 products? 55

56 Start with: Representation We use a simple, early representation scheme for functions Represent a function as a set of OR ed product terms, i.e., a sum of products (SOP). Each product term is also called a cube, e.g., a bc is a cube. Why call it cube? Boolean space of 3 variables Circle all vertices that let f = c b a How does a product term look like?

57 Properties of Cubes In what follows, we refer to product term as cube. For each variable x, x and x do not appear simultaneously. However, for each variable x, it is possible that none of x and x appears in the cube. If for each variable x, one of x and x appears in the cube. The cube is a minterm. The number of vertices in a cube is 2 k. 011 Boolean space of 3 variables c b a

58 Positional Cube Notation (PCN) We represent a cube using Positional Cube Notation (PCN). One slot per variable. In slot for variable x: put 1, if cube has x in it; put 0, if cube has x in it; put -, if cube has no x or x in it. Example: In a Boolean space on three variables a, b, c b: a c: a b c [ ] [ ] 58

59 Positional Cube Notation (PCN) To represent cube in program, we need to encode 1, 0, and -. We need at least two bits to encode three values. One encoding: 01 to encode 1 ; 10 to encode 0 ; 11 to encode -. Example: In a Boolean space on three variables a, b, c b: a c: a b c [ ] [ 1-0 ] a b c [ ] [ ] 59

60 PCN Cube List A sum-of-products (SOP) expression of a Boolean function is also called as a cover of cubes. We present a cover of cubes using a list of cubes in positional cube notation. Example: f = a + bc + ab a bc ab a b c [ ] [ ] [ ] 60

61 Tautology Checking How do we approach tautology checking as a computation? Input: a list of cube in PCN representing an SOP expression of f Output: Yes, when f is always 1; No, when f is not always 1. Cofactors to rescue Great result: f is a tautology if and only if f x and f x are both tautologies. This makes sense: If function f 1, then cofactors both obviously 1. If both cofactors 1, then f = x f x + x f x = x + x = 1 61

62 Recursive Tautology Checking Suggests a recursive computation strategy: If you cannot tell immediately that f is a tautology, go try to see if each cofactor is a tautology. f = 1?? Split on x (f x = 1 AND f x = 1)?? 62 What else do we need? f x = 1 f x = 1 Selection rules: which x is good to pick to split on? Termination rules: how do we know when to stop splitting, so we can answer that the function at this node of tree is tautology or not? Mechanics: how hard is it to actually obtain the cofactors?

63 Recursive Cofactoring Do mechanics first (easy!). For each cube in the list: If you want positive cofactor w.r.t. var x, look at x slot in each cube: [ 10 ] just remove this cube from list, since it s a term with x. [ 01 ] just make this slot 11 (don t care), since we will strike x from the product term. [ 11 ] just leave this alone, since this term doesn t have any x/ x in it. f = abd + b c f a f c 63 abd b c [ ] [ ] [ ] [ ] [ ]

64 Recursive Cofactoring 64 Do mechanics first (easy!). For each cube in the list: If you want negative cofactor w.r.t. var x, look at x slot in each cube: [ 01 ] just remove this cube from list, since it s a term with x. [ 10 ] just make this slot 11 (don t care), since we will strike x from the product term. [ 11 ] just leave this alone, since this term doesn t have any x/ x in it. abd b c f = abd + b c [ ] [ ] f c [ ] [ ]

65 Unate Functions Selection/termination, another trick: Unate functions Special class of Boolean functions f is unate if a SOP representation only has each literal in exactly one polarity, either all true, or all complemented f is positive unate in var x: if changing x 0 1 but keeping other variables constant (no matter what values they are), keeps f constant or makes f change 0 1. f is negative unate in var x: if changing x 0 1 but keeping other variables constant (no matter what values they are), keeps f constant or makes f change1 0. Function that is not unate is called binate. 65 Examples: Is ab + a cd + cd e unate? Is xy + xy + xy z + z unate? Is f = ab positive unate?

66 Unate Functions Analogous to monotonic continuous functions. A monotonically non-decreasing function: whenever x 2 x 1, we have f(x 2 ) f(x 1 ). Example, for a Boolean function f positive unate in x: a b 66 w x 0 1 Boolean function f f(a, b,, w, x) 0 0, or 1 1, or 0 1

67 Checking Unateness How to check unateness? Not easy if f is represented using truth table. Very easy if f is represented as an SOP. Suppose that f is represented as an SOP. Then f is unate in var x if For all the cubes that contain var x, x appears in exactly one polarity, either all true, or all complemented. E.g., f = ab + a cd + cd e is unate in a, b, c, d, e. A sufficient condition only!! If not satisfied, may be either unate or not unate. E.g., f = xy + xy + xy z + z is unate in y, z, but may or may NOT be unate in x. (Actually, it is unate in x!) 67

68 Checking Unate Functions with Cube-List Suppose you have a cube-list for f. A cube-list is unate if for each var x and for all the cubes that contain var x, x only appears in one polarity, not both. Again, just a sufficient condition. E.g., f = a + bc + ac is unate. E.g., f = a + bc + bc may or may NOT be unate. Easier to see if draw the cube-list vertically. a + bc + ac a + bc + bc 68 a bc ac [ ] [ ] [ ] a bc bc [ ] [ ] [ ]

69 Using Unate Functions in Tautology Checking It is very easy to check a unate cube-list for tautology: Unate cube-list for f is tautology iff it contains a cube whose elements are all don t care: [ ]. Question: what exactly is [ ] as a product term? 69 This result actually makes sense... a bc bc a + bc + bc [ ] [ ] [ ] Cannot make a 1 with only product terms where all literals are in just one polarity!

70 Termination Rules Using Unateness 70 If we have a unate cube-list, we can check for tautology directly. Rule 1: The function is a tautology if cube-list has an all-don tcare cube [ ]. Why? function = stuff stuff = 1. Rule 2: The function is NOT tautology if cube-list does not have any all-don t-care cube [ ]. Why? Unate cube-list for the function is tautology iff it contains all-don t-care cube. a b c

71 Other Possible Termination Rules Lots more possible termination rules. For example: Rule 3: The function is tautology if cube list has single var cube that appears in both polarities. Why? function = stuff + x + x + stuff = 1 71

72 Selection Rule 72 We can t use easy termination rules unless cube-list is unate. Selection rule...? Pick splitting var to make unate cofactors. Strategy: pick most non-unate (binate) var as split var. Pick binate var with the most product terms dependent on it Why? Simplify more cubes. If a tie, pick var with minimum #true_var #compl_var Why? Left subtree and right subtree are balanced. x y z w x: binate, in 4 cubes, true-compl = 2-2 =0 y: unate z: unate w: binate, in 4 cubes, true-compl = 3-1 =2

73 73 Recursive Tautology Checking: Done! Algorithm tautology(f represented as cubelist) { /* check if we can terminate recursion */ if (f is unate) { apply unate tautology termination rules directly if (= =1) return (1) else return (0) } else if (any other termination rules, like rule 3, work?) { return the appropriate value if = =1 or = =0 } else { /* canot tell -- find splitting variable */ x = most-not-unate variable in f return ( tautology( f(x=1) ) && tautology( f(x=0) ) ) } }

74 Recursive Tautology Checking Example Example: f = ab + ac + a b c + a f a b c f unate? No Which var to pick? Most non-unate var: a f a a b c f a unate? No Need to further split f a a b c f a unate? Yes! Tautology? Yes! Terminate! 74

75 Recursive Tautology Checking Example f a a b c f a unate? No Which var to pick? Either b or c For example, we pick b f ab a b c f ab unate? Yes! Tautology? Yes! (contain alldon t-care cube) Terminate! f a b a b c f a b unate? No Can we terminate? Yes, due to Rule 3 75

76 Recursive Tautology Checking Example The recursion tree we finally get is f f a f a = 1 f ab = 1 f a b = 1 The tree has tautologies at all leaves, so f is tautology. Note: if any leaf is NOT tautology, f is NOT! 76

77 Recursive Tautology Checking Summary This strategy is so general and useful it has a name: Unate Recursive Paradigm (URP). Again, we see that cofactors are important and useful. Boolean difference, quantifications; real applications like logic network repair Representations (data structures) for Boolean functions are critical. Truth tables, Karnaugh maps, Boolean expressions cannot be manipulated by software. See one real representation: cube-list, positional cube notation 77

78 78 Complementary Materials

79 Representation of Digital Circuits We see how to represent an SOP of a Boolean function. but we will also deal with digital circuits. How can we represent digital circuits? As we know, there are two types of digital circuits Combinational circuits Sequential circuits 79

80 Two Types of Digital Circuits Combinational circuits Current outputs only depend on current inputs, not on the previous inputs. Sequential circuits Current outputs depend on the previous inputs. Primary Combinational Inputs Logic Primary Outputs 80 Memory Elements, e.g., Flip-Flops

81 Sequential Circuits The combinational part of a sequential circuit is critical. For the combinational part of a sequential circuit, its inputs include primary inputs and the outputs of the memory part. its outputs include primary outputs and the inputs to the memory part. Primary Inputs Combinational Logic Primary Outputs Memory Elements, e.g., Flip-Flops 81

82 Representation of Combinational Circuits Represented as a directed graph. Inputs, outputs, and gates nodes Wires directed edges. Why directed edges? Signal flow has direction. x 1 x 1 x 2 x 3 x 4 AND1 OR1 AND2 AND3 OR2 y x 2 x 3 x 4 A 1 A 3 O 1 A 2 O 2 y 82

83 Representation of Combinational Circuits Since a combinational circuit has no loops, the corresponding graph is a directed acyclic graphs (DAG). DAG: A directed graph with no cycles. x 1 x 1 x 2 AND1 x 2 A 1 A 3 x 3 x 4 OR1 AND3 OR2 y x 3 O 1 x 4 A 2 O 2 y AND2 83

84 Traversal of Combinational Circuits Many operations on combinational circuit need to traverse it. Example: obtain the output given an input pattern x 1 x 2 x 3 x 4 AND1 OR1 1 0 AND3 0 OR2 y 1 AND2 1 How to approach this kind of traversal as a computation? Answer: Topological Sorting. 84

85 Topological Sorting Observation on computing the output of a combinational circuit: The output of each gate can be computed only when all of its input are known. We have to obtain its inputs before obtaining output. In other words, if there is a wire (edge) from gate (node) u to v, then gate (node) u should be visited before gate (node) v. This is exactly topological sorting x 1 x 2 x 3 x 4 AND1 OR1 1 0 AND3 0 OR2 One possible visiting order: x 1, x 2, x 3, x 4, AND1, OR1, AND2, AND3, OR2, y. y 1 85 AND2 1

86 Topological Sorting A B C G D E F Topological sorting is not necessarily unique: A, G, D, B, E, C, F and A, B, G, D, E, F, C are both topological sorting. Are the following orderings topological sorting? A, B, E, G, D, C, F A, G, B, D, E, F, C 86

87 Topological Sorting: Algorithm Based on a queue. Algorithm: 1. Compute the in-degrees of all nodes. (in-degree: number of incoming edges of a node.) 2. Enqueue all in-degree 0 nodes into a queue. 3. While queue is not empty 1. Dequeue a node v from the queue and visit it. 2. Decrement in-degrees of node v s neighbors. 3. If any neighbor s in-degree becomes 0, enqueue it into the queue. 87

88 Topological Sorting Algorithm Example A B C Queue D E F G Enqueue A and G In-degrees A B C D E F G Order 88

89 Topological Sorting Algorithm Example A B C D E F Queue A G G In-degrees Dequeue A, visit A, and decrement in-degrees of A s neighbors. A B C D E F G Order 89

90 Topological Sorting Algorithm Example A B C D E F Queue G G Enqueue B In-degrees A B C D E F G Order A 90

91 Topological Sorting Algorithm Example A B C D E F Queue G B G In-degrees A B C D E F G Order A Dequeue G, visit G, and decrement in-degrees of G s neighbors. 91

92 Topological Sorting Algorithm Example A B C D E F Queue B G Enqueue D In-degrees A B C D E F G Order A G 92

93 Topological Sorting Algorithm Example A B C D E F Queue B D G In-degrees A B C D E F G Order A G Dequeue B, visit B, and decrement in-degrees of B s neighbors. 93

94 Topological Sorting Algorithm Example A B C D E F Queue D G In-degrees A B C D E F G Order A G B Dequeue D, visit D, and decrement in-degrees of D s neighbors. 94

95 Topological Sorting Algorithm Example A B C Queue D E F G Enqueue E In-degrees A B C D E F G Order A G B D 95

96 Topological Sorting Algorithm Example A B C D E F Queue E G In-degrees A B C D E F G Order A G B D Dequeue E, visit E, and decrement in-degrees of E s neighbors. 96

97 Topological Sorting Algorithm Example A B C Queue D E F G Enqueue C and F In-degrees A B C D E F G Order A G B D E 97

98 Topological Sorting Algorithm Example A B C D E F Queue C F G In-degrees A B C D E F G Order A G B D E Dequeue C, visit C, and decrement in-degrees of C s neighbors. 98

99 Topological Sorting Algorithm Example A B C D E F Queue F G In-degrees Dequeue F, visit F, and decrement in-degrees of F s neighbors. A B C D E F G Order A G B D E C 99

100 Topological Sorting Algorithm Example A B C Queue D E F G Queue is now empty. Done! In-degrees A B C D E F G Order A G B D E C F 100

101 Circuit Netlist Format We also need to store circuits as a text file. to be processed by different programs, e.g., layout synthesis tool, SPICE, schematic viewer, etc. Such files essentially store a netlist of gates. Many formats exist: Berkeley Logic Interchange Format (BLIF) Structured Verilog Format Bench Format 101

102 Example: Bench Format INPUT(x1) INPUT(x2) INPUT(x3) INPUT(x4) OUTPUT(y) g1=and(x1,x2) g2=or(x3,x4) g3=and(x3,x4) g4=and(g1,g2) y=or(g3,g4) x 1 x 2 x 3 x 4 AND1 OR1 AND2 g1 g2 AND3 g3 g4 OR2 y 102

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits

EE40 Lec 15. Logic Synthesis and Sequential Logic Circuits EE40 Lec 15 Logic Synthesis and Sequential Logic Circuits Prof. Nathan Cheung 10/20/2009 Reading: Hambley Chapters 7.4-7.6 Karnaugh Maps: Read following before reading textbook http://www.facstaff.bucknell.edu/mastascu/elessonshtml/logic/logic3.html

More information

EECS150 - Digital Design Lecture 19 - Combinational Logic Circuits : A Deep Dive

EECS150 - Digital Design Lecture 19 - Combinational Logic Circuits : A Deep Dive EECS150 - Digital Design Lecture 19 - Combinational Logic Circuits : A Deep Dive March 30, 2010 John Wawrzynek Spring 2010 EECS150 - Lec19-cl1 Page 1 Boolean Algebra I (Representations of Combinational

More information

CHAPTER1: Digital Logic Circuits Combination Circuits

CHAPTER1: Digital Logic Circuits Combination Circuits CS224: Computer Organization S.KHABET CHAPTER1: Digital Logic Circuits Combination Circuits 1 PRIMITIVE LOGIC GATES Each of our basic operations can be implemented in hardware using a primitive logic gate.

More information

Anand Raghunathan MSEE 348

Anand Raghunathan MSEE 348 ECE 595Z: Digital VLSI Design Automation, Spring 2012 2012 Anand Raghunathan 1 ECE 595Z Digital Systems Design Automation Module 2 (Lectures 3-5) : Advanced Boolean Algebra Lecture 5 Anand Raghunathan

More information

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing

Boolean Algebra and Digital Logic 2009, University of Colombo School of Computing IT 204 Section 3.0 Boolean Algebra and Digital Logic Boolean Algebra 2 Logic Equations to Truth Tables X = A. B + A. B + AB A B X 0 0 0 0 3 Sum of Products The OR operation performed on the products of

More information

Systems I: Computer Organization and Architecture

Systems I: Computer Organization and Architecture Systems I: Computer Organization and Architecture Lecture 6 - Combinational Logic Introduction A combinational circuit consists of input variables, logic gates, and output variables. The logic gates accept

More information

211: Computer Architecture Summer 2016

211: Computer Architecture Summer 2016 211: Computer Architecture Summer 2016 Liu Liu Topic: Storage Project3 Digital Logic - Storage: Recap - Review: cache hit rate - Project3 - Digital Logic: - truth table => SOP - simplification: Boolean

More information

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL.

XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL. 2017-18 XI STANDARD [ COMPUTER SCIENCE ] 5 MARKS STUDY MATERIAL HALF ADDER 1. The circuit that performs addition within the Arithmetic and Logic Unit of the CPU are called adders. 2. A unit that adds two

More information

Multi-Level Logic Optimization. Technology Independent. Thanks to R. Rudell, S. Malik, R. Rutenbar. University of California, Berkeley, CA

Multi-Level Logic Optimization. Technology Independent. Thanks to R. Rudell, S. Malik, R. Rutenbar. University of California, Berkeley, CA Technology Independent Multi-Level Logic Optimization Prof. Kurt Keutzer Prof. Sanjit Seshia EECS University of California, Berkeley, CA Thanks to R. Rudell, S. Malik, R. Rutenbar 1 Logic Optimization

More information

EEE130 Digital Electronics I Lecture #4

EEE130 Digital Electronics I Lecture #4 EEE130 Digital Electronics I Lecture #4 - Boolean Algebra and Logic Simplification - By Dr. Shahrel A. Suandi Topics to be discussed 4-1 Boolean Operations and Expressions 4-2 Laws and Rules of Boolean

More information

Review. EECS Components and Design Techniques for Digital Systems. Lec 06 Minimizing Boolean Logic 9/ Review: Canonical Forms

Review. EECS Components and Design Techniques for Digital Systems. Lec 06 Minimizing Boolean Logic 9/ Review: Canonical Forms Review EECS 150 - Components and Design Techniques for Digital Systems Lec 06 Minimizing Boolean Logic 9/16-04 David Culler Electrical Engineering and Computer Sciences University of California, Berkeley

More information

CHAPTER 12 Boolean Algebra

CHAPTER 12 Boolean Algebra 318 Chapter 12 Boolean Algebra CHAPTER 12 Boolean Algebra SECTION 12.1 Boolean Functions 2. a) Since x 1 = x, the only solution is x = 0. b) Since 0 + 0 = 0 and 1 + 1 = 1, the only solution is x = 0. c)

More information

Fundamentals of Computer Systems

Fundamentals of Computer Systems Fundamentals of Computer Systems Boolean Logic Stephen A. Edwards Columbia University Summer 2015 Boolean Logic George Boole 1815 1864 Boole s Intuition Behind Boolean Logic Variables X,,... represent

More information

Boolean Algebra, Gates and Circuits

Boolean Algebra, Gates and Circuits Boolean Algebra, Gates and Circuits Kasper Brink November 21, 2017 (Images taken from Tanenbaum, Structured Computer Organization, Fifth Edition, (c) 2006 Pearson Education, Inc.) Outline Last week: Von

More information

Lecture 6: Manipulation of Algebraic Functions, Boolean Algebra, Karnaugh Maps

Lecture 6: Manipulation of Algebraic Functions, Boolean Algebra, Karnaugh Maps EE210: Switching Systems Lecture 6: Manipulation of Algebraic Functions, Boolean Algebra, Karnaugh Maps Prof. YingLi Tian Feb. 21/26, 2019 Department of Electrical Engineering The City College of New York

More information

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates

ECE 250 / CPS 250 Computer Architecture. Basics of Logic Design Boolean Algebra, Logic Gates ECE 250 / CPS 250 Computer Architecture Basics of Logic Design Boolean Algebra, Logic Gates Benjamin Lee Slides based on those from Andrew Hilton (Duke), Alvy Lebeck (Duke) Benjamin Lee (Duke), and Amir

More information

Equivalence Checking of Sequential Circuits

Equivalence Checking of Sequential Circuits Equivalence Checking of Sequential Circuits Sanjit Seshia EECS UC Berkeley With thanks to K. Keutzer, R. Rutenbar 1 Today s Lecture What we know: How to check two combinational circuits for equivalence

More information

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic

Computer Science 324 Computer Architecture Mount Holyoke College Fall Topic Notes: Digital Logic Computer Science 324 Computer Architecture Mount Holyoke College Fall 2007 Topic Notes: Digital Logic Our goal for the next few weeks is to paint a a reasonably complete picture of how we can go from transistor

More information

Fundamentals of Computer Systems

Fundamentals of Computer Systems Fundamentals of Computer Systems Boolean Logic Stephen A. Edwards Columbia University Summer 2017 Boolean Logic George Boole 1815 1864 Boole s Intuition Behind Boolean Logic Variables,,... represent classes

More information

Review for Test 1 : Ch1 5

Review for Test 1 : Ch1 5 Review for Test 1 : Ch1 5 October 5, 2006 Typeset by FoilTEX Positional Numbers 527.46 10 = (5 10 2 )+(2 10 1 )+(7 10 0 )+(4 10 1 )+(6 10 2 ) 527.46 8 = (5 8 2 ) + (2 8 1 ) + (7 8 0 ) + (4 8 1 ) + (6 8

More information

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits.

Digital Logic. CS211 Computer Architecture. l Topics. l Transistors (Design & Types) l Logic Gates. l Combinational Circuits. CS211 Computer Architecture Digital Logic l Topics l Transistors (Design & Types) l Logic Gates l Combinational Circuits l K-Maps Figures & Tables borrowed from:! http://www.allaboutcircuits.com/vol_4/index.html!

More information

ECE/CS 250 Computer Architecture

ECE/CS 250 Computer Architecture ECE/CS 250 Computer Architecture Basics of Logic Design: Boolean Algebra, Logic Gates (Combinational Logic) Tyler Bletsch Duke University Slides are derived from work by Daniel J. Sorin (Duke), Alvy Lebeck

More information

Logic Design. Chapter 2: Introduction to Logic Circuits

Logic Design. Chapter 2: Introduction to Logic Circuits Logic Design Chapter 2: Introduction to Logic Circuits Introduction Logic circuits perform operation on digital signal Digital signal: signal values are restricted to a few discrete values Binary logic

More information

Combinational Logic. Mantıksal Tasarım BBM231. section instructor: Ufuk Çelikcan

Combinational Logic. Mantıksal Tasarım BBM231. section instructor: Ufuk Çelikcan Combinational Logic Mantıksal Tasarım BBM23 section instructor: Ufuk Çelikcan Classification. Combinational no memory outputs depends on only the present inputs expressed by Boolean functions 2. Sequential

More information

Digital Logic (2) Boolean Algebra

Digital Logic (2) Boolean Algebra Digital Logic (2) Boolean Algebra Boolean algebra is the mathematics of digital systems. It was developed in 1850 s by George Boole. We will use Boolean algebra to minimize logic expressions. Karnaugh

More information

Combinational Logic. Review of Combinational Logic 1

Combinational Logic. Review of Combinational Logic 1 Combinational Logic! Switches -> Boolean algebra! Representation of Boolean functions! Logic circuit elements - logic gates! Regular logic structures! Timing behavior of combinational logic! HDLs and combinational

More information

CprE 281: Digital Logic

CprE 281: Digital Logic CprE 28: Digital Logic Instructor: Alexander Stoytchev http://www.ece.iastate.edu/~alexs/classes/ Decoders and Encoders CprE 28: Digital Logic Iowa State University, Ames, IA Copyright Alexander Stoytchev

More information

L4: Karnaugh diagrams, two-, and multi-level minimization. Elena Dubrova KTH / ICT / ES

L4: Karnaugh diagrams, two-, and multi-level minimization. Elena Dubrova KTH / ICT / ES L4: Karnaugh diagrams, two-, and multi-level minimization Elena Dubrova KTH / ICT / ES dubrova@kth.se Combinatorial system a(t) not(a(t)) A combinatorial system has no memory - its output depends therefore

More information

Digital System Design Combinational Logic. Assoc. Prof. Pradondet Nilagupta

Digital System Design Combinational Logic. Assoc. Prof. Pradondet Nilagupta Digital System Design Combinational Logic Assoc. Prof. Pradondet Nilagupta pom@ku.ac.th Acknowledgement This lecture note is modified from Engin112: Digital Design by Prof. Maciej Ciesielski, Prof. Tilman

More information

ECE/CS 250: Computer Architecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Benjamin Lee

ECE/CS 250: Computer Architecture. Basics of Logic Design: Boolean Algebra, Logic Gates. Benjamin Lee ECE/CS 250: Computer Architecture Basics of Logic Design: Boolean Algebra, Logic Gates Benjamin Lee Slides based on those from Alvin Lebeck, Daniel Sorin, Andrew Hilton, Amir Roth, Gershon Kedem Admin

More information

WEEK 2.1 BOOLEAN ALGEBRA

WEEK 2.1 BOOLEAN ALGEBRA WEEK 2.1 BOOLEAN ALGEBRA 1 Boolean Algebra Boolean algebra was introduced in 1854 by George Boole and in 1938 was shown by C. E. Shannon to be useful for manipulating Boolean logic functions. The postulates

More information

Lecture 5: NAND, NOR and XOR Gates, Simplification of Algebraic Expressions

Lecture 5: NAND, NOR and XOR Gates, Simplification of Algebraic Expressions EE210: Switching Systems Lecture 5: NAND, NOR and XOR Gates, Simplification of Algebraic Expressions Prof. YingLi Tian Feb. 15, 2018 Department of Electrical Engineering The City College of New York The

More information

Spiral 2-4. Function synthesis with: Muxes (Shannon's Theorem) Memories

Spiral 2-4. Function synthesis with: Muxes (Shannon's Theorem) Memories 2-4. Spiral 2-4 Function synthesis with: Muxes (Shannon's Theorem) Memories 2-4.2 Learning Outcomes I can implement logic for any truth table by using Shannon's theorem to decompose the function to create

More information

CS226 Mid-Semester Examination (Spring 2016)

CS226 Mid-Semester Examination (Spring 2016) CS226 Mid-Semester Examination (Spring 2016) Max marks: 60 Time: 120 mins The exam is open book and notes brought to the exam hall. Be brief, complete and stick to what has been asked. Unless asked for

More information

Slide Set 3. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary

Slide Set 3. for ENEL 353 Fall Steve Norman, PhD, PEng. Electrical & Computer Engineering Schulich School of Engineering University of Calgary Slide Set 3 for ENEL 353 Fall 2016 Steve Norman, PhD, PEng Electrical & Computer Engineering Schulich School of Engineering University of Calgary Fall Term, 2016 SN s ENEL 353 Fall 2016 Slide Set 3 slide

More information

CS61c: Representations of Combinational Logic Circuits

CS61c: Representations of Combinational Logic Circuits CS61c: Representations of Combinational Logic Circuits J. Wawrzynek March 5, 2003 1 Introduction Recall that synchronous systems are composed of two basic types of circuits, combination logic circuits,

More information

UNIT 4 MINTERM AND MAXTERM EXPANSIONS

UNIT 4 MINTERM AND MAXTERM EXPANSIONS UNIT 4 MINTERM AND MAXTERM EXPANSIONS Spring 2 Minterm and Maxterm Expansions 2 Contents Conversion of English sentences to Boolean equations Combinational logic design using a truth table Minterm and

More information

Computer organization

Computer organization Computer organization Levels of abstraction Assembler Simulator Applications C C++ Java High-level language SOFTWARE add lw ori Assembly language Goal 0000 0001 0000 1001 0101 Machine instructions/data

More information

Fundamentals of Computer Systems

Fundamentals of Computer Systems Fundamentals of Computer Systems Boolean Logic Stephen A. Edwards Columbia University Fall 2011 Boolean Logic George Boole 1815 1864 Boole s Intuition Behind Boolean Logic Variables x, y,... represent

More information

ECE 2300 Digital Logic & Computer Organization

ECE 2300 Digital Logic & Computer Organization ECE 23 Digital Logic & Computer Organization Spring 28 Combinational Building Blocks Lecture 5: Announcements Lab 2 prelab due tomorrow HW due Friday HW 2 to be posted on Thursday Lecture 4 to be replayed

More information

Every time has a value associated with it, not just some times. A variable can take on any value within a range

Every time has a value associated with it, not just some times. A variable can take on any value within a range Digital Logic Circuits Binary Logic and Gates Logic Simulation Boolean Algebra NAND/NOR and XOR gates Decoder fundamentals Half Adder, Full Adder, Ripple Carry Adder Analog vs Digital Analog Continuous»

More information

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors

We are here. Assembly Language. Processors Arithmetic Logic Units. Finite State Machines. Circuits Gates. Transistors CSC258 Week 3 1 Logistics If you cannot login to MarkUs, email me your UTORID and name. Check lab marks on MarkUs, if it s recorded wrong, contact Larry within a week after the lab. Quiz 1 average: 86%

More information

Karnaugh Maps Objectives

Karnaugh Maps Objectives Karnaugh Maps Objectives For Karnaugh Maps of up to 5 variables Plot a function from algebraic, minterm or maxterm form Obtain minimum Sum of Products and Product of Sums Understand the relationship between

More information

Fundamental Algorithms for System Modeling, Analysis, and Optimization

Fundamental Algorithms for System Modeling, Analysis, and Optimization Fundamental Algorithms for System Modeling, Analysis, and Optimization Edward A. Lee, Jaijeet Roychowdhury, Sanjit A. Seshia UC Berkeley EECS 244 Fall 2016 Lecturer: Yu-Yun Dai Copyright 2010-date, E.

More information

Boolean Algebra and Digital Logic

Boolean Algebra and Digital Logic All modern digital computers are dependent on circuits that implement Boolean functions. We shall discuss two classes of such circuits: Combinational and Sequential. The difference between the two types

More information

COMBINATIONAL LOGIC FUNCTIONS

COMBINATIONAL LOGIC FUNCTIONS COMBINATIONAL LOGIC FUNCTIONS Digital logic circuits can be classified as either combinational or sequential circuits. A combinational circuit is one where the output at any time depends only on the present

More information

EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits)

EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) September 5, 2002 John Wawrzynek Fall 2002 EECS150 Lec4-bool1 Page 1, 9/5 9am Outline Review of

More information

Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173

Propositional Logic. Logical Expressions. Logic Minimization. CNF and DNF. Algebraic Laws for Logical Expressions CSC 173 Propositional Logic CSC 17 Propositional logic mathematical model (or algebra) for reasoning about the truth of logical expressions (propositions) Logical expressions propositional variables or logical

More information

Numbers & Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See: P&H Chapter , 3.2, C.5 C.

Numbers & Arithmetic. Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University. See: P&H Chapter , 3.2, C.5 C. Numbers & Arithmetic Hakim Weatherspoon CS 3410, Spring 2012 Computer Science Cornell University See: P&H Chapter 2.4-2.6, 3.2, C.5 C.6 Example: Big Picture Computer System Organization and Programming

More information

Outline. EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) Combinational Logic (CL) Defined

Outline. EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) Combinational Logic (CL) Defined EECS150 - Digital Design Lecture 4 - Boolean Algebra I (Representations of Combinational Logic Circuits) January 30, 2003 John Wawrzynek Outline Review of three representations for combinational logic:

More information

XOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure.

XOR - XNOR Gates. The graphic symbol and truth table of XOR gate is shown in the figure. XOR - XNOR Gates Lesson Objectives: In addition to AND, OR, NOT, NAND and NOR gates, exclusive-or (XOR) and exclusive-nor (XNOR) gates are also used in the design of digital circuits. These have special

More information

Binary Decision Diagrams

Binary Decision Diagrams Binary Decision Diagrams Logic Circuits Design Seminars WS2010/2011, Lecture 2 Ing. Petr Fišer, Ph.D. Department of Digital Design Faculty of Information Technology Czech Technical University in Prague

More information

MC9211 Computer Organization

MC9211 Computer Organization MC92 Computer Organization Unit : Digital Fundamentals Lesson2 : Boolean Algebra and Simplification (KSB) (MCA) (29-2/ODD) (29 - / A&B) Coverage Lesson2 Introduces the basic postulates of Boolean Algebra

More information

UNIT 5 KARNAUGH MAPS Spring 2011

UNIT 5 KARNAUGH MAPS Spring 2011 UNIT 5 KRNUGH MPS Spring 2 Karnaugh Maps 2 Contents Minimum forms of switching functions Two- and three-variable Four-variable Determination of minimum expressions using essential prime implicants Five-variable

More information

Chapter 7 Logic Circuits

Chapter 7 Logic Circuits Chapter 7 Logic Circuits Goal. Advantages of digital technology compared to analog technology. 2. Terminology of Digital Circuits. 3. Convert Numbers between Decimal, Binary and Other forms. 5. Binary

More information

Lecture 10: Synchronous Sequential Circuits Design

Lecture 10: Synchronous Sequential Circuits Design Lecture 0: Synchronous Sequential Circuits Design. General Form Input Combinational Flip-flops Combinational Output Circuit Circuit Clock.. Moore type has outputs dependent only on the state, e.g. ripple

More information

Combinational Logic Design Combinational Functions and Circuits

Combinational Logic Design Combinational Functions and Circuits Combinational Logic Design Combinational Functions and Circuits Overview Combinational Circuits Design Procedure Generic Example Example with don t cares: BCD-to-SevenSegment converter Binary Decoders

More information

The Design Procedure. Output Equation Determination - Derive output equations from the state table

The Design Procedure. Output Equation Determination - Derive output equations from the state table The Design Procedure Specification Formulation - Obtain a state diagram or state table State Assignment - Assign binary codes to the states Flip-Flop Input Equation Determination - Select flipflop types

More information

Review: Additional Boolean operations

Review: Additional Boolean operations Review: Additional Boolean operations Operation: NAND (NOT-AND) NOR (NOT-OR) XOR (exclusive OR) Expressions: (xy) = x + y (x + y) = x y x y = x y + xy Truth table: x y (xy) x y (x+y) x y x y 0 0 1 0 1

More information

This form sometimes used in logic circuit, example:

This form sometimes used in logic circuit, example: Objectives: 1. Deriving of logical expression form truth tables. 2. Logical expression simplification methods: a. Algebraic manipulation. b. Karnaugh map (k-map). 1. Deriving of logical expression from

More information

Simplifying Logic Circuits with Karnaugh Maps

Simplifying Logic Circuits with Karnaugh Maps Simplifying Logic Circuits with Karnaugh Maps The circuit at the top right is the logic equivalent of the Boolean expression: f = abc + abc + abc Now, as we have seen, this expression can be simplified

More information

MODULAR CIRCUITS CHAPTER 7

MODULAR CIRCUITS CHAPTER 7 CHAPTER 7 MODULAR CIRCUITS A modular circuit is a digital circuit that performs a specific function or has certain usage. The modular circuits to be introduced in this chapter are decoders, encoders, multiplexers,

More information

Fundamentals of Digital Design

Fundamentals of Digital Design Fundamentals of Digital Design Digital Radiation Measurement and Spectroscopy NE/RHP 537 1 Binary Number System The binary numeral system, or base-2 number system, is a numeral system that represents numeric

More information

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions?

Boolean Algebra. Digital Logic Appendix A. Postulates, Identities in Boolean Algebra How can I manipulate expressions? Digital Logic Appendix A Gates Combinatorial Circuits Sequential Circuits Other operations NAND A NAND B = NOT ( A ANDB) = AB NOR A NOR B = NOT ( A ORB) = A + B Truth tables What is the result of the operation

More information

DO NOT COPY DO NOT COPY

DO NOT COPY DO NOT COPY Drill Problems 3 benches. Another practical book is VHDL for Programmable Logic, by Kevin Skahill of Cypress Semiconductor (Addison-esley, 1996). All of the ABEL and VHDL examples in this chapter and throughout

More information

Logic Minimization. Two-Level. University of California. Prof. Srinivas Devadas. Prof. Richard Newton Prof. Sanjit Seshia. Prof.

Logic Minimization. Two-Level. University of California. Prof. Srinivas Devadas. Prof. Richard Newton Prof. Sanjit Seshia. Prof. Two-Level Logic Minimization Prof. Srinivas Devadas MIT Prof. Kurt Keutzer Prof. Richard Newton Prof. Sanjit Seshia University of California Berkeley, CA 1 Topics Motivation Boolean functions & notation

More information

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary

Number System. Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary Number System Decimal to binary Binary to Decimal Binary to octal Binary to hexadecimal Hexadecimal to binary Octal to binary BOOLEAN ALGEBRA BOOLEAN LOGIC OPERATIONS Logical AND Logical OR Logical COMPLEMENTATION

More information

Chapter 2 Combinational Logic Circuits

Chapter 2 Combinational Logic Circuits Logic and Computer Design Fundamentals Chapter 2 Combinational Logic Circuits Part 1 Gate Circuits and Boolean Equations Charles Kime & Thomas Kaminski 2008 Pearson Education, Inc. Overview Part 1 Gate

More information

Prove that if not fat and not triangle necessarily means not green then green must be fat or triangle (or both).

Prove that if not fat and not triangle necessarily means not green then green must be fat or triangle (or both). hapter : oolean lgebra.) Definition of oolean lgebra The oolean algebra is named after George ool who developed this algebra (854) in order to analyze logical problems. n example to such problem is: Prove

More information

Digital Logic & Computer Design CS Professor Dan Moldovan Spring Copyright 2007 Elsevier 2-<101>

Digital Logic & Computer Design CS Professor Dan Moldovan Spring Copyright 2007 Elsevier 2-<101> Digital Logic & Computer Design CS 434 Professor Dan Moldovan Spring 2 Copyright 27 Elsevier 2- Chapter 2 :: Combinational Logic Design Digital Design and Computer Architecture David Money Harris and

More information

ENG2410 Digital Design Combinational Logic Circuits

ENG2410 Digital Design Combinational Logic Circuits ENG240 Digital Design Combinational Logic Circuits Fall 207 S. Areibi School of Engineering University of Guelph Binary variables Binary Logic Can be 0 or (T or F, low or high) Variables named with single

More information

Chapter 2 Combinational Logic Circuits

Chapter 2 Combinational Logic Circuits Logic and Computer Design Fundamentals Chapter 2 Combinational Logic Circuits Part 2 Circuit Optimization Goal: To obtain the simplest implementation for a given function Optimization is a more formal

More information

Appendix A: Digital Logic. Principles of Computer Architecture. Principles of Computer Architecture by M. Murdocca and V. Heuring

Appendix A: Digital Logic. Principles of Computer Architecture. Principles of Computer Architecture by M. Murdocca and V. Heuring - Principles of Computer rchitecture Miles Murdocca and Vincent Heuring 999 M. Murdocca and V. Heuring -2 Chapter Contents. Introduction.2 Combinational Logic.3 Truth Tables.4 Logic Gates.5 Properties

More information

Principles of Computer Architecture. Appendix B: Reduction of Digital Logic. Chapter Contents

Principles of Computer Architecture. Appendix B: Reduction of Digital Logic. Chapter Contents B-1 Principles of Computer Architecture Miles Murdocca and Vincent Heuring Appendix B: Reduction of Digital Logic B-2 Chapter Contents B.1 Reduction of Combinational Logic and Sequential Logic B.2 Reduction

More information

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra

Boolean Algebra. Digital Logic Appendix A. Boolean Algebra Other operations. Boolean Algebra. Postulates, Identities in Boolean Algebra Digital Logic Appendix A Gates Combinatorial Circuits Sequential Circuits George Boole ideas 1854 Claude Shannon, apply to circuit design, 1938 (piirisuunnittelu) Describe digital circuitry function programming

More information

Logic and Boolean algebra

Logic and Boolean algebra Computer Mathematics Week 7 Logic and Boolean algebra College of Information Science and Engineering Ritsumeikan University last week coding theory channel coding information theory concept Hamming distance

More information

CprE 281: Digital Logic

CprE 281: Digital Logic CprE 28: Digital Logic Instructor: Alexander Stoytchev http://www.ece.iastate.edu/~alexs/classes/ Examples of Solved Problems CprE 28: Digital Logic Iowa State University, Ames, IA Copyright Alexander

More information

CPE100: Digital Logic Design I

CPE100: Digital Logic Design I Professor Brendan Morris, SEB 3216, brendan.morris@unlv.edu CPE100: Digital Logic Design I Final Review http://www.ee.unlv.edu/~b1morris/cpe100/ 2 Logistics Tuesday Dec 12 th 13:00-15:00 (1-3pm) 2 hour

More information

Synthesis of 2-level Logic Exact and Heuristic Methods. Two Approaches

Synthesis of 2-level Logic Exact and Heuristic Methods. Two Approaches Synthesis of 2-level Logic Exact and Heuristic Methods Lecture 7: Branch & Bound Exact Two Approaches Find all primes Find a complete sum Find a minimum cover (covering problem) Heuristic Take an initial

More information

Sample Marking Scheme

Sample Marking Scheme Page 1 of 10 School of Computer Science 60-265-01 Computer Architecture and Digital Design Fall 2008 Midterm Examination # 1 B Wednesday, November 5, 2008 Sample Marking Scheme Duration of examination:

More information

WEEK 3.1 MORE ON KARNAUGH MAPS

WEEK 3.1 MORE ON KARNAUGH MAPS WEEK 3. MORE ON KARNAUGH MAPS Don t Cares Sometimes, we might have inputs and it doesn t matter what the output is; i.e., we don t care what the output is. These situations are called don t cares. Rather

More information

Hardware Design I Chap. 2 Basis of logical circuit, logical expression, and logical function

Hardware Design I Chap. 2 Basis of logical circuit, logical expression, and logical function Hardware Design I Chap. 2 Basis of logical circuit, logical expression, and logical function E-mail: shimada@is.naist.jp Outline Combinational logical circuit Logic gate (logic element) Definition of combinational

More information

Combinational Logic. By : Ali Mustafa

Combinational Logic. By : Ali Mustafa Combinational Logic By : Ali Mustafa Contents Adder Subtractor Multiplier Comparator Decoder Encoder Multiplexer How to Analyze any combinational circuit like this? Analysis Procedure To obtain the output

More information

UC Berkeley College of Engineering, EECS Department CS61C: Representations of Combinational Logic Circuits

UC Berkeley College of Engineering, EECS Department CS61C: Representations of Combinational Logic Circuits 2 Wawrzynek, Garcia 2004 c UCB UC Berkeley College of Engineering, EECS Department CS61C: Representations of Combinational Logic Circuits 1 Introduction Original document by J. Wawrzynek (2003-11-15) Revised

More information

Ch 2. Combinational Logic. II - Combinational Logic Contemporary Logic Design 1

Ch 2. Combinational Logic. II - Combinational Logic Contemporary Logic Design 1 Ch 2. Combinational Logic II - Combinational Logic Contemporary Logic Design 1 Combinational logic Define The kind of digital system whose output behavior depends only on the current inputs memoryless:

More information

CPE100: Digital Logic Design I

CPE100: Digital Logic Design I Chapter 2 Professor Brendan Morris, SEB 3216, brendan.morris@unlv.edu http://www.ee.unlv.edu/~b1morris/cpe100/ CPE100: Digital Logic Design I Section 1004: Dr. Morris Combinational Logic Design Chapter

More information

VLSI CAD: Lecture 4.1. Logic to Layout. Computational Boolean Algebra Representations: Satisfiability (SAT), Part 1

VLSI CAD: Lecture 4.1. Logic to Layout. Computational Boolean Algebra Representations: Satisfiability (SAT), Part 1 VLSI CAD: Logic to Layout Rob A. Rutenbar University of Illinois Lecture 4.1 Computational Boolean Algebra Representations: Satisfiability (SAT), Part 1 Some Terminology Satisfiability (called SAT for

More information

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3

Digital Logic: Boolean Algebra and Gates. Textbook Chapter 3 Digital Logic: Boolean Algebra and Gates Textbook Chapter 3 Basic Logic Gates XOR CMPE12 Summer 2009 02-2 Truth Table The most basic representation of a logic function Lists the output for all possible

More information

Latches. October 13, 2003 Latches 1

Latches. October 13, 2003 Latches 1 Latches The second part of CS231 focuses on sequential circuits, where we add memory to the hardware that we ve already seen. Our schedule will be very similar to before: We first show how primitive memory

More information

CSE140: Components and Design Techniques for Digital Systems. Logic minimization algorithm summary. Instructor: Mohsen Imani UC San Diego

CSE140: Components and Design Techniques for Digital Systems. Logic minimization algorithm summary. Instructor: Mohsen Imani UC San Diego CSE4: Components and Design Techniques for Digital Systems Logic minimization algorithm summary Instructor: Mohsen Imani UC San Diego Slides from: Prof.Tajana Simunic Rosing & Dr.Pietro Mercati Definition

More information

Binary Decision Diagrams

Binary Decision Diagrams Binary Decision Diagrams Literature Some pointers: H.R. Andersen, An Introduction to Binary Decision Diagrams, Lecture notes, Department of Information Technology, IT University of Copenhagen Tools: URL:

More information

Written reexam with solutions for IE1204/5 Digital Design Monday 14/

Written reexam with solutions for IE1204/5 Digital Design Monday 14/ Written reexam with solutions for IE204/5 Digital Design Monday 4/3 206 4.-8. General Information Examiner: Ingo Sander. Teacher: William Sandqvist phone 08-7904487 Exam text does not have to be returned

More information

Digital Logic Appendix A

Digital Logic Appendix A Digital Logic Appendix A Boolean Algebra Gates Combinatorial Circuits Sequential Circuits 1 Boolean Algebra George Boole ideas 1854 Claude Shannon, apply to circuit design, 1938 Describe digital circuitry

More information

Chap 2. Combinational Logic Circuits

Chap 2. Combinational Logic Circuits Overview 2 Chap 2. Combinational Logic Circuits Spring 24 Part Gate Circuits and Boolean Equations Binary Logic and Gates Boolean Algebra Standard Forms Part 2 Circuit Optimization Two-Level Optimization

More information

CHAPTER 7 MULTI-LEVEL GATE CIRCUITS NAND AND NOR GATES

CHAPTER 7 MULTI-LEVEL GATE CIRCUITS NAND AND NOR GATES CHAPTER 7 MULTI-LEVEL GATE CIRCUITS NAND AND NOR GATES This chapter in the book includes: Objectives Study Guide 7.1 Multi-Level Gate Circuits 7.2 NAND and NOR Gates 7.3 Design of Two-Level Circuits Using

More information

2009 Spring CS211 Digital Systems & Lab CHAPTER 2: INTRODUCTION TO LOGIC CIRCUITS

2009 Spring CS211 Digital Systems & Lab CHAPTER 2: INTRODUCTION TO LOGIC CIRCUITS CHAPTER 2: INTRODUCTION TO LOGIC CIRCUITS What will we learn? 2 Logic functions and circuits Boolean Algebra Logic gates and Synthesis CAD tools and VHDL Read Section 2.9 and 2.0 Terminology 3 Digital

More information

Digital Logic & Computer Design CS Professor Dan Moldovan Spring 2010

Digital Logic & Computer Design CS Professor Dan Moldovan Spring 2010 Digital Logic & Computer Design CS 434 Professor Dan Moldovan Spring 2 Copyright 27 Elsevier 2- Chapter 2 :: Combinational Logic Design Digital Design and Computer rchitecture David Money Harris and

More information

Contents. Chapter 3 Combinational Circuits Page 1 of 36

Contents. Chapter 3 Combinational Circuits Page 1 of 36 Chapter 3 Combinational Circuits Page of 36 Contents Combinational Circuits...2 3. Analysis of Combinational Circuits...3 3.. Using a Truth Table...3 3..2 Using a Boolean Function...6 3.2 Synthesis of

More information

1 Boolean Algebra Simplification

1 Boolean Algebra Simplification cs281: Computer Organization Lab3 Prelab Our objective in this prelab is to lay the groundwork for simplifying boolean expressions in order to minimize the complexity of the resultant digital logic circuit.

More information

Building a Computer Adder

Building a Computer Adder Logic Gates are used to translate Boolean logic into circuits. In the abstract it is clear that we can build AND gates that perform the AND function and OR gates that perform the OR function and so on.

More information