Generic-default : simulation vs. synthesis

A

ALuPin@web.de

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
 
On 31 Mar, 15:14, "ALu...@web.de" <ALu...@web.de> 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) );
);
 
On Mar 31, 10:14 am, "ALu...@web.de" <ALu...@web.de> 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;
 
Hi,

your solutions BOTH work for me, thank you.

Rgds,
ALuPin
 

Welcome to EDABoard.com

Sponsor

Back
Top