Jump to content
Sign in to follow this  
zhon1231

Parameterized Designs

Recommended Posts

Hi all,

I have a quick question regarding parameterized designs. In my testbench I am initializing a DUT that requires a parameter called BIT_WIDTH. Is there any way to initialize the DUT's BIT_WIDTH using a command line argument?

For example, is the following possible?

vcs .... +COMMAND_LINE_BIT_WIDTH=10....

module top

Design #(.BIT_WIDTH(COMMAND_LINE_BIT_WIDTH)) dut (...);

...

Thanks,

Billy

Share this post


Link to post
Share on other sites

Pop the parameter in a package, compile it before the test_harness.

package pkg;

localparam BIT_WIDTH = 10;

endpackage

module th;

DUT #(pkg::BIT_WIDTH) dut();

...

endmodule

class env;

int bit_width = pkg::BIT_WIDTH;

...

endclass

Share this post


Link to post
Share on other sites

Thats my current approach right now. But the bad part is that I have to manually change the contents of the package in order to change the parameters. Is there a way for the package to use the command line arguments?

Share this post


Link to post
Share on other sites

thanks for the reply! pvalue looks like what I need. But it does not seem to be working though.

On my vcs command, I added "-pvalue param1=2", but I keep getting "cross module reference errors".

param1 is defined in my top level package.

package top_pkg;

parameter param1 = 4;

import top_pkg::*;

module top;

dut #(.x (param1)) dut1(...);

Any ideas on fixing this?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×