Module 5: Observation and Checking | Beginner UVM

Objections and End of Test

Learn how UVM controls the end of simulation, how objections keep a test running, and how to finish only after meaningful verification work is complete.

Learning objectives

  • Explain why UVM needs objections to coordinate the end of a test.
  • Use raise_objection() and drop_objection() correctly.
  • Understand what happens when the run phase has no active objections.
  • Recognize common early-termination and test-hang problems.
  • Coordinate stimulus completion with scoreboard checking.

Step 1: Understand the problem

UVM components run concurrently. A sequence may be generating transactions while a driver is driving them, a monitor is observing them, and a scoreboard is still checking previous transactions.

That creates an important question:

When is the test actually finished?

Simply reaching the end of a function or starting a sequence does not automatically tell the entire UVM environment that verification is complete.

UVM uses phase objections to coordinate this.

Test starts
|
v


Run phase begins
|
+--> Sequence generates stimulus
|
+--> Driver drives DUT
|
+--> Monitor observes
|
+--> Scoreboard checks
|
v
Stimulus complete
|
v
Drop objection
|
v
No active objections
|
v
Run phase can finish

An objection is essentially a component saying:

"I am still doing work that must finish before this phase ends."

Step 2: Raise an objection before starting important work

The most common beginner pattern is to raise an objection in the test's run_phase() before starting the main sequence.

task run_phase(uvm_phase phase);


phase.raise_objection(this);

seq = bus_sequence::type_id::create("seq");
seq.start(env.agent.sequencer);

phase.drop_objection(this);

endtask

The sequence is now part of a clearly defined run interval:

raise_objection()
   |
   v


Start sequence
|
v
Generate transactions
|
v
Sequence finishes
|
v
drop_objection()

The objection prevents the run phase from ending while this test still has outstanding work represented by that objection.

Important: Raising an objection does not pause simulation. It simply participates in the decision about when the phase is allowed to end.

Step 3: Understand the objection count

It is useful to think of objections as a count.

raise_objection()  → count increases


drop_objection()   → count decreases

Run phase ends only when:
all required phase activity is complete
and there are no active objections

For example:

Test raises objection
    count = 1


Another component raises objection
count = 2

Test drops objection
count = 1

Other component drops objection
count = 0

Run phase may end

This allows multiple parts of a verification environment to coordinate phase completion without one component having to know every detail about the others.

Key point: One component dropping its objection does not necessarily end the phase. The phase continues while other objections remain active.

Step 4: Build a complete beginner test

Here is a simplified test using the sequence and environment architecture from earlier lessons.

class bus_test extends uvm_test;


`uvm_component_utils(bus_test)

bus_env      env;
bus_sequence seq;

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

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


env = bus_env::type_id::create("env", this);


endfunction

task run_phase(uvm_phase phase);


phase.raise_objection(this);

seq = bus_sequence::type_id::create("seq");

`uvm_info("TEST",
          "Starting main sequence",
          UVM_LOW)

seq.start(env.agent.sequencer);

