## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

3, Issue 4, Oct 2013, 59-66 © TJPRC Pvt. Ltd.

APPROACH TO DESIGN GREATEST COMMON DIVISOR CIRCUITS BASED ON METHODOLOGICAL ANALYSIS AND VALUATE MOST EFFICIENT COMPUTATIONAL CIRCUIT

DARSHANA UPADHYAY, JAHANVI KOLTE & KRITIKA JALAN Institute of Technology, Nirma University, Chharodi, Ahmedabad, Gujarat, India

ABSTRACT

In elementary arithmetic, the greatest common divisor is used to simplify expressions by reducing the size of numbers involved. Greatest common divisor (GCD) of given numbers is the largest number that divides all of the given numbers without leaving any remainder. This paper presents the hardware simulation of different methods employed to compute Greatest common divisor of any two numbers (8-bit binary) in simulator. For this purpose, four different methods were worked out, of which, three were dynamic implementations namely, Euclid's method, Divisibility Check Method, Dynamic modulo and one was static implementation, static modulo method. These algorithms were then compared for their space & time complexity. For Space complexity, number of different components, like basic gates, memory units, plexers, arithmetic operation units, etc. used were compared and for time complexity, clock pulses required were measured for a few set of numbers.

**KEYWORDS: Dynamic Modulo Method, Euclid’s Method, Divisibility Check Method, Static Modulo Method, Time
**

Complexity Analysis , Space Complexity Analysis

INTRODUCTION

Greatest Common Divisor (GCD) of two non-negative numbers is the largest integer that divides both the numbers leaving 0 remainders. GCD (a, b) = max {kЄZ : k|a ^ k|b}. GCD computation is a central task in computer algebra, in particular when computing over rational numbers or over modular integers

[5] .

Greatest Common Divisor can be found using many methods. In this paper, we present four such

methods along with their hardware implementation and analysis of their Time Complexity and Space complexity. The four methods are Method of Equating 0 Remainders, Static Modulo Method, Dynamic Modulo Method and Euclid's Method. The Method of Equating 0 Remainders divides both the numbers with a number starting from the smaller number to 1. When both the remainders are 0, clock pulse stops and that is our GCD value. The Static Modulo Method finds the remainder of two given numbers. Later the divisor and the remainder in the first iteration become the dividend and divisor in second iteration. This continues until remainder becomes zero. The Dynamic Modulo Method differs from Static Modulo Method in the way that it uses registers. In Static Modulo Method, the no. of times the loop runs say l, so l no. of modules must be implemented in this method unlike the dynamic modulo method where you store the output of 1 module in register and use it later. The Euclidean Algorithm is regarded as the grandfather of all algorithms in number theory today because it is the oldest nontrivial algorithm that has survived to the present day

[1] .

In this method, the smaller number is

subtracted from the greater number and the result is stored in the greater number (before subtraction). This continues till

60

Darshana Upadhyay, Jahanvi Kolte & Kritika Jalan

both the numbers become equal. That number is the GCD of given numbers. The Euclidean algorithm solves this problem in time quadratic in size n of inputs

[5] .

The purpose of this paper is to show various hardware implementation of a circuit to calculate GCD. Different digital components have been used to employ the above algorithms. Comparator, Divider and Multiplexer have been used to implement the circuits. Some circuits also use counter and subtractors.

**HARDWARE SIMULATION OF METHODS
**

Under this section, the hardware implementation of all four methods are shown and based on this, the conclusion is reached. Divisibility Check Method The Divisibility Check Method divides both the numbers with a number starting from the smaller number to 1. When both the remainders are 0, clock pulse stops and that is our GCD value. Algorithm Input: Two Unsigned Numbers a and b. Output: Greatest Common Divisor of input. Counter = 0; GCD =0; small=0; big=0; remS=0; remB=0; if (a< b) then small = a; big=b; else small = b; big=a; end Counter = small; repeat: remB = big % Counter; remS = small % Counter; if remB == remS then GCD = Counter; else Counter--; until Counter>0; end

Approach to Design Greatest Common Divisor Circuits Based on Methodological Analysis and Valuate Most Efficient Computational Circuit

