Usage of configdb

please explain and differentiate the below statements iam at my basic stage of understanding UVM

  1. uvm_config_db#(virtual ahb_if)::set(uvm_root::get(), “*”, “ahb_if”, vif);
    2)uvm_config_db#(virtual ahb_if)::get(this, “”, “ahb_if”, vif);

3)assert(uvm_config_db#(int)::get(null, get_full_name(), “no_txn”, no_txn));

In reply to srinu:

  1. uvm_config_db#(virtual ahb_if)::set(uvm_root::get(), “*”, “ahb_if”, vif);

This is “pushing” the virtual interface “vif” of name “ahb_if” to every “*” components from the top level module.

2)uvm_config_db#(virtual ahb_if)::get(this, “”, “ahb_if”, vif);

This is “retrieving” interface “ahb_if” and assigning it to “vif”.

3)assert(uvm_config_db#(int)::get(null, get_full_name(), “no_txn”, no_txn));

This is a basic assert which notifies when no transaction is retrieved.

In reply to srinu:

dont use assert for #3; they should be used for design checking not testbench

use this instead
if( !uvm_config_db #( type )::get( this, “”, “name”, var ))
`uvm_fatal(report_id, “cannot find resource name” )

thanks mr chitlesh and mr bmorris