`uvm_info("TEST",
          "Main sequence completed",
          UVM_LOW)

phase.drop_objection(this);


endtask

endclass

This gives the test a simple lifecycle:

  1. Build the environment.
  2. Enter the run phase.
  3. Raise an objection.
  4. Start the sequence.
  5. Wait for the sequence to finish.
  6. Drop the objection.
  7. Allow the run phase to complete.
  8. Continue to later UVM phases.

Step 5: Understand the early-end problem

One of the most confusing beginner problems is a simulation that appears to stop immediately or before expected transactions have completed.

For example, this is a poor pattern:

task run_phase(uvm_phase phase);


seq = bus_sequence::type_id::create("seq");
seq.start(env.agent.sequencer);

endtask

The test has not explicitly declared that it needs the run phase to remain active while its work is in progress.

The safer beginner pattern is:

task run_phase(uvm_phase phase);


phase.raise_objection(this);

seq = bus_sequence::type_id::create("seq");
seq.start(env.agent.sequencer);

phase.drop_objection(this);

endtask

Notice the ordering. The objection is raised before the important time-consuming work begins and dropped after that work completes.

Common mistake: dropping the objection before the sequence has actually completed. That tells UVM the test is finished even though stimulus may still be expected.

Step 6: The scoreboard may still need time

There is an important subtlety here.

A sequence finishing does not always mean that the entire verification environment has finished processing its transactions.

Sequence


|
| sends final transaction
v
Driver
|
| DUT latency
v
DUT
|
v
Monitor
|
v
Scoreboard
|
v
Final check

Imagine the sequence sends its final transaction and immediately drops its objection. The DUT might still need several clock cycles before producing the response.

If the test ends immediately, the monitor and scoreboard may never see the final result.

A simple beginner solution is to wait for the expected processing to complete before dropping the objection.

task run_phase(uvm_phase phase);


phase.raise_objection(this);

seq = bus_sequence::type_id::create("seq");
seq.start(env.agent.sequencer);

// Allow the DUT and checking components
// to process the final transaction.
repeat (5) @(env.agent.vif.clk);

phase.drop_objection(this);

endtask

The exact waiting mechanism should come from the protocol and verification architecture. A fixed delay can be useful for a simple teaching example, but production environments often use a more meaningful completion condition.

Important: Do not blindly add large delays to "make the test pass." The goal is to understand what event means that the final transaction has actually been processed.

Step 7: Think in terms of completion events

A stronger architecture defines what done actually means.

Weak definition:


"Wait 100 ns and hope everything finished."

Better definition:
"Wait until all expected responses have been observed."

For example, if a test sends exactly ten transactions, the scoreboard might track how many expected transactions have been consumed.

Transactions sent:       10


Expected transactions:   10
Actual transactions:     10
Scoreboard mismatches:    0

Test is ready to finish.

This is much more meaningful than choosing an arbitrary delay.

The specific mechanism used to signal completion can become more sophisticated as the verification environment grows. For now, focus on the principle:

End the test because the verification work is complete—not simply because enough simulation time has passed.

Step 8: Understand objections and infinite processes

Monitors and other passive components often contain loops such as:

forever begin


@(posedge vif.clk);

// Observe transactions
end

That does not mean the test should keep an objection forever.

The monitor can continue waiting for activity while the test's objection controls when the run phase is allowed to finish.

Test


|
| objection
v
Run phase ----------------------+
|
Monitor: forever observe         |
|
Test completes                 |
|                              |
+-- drop objection ------------+
|
v
Run phase ends

This is an important architectural distinction:

  • Forever loop: keeps a component ready to observe activity.
  • Objection: tells UVM that important phase work is still in progress.

Do not solve a test-completion problem by putting an objection inside a monitor's forever loop and never dropping it.

Step 9: Avoid objection leaks

An objection leak occurs when a component raises an objection but fails to drop it.

phase.raise_objection(this);


// Work happens here...

// Missing:
phase.drop_objection(this);

The result can be a test that never finishes because UVM still sees an active objection.

Keep the raise/drop pair easy to identify:

task run_phase(uvm_phase phase);


phase.raise_objection(this);

// Main test activity
seq.start(env.agent.sequencer);

// Final synchronization/checking activity
wait_for_completion();

phase.drop_objection(this);

endtask

When debugging a test that runs forever, ask:

  1. Who raised the objection?
  2. Who is responsible for dropping it?
  3. Can that code path be reached?
  4. Is the component waiting forever for an event that never occurs?

Step 10: Objections are not the same as pass/fail

An objection answers:

"Should this phase remain active?"

It does not answer:

"Did the DUT pass verification?"

Those are separate concerns.

Objection system
|
+--> Controls phase completion


Scoreboard / assertions / checks
|
+--> Determine correctness

UVM reporting
|
+--> Communicates results

A test can finish normally and still contain verification errors. Conversely, a test can fail to finish because of an objection problem even when the DUT behavior was correct.

Verification mindset: "The simulation ended" and "the DUT passed" are not equivalent statements.

Debugging early termination and hangs

Symptom Likely area to investigate
Test ends immediately Check whether the test raised an objection before starting stimulus.
Final response is missing Check whether the objection was dropped before the DUT and scoreboard finished processing.
Simulation never ends Look for an objection that was raised but never dropped.
Scoreboard reports leftover expected transactions The test may have ended before all DUT responses arrived.
Test waits forever Check the completion event or condition being waited on.
Many components use objections Identify which component owns each objection and when it is released.

Try it yourself

Create a test that generates ten bus transactions and uses a run-phase objection to control completion.

  1. Raise an objection before starting the sequence.
  2. Start a sequence that generates ten transactions.
  3. Print a message when the sequence completes.
  4. Allow enough time for the DUT and monitor to process the final transaction.
  5. Drop the objection only after the required verification work is complete.
  6. Use the scoreboard to confirm that all ten expected transactions were observed.

Debug challenge 1: Comment out raise_objection(). Observe what happens to test completion.

Debug challenge 2: Comment out drop_objection(). Identify why the simulation no longer finishes normally.

Debug challenge 3: Drop the objection immediately after starting stimulus rather than after the sequence completes. Observe whether the test can terminate before all checking is complete.

Key takeaways

  • UVM objections help coordinate when a phase is allowed to finish.
  • Raise an objection before important time-consuming work and drop it after that work is complete.
  • A sequence finishing does not always mean that the DUT and scoreboard have finished processing its final transaction.
  • Use meaningful completion conditions instead of arbitrary delays whenever practical.
  • Forever-running monitors do not need to hold the test open with a permanent objection.
  • An objection controls phase completion; it does not determine whether the DUT passed or failed.
  • A test that ends successfully is not necessarily a test that passed verification.

Core mental model

Raise objection
   |
   v


Do verification work
|
+--> Generate stimulus
|
+--> Drive DUT
|
+--> Observe DUT
|
+--> Check results
|
v
Verify completion
|
v
Drop objection
|
v
Run phase can finish
|
v
Later UVM phases execute

Raise → Work → Finish → Drop.

The most important question at the end of a test is not "Have I waited long enough?" It is "Has the verification work I care about actually finished?"

Module 5 complete

You have now built the core observation-and-checking path: monitors observe protocol activity, TLM carries transactions, analysis ports publish observations, subscribers analyze them, scoreboards compare expected and actual behavior, reference models predict expected results, and objections coordinate test completion.

Next, the course moves into Module 6: First Complete Environment, where these pieces are assembled into reusable UVM agents, environments, tests, and complete verification labs.