Am I doing something wrong, or is quartus having a bad day?

T

Tricky

Im trying to do some fixed point math using the fixed point package (I
thought Id try and avoid all the ballache of using numeric_std for
once!). I get the following error from quartus:

Error (10346): VHDL error at fixed_pkg_c.vhdl(4780): formal port or
parameter "size_res" must have actual or default value
Error (10346): VHDL error at fixed_pkg_c.vhdl(4782): formal port or
parameter "size_res2" must have actual or default value
Error (10657): VHDL Subprogram error at test_build.vhd(56): failed to
elaborate call to subprogram "sfixed_high"

Over the following line in my VHDL:

subtype mult_op_t is sfixed( sfixed_high(video, '*',
coeffs( coeffs'low(1), coeffs'low(2) ) )
downto
sfixed_low( video, '*',
coeffs( coeffs'low(1), coeffs'low(2) ) )
);

Am I missing something, or am I confusing quartus with all my existing
subtypes?

Heres all the type declarations and the signals used:

subtype filter_word_t is sfixed(11 downto -4);
subtype coeff_t is sfixed(1 downto -16);
type coeff_array_t is array(integer range <>, integer range <>) of
coeff_t;

In entity:
video : in filter_word_t;
coeffs : in coeff_array_t(0 to 2, 0 to 2)
 
A

Andy

Can you do something like (I haven't actually tried it, so "hold my
beer and watch this"):

constant a,b : coeff_t := (others => '0');
constant axb : sfixed := a * b;
subtype mult_op_t is sfixed(axb'range);

Andy
 
A

Andy Rushton

Tricky said:
Im trying to do some fixed point math using the fixed point package (I
thought Id try and avoid all the ballache of using numeric_std for
once!). I get the following error from quartus:

Error (10346): VHDL error at fixed_pkg_c.vhdl(4780): formal port or
parameter "size_res" must have actual or default value
Error (10346): VHDL error at fixed_pkg_c.vhdl(4782): formal port or
parameter "size_res2" must have actual or default value
Error (10657): VHDL Subprogram error at test_build.vhd(56): failed to
elaborate call to subprogram "sfixed_high"

Over the following line in my VHDL:

subtype mult_op_t is sfixed( sfixed_high(video, '*',
coeffs( coeffs'low(1), coeffs'low(2) ) )
downto
sfixed_low( video, '*',
coeffs( coeffs'low(1), coeffs'low(2) ) )
);

Am I missing something, or am I confusing quartus with all my existing
subtypes?

I suspect that Quartus cannot synthesise sfixed_high and sfixed_low as
constant expressions, which it needs to do to calculate the bounds of
mult_op_t. Try substituting literal values to see if that fixes it. If
it does, inline the size calculation so as to exclude these functions
(i.e. using literals, attribute values, * and + operators only) and see
if it still works.
 
T

Tricky

First, get the version specifically designed for Quartus.
You will find it athttp://www.vhdl.org/fphdl







It doesn't like the fact that "video" is an input, and thus can have a
variable length depending on generics.   This is an Quartus "gotcha"
because of the way their third party VHDL compiler works.




I would do this as:
subtype mult_op_t is sfixed (video'high+coeff_t'high+1
                              downto video'low + coeff_t'low);

Please tell me if this fixes your problem.   I wrote this package and
I'm collecting these things.

Thanks David - that fix made it pass the syntax checker.
Now I just have to tell altera that arrays of arrays constitute
multiple memories, not a million registers and a decoder.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,566
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top