61

Circuit

Figure 1: Divisibility Check Method Static Modulo Method The Static Modulo Method finds the remainder of two given numbers. Later, the divisor and the remainder in the first iteration become the dividend and divisor in second iteration respectively. This continues until remainder becomes zero. The Static Modulo Method differs from dynamic method in the way that it does not employ any registers. The number of times the loop runs (say n), n modules has to be implemented here unlike dynamic modulo method where the output of one module is stored in register and used later. Algorithm Input: Two Unsigned Numbers a and b. Output: Greatest Common Divisor of input. GCD =0; small=0; big=0; rem=0; if (a< b) then small = a; big=b; else small = b; big=a; end here: rem = big % small; if (rem == 0) then

62

Darshana Upadhyay, Jahanvi Kolte & Kritika Jalan

GCD = small; else big = small; small = rem; goto here; end Note: This method has a restriction on the numbers of input. They are in accordance with the number of modules in the circuit. Circuit

Figure 2: Static Modulo Method Dynamic Modulo Method The Dynamic Modulo Method finds the remainder of two given numbers. Later the divisor and the remainder in the first iteration become the dividend and divisor in second iteration. This continues until remainder becomes zero. The number of hardware components used in this method is considerably reduced as compared to Static Modulo Method. Algorithm Input: Two Unsigned Numbers a and b. Output: Greatest Common Divisor of input. GCD =0; small=0; big=0; rem=0; if (a< b) then

Approach to Design Greatest Common Divisor Circuits Based on Methodological Analysis and Valuate Most Efficient Computational Circuit

63

small = a; big=b; else small = b; big=a; end here: rem = big % small; if (rem == 0) then GCD = small; else big = small; small = rem; goto here; end Note: This method has same algorithm as previous one. Only, this has no restriction as it is dynamic implementation. Circuit

Figure 3: Dynamic Modulo Method Euclid’s Method In this method, the smaller number is subtracted from the greater number and the result is stored in the greater number (before subtraction). This continues till both the numbers become equal. This equal number is the GCD of given numbers. The Euclidean Algorithm is regarded as the grandfather of all algorithms in number theory

64

Darshana Upadhyay, Jahanvi Kolte & Kritika Jalan

Algorithm Input: Two Unsigned Numbers a and b. Output: Greatest Common Divisor of input. GCD =0; small=0; big=0; rem=0; here: if (a< b) then small = a; big=b; else small = b; big=a; end big = big - small; a = big ; b= small; if (big == small) then GCD = small; else goto here; end Circuit

Figure 4: Euclid's Method

ANALYSIS

Here, the time and space complexity of each method has been computed as shown below.

Approach to Design Greatest Common Divisor Circuits Based on Methodological Analysis and Valuate Most Efficient Computational Circuit

65

Time Complexity This is computed by counting the number of clock pulses required to get the GCD output by each method for a given set of values. The values are taken in four sets. Set one with both inputs as small numbers. Set two with one number small and the other big. Set three with both numbers medium. Set four with both numbers big. Thus in this way, all types of cases are covered. (Big and small are considered within the range of 1 to 100) Table 1: Time Complexity Comparison Chart Numbers/Algorithms 5,7 9,10 12,16 4,65 11,77 29,42 50,52 96,99 Euclid's Method Dynamic Modulo Equating 0 Remainders (Clock Pulse) (Clock Pulse) (Clock Pulse) 4 8 3 19 6 8 25 1 31 2 1 1 1 1 3 1 1 4 7 8 3 10 28 48 93

Figure 5: Time Complexity Comparison Chart The analysis shows us that, among dynamic methods, Method of Equating 0 Remainders is less complex when it comes to smaller numbers and its complexity gradually increases as the value of the smaller number rises.(E.g. 42, 29 and 96, 99).Euclid's algorithm is less complex or works comparatively better when we have higher order numbers. (E.g. 96 and 99).The dynamic modulo method requires very less clock pulses to compute GCD in all the three sets of experimented values. The static modulo method does not consist of any memory unit in its implementation.Thus, no clock pulses are required to compute GCD. It means that it also has less time complexity. But it ’s hardware complexity is very high. Space Complexity To compute GCD calculation methods in terms of space complexity, the number of hardware components required to build the circuit are taken into consideration. Table 2: Space Complexity Comparison Chart Hardware Equating Zero Components Remainders (8 Bits) Memory Unit 1 Counter Euclid’s Method Dynamic Modulo Static Modulo (8 Bits) (8 Bits) (4 Bits) 2 Registers 2 Registers -

