<<

International Journal of Computer Applications (0975 – 8887) International conference on Innovations in Information, Embedded and Communication Systems (ICIIECS-2014) FPGA Implementation of and Cosine Value Generators using CORDIC Design for Fixed Rotation

Manjunath.C.R Sathiyapriya PG Student, Dept. of ECE Assistant Professor, Dept of ECE, Sri Krishna College of Engineering and Sri Krishna College of Engineering and Technology, Coimbatore, India Technology, Coimbatore, India

ABSTRACT performed using software, which means long computational CORDIC algorithm has been utilized for various applications delays and low performance. Computing the transcendental such as DSP, Biometrics, Image processing, Robotics apart functions using hardware leads to higher speeds with less from general scientific and technical computation. Rotation of computational delay rather than the reference conventional vectors through fixed has a wide range of application. CORDIC algorithm designs that are already available. The But in reference to previous CORDIC models, we don‟t find CORDIC arithmetic unit can be used to solve either set of any optimized scheme for rotation of vectors through fixed following to calculate the : angles. This results in increase in On-chip area and power Y„= K (Ycosλ + Xsinλ) (1) consumption. Taking all these important factors into „ consideration, here in this paper, we have proposed a X = K (Xcosλ + Ysinλ) simplified pipelined CORDIC architecture model by writing Where, K is a referred to be a constant. The trigonometric appropriate programs in VHDL for calculating sine and cosine modified fixed angle rotation CORDIC algorithm was values of an angle with fixed number of iterations. As a result originally developed as a digital solution for real time of this, this proposed CORDIC algorithm model helps in navigation problems. Due to the simplicity of involved achieving reduced On-chip area and power consumption operations the CORDIC algorithm is well suited for VLSI compared to previous reference conventional CORDIC implementations at a reduced cost with low power architecture models. System simulation is carried out using consumption. ModelSim 6.3f and Xilinx ISE design Suite 9.2i 2. CORDIC ALGORITHM Index Term The general CORDIC algorithm design is an iterative CORDIC, sine, cosine, barrel shifter, VHDL technique and it consists of two modes of operation referred to 1. INTRODUCTION as the rotation mode and Vectoring mode. In rotation mode, the coordinate components of a vector and an angle of rotation are In this paper, we present new, fast and highly hardware given to the coordinate components of original vector, after the efficient technique for computing sine and cosine functions rotation are allowed to pass through the given angle set of using CORDIC fixed angle rotation. The Coordinate Rotational angle for computation. In vectoring mode, the coordinate Digital Computer (CORDIC) is a very well known and widely components of a vector are given and the magnitude and used hardware efficient iterative algorithm for the computation angular movement of the original vectors are computed. of elementary arithmetic functions such as hyperbolic, arithmetic trigonometric, exponential and logarithmic 2.1 Mathematical Basis of the Algorithm operations [1]. The CORDIC algorithm can also be applied for The first step to obtain the trigonometric functions is by going rotation based arithmetic functions such as Eigen value for vector rotations mode of operation. It can also be used for decomposition (EVD) [9], Discrete Cosine Transform (DCT), rectangular to polar conversions and polar to rectangular Wireless Local Area Network (WLAN), Fast Fourier conversions for vector magnitude and as a building block in the Transform (FFT) [7] and singular value decomposition [8]. certain transforms such as the DCT and DFT. The main aim of CORDIC algorithm generally works by rotating the coordinate fixed angle rotation CORDIC algorithm is to compute the sine system through a constant set of angles until the angle is and cosine of a given angle using fixed iterations, which we reduced to zero. Not only a wide variety of applications have call θ (theta). Suppose that we have a specific point on the unit been suggested over time, but also a lot of progress has taken , which may be illustrated as follows [7]: place in the area reduction of algorithm design and development of architectures for high performance and low- cost hardware solutions. The CORDIC algorithm doesn‟t need multipliers, it requires only shifters, adders and lookup tables (LUT). So, it‟s easier to implement specialized CORDIC machine, small and fast enough to compute for real time calculations, dedicated to one purpose. The trigonometric and exponential functions are computed fairly often in scientific, business and engineering applications. The computation of these transcendental functions in computers is highly Figure.1.A point on the unit circle rotated by an angle Ѳ

