Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. Project Presentation Computing Multiplication & division using CORDIC in Visual DSP++ PROJECT BY Mohammad Waqas Arbab Waseem Abbas DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. OUTLINE • • • • • • Abstract Introduction Methodology Results & Discussion Conclusion/summary References DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. Abstract • • • • • What is “CORDIC” ? Coordinate Rotation Digital Computer. Three methods of CORDIC algo. linear, circular and hyperbolic For multiplication & div. linear method is used. DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. • WHY CORDIC ? • CORDIC algorithms are efficient in terms of both computation time and hardware resources • Dominates the implementation & hardware cost DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. • HOW ? • The CORDIC algorithm makes use of only shifters and adder blocks to compute these functions. DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. INTRODUCTION • Background ? COordinate Rotational DIgital Computer Jack E. Volder (1959) Primary concern was trig functions Extended by J. Walther in 1971 Used by most calculators today Efficient shift add algorithm/ no mulitplies needed DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. • Comparison ? • Simple Shift-and-add Operation. • (2 adders+2 shifters v.s. 4 mul.+2 adder) • CORDIC algorithms are efficient in terms of both computation time and hardware resources - and in most systems, these resources are normally a premium • This algorithm uses only minimal hardware (adder and shift) for computation of all trigonometric and other function values. It consumes fewer resources than any other techniques and so the performance is high. Thus, almost all scientific calculators use the CORDIC algorithm in their calculations. DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. • Application ? • • • • • • • • • • • • calculators digital-systems satellite microcontrollers Application to DSP algo.s (below) Linear transformation: - DFT, Chirp-Z transform, DHT, and FFT. Digital filters: - Orthogonal digital filters, and adaptive lattice filters. Matrix based digital signal processing algorithms: - QR factorization, with applications to Kalman filtering - Linear system solvers, such as Toeplitz and covariance system solvers,……,etc. DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. • USES ? – – – – – – Linear Functions Trigonometric Functions Hyperbolic Functions Square Rooting Logarithms, Exponentials The functions that can be evaluated using CORDIC methods are sine, cosine, tangent, inverse tangent, hyperbolic sine, hyperbolic cosine, hyperbolic tangent, inverse hyperbolic tangent, natural logarithm, natural exponential, square root, multiplication, division. DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. METHODOLOGY • Explanation of algo.? • Embedding of elementary function evaluation as a generalized rotation operation. • Decompose rotation operation into successive basic rotations. • Each basic rotation can be realized with shift and add arithmetic operations. DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. • Contd. • A CORDIC algorithm for multiplication can be derived using a series representation for x as shown below DSP Presentation From this, z is composed of shifted versions of y. The unknown value for z, may be found by driving x to zero 1 bit at a time. If the ith bit of x is nonzero, yi is right shifted by i bits and added to the current value of z. The ith bit is then removed from x by subtracting 2-i from x. If x is negative, the ith bit in the twos complement format would be removed by adding 2-i. In either case, when x has been driven to zero all bits have been examined and z contains the signed product of x and y correct to B bits. Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. • Contd. multiply(x,y) { for (i=1; i=<B; i++) { if (x > 0) x = x - 2^(-i) z = z + y*2^(-i) else x = x + 2^(-i) z = z - y*2^(-i) } return(z) } DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. • A CORDIC division algorithm is based on rewriting the equation z=x/y into the form xy*z=0. If z is expanded into its series representation, the second version of the equation takes the form in Figure (a), which, after some manipulation, yields Figure (b). DSP Presentation This final form of the equation shows that the quotient z may be estimated 1 bit at a time by driving x to zero using rightshifted versions of y. If the current residual is positive, the ith bit in z is set. Likewise, if the residual is negative the ith bit in z is cleared. Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. divide(x,y) { for (i=1; i=<B; i++) { if (x > 0) x = x - y*2^(-i); z = z + 2^(-i); else x = x + y*2^(-i); z = z - 2^(-i); } return(z) } DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. X(i) X-Reg Barrel shifter +/X(i+1) DSP Presentation Y(i) Y-Reg A Flow chart diagram of CORDIC Barrel shifter +/Y(i+1) Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. RESULTS • • • • • • • • • • • • Loading: "C:\Documents and Settings\arbab waseem abbas\My Documents\VisualDSP Projects\dsp_project\Debug\dsp_project.dxe"... Load complete. Breakpoint Hit at <ffa11ba0> MULTIPLY 36.000000 DIVIDE 9.000000 Breakpoint Hit at <ffa11d36> Loading: "C:\Documents and Settings\arbab waseem abbas\My Documents\VisualDSP Projects\dsp_project\Debug\dsp_project.dxe"... Load complete. Breakpoint Hit at <ffa11ba0> MULTIPLY 50.000000 DIVIDE 4.500000 Breakpoint Hit at <ffa11d36> DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. CONCLUSION • • • • • • CORDIC algorithms are an efficient method to compute many different functions Low area, high speed Used in calculators, DSPs, math-coprocessors and supercomputers. CORDIC saves more hardware cost. By the regularity, the CORDIC based architecture is very suitable for implementation with pipelined VLSI array processors. The utility of the CORDIC based architecture lies in its generality and flexibility. DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. • Contd. • Using CORDIC algorithms may allow a single chip solution where algorithms using the look-up table method may require a large ROM size or where power series calculations require a separate co-processor because of the computation time required. DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. How to Improve ? • Use Pipelined Architecture • Improve the Performance of the Adder(redundant arithmetic, CSA) • Reduce Iteration Number – High radix CORDIC. – Find a optimized shift sequence. – Improve the Scaling Operation. DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. • REFRENCES 1. Volder, Jack E., “The CORDIC Trignometric Computing Technique”, IRE Transactions Electronic Computers, vol. EC-8, pp. 330-334, September 1959. 2. Specker W. H., “A Class of Algorithms for Ln x, Exp x, Sin x, Cos x, Tan-1x and Cot-1x”, IEEE Transactions Electronic Computers, vol. EC-14, pp. 85-86, 1965. 3. Walther, J. S., “A Unified Algorithm For Elementary Functions”, 1971 Proceedings of the Joint Spring Computer Conference, pp. 379-385, 1971. 4. Jarvis, Pitts, “Implementing CORDIC Algorithms”, Dr. Dobb’s Journal, #169`, pp. 152-156, October 1990. 5. Dr Dobb’s official website. DSP Presentation Computing Multiplication & division using CORDIC Department of Computer Systems Engineering, N-W.F.P. University of Engineering & Technology. Thanks for your patience Any queries? DSP Presentation Computing Multiplication & division using CORDIC