Why use uvm_config_db to pass vif or configuration object is recommended?

Every agent should have a configuration object that encapsulates all of the parameters that can be modified to control the agent’s behavior. Examples of this include the notion of the agent being ACTIVE or PASSIVE. Included in the configuration object should be the vif handle.

The agent configuration objects should be created and configured at the test level, giving the user the ability to control the agent behavior on a per-test basis. These configuration objects should then be passed to the respective agent using the uvm_config_db().

Using the uvm_config_db() enables a single call to configure the agent instead of using many different calls to set the various agent parameters.