Euclid's algorithm is an efficient method for computing the greatest common divisor (GCD). It is named...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Euclid's algorithm is an efficient method for computing the greatest common divisor (GCD). It is named after the ancient Greek mathematician Euclid, who first described it in Books VII and X of his Elements. The GCD of two numbers is the largest number that divides both of them without leaving a remainder. Euclid's algorithm is based on the principle that the greatest common divisor of two numbers does not change if the smaller number is subtracted from the larger number. For example, 21 is the GCD of 252 and 105 (252 = 21 12, 105 = 21 5), which is the same as the GCD of 147 and 105, since 252 105 = 147. Since the larger number is reduced, repeating this process gives successively smaller numbers until one of them is zero. When that occurs, the GCD is the remaining nonzero number. For instance, consider the inputs r = 66 and y = 30. X = 66 y = 30 x > y so x = x -y = 66 - 30 36 x > y so x = x -y = 36 30 = 6 y > x so y = y y > x so - x = 30 - 6 = 24 y = y - x = 24 - 6 = 18 y > x so y = y - x = 18 - 6 = 12 y > x so y - y - x = 12 - 6 = 6 x >= y so x = x - y = 6 - 6 = 0 now x = 0 y = 6 so GCD of 66 and 30 is 6 Problem You'll be working with 8-bit integers X = Xo,...X7 and Y = Yo,...,Y7. (a) Design a comparator unit. Given input bits Xi, Y;, Ain and Bin, it produces outputs Aout and Bout such that: • If Ain +0 or Bin + 0, then Agut = Ain and Bout = Bin- %3D Otherwise • If Xin = Yin, Aout = 0, Bout = 0. • If Xin > Yin, Aout = 1, Bout = 0. • If Xin < Yin, Aout = 0, Bout = 1. %3D Produce a full design with logic gates. (b) Using your comparator units, design a full comparator. Given 8-bit inputs X and Y, it produces outputs A and B such that: • If X = Y, A = 0, B = 0. • If X > Y, A = 1, B = 0. • If X < Y, A = 0, B = 1. = Xo, ...X7 and (c) Design an 8-bit conditional subtractor unit. Given inputs X Y = Y,...,Y7, A and B, it produces outputs Z = Zo, ., Z7 such that • If A = 0, B = 1, Z = Y - X. • Else, Z = X - Y. Use full adders and logic gates. Euclid's algorithm is an efficient method for computing the greatest common divisor (GCD). It is named after the ancient Greek mathematician Euclid, who first described it in Books VII and X of his Elements. The GCD of two numbers is the largest number that divides both of them without leaving a remainder. Euclid's algorithm is based on the principle that the greatest common divisor of two numbers does not change if the smaller number is subtracted from the larger number. For example, 21 is the GCD of 252 and 105 (252 = 21 12, 105 = 21 5), which is the same as the GCD of 147 and 105, since 252 105 = 147. Since the larger number is reduced, repeating this process gives successively smaller numbers until one of them is zero. When that occurs, the GCD is the remaining nonzero number. For instance, consider the inputs r = 66 and y = 30. X = 66 y = 30 x > y so x = x -y = 66 - 30 36 x > y so x = x -y = 36 30 = 6 y > x so y = y y > x so - x = 30 - 6 = 24 y = y - x = 24 - 6 = 18 y > x so y = y - x = 18 - 6 = 12 y > x so y - y - x = 12 - 6 = 6 x >= y so x = x - y = 6 - 6 = 0 now x = 0 y = 6 so GCD of 66 and 30 is 6 Problem You'll be working with 8-bit integers X = Xo,...X7 and Y = Yo,...,Y7. (a) Design a comparator unit. Given input bits Xi, Y;, Ain and Bin, it produces outputs Aout and Bout such that: • If Ain +0 or Bin + 0, then Agut = Ain and Bout = Bin- %3D Otherwise • If Xin = Yin, Aout = 0, Bout = 0. • If Xin > Yin, Aout = 1, Bout = 0. • If Xin < Yin, Aout = 0, Bout = 1. %3D Produce a full design with logic gates. (b) Using your comparator units, design a full comparator. Given 8-bit inputs X and Y, it produces outputs A and B such that: • If X = Y, A = 0, B = 0. • If X > Y, A = 1, B = 0. • If X < Y, A = 0, B = 1. = Xo, ...X7 and (c) Design an 8-bit conditional subtractor unit. Given inputs X Y = Y,...,Y7, A and B, it produces outputs Z = Zo, ., Z7 such that • If A = 0, B = 1, Z = Y - X. • Else, Z = X - Y. Use full adders and logic gates.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these accounting questions
-
The greatest common divisor is the largest positive integer that divides the numbers without a remainder. For example, the GCD of8 and 12 is 4. Use the MATLAB Help Window to find a MATLAB built-in...
-
Another solution for Listing 5.9 to find the greatest common divisor of two integers n1 and n2 is as follows: First find d to be the minimum of n1 and n2, then check whether d, d1, d2, , 2, or 1 is a...
-
Formula 8.1 provides a method for computing the sample size required to obtain a confidence interval with a specified confidence level and margin of error. The number resulting from the formula...
-
Prove the famous (your name) uncertainty principle, relating the uncertainty in position (A = x) to the uncertainty in energy For stationary states this doesnt tell you muchwhy not? (B = p/2m + V):
-
Three pollsters will canvas a neighborhood with 21 houses. Each pollster will visit seven of the houses. How many different assignments of pollsters to houses are possible?
-
Light A has four times the power rating of light B when operated at the same voltage. (a) Is the resistance of light A greater than, less than, or equal to the resistance of light B? Explain. (b)...
-
Use the gasoline price index from Table 1. Briefly explain your reasoning in each case. The average price of a gallon of gas was \($2.62\) in 2006. What is the price index for gasoline in 2006, with...
-
Five approaches to transnational financial reporting were identified in the chapter. Required: a. List some of the advantages and disadvantages of each approach. b. Which approach do you favor? Why?
-
Sold a delivery truck on September 23, 2023 for $35,000. The truck had originally been purchased on May 1, 2023 for $33,400. Depreciation taken for book purposes was $7,000. Depreciation taken for...
-
Cooper River Glass Works (CRGW) produces four different models of desk lamps as shown in Figure. The operations manager knows that total monthly demand exceeds the capacity available for production....
-
Certainly! Here's a revised version that you can use to ask an expert for assistance in creating an Excel graph based on the provided information: --- Subject: Request for Expert Assistance: Creating...
-
** Answer each question. Discuss the facts and lawand conclude any legal and ethical violations and party losses. For analysis, make appropriate assumptions. Summarize therelevant factsof the case as...
-
Retro Gym has three creditors: a bank with seniority in the amount of $350, Senior Bondholders in the amount of $190, and a steel trade creditor with no priority in the amount of $40. Retro Gym has...
-
Best Cakes requires a certain part for its baking oven to continue to stay open. Best Cakes orders this part from Oven Repairs Inc. Best Cakes tells Oven Repairs that is must get the item by Friday...
-
Brooklyn Borough Hospital is examining its inpatient services to determine the year-to-year change in revenue. After examining the chart below, please answer the questions listed. 2022 Revenue...
-
Individual Social Media Analysis Assignment: This week, each group member will select a different social media platform as the subject for an individual social media assignment. I am looking for ...
-
What should it have done differently? Was it ethical for Monsanto to settle the litigation with no admission of responsibility or commitment to change any internal practices? why or why not? Did...
-
Suppose that you are part of a virtual team and must persuade other team members on an important matter (such as switching suppliers or altering the project deadline). Assuming that you cannot visit...
-
When rubber is stretched, its elongation is initially proportional to the applied force, but as it reaches about twice its original length, the force required to stretch the rubber increases rapidly....
-
A parametric equation is given by x = sin(t)cos(t), y = 1 .5cos(t) Plot the function for < t
-
Create a vector (name it vctD) that has 9 elements of which the first is 0, the increment is 3 and the last element is 27. Then create a vector (name it vctDop) that consist of the elements of vctD...
-
The Hermite polynomials are often called a set of orthogonal polynomials. Consider the Hermite polynomials up to a specified order \(d\). Let \(\mathbf{h}_{k}\) be a vector in \(\mathbb{R}^{d}\)...
-
Prove Part 3 of Theorem 1.14 using only Definition 1.6. That is, prove that for any non-negative integer \(k\), \[\frac{d}{d x} H_{k}(x)=k H_{k-1}(x)\] Do not use the result of Part 1 of Theorem...
-
In Theorem 1.15 prove that \(E_{p}(x, \delta)=o\left(\delta^{p}ight)\), as \(\delta ightarrow 0\). Theorem 1.15. Let f be a function that has p+ 1 bounded and continuous derivatives in the interval...
Study smarter with the SolutionInn App