28 International Journal of Computer Applications (0975 – 8887) International conference on Innovations in Information, Embedded and Communication Systems (ICIIECS-2014)

The specific point on the unit circle that has a rotation of θ has various modes of operation of CORDIC algorithm are briefly coordinates of (Cosθ, Sinθ). This completely implies that if a discussed as follows: point on the x-axis of the circle is rotated by a particular angle of θ, then the sine and cosine of the angle of rotation may 2.3 Rotation Mode directly read off from the x-axis and y-axis of unit circle. The The first mode of CORDIC algorithm operation is called as rotation of angle can be achieved by rotating the given point on rotation mode by J.E. Volder. In rotation mode, the coordinate the unit circle in a series of steps may be either in the components of a vector and an angle of rotation are given and clockwise direction (decrease in θ) or either in the anti- the coordinate components of original vector, clockwise direction (increase in θ). after the rotation through the given angle are computed. Here the accumulator angle is initialized by a desired set of angle The coordinates of a point in a 2-Dimensional space can be rotation. The decision of rotation is based on the of the represented as vectors. If the coordinates of the point on the residual angle of the angle accumulator. If the input angle is unit circle are referred to be (x, y) then the point can be equally already expressed in the binary arc tangent base, the represented as (x, y)‟ where the inverted comma indicates the accumulator angle is not necessary. The is expressed transpose of the matrix. The rotation of a point in 2D as follows: space may be effected by multiplying the coordinates through a i -I specific point on the unit circle by a rotation matrix. Thus: Xi+1 = xi – yi.d . 2 i -i 푐표푠휃 −푠𝑖푛휃 푥 푥 Yi+1 = yi+xi .d . 2 (5) 푦 = 푦′ ′ (2) 푠𝑖푛휃 푐표푠휃 -1 -i Zi+1 = zi- di .tan ( 2 ) Where (x‟, y‟) is the coordinates of (x, y) of the unit circle rotated through an particular constant angle 휃. This matrix −1, 𝑖푓푧𝑖 < 0 Where, 푑𝑖 = operation can be expressed as follows using the following +1, 표푡ℎ푒푟푤𝑖푠푒 expression below as follows: Then, X‟ = Xcos휃- Ysin휃 (3) xn = An [x0cosz0 – y0sinz0] Y„= Ycos휃+ Xsin휃 yn = An [y0cosz0 – x0sinz0] (6)

In CORDIC fixed angle rotation algorithm,, the final angle 휃푛 zn= 0 is the angle for which sine and cosine are to be calculated and −𝑖 the initial vale 휃1 are rotated until the set to conventional value An =휋 1 + 2 reaches 0 by constant rotation. Instead of rotating from 휃1 to 휃푛 in one complete full sweep, we can move in steps with careful 2.4 Vectoring Mode choice of step values to calculate the sine and cosine values of In vectoring mode, the coordinate components of a vector are angle 휃 with reduced or fixed iteration. Rearranging the given and the magnitude and angular movement of the original following above equation (3) gives us the set of equation as vectors are computed. The vectoring function works by seeking follows: to minimize the y component of the residual vector at each ‟ rotation. The actual sign of the residual y component is used x = cos휃 [ x-ytan휃] (4) for determining which direction is to be rotated next. When the y‟= cos휃 [ y+xtan휃] rotation is initialized to zero, the accumulator contains the traversal angle at the end of iteration. The equation for Thus restricting the rotation angles such that it is transformed vectoring mode of rotation is expressed as follows: −𝑖 to a relation which is of the form tan(휃)=±2 , the i -I multiplication by the tangent term is reduced by an simple shift Xi+1 = xi – yi.d . 2 operation. Therefore, it is observed that the hardware i -i Yi+1 = yi+xi .d . 2 (7) complexity of barrel shifter is nearly half of the CORDIC -1 -i circuit. Therefore, we aim at suggesting some simple Zi+1 = zi- di .tan ( 2 ) techniques to reduce complexity of barrel shifters. Keeping −1, 𝑖푓푦 < 0 Where, 푑 = 𝑖 these key points in view, in this paper we present some best 𝑖 +1, 표푡ℎ푒푟푤𝑖푠푒 angle optimization schemes for reducing the micro rotations and reducing the complexity of barrel shifters for fixed angle Then, vector rotation using CORDIC algorithm for fixed angle 2 2 rotation. 푥푛 =퐴푛 푥0 + 푦0 2.2 Minimization of Hardware Complexity 푦푛 =0 (8) −1 푥 of Barrel Shifter using Hardwired Pre- 푍푛=푍0+푡푎푛 푦 Shifting −2𝑖 A barrel shifter for maximum of S shifts for a particular word An =휋 1 + 2 length L it can be implemented through log2(푠 + 1) stages of The CORDIC rotation and vectoring functions as stated are de-multiplexors, where each stage requires only less number of limited for rotation angles between −휋 2and 휋 2. For the 1:2 lines MUXes. Using the hardwired pre-shifting, it would be composite rotation angles that are larger actually than 휋 2, an therefore easily possible to reduce the total number of shifts to additional rotation is required. J.E.Volder describes the rotation be implemented by the barrel shifters. Thus, it allows us to as ± −휋 2.This gives us the corrected form of iteration sustainably reduce the delay and hardware complexity of barrel equation and it‟s as follows: shifters. Whereas, the conventional barrel shifter has maximum of S shifts for a particular word length L, it can be x‟ = -d. y implemented through log (푠 + 1) stages of 2:1 MUXes. The 2 y‟ = d. x (9)

