Generic-default : simulation vs. synthesis

Discussion in 'VHDL' started by ALuPin@web.de, Mar 31, 2009.

  1. Guest

    Hi,

    I am trying to do the following:

    In a package (pkg_generic.vhd) I declare the following types and
    constants:


    type type_range is array(1 downto 0) of integer range 0 to 3;
    type type_lookup is array (natural range <>) of type_range;

    constant cLookup : type_lookup(1 downto 0) := ( 1 => (2,4), 0 =>
    (0,3) );




    Now I have a component with the following declaration:

    entity test is
    generic( gLookup : type_lookup(0 downto 0) := cLookup(0);
    );
    port( ...);
    end test;

    When compiling in Modelsim I get the following error:
    "Cannot resolve indexed name as type work.pkg_generic.type_lookup"


    For simulation I do not need the default (cLookup(0))
    because it is asserted in the generic map of that component.

    But when trying to synthesize it I get the error:
    "gLookup has no actual or default value"


    How can I marry both, synthesis and simulation ?

    Thank you.

    Rgds,
    ALuPin
     
    , Mar 31, 2009
    #1
    1. Advertising

  2. Tricky Guest

    On 31 Mar, 15:14, "" <> wrote:
    > Hi,
    >
    > I am trying to do the following:
    >
    > In a package (pkg_generic.vhd) I declare the following types and
    > constants:
    >
    > type type_range is array(1 downto 0) of integer range 0 to 3;
    > type type_lookup is array (natural range <>) of type_range;
    >
    > constant cLookup : type_lookup(1 downto 0) := ( 1 => (2,4), 0 =>
    > (0,3) );
    >
    > Now I have a component with the following declaration:
    >
    > entity test is
    > generic( gLookup : type_lookup(0 downto 0) := cLookup(0);
    >        );
    > port( ...);
    > end test;
    >
    > When compiling in Modelsim I get the following error:
    > "Cannot resolve indexed name as type work.pkg_generic.type_lookup"
    >
    > For simulation  I do not need the default (cLookup(0))
    > because it is asserted in the generic map of that component.
    >
    > But when trying to synthesize it I get the error:
    > "gLookup has no actual or default value"
    >
    > How can I marry both, synthesis and simulation ?
    >
    > Thank you.
    >
    > Rgds,
    > ALuPin


    cLookup(0) is not a type_lookup, its a type_range, so you're trying to
    assign incompatible types.

    try this instead:

    generic( gLookup : type_lookup(0 downto 0) := (0 => cLookup(0) );
    );
     
    Tricky, Mar 31, 2009
    #2
    1. Advertising

  3. Guest

    On Mar 31, 10:14 am, "" <> wrote:
    > Hi,
    >
    > I am trying to do the following:
    >
    > In a package (pkg_generic.vhd) I declare the following types and
    > constants:
    >
    > type type_range is array(1 downto 0) of integer range 0 to 3;
    > type type_lookup is array (natural range <>) of type_range;
    >
    > constant cLookup : type_lookup(1 downto 0) := ( 1 => (2,4), 0 =>
    > (0,3) );
    >
    > Now I have a component with the following declaration:
    >
    > entity test is
    > generic( gLookup : type_lookup(0 downto 0) := cLookup(0);
    >        );
    > port( ...);
    > end test;
    >
    > When compiling in Modelsim I get the following error:
    > "Cannot resolve indexed name as type work.pkg_generic.type_lookup"
    >
    > For simulation  I do not need the default (cLookup(0))
    > because it is asserted in the generic map of that component.
    >
    > But when trying to synthesize it I get the error:
    > "gLookup has no actual or default value"
    >
    > How can I marry both, synthesis and simulation ?
    >
    > Thank you.
    >
    > Rgds,
    > ALuPin


    I got several other errors (4 is out of range; an extra semicolon...
    just typos I suspect) but I think your problem is that, as written,
    you're assigning a value to a slice instead of a slice to a slice. The
    code below compiles under Modelsim.

    - Kenn

    package pkg_generic is

    type type_range is array(1 downto 0) of integer range 0 to 3;
    type type_lookup is array (natural range <>) of type_range;

    constant cLookup : type_lookup(1 downto 0) := ( 1 => (1,3), 0 =>
    (0,3) );

    end pkg_generic;

    use work.pkg_generic.all;
    entity test is

    generic( gLookup : type_lookup(0 downto 0) := cLookup(0 downto 0)
    );
    end test;
     
    , Mar 31, 2009
    #3
  4. Guest

    Hi,

    your solutions BOTH work for me, thank you.

    Rgds,
    ALuPin
     
    , Apr 1, 2009
    #4
    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. walala
    Replies:
    4
    Views:
    2,155
    Ralf Hildebrandt
    Sep 8, 2003
  2. walala
    Replies:
    4
    Views:
    1,258
    Technology Consultant
    Sep 9, 2003
  3. Andy
    Replies:
    5
    Views:
    592
  4. Eli Bendersky
    Replies:
    7
    Views:
    619
    Nicolas Matringe
    Oct 27, 2004
  5. KJ
    Replies:
    3
    Views:
    1,333
    alivingstone
    Jun 15, 2011
Loading...

Share This Page