Problems inserting constants into generic-width pipeline

Guest
Hello
I'm developing a CORDIC-pipeline to calculate twiddle-factors for FFT-
calculations. The required precision isn't known at the moment so I
want all word-lengths to be set by generics. In order to allow target
angles around the whole unit circle I have to check the angle and
choose a suitable 'start-vector' in the first stage. This is because
the area of convergence for the simplest implementation of CORDIC only
is -pi/2 - pi/2. Now to my problem.

Since the word-lengths aren't known until component instantiation, how
can I make sure that the constants are fed to the first pipeline stage
in the same precision as the internal signals? I have tables with the
constants in different word lengths, but the compiler complains loudly
about the data types not being correct when I try to use them.

Sincerely
Anton Andersson
 
On Jun 27, 4:07 am, antan...@student.liu.se wrote:

Since the word-lengths aren't known until component instantiation, how
can I make sure that the constants are fed to the first pipeline stage
in the same precision as the internal signals? I have tables with the
constants in different word lengths, but the compiler complains loudly
about the data types not being correct when I try to use them.
Anton,

Your table constants should be defined as integers or reals (whichever
is appropriate). Then when you pass them into the components you
convert them to vectors of the appropriate width. Something along the
lines of the following which demonstrates how you can go from integers
to unsigned or from real to ufixed (using the relatively new fixed
point package).

-- These constants are the 'generic' versions that simply need to be
resized
-- to fit the instance at hand.
constant Some_Constant_int: integer := 123;
constant Some_Constant_real: real := 123.45;
...

-- Inside the architecture where you want to use them

constant Some_Constant_unsigned: unsigned(7 downto 0) :to_unsigned(Some_Constant_int, Some_Constant_unsigned'length);

constant Some_Constant_ufixed: ufixed(7 downto -4) :to_ufixed(Some_Constant_real, 7, -4);


Kevin Jennings
 

Welcome to EDABoard.com

Sponsor

Back
Top