help with syntax

Discussion in 'VHDL' started by Tricky, Apr 30, 2010.

  1. Tricky

    Tricky Guest

    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) )
    );
    Tricky, Apr 30, 2010
    #1
    1. Advertising

  2. Tricky

    Tricky Guest

    PS. Thanks in advance :) Love you all..
    Tricky, Apr 30, 2010
    #2
    1. Advertising

  3. Tricky

    Tricky Guest

    On 30 Apr, 13:17, Alan Fitch <> wrote:
    > On 30/04/2010 10:57, Tricky wrote:> 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:

    >
    > <snip>
    >
    > I suspect this is the real problem:
    >
    > > # ** Error: ./Testbenches/AWEP_filter_TB.vhd(48): No feasible entries
    > > for subprogram "to_sfixed".

    >
    > <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:        
    > Fax:  +44 (0)1425 471573                http://www.doulos.com
    >
    > ------------------------------------------------------------------------
    >
    > This message may contain personal views which are not the views of
    > Doulos, unless specifically stated.


    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!
    Tricky, Apr 30, 2010
    #3
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. gabriele renzi
    Replies:
    2
    Views:
    202
    gabriele renzi
    Dec 31, 2005
  2. Ken Bloom
    Replies:
    3
    Views:
    206
  3. Good Night Moon
    Replies:
    9
    Views:
    280
    Rick DeNatale
    Jul 25, 2007
  4. Jacob Grover
    Replies:
    5
    Views:
    310
    Jacob Grover
    Jul 18, 2008
  5. Mark Richards
    Replies:
    3
    Views:
    310
    Tad McClellan
    Nov 18, 2007
Loading...

Share This Page