Topics: 1. Priority Encoders 2. A question from an exam 3. Addition (if time permits) מבנה המחשב - אביב 2005 תרגול 6#

Slides:



Advertisements
Similar presentations
ECE 3110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices XOR, Parity Circuits, Comparators.
Advertisements

QuickSort Average Case Analysis An Incompressibility Approach Brendan Lucier August 2, 2005.
Uniqueness of Optimal Mod 3 Circuits for Parity Frederic Green Amitabha Roy Frederic Green Amitabha Roy Clark University Akamai Clark University Akamai.
MS 101: Algorithms Instructor Neelima Gupta
Grade School Again: A Parallel Perspective Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2004 Lecture 17Mar 16, 2004Carnegie.
Algorithms Recurrences. Definition – a recurrence is an equation or inequality that describes a function in terms of its value on smaller inputs Example.
Chapter 3 Growth of Functions
Topics: 1. Finding a cycle in a graph 2. Propagation delay - example 3. Trees - properties מבנה המחשב - אביב 2004 תרגול 3#
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Divide-and-Conquer1 7 2  9 4   2  2 79  4   72  29  94  4.
Topics: 1. Trees - properties 2. The master theorem 3. Decoders מבנה המחשב - אביב 2004 תרגול 4#
מבנה המחשב – מבוא למחשבים ספרתיים Parallel Prefix Computation.
Addition מבנה המחשב + מבוא למחשבים ספרתיים תרגול 7#
מבנה המחשב + מבוא למחשבים ספרתיים תרגול 5# Topics: 1.Encoders and decoders 2.Shifters.
Decoders and Trees מבנה המחשב + מבוא למחשבים ספרתיים תרגול 4#
מבנה מחשבים תרגול מספר 4. Definition: A Boolean function f :{0,1} n  {0,1} is monotone if x  y  f (x)  f ( y) (where x  y means : for every i x i.
Variable-Length Codes: Huffman Codes
Recurrences Part 3. Recursive Algorithms Recurrences are useful for analyzing recursive algorithms Recurrence – an equation or inequality that describes.
מבנה המחשב - מבוא למחשבים ספרתיים U-PENCs, B-PENCs & Half Decoders תרגול מספר 6.
מבנה מחשב – מבוא למחשבים ספרתיים Encoders, Decoders & Shifters תרגול מספר 5.
Great Theoretical Ideas in Computer Science.
DATA STRUCTURES AND ALGORITHMS Lecture Notes 1 Prepared by İnanç TAHRALI.
Ch. 8 & 9 – Linear Sorting and Order Statistics What do you trade for speed?
Divide-and-Conquer 7 2  9 4   2   4   7
Approximating the MST Weight in Sublinear Time Bernard Chazelle (Princeton) Ronitt Rubinfeld (NEC) Luca Trevisan (U.C. Berkeley)
Analyzing Recursive Algorithms A recursive algorithm can often be described by a recurrence equation that describes the overall runtime on a problem of.
Order Statistics The ith order statistic in a set of n elements is the ith smallest element The minimum is thus the 1st order statistic The maximum is.
David Luebke 1 10/13/2015 CS 332: Algorithms Linear-Time Sorting Algorithms.
CSC 41/513: Intro to Algorithms Linear-Time Sorting Algorithms.
Logic Circuits Chapter 2. Overview  Many important functions computed with straight-line programs No loops nor branches Conveniently described with circuits.
The Selection Problem. 2 Median and Order Statistics In this section, we will study algorithms for finding the i th smallest element in a set of n elements.
10/25/20151 CS 3343: Analysis of Algorithms Lecture 6&7: Master theorem and substitution method.
Data Structures and Algorithms (AT70.02) Comp. Sc. and Inf. Mgmt. Asian Institute of Technology Instructor: Prof. Sumanta Guha Slide Sources: CLRS “Intro.
Mathematical Background and Linked Lists. 2 Iterative Algorithm for Sum Find the sum of the first n integers stored in an array v : sum (v[], n) temp_sum.
Mudasser Naseer 1 11/5/2015 CSC 201: Design and Analysis of Algorithms Lecture # 8 Some Examples of Recursion Linear-Time Sorting Algorithms.
Recursion Algorithm : Design & Analysis [3]. In the last class… Asymptotic growth rate The Sets ,  and  Complexity Class An Example: Maximum Subsequence.
EE2174: Digital Logic and Lab Professor Shiyan Hu Department of Electrical and Computer Engineering Michigan Technological University CHAPTER 8 Arithmetic.
Recurrences David Kauchak cs161 Summer Administrative Algorithms graded on efficiency! Be specific about the run times (e.g. log bases) Reminder:
Solving Recurrences with the Substitution Method.
Design & Analysis of Algorithms COMP 482 / ELEC 420 John Greiner
CS1Q Computer Systems Lecture 8
ECE 2110: Introduction to Digital Systems Chapter 6 Combinational Logic Design Practices XOR and parity check Circuits.
Grade School Again: A Parallel Perspective CS Lecture 7.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
1 Algorithms Searching and Sorting Algorithm Efficiency.
Unary, Binary, and Beyond Great Theoretical Ideas In Computer Science Steven RudichCS Spring 2003 Lecture 2Jan 16, 2003Carnegie Mellon University.
Advanced Algorithms Analysis and Design By Dr. Nazir Ahmad Zafar Dr Nazir A. Zafar Advanced Algorithms Analysis and Design.
Approximating the MST Weight in Sublinear Time
CS 3343: Analysis of Algorithms
Data Structures and Algorithms (AT70. 02) Comp. Sc. and Inf. Mgmt
David Kauchak CS52 – Spring 2015
Reference: Chapter 3 Moris Mano 4th Edition
CS 3343: Analysis of Algorithms
CS 3343: Analysis of Algorithms
Lower Bound Theory.
King Fahd University of Petroleum and Minerals
Algorithms (2IL15) – Lecture 2
CS200: Algorithm Analysis
CS 3343: Analysis of Algorithms
Grade School Revisited: How To Multiply Two Numbers
Chapter 11 Limitations of Algorithm Power
Linear-Time Sorting Algorithms
Lecture 5 Algorithm Analysis
At the end of this session, learner will be able to:
Discrete Mathematics 7th edition, 2009
David Kauchak cs161 Summer 2009
The Selection Problem.
Divide-and-Conquer 7 2  9 4   2   4   7
Presentation transcript:

Topics: 1. Priority Encoders 2. A question from an exam 3. Addition (if time permits) מבנה המחשב - אביב 2005 תרגול 6#

Correctness of PCP-OR (Q6.1)

Correctness of PCP-OR (cont.) The correctness of the design: Note the design is given for n = 2 k. Prove by induction on k. Basis: k = 1, Trivial (correctness of OR). Hypothesis: Assume correct for all j<k+1. Step: Prove for k=1. Observation: If y[s] = 1, then y[t] = 1 for t >= s.

Correctness of PCP-OR (cont.) Separate into two cases: If the leading one is on the [n/2:n-1]  The leading x values are 0, and hence y[0:n/2-1] = 0 (as should be). y[n/2:n-1] are correct by the induction. If the leading one is on the [0:n/2-1]  All the trailing outputs should be 1(observation). So y[n/2:n-1] = 1. y[0:n/2-1] are correct by the induction.

Non 2 k PCP-OR For this case, we use the padding idea. We pad the number of bits to be a whole power of 2. Question: What should it be padded with? Answer: Doesn’t matter for the PCP-OR.

Delay analysis of PCP-OR d(n) = d(n/2) + 1.  d(n) = log(n). For n  2k, the padding leads to d(n) =  log(n) .

Lower bound for the delay of PCP-OR This type of proof can be extended for PCP-OP for many other op. First we show that all the input bits are non- redundant. Assume there is a redundant bit, then we can make the circuit return wrong result (0 in all bits besides this one). Now we can use cone argument and obtain log(n).

Lower bound for the cost of PCP-OR (Q6.2) Note the design given is of cost O(n logn). Is this optimal? No, a trivial design can lead to linear size implementation. y[0] = x[0] y[j] = OR(y[j-1],x[j]). So every new output requires only one new gate, and the design is correct due to the associativity of the OR operation.

Lower bound for the cost of PCP-OR (cont.) So the lower bound we try to prove is linear. Note that there are no trivial outputs, i.e., no output is constant or equals an input bit (besides y[0]). Moreover, no output y[k] equals any other output y[j] (j  k).  Every output bit is the output of a non-trivial gate, and hence the c(n) =  (n).

Q1 from Exam 2000a Input: x[0:n-1] Output y[0:n-1] Functionality: –Let s[j] = Σ x[k] (k=0..j) –Let t[j] = Σ s[k] (k=0..j) –y[j] = 1 if and only if s[j] and t[j] are even.

Q1 from Exam 2000a (cont.) Note that: –s[0] = x[0]. –s[1] = x[0] + x[1]. –s[2] = x[0] + x[1] + x[2]. –s[3] = x[0] + x[1] + x[2] + x[3]. –t[0] = x[0]. –t[1] = 2x[0] + x[1]. –t[2] = 3x[0] + 2x[1] + x[2]. –t[3] = 4x[0] + 3x[1] + 2x[2] + x[3].

Q1 from Exam 2000a (cont.) Note that: –Parity(s[0]) = XOR(x[0]). –Parity(s[1]) = XOR(x[0] + x[1]). –Parity(s[2]) = XOR(x[0] + x[1] + x[2]). –Parity(s[3]) = XOR(x[0] + x[1] + x[2] + x[3]). –Parity(t[0]) = XOR(x[0]). –Parity(t[1]) = XOR(x[1]). –Parity(t[2]) = XOR(x[0] + x[2]). –Parity(t[3]) = XOR(x[1] + x[3]).

Q1 from Exam 2000a (cont.) y[2k+1] = 1 if and only if: –The XOR of the odd bits is 1. –The XOR of all bits is 1. In order that y[2k] = 1 if and only if: –The XOR of the even bits is 1. –The XOR of all bits is 1.  Conclusion: The XOR of even bits and the XOR of odd bits should be 1.

Q1 from Exam 2000a (cont.) Conclusion2: –We need to calculate the PCP-XOR of the odd bits. –We need to calculate the PCP-XOR of the even bits. –We combine them with AND (and not) gate, for each j. Conclusion3: The circuit is composed of 2 PCP-XOR trees and linear number of gates.

Q1 from Exam 2000a (cont.) So how do we implement (in logarithmic delay and linear time a PCP-XOR tree? Hint: Look at the design of PCP-OP (for any binary OP), you used in fast addition.

Functionality of Adder (Q8.1) An adder gets three inputs A[0:n-1], B[0:n-1], C[0], and returns S[0:n-1], C[n], such that: + + = 2 n C[n]+ Is the functionality of Adder is well defined? In order to prove this, we need to show that for every possible input A,B,C[0] there exists exactly one output S,C[n], that agree with the definition.

Functionality of Adder (cont.) The minimum value A+B+C[0] is 0. The maximum value of A+B+C[0] is 2 n+1 – 1. Any number in this range can be represented by n+1bits, so 2 n C[n]+ are enough to represent every number in this range. The representation is unique, so the result of Adder is unique (and hence well defined).

Lower bounds for Adder (Q8.2) The delay is d(n) =  (log n). The proof is done using cone arguments. Non of the input bits is redundant (trivial). So the cone is cone of 2n+1 bits. The cost is c(n) =  (n). The proof is (again) by examining the outputs. Non of them is trivial. Non of them equals the input.

Lower bounds for Adder (cont.) The cost is c(n) =  (n). The proof is (again) by examining the outputs. Non of them is trivial. Non of them equals the input. Non of them equals the other.  Every output comes from a unique gate, so there must be  (n) gates.