1 |
2 |
feddischso |
\documentclass[a4paper, 12pt, notitlepage]{report}
|
2 |
|
|
|
3 |
|
|
\usepackage{amsfonts}
|
4 |
|
|
\usepackage{graphicx}
|
5 |
|
|
\usepackage{fullpage}
|
6 |
|
|
\usepackage[pagewise]{lineno}
|
7 |
|
|
\usepackage{hyperref}
|
8 |
|
|
\usepackage{longtable}
|
9 |
|
|
\usepackage{ltxtable}
|
10 |
|
|
\usepackage[usenames,dvipsnames]{color}
|
11 |
|
|
\usepackage{colortbl}
|
12 |
|
|
\usepackage{tabularx, booktabs}
|
13 |
|
|
\usepackage{multirow}
|
14 |
|
|
\usepackage{dirtree}
|
15 |
|
|
\definecolor{tableheadcolor}{gray}{0.8}
|
16 |
|
|
\definecolor{darkblue}{rgb}{0,0,.5}
|
17 |
|
|
\definecolor{gray}{gray}{0.95}
|
18 |
|
|
\definecolor{lightgray}{gray}{0.95}
|
19 |
|
|
\newcommand{\file}[1]{\textbf{#1}}
|
20 |
|
|
\newcommand{\state}[1]{{\tt\textbf{#1}}}
|
21 |
|
|
\newcommand{\signal}[1]{{\textbf{\tt#1}}}
|
22 |
|
|
\title{YAC - Yet Another CORDIC Core}
|
23 |
|
|
\author{Christian Haettich [feddischson@opencores.org]}
|
24 |
|
|
\date{\today}
|
25 |
|
|
|
26 |
|
|
\begin{document}
|
27 |
|
|
|
28 |
|
|
%%%%%%%%%% PRELIMINARY MATERIAL %%%%%%%%%%
|
29 |
|
|
\maketitle
|
30 |
|
|
\begin{center}
|
31 |
|
|
IP core and C-model documentation
|
32 |
|
|
\end{center}
|
33 |
|
|
\thispagestyle{empty}
|
34 |
|
|
|
35 |
|
|
\tableofcontents
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
\chapter{Organization and Introduction}
|
39 |
|
|
\section{History}
|
40 |
|
|
\begin{table}[htbp]
|
41 |
|
|
\center
|
42 |
|
|
\begin{tabular}{@{}llll@{}}
|
43 |
|
|
\rowcolor{tableheadcolor}\textbf{Version}& \textbf{Date} & \textbf{Description} & \textbf{Author} \\
|
44 |
|
|
|
45 |
|
|
\multirow{1}{*}{0.01} & 4th March 2014 & Initial document & Christian Haettich\\\midrule
|
46 |
|
|
\bottomrule
|
47 |
|
|
\end{tabular}
|
48 |
|
|
\caption{History}
|
49 |
|
|
\label{tab:frqband}
|
50 |
|
|
\end{table}
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
\section{Folder and Files}
|
54 |
|
|
|
55 |
|
|
\dirtree{%
|
56 |
|
|
.1 /.
|
57 |
|
|
.2 c\_octave.
|
58 |
|
|
.3 cordic\_iterative.c\DTcomment{C-code for bit accurate model}.
|
59 |
|
|
.3 cordic\_iterative\_code.m\DTcomment{Script to auto-generate VHDL and C-code}.
|
60 |
|
|
.3 cordic\_iterative\_test.m\DTcomment{YAC performance analysis script}.
|
61 |
|
|
.2 doc.\DTcomment{Contains files to create this documentation}.
|
62 |
|
|
.2 licenses.
|
63 |
|
|
.3 lgpl-3.0.txt\DTcomment{LGPL license}.
|
64 |
|
|
.2 README.txt\DTcomment{A short read-me file}.
|
65 |
|
|
.2 rtl.
|
66 |
|
|
.3 vhdl.
|
67 |
|
|
.4 cordic\_iterative\_int.vhd\DTcomment{Top-level VHDL file}.
|
68 |
|
|
.4 cordic\_iterative\_pkg.vhd\DTcomment{VHDL package file}.
|
69 |
|
|
.4 cordic\_iterative\_tb.vhd\DTcomment{VHDL testbench}.
|
70 |
|
|
}
|
71 |
|
|
|
72 |
|
|
\section{License}
|
73 |
|
|
Copyright (c) 2014, Christian Haettich, All rights reserved. \newline\newline
|
74 |
|
|
YAC is free software; you can redistribute it and/or
|
75 |
|
|
modify it under the terms of the GNU Lesser General Public
|
76 |
|
|
License as published by the Free Software Foundation; either
|
77 |
|
|
version 3.0 of the License, or (at your option) any later version. \newline\newline
|
78 |
|
|
YAC is distributed in the hope that it will be useful,
|
79 |
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
80 |
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
81 |
|
|
Lesser General Public License for more details. \newline\newline
|
82 |
|
|
You should have received a copy of the GNU Lesser General Public
|
83 |
|
|
License along with this library. If not, download it from
|
84 |
|
|
http://www.gnu.org/licenses/lgpl
|
85 |
|
|
|
86 |
|
|
|
87 |
|
|
\section{The CORDIC algorithm}
|
88 |
|
|
|
89 |
|
|
The CORDIC algorithm is used to do trigonometric, hyperbolic, multiplication
|
90 |
|
|
and division calculations in a hardware-efficient way. This means, that
|
91 |
|
|
only bit-shift, addition and subtraction operations in combination
|
92 |
|
|
with a lookup-table is required.\newline
|
93 |
|
|
Good introductions are available in \cite{survey}\cite{vlsi}\cite{dawid}.
|
94 |
|
|
A description on wikibook.org \cite{wikibook} is also useful.
|
95 |
|
|
For this reason, no more introduction is given here and the following chapters assume, that
|
96 |
|
|
the reader is familiar with the CORDIC algorithm.
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
\chapter{IP-Core Description}
|
100 |
|
|
|
101 |
|
|
The two files \file{cordic\_iterative\_int.vhd} and \file{cordic\_iterative\_pkg.vhd}
|
102 |
|
|
implements an iterative CORDIC algorithm in fixed-point format.
|
103 |
|
|
Iterative means, that the IP-core is started with a set of input data and after
|
104 |
|
|
a specific amount of clock cycles, the result is available. No parallel data
|
105 |
|
|
can be processed. The
|
106 |
|
|
following six modes are supported:
|
107 |
|
|
\begin{itemize}
|
108 |
|
|
\item trigonometric rotation
|
109 |
|
|
\item trigonometric vectoring
|
110 |
|
|
\item linear rotation
|
111 |
|
|
\item linear vectoring
|
112 |
|
|
\item hyperbolic rotation
|
113 |
|
|
\item hyperbolic vectoring
|
114 |
|
|
\end{itemize}
|
115 |
|
|
|
116 |
|
|
\section{Port Description}
|
117 |
|
|
\begin{table}[htbp]
|
118 |
|
|
\center
|
119 |
|
|
\begin{tabular}{@{}lllll@{}}
|
120 |
|
|
\rowcolor{tableheadcolor}\textbf{Name}& \textbf{Type} & \textbf{Direction} & \textbf{Size} & \textbf{Description} \\
|
121 |
|
|
|
122 |
|
|
\multirow{1}{*}{clk} & std\_logic & input & 1 & clock \\\midrule
|
123 |
|
|
\multirow{1}{*}{rst} & std\_logic & input & 1 & synchronous reset \\\midrule
|
124 |
|
|
\multirow{1}{*}{en} & std\_logic & input & 1 & clock-enable \\\midrule
|
125 |
|
|
\multirow{1}{*}{start} & std\_logic & input & 1 & start trigger \\\midrule
|
126 |
|
|
\multirow{1}{*}{done} & std\_logic & output & 1 & done indicator \\\midrule
|
127 |
|
|
\multirow{1}{*}{mode} & std\_logic\_vector & input & 4 & mode configuration \\\midrule
|
128 |
|
|
\multirow{1}{*}{x\_i} & std\_logic\_vector & input & XY\_WIDTH & X input vector \\\midrule
|
129 |
|
|
\multirow{1}{*}{y\_i} & std\_logic\_vector & input & XY\_WIDTH & Y input vector \\\midrule
|
130 |
|
|
\multirow{1}{*}{a\_i} & std\_logic\_vector & input & A\_WIDTH + 2 & angular input vector \\\midrule
|
131 |
|
|
\multirow{1}{*}{x\_o} & std\_logic\_vector & input & XY\_WIDTH + GUARD\_BITS & X output vector \\\midrule
|
132 |
|
|
\multirow{1}{*}{y\_o} & std\_logic\_vector & input & XY\_WIDTH + GUARD\_BITS & Y output vector \\\midrule
|
133 |
|
|
\multirow{1}{*}{a\_o} & std\_logic\_vector & input & A\_WIDTH + 2 & angular output vector \\\midrule
|
134 |
|
|
\bottomrule
|
135 |
|
|
\end{tabular}
|
136 |
|
|
\caption{Port description}
|
137 |
|
|
\label{tab:ports}
|
138 |
|
|
\end{table}
|
139 |
|
|
|
140 |
|
|
\begin{figure}[p]
|
141 |
|
|
\centering
|
142 |
|
|
\includegraphics{figs/block_symbol.pdf}
|
143 |
|
|
\caption{YAC block symbol}
|
144 |
|
|
\label{fig:ports}
|
145 |
|
|
\end{figure}
|
146 |
|
|
Table \ref{tab:ports} and Figure \ref{fig:ports} gives an overview
|
147 |
|
|
of the YAC ports.
|
148 |
|
|
The three input ports start, done and mode and are used to interact
|
149 |
|
|
with an external state machine or with a software driver.
|
150 |
|
|
After setting \signal{start} to high, the YAC starts processing.
|
151 |
|
|
If all necessary rotations are done, the \signal{done} output is set to
|
152 |
|
|
high for one clock cycle.
|
153 |
|
|
When starting the YAC, all other inputs must contain valid data.
|
154 |
|
|
The mode input is used to select the CORDIC mode.
|
155 |
|
|
Table \ref{fig:ports} shows all input and output ports and Figure
|
156 |
|
|
\ref{fig:ports} shows a CORDIC block symbol: $x_i, y_i, a_i, x_o, y_o, a_o$
|
157 |
|
|
are data ports whereas start, done and mode are configuration signals.
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
|
161 |
|
|
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
\section{Parameter Description}
|
165 |
|
|
\begin{table}[htbp]
|
166 |
|
|
\center
|
167 |
|
|
\begin{tabular}{@{}lllll@{}}
|
168 |
|
|
\rowcolor{tableheadcolor}\textbf{Name}& \textbf{type} & \textbf{size} & \textbf{Description} \\
|
169 |
|
|
|
170 |
|
|
\multirow{1}{*}{XY\_WIDTH} & natural & defines the size of x and y input and output vectors \\\midrule
|
171 |
|
|
\multirow{1}{*}{A\_WIDTH} & natural & defines the size of the angular input and output vectors \\\midrule
|
172 |
|
|
\multirow{1}{*}{GUARD\_BITS} & natural & defines the number of guard bits \\\midrule
|
173 |
|
|
\multirow{1}{*}{RM\_GAIN} & natural & defines the precision of the CORDIC gain removal \\\midrule
|
174 |
|
|
\bottomrule
|
175 |
|
|
\end{tabular}
|
176 |
|
|
\caption{Parameter description}
|
177 |
|
|
\label{tab:params}
|
178 |
|
|
\end{table}
|
179 |
|
|
Table \ref{tab:params} shows the four parameter, which can be used to parameterize
|
180 |
|
|
the YAC.
|
181 |
|
|
|
182 |
|
|
|
183 |
|
|
\section{Mode description}
|
184 |
|
|
With the mode-input, it is possible to select between circular, linear and hyperbolic
|
185 |
|
|
operation as well as between rotation and vectoring operations:
|
186 |
|
|
\begin{itemize}
|
187 |
|
|
\item mode(1:0) = "00" selects circular operation
|
188 |
|
|
\item mode(1:0) = "01" selects linear operation
|
189 |
|
|
\item mode(1:0) = "10" selects hyperbolic operation
|
190 |
|
|
\item mode(1:0) = "11" is reserved
|
191 |
|
|
\item mode(3) = '0' selects rotation
|
192 |
|
|
\item mode(3) = '1' selects vectoring
|
193 |
|
|
\end{itemize}
|
194 |
|
|
The package cordic\_iterative\_int.vhd contains the following defines to
|
195 |
|
|
setup the mode:
|
196 |
|
|
\begin{itemize}
|
197 |
|
|
\item VAL\_MODE\_CIRC = "00"
|
198 |
|
|
\item VAL\_MODE\_LIN = "01"
|
199 |
|
|
\item VAL\_MODE\_HYP = "10"
|
200 |
|
|
\item I\_FLAG\_VEC\_ROT = 3 (bit index)
|
201 |
|
|
\end{itemize}
|
202 |
|
|
For example if a hyperbolic rotation mode is required, the mode input is "0010",
|
203 |
|
|
and for the linear vector operation, the mode input is "1001".
|
204 |
|
|
Please note, that bit number 2 is reserved for future implementations.\newline
|
205 |
|
|
Table \ref{tab:modes} defines the behaviour of the YAC
|
206 |
|
|
for different mode configurations.
|
207 |
|
|
\begin{table}[htbp]
|
208 |
|
|
\center
|
209 |
|
|
\begin{tabular}{@{}ll@{}}
|
210 |
|
|
\rowcolor{tableheadcolor}\textbf{Setup}& \textbf{Description} \\
|
211 |
|
|
|
212 |
|
|
\multirow{2}{*}{mode =( FLAG\_VEC\_ROT = 1, VAL\_MODE\_CIR ) } & $a_o = \textrm{atan2}( y_i, x_i ) \cdot \beta, $\\
|
213 |
|
|
& $x_o = \sqrt{ x_i^2+y_i^2 } $ \\\midrule
|
214 |
|
|
\multirow{2}{*}{mode =( FLAG\_VEC\_ROT = 0, VAL\_MODE\_CIR ) } & $x_o = \cos( a_i / \beta ) \cdot \alpha $\\
|
215 |
|
|
& $y_o = \sin( a_i / \beta ) \cdot \alpha $\\\midrule
|
216 |
|
|
\multirow{1}{*}{mode =( FLAG\_VEC\_ROT = 1, VAL\_MODE\_LIN ) } & $a_o = z + y/x $\\\midrule
|
217 |
|
|
\multirow{1}{*}{mode =( FLAG\_VEC\_ROT = 0, VAL\_MODE\_LIN ) } & $a_o = y + x\cdot z $ $ $\\\midrule
|
218 |
|
|
\multirow{2}{*}{mode =( FLAG\_VEC\_ROT = 1, VAL\_MODE\_HYP ) } & $a_o = \textrm{tanh}( y_i / x_i ) \cdot \beta, $\\
|
219 |
|
|
& $x_o = \sqrt{ x_i^2-y_i^2 } $\\\midrule
|
220 |
|
|
\multirow{2}{*}{mode =( FLAG\_VEC\_ROT = 0, VAL\_MODE\_HYP ) } & $x_o = \cosh( a_i / \beta ) \cdot \alpha$\\
|
221 |
|
|
& $y_o = \sinh( a_i / \beta ) \cdot \alpha$\\
|
222 |
|
|
\bottomrule
|
223 |
|
|
\end{tabular}
|
224 |
|
|
\caption{Mode description (see equation \ref{eqn:alpha} and \ref{eqn:beta} for $\alpha$ and $\beta$)}
|
225 |
|
|
\label{tab:modes}
|
226 |
|
|
\end{table}
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
\section{Data Range and Limitations}
|
230 |
|
|
|
231 |
|
|
Both, the $x_i$ and $y_i$ inputs are defined with a size of $XY\_WIDTH$ and therefore,
|
232 |
|
|
the maximum positive value in the two's complement format is
|
233 |
|
|
\begin{eqnarray}
|
234 |
|
|
\alpha & = & 2^{XY\_WIDTH-1}-1
|
235 |
|
|
\label{eqn:alpha}
|
236 |
|
|
\end{eqnarray}
|
237 |
|
|
The angle input $a_i$ is defined with a size of $A\_WIDTH+2$.
|
238 |
|
|
The value $\beta$ is defined with
|
239 |
|
|
\begin{eqnarray}
|
240 |
|
|
\beta & = & 2^{A\_WIDTH-1} -1
|
241 |
|
|
\label{eqn:beta}
|
242 |
|
|
\end{eqnarray}
|
243 |
|
|
|
244 |
|
|
\subsection{Circular Vectoring Mode}
|
245 |
|
|
|
246 |
|
|
The valid input range for $x_i$ and $y_i$ is $-\alpha ... +\alpha$.
|
247 |
|
|
The angular input $a_i$ is ignored.
|
248 |
|
|
|
249 |
|
|
\subsection{Circular Rotation Mode}
|
250 |
|
|
The valid input range for $x_i$ and $y_i$ is $-\alpha ... +\alpha$.
|
251 |
|
|
For the angular input $a_i$, values between $-\beta\pi$ and $+\beta\pi$ are valid.
|
252 |
|
|
For calculating a complex rotation of a complex vector, all three inputs
|
253 |
|
|
are required. For calculating $\sin$ and $\cos$, $x_i$ is set to $\alpha$
|
254 |
|
|
and $y_i$ to 0, the angle input $a_i$ gets the angle.
|
255 |
|
|
|
256 |
|
|
\subsection{Linear Vectoring Mode}
|
257 |
|
|
The linear vectoring mode is used to calculate $y_i / x_i$. The limitation
|
258 |
|
|
of this operation is the following:
|
259 |
|
|
\begin{eqnarray}
|
260 |
|
|
\frac{y_i}{x_i} \le 2
|
261 |
|
|
\end{eqnarray}
|
262 |
|
|
The valid input values for $x_i$ and $y_i$ are $-\alpha ... +\alpha$.
|
263 |
|
|
|
264 |
|
|
\subsection{Linear Rotation Mode}
|
265 |
|
|
The two inputs $x_i$ and $y_i$ have a valid data range between $-\alpha$ and $+\alpha$.
|
266 |
|
|
|
267 |
|
|
|
268 |
|
|
\subsection{Hyperbolic Vectoring Mode}
|
269 |
|
|
The data-range for $x_i$ and $y_i$ is $-0.79 \cdot \alpha$ to $0.79 \cdot \alpha$.
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
\subsection{Hyperbolic Rotation Mode}
|
273 |
|
|
The data-range for $a_i$ is $-\beta ... \beta$. Typically, $x_i$ is set to
|
274 |
|
|
$\alpha$ and $y_i$ to 0.
|
275 |
|
|
|
276 |
|
|
\section{Internal Operation}
|
277 |
|
|
\begin{figure}[p]
|
278 |
|
|
\centering
|
279 |
|
|
\includegraphics[width=200pt]{figs/state_diagram.pdf}
|
280 |
|
|
\caption{State diagram}
|
281 |
|
|
\label{fig:states}
|
282 |
|
|
\end{figure}
|
283 |
|
|
Five states are used do to the CORDIC algorithm. The five states are visualized in a
|
284 |
|
|
state diagram in Figure \ref{fig:states}.
|
285 |
|
|
After reset, the YAC goes into the \state{ST\_IDLE} state. Only in this state, the
|
286 |
|
|
start signal is accepted. After starting the YAC, the state switches from
|
287 |
|
|
the \state{ST\_IDLE} state to the \state{ST\_INIT} state. The init state does some initial
|
288 |
|
|
rotations/flipping.
|
289 |
|
|
After initialization, the main rotation starts with the \state{ST\_ROTATION} state
|
290 |
|
|
(there are a few cases, where no further rotations are required, see next sections).
|
291 |
|
|
Every rotation step is done within two clock cycles: in the first cycle,
|
292 |
|
|
the angular value is loaded from the lookup-table and shifted. In addition,
|
293 |
|
|
the x and y values are shifted. In the second
|
294 |
|
|
clock cycle, the results are added according to the CORDIC algorithm.
|
295 |
|
|
After all required iterations are done, the state switches to
|
296 |
|
|
the \state{RM\_GAIN} state, where the CORDIC gain is removed (depending on
|
297 |
|
|
the mode). The last state \state{ST\_DONE} is only used to set the done flag to
|
298 |
|
|
'1' for one clock cycle. After this, the YAC returns to the \state{ST\_IDLE} state.
|
299 |
|
|
|
300 |
|
|
|
301 |
|
|
|
302 |
|
|
\subsection{Initialization}
|
303 |
|
|
During the initialization state ST\_INIT, pre-rotations are done, depending on
|
304 |
|
|
the selected mode.
|
305 |
|
|
|
306 |
|
|
|
307 |
|
|
\subsubsection{Circular Vectoring Mode}
|
308 |
|
|
Because we support atan2 and not atan, we do the following pre-rotations.
|
309 |
|
|
Some specific input values don't need a further processing, for
|
310 |
|
|
example $atan( 0, 0 )$.\newline\newline
|
311 |
|
|
\begin{tabular}{@{}lp{380pt}@{}}
|
312 |
|
|
\rowcolor{tableheadcolor}\textbf{Input} &\textbf{ Description } \\
|
313 |
|
|
|
314 |
|
|
$x_i = 0, y_i = 0$ & Fixed result: $x_o = 0, a_o = 0$,
|
315 |
|
|
to support cartesian to polar coordinate transformations,
|
316 |
|
|
further processing is skipped \\ \midrule
|
317 |
|
|
|
318 |
|
|
$x_i = 0, y_i > 0 $ & Fixed result: $x_o = y_i, a_o = \pi/2$,
|
319 |
|
|
further processing is skipped \\ \midrule
|
320 |
|
|
|
321 |
|
|
$x_i = 0, y_i < 0 $ & Fixed result: $x_o = -y_i, a_o = -\pi/2$,
|
322 |
|
|
further processing is skipped \\ \midrule
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
$x_i < 0, y_i < 0 $ & Pre-rotation from the third to the first quadrant,
|
326 |
|
|
the angular register is initialized with $-\pi$ and
|
327 |
|
|
the sign of the $x$ and $y$ register is flipped. \\ \midrule
|
328 |
|
|
|
329 |
|
|
$x_i < 0, y_i \ge 0 $ & Pre-rotation from the second to the fourth quadrant,
|
330 |
|
|
the angular register is initialized with $\pi$ and
|
331 |
|
|
the sign of the $x$ and $y$ register is flipped. \\ \midrule
|
332 |
|
|
|
333 |
|
|
|
334 |
|
|
$x_i = + \alpha, y_i = + \alpha $ & Fixed result: $x_o = \sqrt{2} \cdot \alpha, a_o = \frac{\pi}{4} \cdot \beta$ ,
|
335 |
|
|
further processing is skipped \\ \midrule
|
336 |
|
|
|
337 |
|
|
$x_i = + \alpha, y_i = - \alpha $ & Fixed result: $x_o = \sqrt{2} \cdot \alpha, a_o = - \frac{\pi}{4} \cdot \beta$,
|
338 |
|
|
further processing is skipped \\ \midrule
|
339 |
|
|
|
340 |
|
|
$x_i = - \alpha, y_i = + \alpha $ & Fixed result: $x_o = \sqrt{2} \cdot \alpha, a_o = \frac{3 \pi}{4} \cdot \beta$,
|
341 |
|
|
further processing is skipped \\ \midrule
|
342 |
|
|
|
343 |
|
|
$x_i = - \alpha, y_i = - \alpha $ & Fixed result: $x_o = \sqrt{2} \cdot \alpha, a_o = - \frac{3 \pi }{4} \cdot \beta$ ,
|
344 |
|
|
further processing is skipped \\
|
345 |
|
|
\bottomrule
|
346 |
|
|
\end{tabular}
|
347 |
|
|
|
348 |
|
|
\subsubsection{Circular Rotation Mode}
|
349 |
|
|
The following pre-rotations are done:\newline\newline
|
350 |
|
|
\begin{tabular}{@{}lp{380pt}@{}}
|
351 |
|
|
\rowcolor{tableheadcolor}\textbf{Input} &\textbf{ Description } \\
|
352 |
|
|
|
353 |
|
|
$a_i < - \frac{\pi}{2}$ & Pre-rotation from the third to the first quadrant,
|
354 |
|
|
the sign of the $x$ and $y$ register is flipped,
|
355 |
|
|
the angular register is initialized with $\pi$ \\ \midrule
|
356 |
|
|
|
357 |
|
|
$a_i > \frac{\pi}{2}$ & Pre-rotation from the second to the fourth quadrant,
|
358 |
|
|
the sign of the $x$ and $y$ register is flipped,
|
359 |
|
|
the angular register is initialized with $-\pi$ \\
|
360 |
|
|
\bottomrule
|
361 |
|
|
\end{tabular}
|
362 |
|
|
|
363 |
|
|
\subsubsection{Linear Vectoring Mode}
|
364 |
|
|
The following pre-rotations are done:\newline\newline
|
365 |
|
|
\begin{tabular}{@{}lp{380pt}@{}}
|
366 |
|
|
\rowcolor{tableheadcolor}\textbf{Input} &\textbf{ Description } \\
|
367 |
|
|
|
368 |
|
|
$x_i < 0$ & Pre-rotation from the left half to the right half, thus
|
369 |
|
|
the sign of the $x$ and $y$ register is flipped \\
|
370 |
|
|
\bottomrule
|
371 |
|
|
\end{tabular}
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
\subsection{Rotation}
|
375 |
|
|
|
376 |
|
|
\subsubsection{Hyperbolic Repetitions}
|
377 |
|
|
The following iteration steps are repeated for convergence of the hyperbolic mode:
|
378 |
|
|
\begin{eqnarray}
|
379 |
|
|
4, 13, 40, 121, ..., 3i+1
|
380 |
|
|
\end{eqnarray}
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
|
|
\section{Testbench}
|
385 |
|
|
A VHDL testbench (cordic\_iterative\_tb.vhd) is available which reads from an input file
|
386 |
|
|
data. This data is fed into the YAC. In addition, the input file must
|
387 |
|
|
provide the output data, which is expected from the YAC processing.
|
388 |
|
|
The following format is used in the testbench input-file:
|
389 |
|
|
\begin{verbatim}
|
390 |
|
|
x_i y_i a_i x_o y_o a_o mode
|
391 |
|
|
|
392 |
|
|
1234 1234 1234 1234 1234 1234 111 \
|
393 |
|
|
2345 2345 2345 2345 2345 2345 222 | 7 columns:
|
394 |
|
|
3456 3456 3456 3456 3456 3456 333 | 3 input, 3 output and one mode
|
395 |
|
|
... ... |
|
396 |
|
|
... |
|
397 |
|
|
...
|
398 |
|
|
\end{verbatim}
|
399 |
|
|
The data must be in the two's complement with a base of 10.
|
400 |
|
|
After processing all lines, the testbench prints some info, how much
|
401 |
|
|
tests failed.\newline
|
402 |
|
|
For generating the test-patterns, the C-model with octave is used. By running
|
403 |
|
|
the script \file{cordic\_iterative\_test.m}, an entry
|
404 |
|
|
in the testbech data file is done for every cordic calculation.
|
405 |
|
|
|
406 |
|
|
|
407 |
|
|
\chapter{Using the C-Model with Octave or Matlab}
|
408 |
|
|
For using the C-model, open octave or Matlab and compile the C-Model
|
409 |
|
|
with \newline
|
410 |
|
|
\textit{mex cordic\_iterative.c}
|
411 |
|
|
Afterwards, the C-model can be used in Octave/Matlab with the function call\newline
|
412 |
|
|
{\tt [ x\_o, y\_o, a\_o, it ] = cordic\_iterative( x\_i, y\_i, a\_i, mode, XY\_WIDTH, ANGLE\_WIDTH,
|
413 |
|
|
GUARD\_BITS, RM\_GAIN )}.\newline
|
414 |
|
|
The input and output arguments reflect almost the ports and parameters of the
|
415 |
|
|
VHDL toplevel implementation, except that there is no done, start clk and rst port
|
416 |
|
|
in the C-model. In addition, the last argument provides the number of iterations,
|
417 |
|
|
which are done.\newline \newline
|
418 |
|
|
The input arguments x\_i, y\_i, and a\_i can be 1xN vectors with N elements.
|
419 |
|
|
In this case, this three input arguments must have the same size. All
|
420 |
|
|
output arguments will also have the same size 1xN.
|
421 |
|
|
|
422 |
|
|
|
423 |
|
|
|
424 |
|
|
\section{Guard-Bits -- Input and output sizes}
|
425 |
|
|
It is possible to define MSB guard bits.
|
426 |
|
|
The need of MSB guard bits have several reasons. On the one hand,
|
427 |
|
|
they are required to handle the data growth of the cordic gain within the rotation state.
|
428 |
|
|
(which is compensated later). A nother reason is the data growth caused by the choise of
|
429 |
|
|
input data. For example
|
430 |
|
|
\begin{eqnarray}
|
431 |
|
|
\sqrt{ \alpha^2 + \alpha^2 } = \sqrt{2} \alpha
|
432 |
|
|
\end{eqnarray}
|
433 |
|
|
and therefore, a growth by the factor $\sqrt{2}$ happens, if an absolute calculation
|
434 |
|
|
of the two maximum input values is processed.\newline
|
435 |
|
|
\newline
|
436 |
|
|
Another point is the input and output size of the angular values ($a_i$ and $a_o$)
|
437 |
|
|
Because within this YAC, $\beta$ represents the angle 1, the input and output with
|
438 |
|
|
of $a_i$ and $a_o$ is A\_WIDTH+2, which allows to process angle values within
|
439 |
|
|
$-\pi ... \pi$
|
440 |
|
|
|
441 |
|
|
|
442 |
|
|
\subsection{Input data width versus iterations}
|
443 |
|
|
The number of iterations depends on the width of the input data.
|
444 |
|
|
Input data with $X$ bit require $X+1$ rotations \cite{dawid}.
|
445 |
|
|
This requires, that the number of iterations are adapted. One solution might
|
446 |
|
|
be to detect the size of the input data and use this information for the CORDIC processing.
|
447 |
|
|
In YAC, a different sheme was chosen: the rotations are done until
|
448 |
|
|
\begin{itemize}
|
449 |
|
|
\item the angular register is 0 or doesn't change (in case of the rotation mode)
|
450 |
|
|
\item the y register is 0 or doesn't change (in case of the vecotring mode).
|
451 |
|
|
\end{itemize}
|
452 |
|
|
This results in a dynamic iterations adaption, depending the the input data width.
|
453 |
|
|
|
454 |
|
|
\chapter{Performance}
|
455 |
|
|
The performance is evaluated through the matlab script \file{cordic\_iterative\_test.m}.
|
456 |
|
|
|
457 |
|
|
|
458 |
|
|
\chapter{Open issues and future work}
|
459 |
|
|
|
460 |
|
|
\section{Next steps}
|
461 |
|
|
\begin{itemize}
|
462 |
|
|
\item Add YAC to a FPGA based System-on-Chip to prove
|
463 |
|
|
FPGA feasibility
|
464 |
|
|
\item Performance optimization
|
465 |
|
|
\item circuit optimizations
|
466 |
|
|
\item numerical optimizations
|
467 |
|
|
\end{itemize}
|
468 |
|
|
|
469 |
|
|
\section{Future plans}
|
470 |
|
|
\begin{itemize}
|
471 |
|
|
\item Hyperbolic range extension
|
472 |
|
|
\item Floating point CORDIC
|
473 |
|
|
\end{itemize}
|
474 |
|
|
|
475 |
|
|
|
476 |
|
|
|
477 |
|
|
%%%%%%%%%% BIBLIOGRAPHY %%%%%%%%%%
|
478 |
|
|
\begin{thebibliography}{9}
|
479 |
|
|
|
480 |
|
|
\bibitem{survey}
|
481 |
|
|
Andraka, Ray; \textit{A survey of CORDIC algorithms for FPGA based computers}
|
482 |
|
|
|
483 |
|
|
\bibitem{vlsi}
|
484 |
|
|
Hu, Yu Hen; \textit{CORDIC-Based VLSI Architectures for Digital Signal Processing}
|
485 |
|
|
|
486 |
|
|
\bibitem{wikibook}
|
487 |
|
|
CORDIC on wikibook: \url{http://en.wikibooks.org/wiki/Digital_Circuits/CORDIC}
|
488 |
|
|
|
489 |
|
|
\bibitem{dawid}
|
490 |
|
|
David, Herbert; Meyr, Heinricht; \textit{CORDIC Algorithms and Architectures}
|
491 |
|
|
\url{http://www.eecs.berkeley.edu/newton/Classes/EE290sp99/lectures/ee290aSp996_1/cordic_chap24.pdf}
|
492 |
|
|
\end{thebibliography}
|
493 |
|
|
\end{document}
|
494 |
|
|
|
495 |
|
|
|
496 |
|
|
%
|
497 |
|
|
%
|
498 |
|
|
% Opencores Description
|
499 |
|
|
%
|
500 |
|
|
% For this project GIT is preferred as revision control and therefore, the files under development are located on https://github.com/feddischson/yac.
|
501 |
|
|
% Nevertheless, stable intermediate steps are place here on SVN.
|
502 |
|
|
%
|
503 |
|
|
%
|
504 |
|
|
%
|
505 |
|
|
%
|
506 |
|
|
%
|
507 |
|
|
%
|