1
play

1 Mux Representation of Boolean Functions MUX circuit to implement - PDF document

ECE 474A/57A Computer-Aided Logic Design Lecture 11 Binary Decision Diagrams (BDDs) ECE 474a/575a 1 of 31 Susan Lysecky Boolean Logic Functions Representations Function can be represented in different ways Truth table, equation, K-map,


  1. ECE 474A/57A Computer-Aided Logic Design Lecture 11 Binary Decision Diagrams (BDDs) ECE 474a/575a 1 of 31 Susan Lysecky Boolean Logic Functions Representations � Function can be represented in different ways Truth table, equation, K-map, circuit, etc… � � Some representations not unique (not canonical) F b a 0 1 0 1 1 a Equation 1: F(a,b) = a’b’ + a’b 1 0 0 Equation 2: F(a,b) = a’ b a b F F 0 0 1 0 1 1 1 0 0 Circuit 1 1 1 0 a F Truth table Circuit 2 The function F ECE 474a/575a 2 of 31 Susan Lysecky Why BDDs An Efficient Representation � Synthesis, optimization, verification, and testing algorithms/tools manipulate large Boolean functions Important to have efficient way to represent these functions � Binary Decision Diagrams (BDDs) have emerged as a popular choice for representing � these functions � BDDs � Graph representation similar to a binary tree (i.e. decision trees from previous lectures) � Able to efficiently represent large functions � Some representations are canonical (unique) ECE 474a/575a 3 of 31 Susan Lysecky 1

  2. Mux Representation of Boolean Functions MUX circuit to implement logic � 1 0 x1 x2 x3 S function S 0 1 x3 0 0 0 1 MUX 1 1 0 0 0 1 0 0 1 0 1 x2 0 1 0 1 0 1 1 1 MUX MUX 1 0 0 1 1 0 1 1 0 1 x1 1 1 0 0 MUX 1 1 1 0 S(x1, x2, x3) 1 0 1 0 1 0 1 0 0 1 0 1 0 1 0 1 X3 (0) X3 (1) X3 (0) X3 (1) MUX MUX MUX MUX 1 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 x2 (0) x2 (1) x2 (1) x2 (0) MUX MUX MUX MUX MUX MUX MUX MUX 0 1 0 1 0 1 0 1 X1 (0) X1 (1) X1 (0) X1 (0) MUX MUX MUX MUX S(0, 0, 0) = 1 S(1, 1, 1) = 0 S(0, 1, 0) = 1 S(0, 0, 1) = 0 ECE 474a/575a 4 of 31 Susan Lysecky Mux Representation of Boolean Functions Relation to BDDs � Corresponding BDD to implement function S x1 x2 x3 S 0 0 0 1 One-to-one correspondence to the MUX gates in � 0 0 1 0 the flipped circuit 0 1 0 1 0 1 1 1 1 0 0 1 1 0 1 1 1 1 0 0 1 1 1 0 S(x1, x2, x3) S(x1, x2, x3) 1 0 x1 0 1 MUX x3 x1 0 1 MUX 1 1 0 x2 x2 0 1 0 1 MUX MUX x2 x2 0 1 0 1 MUX MUX x3 1 1 0 0 1 MUX x1 x3 0 1 MUX 1 0 S(x1, x2, x3) 1 0 Same circuit, just Corresponding BDD flipped ECE 474a/575a 5 of 31 Susan Lysecky Binary Decision Diagram (BDD) Example 1 � How does it work? x1 x2 x3 S S(x1, x2, x3) 0 0 0 1 � Line with bubble represent value = 0 x1 0 0 1 0 � Lines without bubble represent value = 1 0 1 0 1 0 1 1 1 x2 x2 1 0 0 1 1 0 1 1 x3 1 1 0 0 1 1 1 0 1 0 S(0, 0, 0) S(1, 1, 1) S(0, 1, 0) S(0, 0, 1) x1 x1 x1 x1 x2 x2 x2 x2 x2 x2 x2 x2 x3 x3 x3 x3 1 0 1 0 1 0 1 0 ECE 474a/575a 6 of 31 Susan Lysecky 2

  3. Binary Decision Diagram (BDD) Edge Notations Several ways to represent value = 1 and value = 0 � Bubble vs. Non-bubble line � Dashed vs. Solid line � � T (then) vs. E (else) labels � We will adopt T vs. E labels – consistent with most of the book (Hatchel) examples S(x1, x2, x3) S(x1, x2, x3) S(x1, x2, x3) x1 x1 x1 T E x2 x2 x2 x2 x2 x2 T T E E x3 x3 x3 E T 1 0 1 0 1 0 ECE 474a/575a 7 of 31 Susan Lysecky Binary Decision Diagram (BDD) Example 2 � Let’s consider another function f(a,b,c,d) = abc + b’d + c’d f f f a a a T E T E T E b b b b b b T T T T T T E E E E E E c c c c c c E E E E E E T T T T T T d d d T E T E T E 1 0 1 0 1 0 What is the value of f(1,0,1,0)? What is the value of f(1,1,0,1)? Notice that if a=1 and b=0, the function does not depend on a value for c. ECE 474a/575a 8 of 31 Susan Lysecky Ordered Binary Decision Diagram (OBDD) What is a OBDD? � Ordered binary decision diagrams ensure the variables appear in the same order along all paths from the root to the leaves f f a a E T E T c c b c T E T E T E E T b c b E E T T T E 1 0 0 1 Ordering : a ≤ c ≤ b Not ordered ECE 474a/575a 9 of 31 Susan Lysecky 3

  4. Ordered Binary Decision Diagram (OBDD) Different Ordering Lead to Different Complexity – Example1 Variable ordering important, may result in a more complex (or simple) BDD � All three BDDs below represent the same function � Third ordering (b ≤ c ≤ a ≤ d) optimal because there is exactly one node for � each variable f f f a a b T E T E T E b b d d c T T T E E E E E T T c c b b a E E E E E T T T T T d d T c c E T E E E T T 1 0 1 0 1 0 Order : a ≤ b ≤ c ≤ d Order : a ≤ d ≤ b ≤ c Order : b ≤ c ≤ a ≤ d ECE 474a/575a 10 of 31 Susan Lysecky Ordered Binary Decision Diagram (OBDD) Different Ordering Lead to Different Complexity – Example 2 Consider F = ab + cd + ef, again both BDDs represent same function � Variable order has a large impact on resulting BDD, first variable ordering (a � ≤ b ≤ c ≤ d ≤ e ≤ f) yields a much simpler BDD f a f a c c T E b E e e e c T e T E d E T b b b b e T E f d d E T 0 1 f 0 1 Order : a ≤ b ≤ c ≤ d ≤ e ≤ f Order : a ≤ c ≤ e ≤ b ≤ d ≤ f ECE 474a/575a 11 of 31 Susan Lysecky BDDs for Basic Logic Functions AND OR XOR NAND a b F a b F a b F a b F NOT 0 0 0 0 0 0 0 0 0 0 0 1 a F 0 1 0 0 1 1 0 1 1 0 1 1 0 1 1 0 0 1 0 1 1 0 1 1 0 1 1 0 1 1 1 1 1 1 1 1 0 1 1 0 f f f f f a a a a a E T T E T E T E E T 1 0 b b b b b E T T E T E T T E E 1 0 1 0 1 0 1 0 ECE 474a/575a 12 of 31 Susan Lysecky 4

  5. Formal Definition of BDDs A BDD is a direct acyclic graph (DAG) representing a � multiple-output switching function F Function node f � Nodes are partitioned into three subsets b T E Internal Function node � nodes c T Represents the function symbol (f) E � � Indegree = 0 a E � Outdegree = 1 T d T E � Internal node � Represents variable in function (a, b, c, d) 1 0 Terminal nodes Indegree ≥ 1 � Outdegree = 2 � Terminal node � Represents a value (1 or 0) � � Indegree ≥ 1 � Outdegree = 0 ECE 474a/575a 13 of 31 Susan Lysecky Formal Definition of BDDs � A BDD definition (cont’) Three types of edges f � Incoming edge Incoming edge � b � From the function node and defines function T E T edge � T edge c From an internal node and represents when � T E E edge the corresponding variable is 1 a E � E edge T d From an internal node and represents when � T E the corresponding variable is 0 1 0 ECE 474a/575a 14 of 31 Susan Lysecky Formal Definition of BDDs � A BDD definition (cont’) f � The function f represented by a BDD is Function of the function node is the function of defined as follows b it’s outgoing edge � The function of the terminal node is a T E constant value (1 or 0) c � The function of a T edge is the function of Function of this T E the head node E edge is a’ The function of a E edge is the complement � a E of the function of the node T d � The function of a node v is given by vf T + T E v’f E , when f T is the function of the T edge and Function of this f E is the function of the E edge T edge is a The function of the function node is the � 1 0 function of it’s outgoing edge Function of this terminal node is 0 Function of this terminal node is 1 ECE 474a/575a 15 of 31 Susan Lysecky 5

  6. BDD Canonical Form BDDs are canonical (unique) for a representation of f � F given a variable ordering if b � All internal nodes are descendants of some node T E There are no isomorphic subgraphs � 1 c For every node f T ≠ f E � T E d d T T E E 1 0 1 0 Isomorphic subgraphs Isomorphic Two graphs are isomorphic if there is a one-to-one correspondence between their vertices and there is an edge between two vertices of one graph if and only if there is an edge between the two corresponding vertices in the other graph English – same subgraph - all vertices the same, all edges between vertices the same ECE 474a/575a 16 of 31 Susan Lysecky Building BDDs For a Function F � How do I build a BDD given a function F ? F = a’b + abc’ + a’b’c � Recursive use of Shannon’s Expansion Theorem F = a(bc’) + a’(b+b’c) � F = aF a + a’F a’ � We can keep applying expansion theorem, F a’ = (b+b’c) eventually we reach the unique canonical form , which uses only minterms F a = (bc’) F a also called the cofactor of F w.r.t. (with respect to) a F = a’b + abc’ + a’b’c F = a’b + abc’ + a’b’c F = bF b + b’F b’ F = cF c + c’F c’ F = b(a’+ ac’) + b’(a’c) F = c(a’b + a’b’) + c’(a’b + ab) F expanded w.r.t to b F expanded w.r.t to c ECE 474a/575a 17 of 31 Susan Lysecky Building BDDs - Exercise 1 � Build a BDD for f = abc + ab’c + a’bc’ + a’b’c’ f � Use the variable ordering a ≤ b ≤ c partial expansion with respect to a Compute cofactors of f with respect to a (first variable in ordering) f f = abc + ab’c + a’bc’ + a’b’c’ a f a = bc + b’c T E f a f a’ f a’ = bc’ + b’c’ ECE 474a/575a 18 of 31 Susan Lysecky 6

Recommend


More recommend