I want to pass pass parameter “num_ports” into parameterised class as below. I am setting num_ports inside uvm_config_db from tb_top file & getting it inside build phase of env file as below.
code inside env.sv
int num_ports;
- uvm_config_db#(int)::get(uvm_root::get(), “*”, “num_ports”, num_ports);
- h_abc = abc#(num_ports, 8)::type_id::create(“h_abc”, this);
Above line number 2 gives an compile error pointing to num_ports as: xmvlog: *E,NOTPAR (/…/…/…/.sv,315|59): Illegal operand for constant expression [4(IEEE)].
My class definition:
class abc#(int NUM_PORTS=8, int CNT=1) extends base_class;
May I know why I am getting this error & fix for the same?
Regards,
Gajjar