Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Generic-default : simulation vs. synthesis

2 views
Skip to first unread message

ALu...@web.de

unread,
Mar 31, 2009, 10:14:06 AM3/31/09
to
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

Tricky

unread,
Mar 31, 2009, 11:21:29 AM3/31/09
to

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) );
);

kennhe...@sympatico.ca

unread,
Mar 31, 2009, 11:23:21 AM3/31/09
to

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;

ALu...@web.de

unread,
Apr 1, 2009, 3:24:26 AM4/1/09
to
Hi,

your solutions BOTH work for me, thank you.

Rgds,
ALuPin

0 new messages