Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to access parameters within non-imported package #804

Closed
veripoolbot opened this issue Jul 20, 2014 · 4 comments
Closed

How to access parameters within non-imported package #804

veripoolbot opened this issue Jul 20, 2014 · 4 comments
Assignees
Labels
resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800

Comments

@veripoolbot
Copy link
Contributor


Author Name: Jonathon Donaldson
Original Redmine Issue: 804 from https://www.veripool.org
Original Date: 2014-07-20
Original Assignee: Wilson Snyder (@wsnyder)


I have been having great success with Verilator. However, I'm running into one very minor issue right now. I can think of a work-around but I want to know the best way to do this - if there is one.

I have a system verilog package that I created solely for the purpose of accessing certain functions/parameters that I use within my design. I did this so that I don't have to have a bunch of /verilator public/ comments cluttering up my design. In summary what I did was this (not checked for syntax correctness but you get the idea):

package My_Design_Imported_Package_1;
localparam MY_PARAM1 = 1;
endpackage

package My_Design_Imported_Package_2;
localparam MY_PARAM2 = 2;
endpackage

package My_Verilator_NonImported_Package;
import My_Design_Imported_Package_1::;
import My_Design_Imported_Package_2::
;

localparam VERILATOR_PARAM1 /verilator public/ = MY_PARAM1;
localparam VERILATOR_PARAM2 /verilator public/ = MY_PARAM2;

endpackage

The package "My_Verilator_NonImported_Package" is not imported anywhere within my design. I was hoping I could use it just to get access to some parameters without having to actually import it anywhere.

However, what I found was that unless I actually 'import' the package somewhere in the design verilator optimizes the package away.

Is there any way to accomplish what I'm trying to do? I can think of a work-around - which is to create a wrapping veratilor-only testbench module which wraps around my real design and then import the verilator-only package into that module. But I was hoping to avoid that if possible...

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Jonathon Donaldson
Original Date: 2014-07-28T07:24:33Z


"However, what I found was that unless I actually 'import' the package somewhere in the design verilator optimizes the package away."

Minor clarification: Just importing the package is insufficient. I have to import the package and use at least 1 parameter found in that package in order for it to not be optimized away.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-11-06T22:54:05Z


Fixed in git towards 3.865.

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Jonathon Donaldson
Original Date: 2014-11-07T23:33:28Z


Way cool! Thanks!

@veripoolbot
Copy link
Contributor Author


Original Redmine Comment
Author Name: Wilson Snyder (@wsnyder)
Original Date: 2014-11-15T13:46:17Z


In 3.866.

@veripoolbot veripoolbot added resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800 labels Dec 22, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution: fixed Closed; fixed type: feature-IEEE Request to add new feature, described in IEEE 1800
Projects
None yet
Development

No branches or pull requests

2 participants