Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > VHDL > Generic-default : simulation vs. synthesis

Reply
Thread Tools

Generic-default : simulation vs. synthesis

 
 
ALuPin@web.de
Guest
Posts: n/a
 
      03-31-2009
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

 
Reply With Quote
 
 
 
 
Tricky
Guest
Posts: n/a
 
      03-31-2009
On 31 Mar, 15:14, "(E-Mail Removed)" <(E-Mail Removed)> 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) );
);
 
Reply With Quote
 
 
 
 
kennheinrich@sympatico.ca
Guest
Posts: n/a
 
      03-31-2009
On Mar 31, 10:14*am, "(E-Mail Removed)" <(E-Mail Removed)> 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;
 
Reply With Quote
 
ALuPin@web.de
Guest
Posts: n/a
 
      04-01-2009
Hi,

your solutions BOTH work for me, thank you.

Rgds,
ALuPin
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simulation vs Synthesis ALuPin@web.de VHDL 14 02-21-2006 10:15 AM
long counters in simulation and synthesis Eli Bendersky VHDL 7 10-27-2004 07:22 AM
Simulation is OK but problem with synthesis Andy VHDL 5 10-22-2003 06:24 AM
SOS! newbie question about synthesizable VHDL : synthesis run successfully but post-synthesis failed... walala VHDL 4 09-09-2003 08:41 AM
what are the possible reasons that successful pre-synthesis simulation + successful synthesis = failed post-synthes walala VHDL 4 09-08-2003 01:51 PM



Advertisments