help with syntax

T

Tricky

Im having trouble getting the syntax correct for defining this
constant in modelsim. basically Ive got a 3x3 2-D array of sfixed.I
get the feeling Im not indexing the 2d array correctly. The errors I
get are:

# ** Warning: ./Testbenches/AWEP_filter_TB.vhd(48): (vcom-1172)
Aggregate element expression (function call "to_sfixed") is not of
type sub-array #2 of work.awep_setup_package.coeff_array_t.
# ** Error: ./Testbenches/AWEP_filter_TB.vhd(48): No feasible entries
for subprogram "to_sfixed".
# ** Error: ./Testbenches/AWEP_filter_TB.vhd(48): Aggregate expression
cannot be scalar type std.standard.integer.

Could I get some help?

subtype coeff_t is sfixed(1 downto -16);
type coeff_array_t is array(-1 to 1, -1 to 1) of coeff_t;


-- x y --top row
FILTER_COEFFS : coeff_array_t := ( (-1,-1) =>
to_sfixed(0.0, coeff_t'high+1, abs(coeff_t'low) ) ,
( 0,-1) =>
to_sfixed(0.0, coeff_t'high+1, abs(coeff_t'low) ) ,
( 1,-1) =>
to_sfixed(0.0, coeff_t'high+1, abs(coeff_t'low) ) ,

--middle
row
(-1, 0) =>
to_sfixed(0.0, coeff_t'high+1, abs(coeff_t'low) ) ,
( 0, 0) =>
to_sfixed(1.0, coeff_t'high+1, abs(coeff_t'low) ) ,
( 1, 0) =>
to_sfixed(0.0, coeff_t'high+1, abs(coeff_t'low) ) ,

--bottom
row
(-1, 1) =>
to_sfixed(0.0, coeff_t'high+1, abs(coeff_t'low) ) ,
( 0, 1) =>
to_sfixed(0.0, coeff_t'high+1, abs(coeff_t'low) ) ,
( 1, 1) =>
to_sfixed(0.0, coeff_t'high+1, abs(coeff_t'low) )
);
 
T

Tricky

On 30/04/2010 10:57, Tricky wrote:> Im having trouble getting the syntax correct for defining this

<snip>

I suspect this is the real problem:


<snip>

Alan

--
Alan Fitch
Senior Consultant

Doulos – Developing Design Know-how
VHDL * Verilog * SystemVerilog * SystemC * PSL * Perl * Tcl/Tk * Project
Services

Doulos Ltd. Church Hatch, 22 Marketing Place, Ringwood, Hampshire, BH24
1AW, UK
Tel:  + 44 (0)1425 471223               Email: (e-mail address removed)        
Fax:  +44 (0)1425 471573                http://www.doulos.com

I maybe should have said I have inclided the floatfixed libraries

It compiles fine when I dont try and assign individual indices and
just create an aggregate:

--left
column x y
FILTER_COEFFS : coeff_array_t := ( ( to_sfixed(0.0,
coeff_t'high+1, abs(coeff_t'low) ) , -- (-1,-1)
to_sfixed(0.0,
coeff_t'high+1, abs(coeff_t'low) ) , -- (-1, 0)
to_sfixed(0.0,
coeff_t'high+1, abs(coeff_t'low) ) -- (-1, 1)
),

--middle column
( to_sfixed(0.0,
coeff_t'high+1, abs(coeff_t'low) ) , -- ( 0,-1)
to_sfixed(1.0,
coeff_t'high+1, abs(coeff_t'low) ) , -- ( 0, 0)
to_sfixed(0.0,
coeff_t'high+1, abs(coeff_t'low) ) -- ( 0, 1)
),

--right coloumn
( to_sfixed(0.0,
coeff_t'high+1, abs(coeff_t'low) ) , -- ( 1,-1)
to_sfixed(0.0,
coeff_t'high+1, abs(coeff_t'low) ) , -- ( 1, 0)
to_sfixed(0.0,
coeff_t'high+1, abs(coeff_t'low) ) -- ( 1, 1)
)
)

The only problem I have with this is that the aggregate asigns it
column major, and I was trying to write it row major. Its not a big
issue, but thought it might just be easier to look at it when
assigning values starting top left going from right to left, rather
than top to bottom.Maybe Im just being too picky!
 

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

No members online now.

Forum statistics

Threads
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top