UVM Agent

The UVM Agent encapsulates sequencer, driver, and monitor into a reusable verification unit.

📘 What is a UVM Agent?

A UVM Agent is a container component that groups together:

  • Sequencer
  • Driver
  • Monitor

It represents one interface of the DUT and can operate in:

  • Active Mode → Drives stimulus + monitors
  • Passive Mode → Only monitors
🏗 Agent Architecture

        ---------------------
        |      Agent        |
        |-------------------|
        |  Sequencer        |
        |  Driver           |
        |  Monitor          |
        ---------------------

The agent connects:

  • Sequencer → Driver (TLM connection)
  • Monitor → Scoreboard (Analysis port)
💻 UVM Agent Example

class my_agent extends uvm_agent;

  `uvm_component_utils(my_agent)

  my_sequencer  seqr;
  my_driver     drv;
  my_monitor    mon;

  function new(string name = "my_agent", uvm_component parent);
    super.new(name, parent);
  endfunction

  function void build_phase(uvm_phase phase);
    super.build_phase(phase);

    if (is_active == UVM_ACTIVE) begin
      seqr = my_sequencer::type_id::create("seqr", this);
      drv  = my_driver::type_id::create("drv", this);
    end

    mon = my_monitor::type_id::create("mon", this);
  endfunction

  function void connect_phase(uvm_phase phase);
    super.connect_phase(phase);

    if (is_active == UVM_ACTIVE) begin
      drv.seq_item_port.connect(seqr.seq_item_export);
    end
  endfunction

endclass
🔄 Active vs Passive Agent
Mode Sequencer Driver Monitor Usage
Active Generate stimulus
Passive Observe traffic only
🚀 Why Agents Are Important
  • Encapsulation of interface logic
  • Reusable across multiple tests
  • Supports scalable verification
  • Allows easy active/passive configuration