Hi,
I have a question regarding the passing of interface parameters (ex. DATA WIDTH, ADDR WIDTH) to the interface inside a agent/driver/monitor, if the same agent is instantiated multiple times.
Example.
//Top module
example_if #(DWIDTH1, AWIDTH1) if_0;
example_if #(DWIDTH2, AWIDTH2) if_1;
example_if #(DWIDTH3, AWIDTH3) if_2;
// driver
virtual example_if vif;
uvm_config_db#(virtual example_if )::get(this, “”, “example_vif “, vif)
// enviroment
example_agent agents[];
for(int i = 0; i < 3; i++) begin
agents[i] = example_agent::type_id::create(inst_name, this);
end
My question is how to pass the parameters from top if_0 (DWIDTH1, AWIDTH1) to the driver in the agent [0], the parameters from if_1 (DWIDTH2, AWIDTH2) to the driver in the agent [1] and so on .
Regards,
Adrian
This is one of the big problems with using parameterized interfaces. The parameters of interface become part of the interface type, just like a parameterized class. You can only make an assignment to a virtual interface variable if the interface instance parameters match.
This means you have to parameterize your driver to match the interface parameters
// driver
virtual example_if#(DWIDTH,AWIDTH) vif;
uvm_config_db#(virtual example_if#(DWIDTH,AWIDTH) )::get(this, “”, “example_vif “, vif)
This means you have to either parameterize your agents(which means you won’t be able to make an array of agents), or use the factory to override each driver with the proper parameter overrides.
There have been many papers written to deal with this issue, including avoiding parameterized interfaces or avoiding virtual interfaces altogether.
In reply to sin_adrian91:
One of our consultants has written an interesting paper on this topic.