zhon1231 Posted December 22, 2011 Report Share Posted December 22, 2011 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 Quote Link to comment Share on other sites More sharing options...
calvapete Posted December 22, 2011 Report Share Posted December 22, 2011 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 Quote Link to comment Share on other sites More sharing options...
zhon1231 Posted December 22, 2011 Author Report Share Posted December 22, 2011 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? Quote Link to comment Share on other sites More sharing options...
sacjin1123 Posted December 22, 2011 Report Share Posted December 22, 2011 you can use "+pvalue dut.BIT_WIDTH=value " Quote Link to comment Share on other sites More sharing options...
zhon1231 Posted December 22, 2011 Author Report Share Posted December 22, 2011 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? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.