All Packages Class Hierarchy This Package Previous Next Index
Class byucc.jhdl.modgen.Cordic
java.lang.Object
|
+----byucc.jhdl.base.Nameable
|
+----byucc.jhdl.base.Node
|
+----byucc.jhdl.base.Cell
|
+----byucc.jhdl.base.Structural
|
+----byucc.jhdl.Logic.Logic
|
+----byucc.jhdl.modgen.Cordic
- public class Cordic
- extends Logic
General Description
This builds a generic width CORDIC unit. The CORDIC is parameterized
with respect to wordsize, number of iterations, pipeline depth, angle
type, and CORDIC function.
Hardware to extend the domain of the CORDIC to +/-180 degrees can also
be generated.
For an introduction to CORDIC processors, see Andraka, Ray. A survey of
CORDIC algorithms for FPGA based computers.
Implementation
All Technologies
CORDIC units can have a maximum wordsize of 32 bits, and a maximum number
of iterations = 31.
All the input x,y,z and output x,y,z must be the same wordsize.
Selecting Cordic function and angle type
The function and angle type of the CORDIC is selected by passing
predefined constants from the Cordic class to the constructor. These
constants are listed below.
Modes:
- Cordic.UNIFIED: Unified mode CORDIC
- Cordic.ROTATIONAL: Rotational mode CORDIC
- Cordic.VECTOR: Vector mode CORDIC
Angle types:
- Cordic.DEGREE: Degrees
- Cordic.RADIANS: Radians
- Cordic.FRACTIONS: Fractions of rotation. .25 = 90 degrees.
Pipelining
Pipelining is enabled by setting the registered parameter true and
selecting a pipe_depth. The pipe_depth of the CORDIC determines how many
stages of the CORDIC are paired with a pipeline register.
In order to determine the latency of the pipe, find the number of stages
in the CORDIC and divide that number by the pipe_depth. If there is a
remainder, add 1. The short pipe stage resulting from a remainder in this
computation is always placed at the inputs of the CORDIC.
The number of stages in the CORDIC can be determined by the following
method:
First, take the number of iterations.
For UNIFIED and VECTOR mode, add two stages if initial rotations are
enabled (see below for explanation of initial rotations).
For ROTATIONAL mode with a degree type other than FRACTION, add two stages
if initial rotations is enabled, but small initial rotations is not
(see below for explanation of initial rotations).
For ROTATIONAL mode with a degree type of FRACTION add one stage if
initial rotations is enabled and small initial rotations is not.
ROTATIONAL mode with a degree type of FRACTIONS and both initial rotations
and small initial rotations enabled is identical to a ROTATIONAL CORDIC
without any initial rotations, so add 0 in that case.
The registers in the pipe can be stalled using a clk_en signal.
clk_en can be passed in null for a perpetually enabled design. An
exception will be thrown if clk_en is present when the CORDIC is
unregistered.
Initial Rotations
Because the CORDIC algorithm is based on a tangent function, the domain
and range of the input and output angles is restricted to +/- 90 degrees.
This can be extended by enabling initial rotations hardware. Initial
rotations hardware adds 1-2 extra computational stages to the CORDIC to
correct inputs and outputs.
There are two types of initial rotations hardware. The first is normal
initial rotations, which takes operands in any quadrant of the Cartesian
plane and returns the correct outputs. The second is small initial
rotations. This mode allows inputs from any quadrant, but restricts the
range of input and output angles to +/- 90 degrees. Positions in the
left half of the Cartesian plane are represented with a negative magnitude
for polar notation (output of VECTOR mode, input of ROTATIONAL mode).
Rectangular inputs and outputs are unchanged in their representation.
Operand Format
CORDIC processors have a growth factor of approximately 1.67 associated
with their computation on x,y operands. For this reason, all x,y inputs
must allow both a sign bit and growth bit at the most significant
positions of the input words.
Angles are formatted in fixed point notation according to the following
table:
| FRACTION | DEGREE | RADIAN |
| Normal | .sxxxx... | sxxxxxxx.xxxx... |
sx.xxxx... |
| Initial Rotations | s.xxxx... | sxxxxxxxx.xxxx... |
sxx.xxxx... |
| Small Initial Rotations | .sxxxx... |
sxxxxxxx.xxxx... | sx.xxxx... |
s=sign bit x=normal bit
Xilinx XC4K
Calculating CORDIC size
To find the CLB count for a CORDIC processor, take the wordsize of the
operands, divide by two and add the remainder. Add one to that number,
multiply by three. This is the number of CLBs per stage in the CORDIC.
Multiply by the number of stages in the CORDIC (a method for computing this
number can be found under pipelining above).
In summary:
Number of CLBs = (((wordsize/2)+(wordsize%2)+1)* 3)* number of stages
- Author:
- Jeremy Anderson
-
cell_interface
-
-
cellname
-
-
DEGREE
-
-
FRACTION
-
-
RADIAN
-
-
ROTATIONAL
-
-
UNIFIED
-
-
VECTOR
-
-
Cordic(Node, int, int, boolean, int, int, boolean, boolean, Wire, Wire, Wire, Wire, Wire, Wire, Wire, Wire)
- Constructor for CORDIC unit
-
cellInterfaceDeterminesUniqueNetlistStructure()
-
-
clock()
-
-
compute(int, int, int, int, boolean, boolean, int, int, int, int)
- Compute implements the behavior of the CORDIC for behavioral modelling
of the circuit
-
defaultSimulationModelIsBehavioral()
- The default simulation model is behavioral
-
getCellName()
-
-
propagate()
-
-
reset()
-
cell_interface
public static CellInterface cell_interface[]
cellname
public static final String cellname
UNIFIED
public static final int UNIFIED
ROTATIONAL
public static final int ROTATIONAL
VECTOR
public static final int VECTOR
FRACTION
public static final int FRACTION
DEGREE
public static final int DEGREE
RADIAN
public static final int RADIAN
Cordic
public Cordic(Node parent,
int cordicmode,
int angletype,
boolean registered,
int num_iter,
int pipe_depth,
boolean init_rots,
boolean small_ir,
Wire clk_en,
Wire vec,
Wire xin,
Wire yin,
Wire zin,
Wire xout,
Wire yout,
Wire zout)
- Constructor for CORDIC unit
- Parameters:
- parent - Parent of this circuit
- cordicmode - Cordic.UNIFIED,Cordic.ROTATIONAL, or Cordic.VECTOR. UNIFIED will do both
modes of operation, with the control signal passed on the vec wire
(1 for vector mode, 0 for rotational mode). Vector mode will do
rectangular to polar conversions, Rotational mode does polar to
rectangular conversions.
- angletype - Cordic.FRACTION, Cordic.DEGREE, or Cordic.RADIAN to select which type of
angles to use in the CORDIC
- registered - True to add registers to the CORDIC
- num_iter - Number of iterations to build. The maximum is wordsize-1
- pipe_depth - Number of iterations per pipeline register. 1 for
fully pipelined. This parameter has no meaning if registered = false.
- init_rots - True to add initial rotation hardware to the CORDIC to
extend the domain to +/-180 degrees.
- small_ir - True to constrain input and output angles to +/-90
degress when using initial rotations. Points in the left half plane
are represented with a negative magnitude.
- clk_en - Clock enable wire for the registers.
- vec - Control wire for Unified mode CORDIC
- xin - X input
- yin - Y input
- zin - Angle input
- xout - X output
- yout - Y output
- zout - Angle output
getCellName
public String getCellName()
- Overrides:
- getCellName in class Cell
cellInterfaceDeterminesUniqueNetlistStructure
public boolean cellInterfaceDeterminesUniqueNetlistStructure()
- Overrides:
- cellInterfaceDeterminesUniqueNetlistStructure in class Cell
defaultSimulationModelIsBehavioral
protected boolean defaultSimulationModelIsBehavioral()
- The default simulation model is behavioral
- Overrides:
- defaultSimulationModelIsBehavioral in class Structural
reset
public void reset()
- Overrides:
- reset in class Structural
compute
public static int[] compute(int width,
int num_iterations,
int cordicmode,
int angletype,
boolean init_rot,
boolean small_rt,
int x,
int y,
int z,
int v)
- Compute implements the behavior of the CORDIC for behavioral modelling
of the circuit
- Parameters:
- width - Wordsize of the CORDIC
- num_iterations - Number of iterations
- cordicmode - Cordic.UNIFIED, Cordic.ROTATIONAL, or Cordic.VECTOR. See constructor for
details.
- angletype - Cordic.FRACTION,Cordic.DEGREE,or Cordic.RADIAN. See constructor for details.
- init_rot - True for additional hardware to extend the domain of the
circuit to +/-180 degrees.
- small_rt - True to constrain input and output angles to the range
+/- 90 degrees. Points in the left half plane are represented with a
negative magnitude.
- x - X input.
- y - Y input.
- z - Angle input.
- v - Control signal for unified mode.
- Returns:
- Array of integers containing the output x,y, and angle of the
CORDIC.
propagate
public void propagate()
- Overrides:
- propagate in class Structural
clock
public void clock()
- Overrides:
- clock in class Structural
All Packages Class Hierarchy This Package Previous Next Index