associative dyadic boolean functions goals
play

Associative dyadic boolean functions Goals Def: A Boolean function f - PowerPoint PPT Presentation

Associative dyadic boolean functions Goals Def: A Boolean function f : { 0 , 1 } 2 { 0 , 1 } is associative if define associative Boolean functions (and classify them). Chapter 3: Trees f ( f ( 1 , 2 ) , 3 ) = f ( 1 , f ( 2 ,


  1. Associative dyadic boolean functions Goals Def: A Boolean function f : { 0 , 1 } 2 → { 0 , 1 } is associative if define associative Boolean functions (and classify them). Chapter 3: Trees f ( f ( σ 1 , σ 2 ) , σ 3 ) = f ( σ 1 , f ( σ 2 , σ 3 )) , trees - combinational circuits that implement associative Computer Structure - Spring 2004 Boolean funcs. for every σ 1 , σ 2 , σ 3 ∈ { 0 , 1 } . analyze delay & cost of trees. � Dr. Guy Even c Q: List all the associative Boolean functions prove optimality. Tel-Aviv Univ. f : { 0 , 1 } 2 → { 0 , 1 } . “A”: There are 16 dyadic Boolean functions, only need to list them and check... – p.1 – p.2 – p.3 f n : repeating f : { 0 , 1 } 2 → { 0 , 1 } f n : the associative case Definition of OR -trees Def: A combinational circuit C = �G , N� that satisfies the following conditions is called an OR -tree ( n ) . Def: Let f : { 0 , 1 } 2 → { 0 , 1 } denote a Boolean function. The If f ( x 1 , x 2 ) is associative, then parenthesis are not function f n : { 0 , 1 } n → { 0 , 1 } , for n ≥ 2 is defined by 1. Input: x [ n − 1 : 0] . important. induction as follows. Claim: If f : { 0 , 1 } 2 → { 0 , 1 } is an associative Boolean 2. Output: y ∈ { 0 , 1 } 1. If n = 2 then f 2 ≡ f . function, then 3. Functionality: y = OR ( x [0] , x [1] , · · · , x [ n − 1]) . 2. If n > 2 , then f n is defined based on f n − 1 as follows: 4. Gates: All the gates in G are OR -gates. f n ( x 1 , x 2 , . . . x n ) = f ( f k ( x 1 , . . . , x k ) , f n − k ( x k +1 , . . . , x n )) , 5. Topology: The underlying graph of DG ( C ) (i.e. △ f n ( x 1 , x 2 , . . . x n ) = f ( f n − 1 ( x 1 , . . . , x n − 1 ) , x n ) . for every k ∈ [2 , n − 2] . undirected graph obtained by ignoring edge directions) is a tree. Q: Show that the set of functions f n ( x 1 , . . . , x n ) that are Example: induced by associative dyadic Boolean functions is Note that in the tree: leaves correspond to the inputs x [ n − 1 : 0] and the NOR 4 ( x 1 , x 2 , x 3 , x 4 ) = NOR ( NOR ( NOR ( x 1 , x 2 ) , x 3 ) , x 4 ) . { constant 0 , constant 1 , x 1 , x n , AND , OR , XOR , NXOR } . output y . interior nodes - OR -gates. Note that NOR is not associative! note: only last 4 functions are “interesting”. We focus on OR . Could root the tree, and then the root is the output. – p.4 – p.5 – p.6

  2. Example: OR -tree (4) Recursive definition of OR -trees Cost of OR -trees Def: an OR -tree ( n ) is defined recursively as follows: Claim: The cost of every OR -tree ( n ) is ( n − 1) · c ( OR ) . x [0] x [1] x [2] x [3] x [0] x [1] Proof: By induction on n . or or or basis: a single OR -gate is an or x [2] OR -tree (2) . Induction basis: n = 2 . In this case, OR -tree (2) contains a single OR -gate. or or step: an OR ( n ) -tree is a circuit x [3] in which y or -tree( n 1 ) or -tree( n 2 ) 1. the output is computed by or an OR -gate. y 2. the inputs of this OR - Cost - both trees have 3 gates. gate are the outputs of or OR -tree ( n 1 ) & OR -tree ( n 2 ) , Delay - 2 gates vs. 3 . where n = n 1 + n 2 . – p.7 – p.8 – p.9 Cost of OR -trees - Induction step Delay of OR -trees Are balanced OR -trees optimal? let C denote an OR -tree ( n ) . let g denote the OR -gate that outputs the output of C . Claim: The delay of a balanced OR -tree ( n ) is What is the best (min. cost & delay) choice of a topology for a combinational circuit that implements the g is fed by two wires e 1 and e 2 . ⌈ log 2 n ⌉ · t pd ( OR ) . Boolean function OR n ? Is a tree indeed the best e 1 is the output of C 1 - an OR -tree ( n 1 ) topology? e 2 is the output of C 2 - an OR -tree ( n 2 ) Could one do better if another implementation is used? Proof: homework. Note that the term “balanced tree” can n 1 + n 2 = n be interpreted in more than one way especially if n is not a Ind. Hyp. ⇒ c ( C 1 ) = ( n 1 − 1) · c ( OR ) & c ( C 2 ) = ( n 2 − 1) · c ( OR ) . power of 2 ... c ( C ) = c ( g ) + c ( C 1 ) + c ( C 2 ) = (1 + n 1 − 1 + n 2 − 1) · c ( OR ) = ( n − 1) · c ( OR ) . QED – p.10 – p.11 – p.12

  3. � � � � � Optimality of balanced OR -trees Optimality of balanced OR -trees Restriction of a Boolean function Def: Let f : { 0 , 1 } n → { 0 , 1 } denote a Boolean function. Let Would like to prove that every combinational circuit C that Would like to prove that every combinational circuit C that σ ∈ { 0 , 1 } . The Boolean function g : { 0 , 1 } n − 1 → { 0 , 1 } implements OR n satisfies: implements OR n satisfies: defined by c ( C ) ≥ n − 1 c ( C ) ≥ n − 1 △ t pd ( C ) ≥ log 2 n. t pd ( C ) ≥ log 2 n. g ( w 0 , . . . , w n − 2 ) = f ( w 0 , . . . , w i − 1 , σ, w i , . . . , w n − 2 ) is called the restriction of f with x i = σ . We denote it by We need to be more accurate about the model: Looking for proof also for the case that DG ( C ) is not a tree! f x i = σ . Q: what is the cost/delay of an n -input OR -gate? Examples: △ assumption 1: the fan-in of every gate ≤ 2 , so we have to x 2 =1 ( x 1 ) = XOR ( x 1 , 1) XOR build big gates from basic gates. assumption 2: the cost of every basic gate is ≥ 1 . � (input/output gates are free) if � n − 1 1 i =1 x i + 1 > n/ 2 △ x n =1 ( x 1 , . . . , x n − 1 ) = MAJORITY otherwise. 0 – p.13 – p.14 – p.15 Input-Output reachability Input-Output reachability - cont. Cone of a Boolean function A boolean function f : { 0 , 1 } n → { 0 , 1 } depends on its i th Find vectors w ′ , w ′′ ∈ { 0 , 1 } n such that Claim: If a combinational circuit C implements a Boolean input if function f , then there must be a path in DG ( C ) from every f ( w ′ ) � = f ( w ′′ ) x i =0 �≡ f input in cone ( f ) to the output of f . f x i =1 . w ′ [ i ] � = w ′′ [ i ] . Proof: by contradiction, Def: The cone of a Boolean function f is defined by assume i ∈ cone ( f ) . Proof of Simulation Theorem △ ⇒ C outputs the same value in y when input w ′ and w ′′ . cone ( f ) = { i : f depends on its i th input } . let g i ∈ G denote the input gate that feeds the i th input. assume that in DG ( C ) there is no path from g i to the ⇒ C errs either with w ′ or with w ′′ . QED Claim: The Boolean function OR n depends on all its inputs, output y . namely show that C does not implement f . | cone ( OR n ) | = n. – p.16 – p.17 – p.18

  4. DAG terminology Linear Cost Lower Bound Theorem Leaves and interior vertices in trees Consider the directed acyclic graph (DAG) DG ( C ) . Let T = ( V, E ) denote a tree with at least two vertices. assumptions: deg in ( v ) : in-degree of a vertex v is the number of edges A leaf is a vertex of degree 1 . that enter the vertex v . fan-in of every gate at most 2 . An interior vertex is a vertex that is not a leaf. deg out ( v ) : out-degree of a vertex v : is the number of leaves ( V ) - set of leaves in V . cost of trivial gates (i.e. input/output gates) is zero. edges that emanate from the vertex v . cost of non-trivial gate is at least 1 . interior ( V ) - set of interior vertices in V . source - a vertex with in-degree zero. Claim: sink - a vertex with out-degree zero. Theorem: If C is a combinational circuit that implements a If the degree of every vertex in T is at most three, then Boolean function f , then interior vertex - a vertex that is neither a source or a | interior ( V ) | ≥ | leaves ( V ) | − 2 . sink. c ( C ) ≥ | cone ( f ) | − 1 . sources Corollary: If C n is a combinational circuit that implements OR n , then c ( C n ) ≥ n − 1 . Easy to prove theorem for trees, but what about arbitrary sinks interior vertices DAGs? – p.19 – p.20 – p.21 Underlying graph of DG ( C ) Construction of T Proof of linear cost lower bound theorem C - a combinational circuit & DG ( C ) = ( V, A ) - a DAG If underlying graph of DG ( C ) is a tree, then previous claim proves the theorem. underlying graph of DG ( C ) - undirected graph v v v v 1 2 3 4 G = ( V, E ) , where ( u, v ) ∈ E ⇔ ( u → v ) ∈ A . If DG ( C ) = ( V, E ) is not a tree, then construct a directed “binary tree” T = ( V ′ , E ′ ) such that If fan-in of every gate in C is at most 2 , then degree of V ′ ⊆ V & E ′ ⊆ E every vertex in G is at most 3 . sources ( T ′ ) = cone ( f ) Leaves in G correspond to input and output gates in C . output gate ∈ V ′ . Interior vertices in G correspond to non-trivial gates in in T ′ we have | interior nodes | ≥ | sources | − 1 . C . Case of a tree: But interior nodes of T are also interior in DG ( C ) , and Claim: Assume C has n inputs and a single output. number of sources in T equals | cone ( f ) | . QED. y Assume fan-in of all gates is at most 2 . If G is a tree, then Left to show how T is constructed... c ( C ) ≥ n − 1 . – p.22 – p.23 – p.24

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend