Monitor Architecture
Learn how a UVM monitor observes DUT interface activity, reconstructs protocol transactions, and publishes what actually happened for checking and coverage.
Learning objectives
- Explain the purpose of a UVM monitor and why it should not drive the DUT.
- Understand the difference between a driver transaction and an observed transaction.
- Build a basic monitor that samples a virtual interface.
- Recognize a valid protocol transfer using clock and handshake signals.
- Create an observed transaction from interface signals.
- Publish observed transactions through a UVM analysis port.
- Understand how monitors support scoreboards, coverage, and other analysis components.
Step 1: What does a monitor do?
A monitor is a passive UVM component that observes activity on a DUT interface and converts that activity into transactions that other verification components can understand.
The key word is passive. A monitor observes signals, but it does not drive them.
The basic verification flow is:
Sequence
↓
Sequencer
↓
Driver
↓
DUT
↓
Interface
↓
Monitor
↓
Observed Transaction
↓
Scoreboard / Coverage / Subscribers
The driver says what the testbench intended to send. The monitor reports what the DUT interface actually showed.
Step 2: Why not use the driver's transaction?
It may seem convenient to send the driver's transaction directly to the scoreboard. However, that would only tell you what the testbench asked the DUT to do.
It would not prove that the DUT actually received or produced the expected protocol activity.
Consider this flow:
Driver intends:
write = 1
addr = 8'h20
data = 8'hAA
↓
DUT interface
↓
Monitor observes:
write = 1
addr = 8'h20
data = 8'hAA
The monitor provides independent evidence that the transaction appeared on the interface.
If the driver has a bug and accidentally drives 8'hAB instead of
8'hAA, a monitor can expose that difference.
Step 3: The monitor has three main jobs
A basic monitor performs three responsibilities:
- Sample: observe interface signals at the correct protocol event.
- Translate: convert pin-level activity into a transaction object.
- Publish: send the observed transaction to analysis components.
Conceptually:
DUT signals
↓
Protocol sampling
↓
Transaction reconstruction
↓
analysis_port.write()
↓
Scoreboard / Coverage / Subscriber
Keeping these responsibilities together makes the monitor a clean boundary between the signal-level world and the transaction-level verification environment.
Step 4: Create a monitor class
A monitor is a UVM component, so it extends uvm_monitor.
class bus_monitor extends uvm_monitor;
`uvm_component_utils(bus_monitor)
virtual bus_if vif;
uvm_analysis_port #(bus_transaction) analysis_port;
function new(
string name = "bus_monitor",
uvm_component parent = null
);
super.new(name, parent);
analysis_port =
new("analysis_port", this);
endfunction
endclass
Notice the two important pieces:
vifgives the monitor access to the DUT interface.analysis_portprovides a path for publishing observed transactions.
The monitor does not have a sequence item port because it does not consume sequence items from a sequencer.
Step 5: Sample the interface at the correct time
A monitor must understand the protocol it is observing. It should not simply sample signals at arbitrary times.
Suppose the interface uses a simple valid/ready handshake.
A transfer occurs when both signals are high on a clock edge:
transfer = valid && ready
The monitor can wait for that event:
@(posedge vif.clk iff
vif.valid && vif.ready);
This means: wait for a rising clock edge where both valid and ready are true.
The exact sampling condition depends on the DUT protocol. A FIFO, APB interface, AXI interface, interrupt interface, or custom protocol may require completely different observation rules.
Step 6: Reconstruct a transaction
Once the monitor detects a valid transfer, it creates a transaction and copies the relevant interface values into it.
task collect_transfer();
bus_transaction observed;
observed =
bus_transaction::type_id::create("observed");
@(posedge vif.clk iff
vif.valid && vif.ready);
observed.write = vif.write;
observed.addr = vif.addr;
observed.data = vif.data;
analysis_port.write(observed);
endtask
The resulting object represents what the monitor observed on the interface.
This is called transaction reconstruction: multiple signals are sampled and turned back into one meaningful protocol transaction.
Step 7: Run the monitor continuously
A monitor normally needs to observe transactions for the entire simulation.
Its run_phase() therefore contains a loop.
task run_phase(uvm_phase phase);
forever begin
collect_transfer();
end
endtask
The complete monitor now looks like:
class bus_monitor extends uvm_monitor;
`uvm_component_utils(bus_monitor)
virtual bus_if vif;
uvm_analysis_port #(bus_transaction) analysis_port;
function new(
string name = "bus_monitor",
uvm_component parent = null
);
super.new(name, parent);
analysis_port =
new("analysis_port", this);
endfunction
task collect_transfer();
bus_transaction observed;
observed =
bus_transaction::type_id::create("observed");
@(posedge vif.clk iff
vif.valid && vif.ready);
observed.write = vif.write;
observed.addr = vif.addr;
observed.data = vif.data;
analysis_port.write(observed);
endtask
task run_phase(uvm_phase phase);
forever begin
collect_transfer();
end
endtask
endclass
This is the fundamental structure of a transaction-level monitor.
Step 8: What belongs in a monitor?
A monitor should contain the logic needed to recognize and reconstruct the protocol transaction.
Typical responsibilities include:
- Waiting for clock or protocol events
- Detecting valid transfers
- Sampling interface signals
- Reconstructing transaction fields
- Handling protocol-specific multi-cycle transfers
- Publishing observed transactions
- Optionally reporting useful debug information
The monitor should generally not contain scoreboard comparison logic. Its job is to observe and publish, not decide whether the DUT is correct.
Step 9: What does not belong in a monitor?
- Driving DUT signals: that belongs to the driver.
- Generating stimulus: that belongs to sequences.
- Choosing which sequence runs: that belongs to the test or sequence layer.
- Determining expected DUT behavior: that belongs to checking/reference-model logic.
- Deciding overall pass/fail: that belongs to checking and reporting.
Step 10: Connect the monitor to analysis components
The monitor's analysis port can publish transactions to multiple consumers.
monitor.analysis_port
│
├──→ scoreboard
│
├──→ coverage collector
│
└──→ subscriber
This is one of the most useful properties of the UVM analysis-port architecture: the monitor does not need to know who will consume the transaction.
The monitor simply publishes:
analysis_port.write(observed);
Other components can subscribe to the same stream.
Step 11: Connect the monitor inside the agent
A typical active agent contains a driver, sequencer, and monitor.
class bus_agent extends uvm_agent;
`uvm_component_utils(bus_agent)
bus_sequencer sequencer;
bus_driver driver;
bus_monitor monitor;
function new(
string name = "bus_agent",
uvm_component parent = null
);
super.new(name, parent);
endfunction
function void build_phase(uvm_phase phase);
super.build_phase(phase);
monitor =
bus_monitor::type_id::create(
"monitor", this);
if (is_active == UVM_ACTIVE) begin
sequencer =
bus_sequencer::type_id::create(
"sequencer", this);
driver =
bus_driver::type_id::create(
"driver", this);
end
endfunction
endclass
Notice that the monitor is created for both active and passive operation. An active agent drives stimulus; a passive agent only observes.
This makes the monitor one of the key pieces that allows the same agent architecture to support active and passive verification modes.
Step 12: Monitor independence is important
A strong monitor should be as independent as practical from the driver's internal state.
For example, the monitor should determine whether a transfer happened by observing the interface protocol rather than assuming:
"The driver sent an item, therefore the DUT received it."
Instead, it should observe the actual interface:
"valid && ready occurred, so a transfer happened."
This independence makes the monitor useful for detecting driver errors as well as DUT errors.
Step 13: Debug the monitor
If the scoreboard reports that no transactions were received, the monitor is one of the first places to investigate.
Add temporary debug output:
`uvm_info("MON",
$sformatf("Observed:\n%s",
observed.sprint()),
UVM_MEDIUM)
Then trace:
- Is the monitor's virtual interface configured?
- Is the monitor running?
- Is its sampling condition ever satisfied?
- Are the correct signals being sampled?
- Are the transaction fields reconstructed correctly?
- Is
analysis_port.write()being called? - Is the analysis port connected to its consumer?
This gives you a systematic path from interface activity to transaction-level observation.
Common monitor mistakes
- Driving signals from the monitor: a monitor should be passive.
- Sampling at the wrong clock edge: the transaction may be reconstructed incorrectly.
- Ignoring the protocol handshake: sampling
validwithout confirming a real transfer can create false transactions. - Publishing the driver's transaction: this bypasses independent observation.
- Forgetting to create the analysis port: consumers cannot receive transactions.
- Forgetting
analysis_port.write(): the monitor may observe correctly but publish nothing. - Using the wrong virtual interface: the monitor may be watching the wrong signals.
- Putting scoreboard logic in the monitor: keep observation and checking separate.
- Creating a new transaction too early or too late: ensure each published object represents exactly one observed protocol operation.
Monitor architecture at a glance
UVM AGENT
┌──────────────────────────────┐
│ │
│ Sequencer → Driver │
│ │ │
│ ▼ │
│ DUT │
│ │ │
│ ▼ │
│ Interface │
│ │ │
│ ▼ │
│ Monitor │
│ │ │
└──────────────────┼───────────┘
│
▼
Analysis Port
/ | \
/ | \
▼ ▼ ▼
Scoreboard Coverage Subscriber
The monitor is the observation boundary between the DUT's signal-level interface and the transaction-level verification environment.
Debugging principle: verify what actually happened
A verification environment becomes much more trustworthy when it bases checking on independent observations.
Think about the difference:
Driver:
"I intended to send WRITE 0x20 / AA."
Monitor:
"I observed WRITE 0x20 / AA."
Scoreboard:
"The observed result matches the expected result."
Each component has a distinct responsibility. Together they create an evidence chain from stimulus to verification result.
Try it yourself
Build a basic bus_monitor that observes a
valid/ready interface.
- Create a
virtual bus_ifhandle. - Create a
uvm_analysis_port #(bus_transaction). - Wait for a clock edge where
valid && readyis true. - Create an observed transaction.
- Copy
write,addr, anddatafrom the interface. - Publish it with
analysis_port.write(observed). - Add a temporary
uvm_info()message to display the observed transaction.
Run a directed sequence from Lesson 38 and confirm that the monitor reports the transactions that actually appear on the interface.
Challenge
Modify the monitor so that it distinguishes between reads and writes and reports each observed transaction clearly.
Then intentionally introduce a driver mistake—for example, drive an incorrect data value—and determine whether the monitor reports the value that the driver intended or the value that actually appeared on the interface.
The expected answer should be: the monitor reports what it observed.
That independence is one of the foundations of trustworthy checking.
Key takeaways
- A UVM monitor is a passive component that observes DUT interface activity.
- The monitor converts pin-level protocol activity into transaction-level objects.
- Monitor transactions represent what actually happened on the interface, not merely what the driver intended.
- Sampling must follow the DUT protocol and occur at the correct timing point.
- An analysis port publishes observed transactions to scoreboards, coverage collectors, and subscribers.
- Keep observation, stimulus generation, driving, and checking as separate responsibilities.
- A good monitor works in both active and passive agents because observation does not require driving.
- When debugging, trace the path: interface → sampling → transaction reconstruction → analysis port → consumer.