Configuration using $value$plusargs

Status
Not open for further replies.

Yankie

Newbie level 4
Joined
Dec 12, 2012
Messages
5
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,345
Hi,

I want to have variable number of drivers for my verification env and also to have different configuration for each driver.
Is there a way of doing it?

E.g
global_config class extends uvm_component;
int no_of_drivers;
int max_delay[];

function new(string name="gbl_cfg", uvm_component parent=null);
super.new(name,parent);
this.name = name;
if (!$value$plusargs("NO_OF_DRV=%d", no_of_drivers))
no_of_drivers = 2;
endfunction

virtual function void build_phase(uvm_phase phase);
super.build_phase(phase);
max_delay = new[no_of_drivers];

foreach(fencer_tx_fc[idx])
begin
if (!$value$plusargs($psprintf("MAX_DELAY_DRV_%0d",idx)=%0d, max_delay[idx])) // This statement does not work. Could you suggest something similar?
max_delay[idx] = 5;
end
end

endfunction
endclass

if (!$value$plusargs($psprintf("MAX_DELAY_DRV_%0d",idx)=%0d, max_delay[idx])) -> This statement does not work. Could you suggest something similar?

If I run with "+NO_OF_DRV=5 +MAX_DELAY_DRV_0=10 +MAX_DELAY_DRV_4=3" compile options, I want the max_delay array to be as follows:
max_delay = {3,5,5,5,10}
If the next simulation is run with "+NO_OF_DRV=2 +MAX_DELAY_DRV_0=1 +MAX_DELAY_DRV_1=2", the max_delay array to be max_delay={1,2}

Is this possible? If so, how?

TIA !
 

Can you elaborate what you mean by "this statement does not work"? Does it not compile? Does it not grab the value for its corresponding plusarg? I see a syntax error in the pointed statement.

The following will work. Also make sure that the fencer_tx_fc array exists (i.e. array size is not zero). It appears the size of fencer_tx_fc has to be at least a subset or equal to the size of max_delay.

Code:
if(!$value$plusargs({$psprintf("MAX_DELAY_DRV_%0d",idx),"=%d"}, max_delay[idx]))
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…