1

TableI Time Complexity Comparison Chart shows clock pulses required by various algorithms to compute specific problems of GCD.

66

Darshana Upadhyay, Jahanvi Kolte & Kritika Jalan

Plexers 2 Mux Arithmetic 4 Comparator 2 Divider Units Basic Gates 1 NOT 2 AND 1 OR

Table 2: Contd., 3 Mux 1 Comparartor 2 Subtractor -

3 Mux 2 Comparator 3 Divider 1 NOT 1 AND

6 Mux 4 Comparator 4 Divider 1 OR

From the above analysis, it is clear that the number of hardware components requiredimplement Euclid's Method has the least space complexity.

PERFORMANCE EVALUATION

All the circuits are formulated using Logisim Simulator 2.7.1 .

CONCLUSIONS

From the analysis we can conclude that among all the four methods, Euclid's method has least number of components i.e. it is the best suited method in terms of space complexity as it may be used to generate almost all the most important traditional musical rhythms used in different cultures throughout the world. It is a key element of the RSA algorithm, a public-key encryption method widely used in electronic commerce. It is a basic tool for proving theorems in modern number theory, such as Lagrange's four-square theorem and the fundamental theorem of arithmetic. But Dynamic Modulo Method is the best method in terms of time complexity as the number of clock pulses required to obtain the answer is considerably reduced as it can be used to get a very fast, practical and deterministic algorithm for triangularizing integer matrices, Pad approximation, iterative solution of linear systems, Eigen value problems, orthogonal polynomials, coding theory.

REFERENCES

1. B. Vallee, 2003, Dynamical analysis of a class of Euclidean Algorithms., The Computer Science, 297(1-3): pp. 447-486. 2. Haroon Altarawneh, 2011, A Comparison of Several Greatest Common Divisor (GCD) Algorithms, International Journal of Computer Applications (0975 - 8887), Volume 26, No.5 3. Jeffrey Shallit and Jonathan Sorenson, 1994, Analysis Of Left-Shift GCD Binary Algorithm, J.Symbolic Computation, pp. 473-486 4. 5. Jonanthan Sorenson, 1994, Two fast GCD Algorithms, Journal Of Algorithms 16, pp. 110-11 P. Emeliyanenko, (2010a ) A complete modular resultant algorithm targeted for realization on graphics hardware, PASCO 10, pp. 35-43, New York, NY, USA. ACM ;(2010b) Accelerating Symbolic Computations on NVIDIA Fermi, GTC 10, Poster presentation; (2010c)Modular Resultant Algorithm for Graphics Processors, ICA3PP 10, pp. 427-440, Berlin, Heidelberg, Springer-Verlag.2 6. T. Jebelean, 2010, Comparing Several GCD Algorithms “ Che Wun Chiou, Fu Hua Chou , Yun -Chi Yeh , Speeding up Euclid's GCD algorithm with no magnitude comparisons , International Journal of Information and Computer Security table of contents archive Volume 4 Issue 1.

2

TableII Space Complexity Comparison Chart shows hardware components required by circuits of various algorithms to compute GCD.

- 2011squad Nt Solns
- 1 - Intro to Algorithms
- R1-00-0486
- Long
- Nom Perdana Prime
- numbertheorytipstricks
- Tutorial Python 02
- Number Theory
- 02.Solutions
- Lecture Notes Incomplete
- lnzd
- A GENTLE INTRODUCTION TO NUMBER THEORY AND CRYPTOGRAPHY.pdf
- Sage for Abstract Algebra
- Group Theory
- Computer Project - Copy
- Topics and Websites
- DAYANG
- Scimakelatex.11890.Mariano
- Progression Pathways Assessment Framework
- basics of c++
- lec1
- Vedicpdf
- MELJUN CORTES Free Elec 1 -Robotics-Student 2016 IT
- The Remainder and Factor Theorem
- Some Tips for Preparing Your Paper Presentation
- 14297.Lauren+Gauss
- Scimakelatex.21094.Hashem.taghi
- Con Frac
- Scimakelatex.29628.None
- TA ZC142-L7

