Hardware of the Elementary Function by CORDIC

It sets to image processing, Usually, Elementary-function operations, such as trigonometric functions and logarithm, are performed. In hardware of image processing, I think that it is useful with the point that hardware the elementary function of these can reduce design loads called shortening of development time. Then, an algorithm called CORDIC was used and processing of sin and cos which are trigonometric functions was fixed-point. A result which can say that the arithmetic precision is equivalent to math.h which is a standard header file of the C language was brought.


Introduction
With advanced features of inclusion apparatus, hardware of image processing is becoming indispensable.And elementary-function operations, such as trigonometric functions, an exponential function, a logarithmic function, are carried out to image processing in many cases.When performing image processing at high speed, improvement in the speed of elementary-function operation becomes indispensable.Then, although processing can be accelerated by using an algorithm called CORDIC as the example and such a hardware library exists, neither performance nor a circuit scale is clarified, and it is difficult for other developers using it.In this research, in various elementary functions, it is flexible, and hardware processing of sin and cos using an algorithm called CORDIC which is simple processing using a table.In this paper, processing of sin and cos is fixed-point, and it is shown that the arithmetic precision is equivalent to the single precision floating point version.Furthermore, processing time, a circuit scale, and clock frequency are clarified through the mounting experiment to FPGA.

The hardware design of trigonometric functions 2.1 CORDIC
First, an algorithm called CORDIC is an algorithm which performs elementary-function operation.It is the repetitive solving method for the ability to obtain the solution convergent by considering a function to be a vector on a two-dimensional plane, and carrying out repetitive calculation of the rotation of a vector.Furthermore, as the preceding clause showed, in various elementary functions, it is flexible.The definitional equation of CORDIC is shown in (1) of the following, (2), and (3).
(1) ( x and y express an x-coordinate and y coordinates, respectively, and z is an angle when it indicates by polar coordinates.It changes by whether a vector rotates to positive direction, or it rotates in the negative direction, and when rotating to positive direction and rotating in 1 and the negative direction, it becomes a value of -1.m differs in a value according to the kind of function.When m is 1, coordinates like sin or cos are a function which changes in the shape of a circle, and when m is -1 and the function and m from which coordinates like sinh or cosh change in the shape of a hyperbola are 0, coordinates are a function which carries out alignment change.Concretely, the example of a function realizable with these values is shown in the DOI: 10.12792/iciae2013.036 following Table 1.Although Mode of Table 1 has two, rotation and vectoring, this is the difference in the method of convergence.In Rotation, the angle Z is completed as the input by rotation of a vector, and, in vectoring, y coordinates are completed as 0 by rotation of a vector. Table1.The example of a function by CORDIC Thus, CORDIC is excellent in the point that various elementary functions are realizable, by changing m and Mode.Next, the formula which asks for the angle required in order to rotate a vector with this algorithm is shown in following (4).This angle is repeated and it asks according to the number of times.Since a solution can be converged by repeating at least 17 times, from to is used in fact.to be used is shown in the following Table 2.Moreover, after converging a vector using Table 2, a formula (1), (2), and (3) about X R and Y R of Table 1, division is done by R of the absolute value of the vector.As an example, the right triangle in j= 0 of Table 2, Only the case of j= 0, 1, and 2 is illustrated in Fig. 1.However, when calculating X R and Y R of Table 1 with the elementary function derived this time, the absolute value of the conversion vector in j= 17 is required.In practice, X R and Y R can be calculated by doing division of the X coordinate and y coordinate for which it asked by the formula ( 1) and ( 2) by R 17 .

Design of Hardware
The data path of hardware is shown in Fig. 2 in the hardware design of sin and cos using a CORDIC algorithm.Although the algorithm of the preceding clause was hardware obediently fundamentally, some initial values, number of times of a repetition, etc. were changed.
Fig2.The data path of hardware By this hardware, in the state S1, 16 bit shifts of the input angle deg are carried out to the left, and it is set to Z1.
In the state S2, count +1 bit shift of X0 and Y0 is carried out to the right, and it is set to XX and YY.Moreover, only 1 will be added if count will be in the state S4.
In the state S3, X0 and YY, Y0 and XX , Z0, and arctan are subtracted and added, and each calculation result is set to X1, Y1, and ZZ by performing size comparison of Z1 and Z0.In addition, arctan changes with count and a value is the same value as the table for convergence of Table 2.
In the state S4, X1, Y1, and ZZ which were calculated by S3 are set to X0, Y0, and Z0, respectively, and one is further added to count.
If count is set to 16, it will change in the state S5, and except it, it returns to S2 and calculates to S4 again.
In the state S5, 32768 is added to X0 and Y0, respectively for rounding off, and it is set to X1 and Y1 In the state S6, X1 and Y1 are multiplied by r, and calculation of cos and sin is completed.

Experiment/Results
It verified by measuring the accuracy of the developed fixed-point version with the processing result of sin and cos of math.h which is a standard header file of the C language.However, since the decimal fraction of the output of the developed program was calculated as 24 bits, it compared with the processing result of math.h by multiplying by .The error by an input angle is shown in the following Table 4.By this hardware, since it processed using the multiplier without using the division machine, the number of a Registers and LUTs were able to be lessened.

Conclusions
The method of fixed-point-izing at the time of making a CORDIC algorithm into hardware and the details of hardware were shown.By verification of accuracy, it checked that there was accuracy equivalent to the value of math.h, and the details of the circuit scale were shown.From now on, performance gain by pipeline processing is performed and comparison of a circuit scale with model processing or a clock period is performed one by one.Moreover, Hardware of elementary functions other than trigonometric functions is verified.Furthermore, the library of the elementary function by CORDIC is created.I think that what is necessary is just to be able to provide for a researcher.

Table2
of convergence, the arbitrary angles from 0 [deg] to 90 [deg] can be denoted by sufficient accuracy with the combination of addition and subtraction from to Fig 1.Right triangle used by CORDIC

Table4
said that it is equivalent to the accuracy of the fixed-point version developed from this result, and math.h.Next, designed hardware was mounted in SPARTAN-6 of Xilinx.The result, It turned out that the clock period can operate by 6.074[ns].A circuit scale is shown in Table5.Table5.The circuit scale at the time of mounting