Generic-default : simulation vs. synthesis

A

ALuPin

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
 
T

Tricky

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

kennheinrich

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;
 

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,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top