FreeCore Function #8:
512-point Cosine
Module name: cosine
Current release: version 1.0, August 19, 1997
Contributed by: Rune Baeverrud
Introduction
Shown below is the schematic representation of the Cosine Module.
The Cosine Module has the following key properties:
- 512 points around the unit circle (128 points / quadrant), using single 256 point
lookup-table (one EAB).
- 7 bits + sign bipolar or 8 bit unipolar output resolution, giving Signal-to-Noise Ratio
(SNR) = 50,23dB.
- Cosine table generated with the MIFGEN utility, see below for details.
- Variable length pipeline for up to 80MHz operation.
The Cosine Look-up Table
The cosine look-up table was generated using the MIFGEN utility also available on this
web site. The MIFGEN utility was set up with the following parameters:
- Angle range = "0-180 degrees"
- Peak Amplitude = 126.20
- Number of Samples = 256
- Number of Bits = 8
- Function = "Cosine"
- Options = "Symmetry"
Two files exists, one with Offset = 0 named "COS180N.MIF" and another with
Offset = 128 named "COS180P.MIF". COS180N.MIF will be used if parameter POLARITY
is set to "BIPOLAR", and COS180P.MIF will be used if parameter POLARITY is set
to "UNIPOLAR". Options = "Symmetry" was chosen, requiring absolutely
no manipulation of the look-up table output. This gives the advantage of high speed and
very compact design. The amplitude was chosen to 126.2 - giving the highest possible SNR
and therefore the closest approximation to a pure cosine.
High Speed
With no pipelining (all levels set to "UNREGISTERED") a speed of 30-40 MHz is
achievable in a FLEX 10K -3 device. With level 1, 2 and 3 set to "REGISTERED" (3
levels of pipeline) a speed of above 80MHz is achievable in a FLEX 10K -3 device.
Module Parameters
PARAMETERS |
POLARITY |
Set to "UNIPOLAR" (1..128..255) operation or "BIPOLAR"
(-126..0..126) operation (using 2's complement). |
LEVEL1 |
Should be "REGISTERED" or "UNREGISTERED". Level 1 is the output of
the subtractor ("angle/index modifier") and multiplexer which feeds the EAB
look-up table. |
LEVEL2 |
Should be "REGISTERED" or "UNREGISTERED". Level 2 is the input
registers in the EAB look-up table. |
LEVEL3 |
Should be "REGISTERED" or "UNREGISTERED". Level 3 is the output
registers in the EAB look-up table. |
INPUT PORTS |
SysClk |
System clock input. |
Angle[8..0] |
9 bits (512 indexes) input giving the relative angle on the unit circle. Values 0-255
correspond to angles in the 0-180 degree range, values 256-511 correspond to angles in the
180-360 degree range. |
OUTPUT PORTS |
Wave[7..0] |
Digital Waveform output, unipolar or bipolar, depending on the POLARITY
parameter setting. |
NOTE: You need to
copy the files COS180N.MIF and COS180P.MIF to your current working directory.
Enjoy!
|