- UT Dallas Syllabus for cs4349.501 06f taught by Ramaswamy Chandrasekaran (chandra)
- Public Cloud Partition Using Load Status Evaluation and Cloud Division Rules
- Voice Recognition System using Template Matching
- Scheduling Resources In a Hetero-Gene Cloud Using Genetic Algorithm
- A review on Development of novel algorithm by combining Wavelet based Enhanced Canny edge Detection and Adaptive Filtering Method for Human Emotion Recognition
- Principles of parallel algorithm models and their objectives
- Analysis & Design Algorithm MCQ'S
- As 2805.5.1-1992 Electronic Funds Transfer - Requirements for Interfaces Ciphers - Data Encipherment Algorith
- UT Dallas Syllabus for cs3345.501 05s taught by Greg Ozbirn (ozbirn)
- Determining the shortest path for Travelling Salesman Problem using Nearest Neighbor Algorithm
- UT Dallas Syllabus for opre7313.001.11s taught by Milind Dawande (milind)
- The Optimizing Multiple Travelling Salesman Problem Using Genetic Algorithm
- tmp904.tmp
- UT Dallas Syllabus for cs3333.001.11s taught by Jeyakesavan Veerasamy (veerasam)
- A Survey of Modern Data Classification Techniques
- Hashing Algorithm
- UT Dallas Syllabus for opre7313.001.08f taught by Milind Dawande (milind)
- A Survey on Gesture Recognition
- tmpDF60.tmp
- UT Dallas Syllabus for cs2305.002 05f taught by Timothy Farage (tfarage)
- Content-Based Image Retrieval Using Features Extracted From Block Truncation Coding
- OCR for Gujarati Numeral using Neural Network
- tmpAA72
- tmpCB3F.tmp
- Appraisal of PSO Algorithm over Genetic Algorithm in WSN Using NS2
- UT Dallas Syllabus for cs6363.002.08s taught by Balaji Raghavachari (rbk)
- Comparative Analysis of Optimization Algorithms Based on Hybrid Soft Computing Algorithm
- Introduction to Multi-Objective Clustering Ensemble
- Simulation of Single and Multilayer of Artificial Neural Network using Verilog
- tmp8BC6

- 6.IJHRMRAPR20176
- 11.IJBMRAPR201711
- 10.IJBMRAPR201710_2
- 8.IJBMRAPR20178
- 6.IJBMRAPR20176
- 5.IJHRMRAPR20175
- 2.IJHRMRAPR20172
- 4.IJHRMRAPR20174
- 1.IJHRMRAPR20171
- 1.IJRMRAPR20171
- 2.IJRMRAPR20172
- 7.IJBMRAPR20177
- 5.IJBMRAPR20175
- 9.IJBMRAPR20179
- 3.IJHRMRAPR20173
- 2.IJBMRAPR20172
- 2.IJSMMRDAPR20172
- 3.IJSMMRDAPR20173
- 1.IJSMMRDAPR20171
- 1.IJMPSAPR20171
- 2.IJGPMJUN20172
- 4.IJSMMRDAPR20174
- 3.IJBMRAPR20173
- 3.IJMPSAPR20173
- 3.IJAFMRAPR20173
- 1.IJBMRAPR20171
- 4.IJBMRAPR20174
- 2.IJMPSAPR20172
- 2.IJAFMRAPR20172
- 1.IJAFMRAPR20171

Sign up to vote on this title

UsefulNot usefulRead Free for 30 Days

Cancel anytime.

Close Dialog## Are you sure?

This action might not be possible to undo. Are you sure you want to continue?

Close Dialog## This title now requires a credit

Use one of your book credits to continue reading from where you left off, or restart the preview.

Loading