Jump to content

conditionnal import package in SV


Recommended Posts

Hello everyone,

I want to select package depending of parameter. I have the same parameters which different value in this two packages : pkg_std, pkg_a. And I would like to select the good one depending of the mode A

I don't know if it's possible.

Modelsim get an error on this :

Parameter A = 0;

if(!A)
begin
     import pkg_std::*;
end
else
begin
     import pkg_a::*;
end

 

It s seems a conflict between the two packages, because all parameters declared into the package are "undefined variable".

I'm curious if you have already to attempt this?

Let me know, please.

 

Thanks a lot.

 

Bye, JP LM

Link to post
Share on other sites

The import statement only makes symbols visible inside the scope of the import. Your import statement is inside a generate block and does not make symbols visible after the generate.

 

If you need to select this package globally, it might be better to have two different versions of the same package compiled into separate libraries. Then just select the library you want at compilation time.

 

If the package only contains parameter values, then you might consider using a structure or class type as a container for your parameters instead of a package.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...