Virtual interface set error

Hi,
I am new to uvm and i have shared my and gate eda playground link. i am facing this error and i dono how to proceed.

In reply to dkumar264:

Hi,
I am new to uvm and i have shared my and gate eda playground link. i am facing this error and i dono how to proceed.
simple uvm and.svhd - EDA Playground

your field name with which you are setting should be same while getting.
in driver your field name should be inf which should be same in top and also do the same in monitor.
if(!uvm_config_db#(virtual andf )::get(this,“”,“inf”,a1))

In reply to dkumar264:

The driver’s error is fixed as below. You may need to fix other popped up similar errors from monitor.sv

testbench.sv
add the following to set driver.sv virtual interface


module top;
  andf a1();
  ...
  initial begin 
    uvm_config_db#(virtual andf)::set(null,"*","a1",a1);   
...

driver.sv
update: the third argument is the instance name of virtual interface.


class and_driver extends uvm_driver #(seq_item);
  virtual andf a1;
   if(!uvm_config_db#(virtual andf )::get(this,"","andf",a1))
      `uvm_fatal("NO_VIF",{"virtual interface must be set for: ",get_full_name(),".a1"});
-->
   if(!uvm_config_db#(virtual andf )::get(this,"","a1",a1))
      `uvm_fatal("NO_VIF",{"virtual interface must be set for: ",get_full_name(),".a1"});

In reply to Lina.Lin:

Lina, sorry but I have to correct you. The 3rd Argument is a Name under which the value (4th argument) is stored.

For setting in the toplevel module “inf” is used and in the driver “andf” is used. Replace in the driver “andf” with “inf” and it will work.

In reply to chr_sue:

Thanks chr_sue for clarification. 3rd argument “field name” of uvm_config_db::set() and uvm_config_db::get() should match. It can be any string name as long as match between set and get.

My practice is that using the name corresponding to the target’s declaration name will provide more readability and correlation.