29 International Journal of Computer Applications (0975 – 8887) International conference on Innovations in Information, Embedded and Communication Systems (ICIIECS-2014)

휋 z‟ = z + d. 2 3. IMPLEMENTATION In this paper, the FPGA implementation for calculating the sine −1, 𝑖푓 푦 < 0 Where, 푑𝑖 = and cosine values of a given angle using CORDIC fixed angle +1, 표푡ℎ푒푟푤𝑖푠푒 rotation is presented. The module was actually implemented by Since, there is no actual growth for the initial condition. using the Xilinx ISE Design Suite 9.2i and VHDL. The Alternatively an initial rotation of either 휋 표푟 0 can be made, ModelSim simulator is used for verifying the functionalities of avoiding the reassignment of x and y components to the initial the module and this module is described using VHDL and rotation of coordinates on the of specific point on the unit synthesized using Xilinx ISE Design. circle. x‟ = d. x y‟ = d. y 푧, 𝑖푓 푑 = 1 푍 = (10) 𝑖 푧 − 휋, 푑 = −1 −1, 𝑖푓 푥 < 0 Where,푑 = 𝑖 +1, 표푡ℎ푒푟푤𝑖푠푒 2.5 Evaluation of Fixed Angle Rotation Algorithm for Sine and Cosine Value Generators using CORDIC In the rotation mode of operation the sine and cosine of the given input angle can be computed simultaneously at an equal set of intervals through constant micro rotations. By setting the Figure 3: consist the ModelSim results for binary input y component of the input vector to be zero, it reduces the angle An =45deg and binary outputs Xn (cos (Zo)), yn(sin rotation mode result to: (Z0)) in the form of waveforms and their corresponding magnitude respectively. xn = An [x0cosz0 – y0sinz0] (11) The following table shows the synthesis report for CORDIC yn = An [y0cosz0 – x0sinz0] fixed angle rotation for calculating sine and cosine of an angle. Table I Synthesis Report

Number of 130 Slices

Maximum 228.7Mhz Frequency

Slice Delay 8.35nSec Product

