digital logic design a rigorous approach c
play

Digital Logic Design: a rigorous approach c Chapter 12: Trees Guy - PowerPoint PPT Presentation

Digital Logic Design: a rigorous approach c Chapter 12: Trees Guy Even Moti Medina School of Electrical Engineering Tel-Aviv Univ. May 3, 2020 Book Homepage: http://www.eng.tau.ac.il/~guy/Even-Medina 1 / 31 Preliminary questions:


  1. Digital Logic Design: a rigorous approach c � Chapter 12: Trees Guy Even Moti Medina School of Electrical Engineering Tel-Aviv Univ. May 3, 2020 Book Homepage: http://www.eng.tau.ac.il/~guy/Even-Medina 1 / 31

  2. Preliminary questions: Which Boolean functions are suited for implementation by 1 tree-like combinational circuits? In what sense are tree-like implementations optimal? 2 2 / 31

  3. Reminder: Binary Boolean Functions Definition A binary Boolean function is a function f : { 0 , 1 } 2 → { 0 , 1 } . A binary function is often denoted by a dyadic operator, say ∗ . So instead of writing f ( a , b ), we write a ∗ b . 3 / 31

  4. Reminder: Associative Boolean functions Definition A binary Boolean function ∗ : { 0 , 1 } 2 → { 0 , 1 } is associative if ( x 1 ∗ x 2 ) ∗ x 3 = x 1 ∗ ( x 2 ∗ x 3 ) , for every x 1 , x 2 , x 3 ∈ { 0 , 1 } . One may omit parenthesis: x 1 ∗ x 2 ∗ x 3 is well defined. Consider the function f n : { 0 , 1 } n → { 0 , 1 } defined by f n ( x 1 , . . . , x n ) � x 1 ∗ · · · ∗ x n 4 / 31

  5. Extension of associative function Definition Let f : { 0 , 1 } 2 → { 0 , 1 } denote a Boolean function. The function f n : { 0 , 1 } n → { 0 , 1 } , for n ≥ 1, is defined recursively as follows. If n = 1, then f 1 ( x ) = x . 1 If n = 2, then f 2 = f . 2 If n > 2, then f n is defined based on f n − 1 as follows: 3 △ f n ( x 1 , x 2 , . . . x n ) = f ( f n − 1 ( x 1 , . . . , x n − 1 ) , x n ) . Claim If f : { 0 , 1 } 2 → { 0 , 1 } is an associative Boolean function, then f n ( x 1 , x 2 , . . . x n ) = f ( f n − k ( x 1 , . . . , x n − k ) , f k ( x n − k +1 , . . . , x n )) , for every n ≥ 2 and k ∈ [1 , n − 1] . 5 / 31

  6. Trees of associative Boolean gates To simplify the presentation, consider the Boolean function or n . Definition A combinational circuit H = ( V , E , π ) that satisfies the following conditions is called an or -tree( n ). The graph DG ( H ) is a rooted tree with n sources. 1 Each vertex v in V that is not a source or a sink is labeled 2 π ( v ) = or . The set of labels of leaves of H is { x 0 , . . . , x n − 1 } . 3 x [0] x [1] x [2] x [3] x [0] x [1] or or or x [2] or or x [3] y or y 6 / 31

  7. Correctness of or -tree( n ) Definition A combinational circuit H = ( V , E , π ) that satisfies the following conditions is called an or -tree( n ). Topology. The graph DG ( H ) is a rooted tree with n sources. 1 Each vertex v in V that is not a source or a sink is labeled 2 π ( v ) = or . The set of labels of leaves of H is { x 0 , . . . , x n − 1 } . 3 Claim Every or -tree ( n ) implements the Boolean function or n . 7 / 31

  8. Relation to Boolean Formulas Definition A Boolean formula ϕ is an or ( n ) formula if it satisfies three conditions: (i) it is over the variables X 0 , . . . , X n − 1 , (ii) every variable X i appears exactly once in ϕ , and (iii) the only connective in ϕ is the or connective. Claim A Boolean circuit C is an or ( n ) -tree if and only if its graph (without the input/output gates) is a parse tree of an or ( n ) -formula. 8 / 31

  9. Cost of or -tree( n ) x [0] x [1] x [2] x [3] x [0] x [1] or or or x [2] or or x [3] y or y Claim The cost of every or -tree ( n ) is ( n − 1) · c ( or ) . Lemma Let G = ( V , E ) denote a rooted tree in which the in-degree of each vertex is at most two. Then |{ v ∈ V | deg in ( v ) = 2 }| = |{ v ∈ V | deg in ( v ) = 0 }| − 1 . 9 / 31

  10. Depth of tree delay of an or tree = number of or -gates along the longest path from an input to an output. Definition (depth - nonstandard definition) The depth of a rooted tree T is the maximum number of vertices with in-degree greater than one in a path in T . We denote the depth of T by depth ( T ). Why is this nonstandard? Usually, depth is simply the length of the longest path. Here we count only vertices with in-degree ≥ 2. Why? Input and output gates have zero delay (no computation) Assume inverters are free and have zero delay (we will show that for or ( n ) cost & delay are not reduced even if inverters are free and without delay) 10 / 31

  11. Binary rooted trees Definition A rooted tree is a binary tree if the maximum in-degree is two. A rooted tree is a minimum depth tree if its depth is minimum among all the rooted trees with the same number of leaves. All binary trees with n leaves have the same cost. But, which have minimum depth? if n that is a power of 2, then there is a unique minimum 1 depth tree, namely, the perfect binary tree with log 2 n levels. if n is not a power of 2, then there is more than one minimum 2 depth tree... (balanced trees) 11 / 31

  12. Example: Delay analysis Are these minimum depth trees? or or or or or or or or or or Figure: Two trees with six inputs. 12 / 31

  13. Depth: lower bound Claim If T n is a rooted binary tree with n leaves, then the depth of T n is at least ⌈ log 2 n ⌉ . Suffice to prove depth ≥ log 2 n . 1 Complete induction on n . 2 13 / 31

  14. Min Depth: the case n = 2 k (perfect binary trees) The distance of a vertex v to the root r in a rooted tree is the length of the path from v to r . Definition A rooted binary tree is perfect if: The in-degree of every non-leaf is 2, and All leaves have the same distance to the root. Note that the depth of a perfect tree equals the distance from the leaves to the root (no vertices with in-degree 1). Claim The number of leaves in a perfect tree is 2 k , where k is the distance of the leaves to the root. Claim Let n denote the number of leaves in a perfect tree. Then, the distance from every leaf to the root is log 2 n. 14 / 31

  15. Minimum depth trees We now show that for every n , we can construct a minimum depth tree T ∗ n of depth ⌈ log 2 n ⌉ . In fact, if n is not a power of 2, then there are many such trees. 15 / 31

  16. Balanced partitions Definition Two positive integers a , b are a balanced partition of n if: a + b = n , and 1 max {⌈ log 2 a ⌉ , ⌈ log 2 b ⌉} ≤ ⌈ log 2 n ⌉ − 1. 2 Claim If n = 2 k − r, where 0 ≤ r < 2 k − 1 , then the set of balanced partitions is = { ( a , b ) | 2 k − 1 − r ≤ a ≤ 2 k − 1 and b = n − a } . △ P 16 / 31

  17. Construction of a balanced tree Algorithm 1 Balanced-Tree( n ) - a recursive algorithm for construct- ing a binary tree T ∗ n with n ≥ 1 leaves. The case that n = 1 is trivial (an isolated root). 1 If n ≥ 2, then let a , b be balanced partition of n . 2 Compute trees T ∗ a and T ∗ b . Connect their roots to a new root 3 to obtain T ∗ n . Definition A rooted binary tree T n is a balanced tree if it is a valid output of Algorithm Balanced-Tree(n). 17 / 31

  18. Def: balanced tree Algorithm 2 Balanced-Tree( n ) - a recursive algorithm for construct- ing a binary tree T ∗ n with n ≥ 1 leaves. The case that n = 1 is trivial (an isolated root). 1 If n ≥ 2, then let a , b be balanced partition of n . 2 Compute trees T ∗ a and T ∗ b . Connect their roots to a new root 3 to obtain T ∗ n . Claim The depth of a binary tree T ∗ n constructed by Algorithm Balanced-Tree ( n ) is ⌈ log 2 n ⌉ . Corollary The propagation delay of a balanced or -tree ( n ) is ⌈ log 2 n ⌉ · t pd ( or ) . 18 / 31

  19. Optimality of trees Goals: prove optimality of a balanced or -tree( n ). Theorem Let C n denote a combinational circuit that implements or n . Then, c ( C n ) ≥ n − 1 . Theorem Let C n denote a combinational circuit that implements or n . Let k denote the maximum fan-in of a gate in C n . Then t pd ( C n ) ≥ ⌈ log k n ⌉ . 19 / 31

  20. Flipping bits Definition Let flip i : { 0 , 1 } n → { 0 , 1 } n be the Boolean function defined by △ flip i ( � x ) = � y , where � x j if j � = i △ y j = not ( x j ) if i = j . 20 / 31

  21. The cone of a function Definition (Cone of a Boolean function) The cone of a Boolean function f : { 0 , 1 } n → { 0 , 1 } is defined by △ cone ( f ) = { i : ∃ � v such that f ( � v ) � = f ( flip i ( � v )) } Example cone ( xor ) = { 1 , 2 } . We say that f depends on x i if i ∈ cone ( f ). 21 / 31

  22. Example Consider the following Boolean function: � if � 0 i x i < 3 f ( � x ) = 1 otherwise. Suppose that one reveals the input bits one by one. As soon as 3 ones are revealed, one can determine the value of f ( � x ). Nevertheless, the function f ( � x ) depends on all its inputs, and hence, cone ( f ) = { 1 , . . . , n } . 22 / 31

  23. Constant Functions Claim cone( f ) = ∅ ⇐ ⇒ f is a constant Boolean function. 23 / 31

  24. Composition of Functions Claim x ) � B ( f 1 ( � If g ( � x ) , f 2 ( � x )) , then cone( g ) ⊆ cone( f 1 ) ∪ cone( f 2 ) . 24 / 31

  25. Graphical Cone Definition Let G = ( V , E ) denote a DAG. The graphical cone of a vertex v ∈ V is defined by △ cone G ( v ) = { u ∈ V : deg in ( u ) = 0 and ∃ path from u to v } . In a combinational circuit, every source is an input gate. This means that the graphical cone of v equals the set of input gates from which there exists a path to v . 25 / 31

  26. Functional Cone ⊆ Graphical Cone Claim Let H = ( V , E , π ) denote a combinational circuit. Let G = DG ( H ) . For every vertex v ∈ V , the following holds: cone( f v ) ⊆ cone G ( v ) . Namely, if f v depends on x i , then the input gate u that feeds the input x i must be in the graphical cone of v . 26 / 31

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