Hi,
How to pass parameter value from class to module
For ex.
module Tb ;
parameter TB_MODE ;
assign Rx =(TB_MODE=="A")?1'b1:1'b0;
endmodule
class test ;
(How to pass A in test)
TB_MODE ="A";
endclass
It’s possible. if it is possible plz provide me idea.
Thanks for advance
Elam
In reply to Elamparethy:
I typically employ a paramegers package that can then be imported or referenced by any other package/module/class. This isn’t going to allow you to set the parameter in the test class and reference it elsewhere, but it does allow for information sharing.
package params_pkg;
parameter string TB_MODE = "A";
endpackage
module Tb;
assign Rx = (params_pkg::TB_MODE=="A") ? 1'b1:1'b0;
endmodule
package test_pkg;
class test;
// Can reference params_pkg::TB_MODE here as well
endclass
endpackage
Thanks jcraft, will try this .
Hi jcraft,
logic Not working, i’m getting error params_pkg not declared
module tb_top;
parameter TB_MODE = (vif.mode==1)?"A":"B";
endmodule
class test();
intf vif
vif.mode=1'b1;
endclass
It’s Possible ?
Thanks,
Elam
In reply to Elamparethy:
It is not clear what you were trying to do. Module parameters can be overridden when you instantiate them. Class parameters can be overridden when creating a specialization of the class type. You cannot use variables in an expression to set the value of a parameter (only other parameters or constant literals).
Also, since you posted this in the UVM forum, I suppose you are using the UVM. If that is true, the uvm_config_db might be appropriate.
Thanks dave_59,
yeah, it’s UVM Only I will try uvm_config_db logic.