4. CONCLUSION We have successfully implemented the fixed angle rotation CORDIC algorithm for calculating the sine and cosine of angle, on ModelSim simulator using the VHDL language through repeated shift-add operations and this is one of the main features which makes the CORDIC algorithm to be more attractive for a wide variety of applications. Our design can be Fig 2: Cordic Block For Fixed Angle Rotation implemented on Xilinx Spartan 3 XC3S50 using the Xilinx ISE Design Suite 9.2i and VHDL language. The design module is By setting x0 equal to 1/ An, the rotation of angle through the much more efficient and consumes less area than the specific point on the unit circle produces the unscaled sine and conventional CORDIC algorithm design models. As part of cosine values of the angle argument, z0. The magnitude value is future work, fixed angle CORDIC algorithm can be very of modulated by the sine and cosine values. Using the implemented on FPAA (Field Programmable Analog Array), some special techniques such as look up table requires a pair of Wireless Local Area Network, Hough Transform. multipliers to obtain the modulation. The CORDIC algorithm performs the multiply as a part of rotation operation. Therefore 5. REFERENCES it eliminates the need of explicit multipliers. The output of the [1] Ray Andraka, FPGA '98. Proceedings of the 1998 CORDIC rotator is scaled by a rotator again. If the obtained ACM/SIGDA sixth international symposium on Field gain is not acceptable, a single multiply is performed by the programmable gate arrays, Feb. 22-24, 1998, Monterey, reciprocal of the gain constant placed before the CORDIC CA. pp191-200 rotator and this will yield the unscaled results[1]. It can be noted that the hardware complexity of fixed angle CORDIC [2] Vikas Sharma,"FPGA Implement999ation of EEAS rotator is approximately equally to that of the single multiplier CORDIC based Sine and Cosine Generator",M.Tech unit with the same word size. Thesis,Dept.Electron.Comm.Eng.,Thapar Univ., Patiala, 2009.

30 International Journal of Computer Applications (0975 – 8887) International conference on Innovations in Information, Embedded and Communication Systems (ICIIECS-2014)

[3] Satyasen Panda,"Performance Analysis and Design of a [10] Pramod Kumar Meher., and Sang Yoon Park., “CORDIC Discrete Cosine Transformusing Designs for Fixed Angle Rotation,” IEEE Comput. Mag., CORDICAlgorithm",M.TechThesis,Dept.Electron.Comm. Vol.22,2013,pp.217-228. Eng.,NITRourkela, Rourkela,Orissa,2010. [11] Vladimirova, T. and Tiggler, “FPGA Implementation of [4] Kris Raj, Gaurav Doshi, Hiren Shah [online] Available: Sine and Cosine Generators Using the CORDIC http://teal.gmu.edu/courses/ECE645/projects_S06/talks/C Algorithm”, Proc. of Military and Aerospace Application ORDIC.pdf(URL) of Programmable Devices and Technologies Conference (MAPLD 99), Sep. 1999, Laurel, MA, A-2, pp. 28-30. [5] S.K.Pattanaik and K.K.Mahapatra,'DHT Based JPEG Image Compression Using a Novel Energy Quantization [12] Naveen Kumar and Amandeep Singh Sappal” Coordinate Method", IEEE International Conference on Industrial Rotation Digital Computer Algorithm: Design and Technology,pp.2827-2832,Dec 2006. Architectures”, International Journal of Advanced Computer Science and Applications, Vol. 2, No. 4, 2011, [6] Volder, J.,"Binary Computation Algorithms for coordinate pp 68-71. rotation and functiongeneration,"Convair Report IAR-1 148 Aeroelectrics , June 1956. [13] S.F.Hsiao and J.M.Delosme, \Parallel Singular Value Decomposition of Complex Matrices usijng [7] Volder, J.,"The CORDIC Trigonometric Computing Multi{dimensional CORDIC Algorithms," IEEE Technique,"IRE Trans.Electronic Computing, Vol EC-8, Transactions on Signal Processing, vol. 44, no. 3, pp. pp330-334 Sept 1959. 685{697, March 1996. [8] Walther J.S.,"A unified algorithm for elementary [14] J. Lee and T. Lang, \On-line CORDIC for generalized functions," Spring Joint Computer singular value decomposition," in SPIE Vol. 1058 High Conf.,1971,proc.,pp.379-385. Speed Computing II, pp. 235{47, 1989. [9] Ahmed,H.M.,Delosme, J.M.,and Morf,M.,"Highly [15] S.F.Hsiao and J.M.Delosme, \Householder CORDIC Concurrent Computing Structure for Matrix Arithmetic algorithms," IEEE Transactions on Computers, vol. C{44, and Signal Processing," IEEE Comput. no. 8, pp. 990{1001, Aug. 1995. Mag,,Vol.15,1982,pp.65-82.

31