Facebook/LinkedIn login is now deprecated, please disconnect our access to your social profile.
User dashboard under chipverify.com/connect will be deprecated from Oct 1, 2020, Read More.
Let us contribute to a cleaner Earth, Go Green Updated: May 31, 2020
2 minutes reading time (349 words)

how to turn an agent from active to passive ?

how to turn an agent from active to passive ?

An agent is a hierarchical block which puts together other verification components that are dealing with a specific DUT interface. It usually contains a sequencer to generate data transactions, a driver to drive these transactions to the DUT, and a monitor that sits on the interface and tries to capture the pin wiggling that happens on the DUT interface. So, in a typical UVM environment there'll be multiple agents connected to various interfaces of the DUT. Sometimes, we do not want to drive anything to the DUT, but simply monitor the data produced by DUT. It would be nice to have a feature to turn the sequencer and driver of an agent ON and OFF when required.

It is recommended to use the internal variable is_active already present in the base uvm_agent class to implement this functionality. is_active is an enumeration of type uvm_active_passive_enum defined as follows:

typedef enum bit { UVM_PASSIVE=0, UVM_ACTIVE=1 } uvm_active_passive_enum;

First, let's see what uvm_agent has to offer in its build phase.

virtual class uvm_agent extends uvm_component;
  uvm_active_passive_enum  is_active = UVM_ACTIVE;
  function void build_phase (uvm_phase phase);
    int active;
    super.build_phase (phase);
    if (get_config_int ("is_active", active)) is_active = uvm_active_passive_enum'(active);

Since uvm_agent already has the code to retrieve the field is_active from configuration database, we only need to act upon it.

class my_agent extends uvm_agent;
  virtual function void build_phase (uvm_phase phase);
    // Call uvm_agent build phase which will retrieve is_active
    super.build_phase (phase);
    // At this point, we already have the value for is_active
    m_mon0 = my_monitor :: type_id :: create ("m_mon0", this);
    if (get_is_active ()) begin
      m_drv0 = my_driver :: type_id :: create ("m_drv0", this);
      m_seqr = my_sequencer :: type_id :: create ("m_seqr", this);

By default, an agent is ACTIVE and can be turned into passive mode by setting the variable is_active to UVM_PASSIVE.

class my_env extends uvm_env;
  // Instantiate the agent
  // Either pass it as a configuration object
  uvm_config_db #(int) :: set (this, "m_agnt0", "is_active", 0);
  // Or simply set the variable
  m_agnt0.is_active = UVM_PASSIVE;
what happens when you register a component with fa...
how to set timeout value for simulations ?

By accepting you will be accessing a service provided by a third-party external to https://www.chipverify.com/

You consent to our cookies if you continue to use our website. To know more about cookies, see our privacy policy. I accept cookies from this site.