Module 4: Coverage and Assertions | Intermediate UVM

Cross Coverage

Learn how to measure meaningful combinations of verification dimensions and use uncovered crosses to drive coverage closure.

Learning objectives

  • Explain what cross coverage measures and when it provides useful information beyond individual coverpoints.
  • Build a cross between meaningful coverpoints using SystemVerilog.
  • Choose bins that represent verification intent rather than arbitrary signal values.
  • Distinguish valid, irrelevant, and illegal combinations.
  • Sample cross coverage at the correct transaction or protocol event.
  • Diagnose uncovered cross bins and use them to guide stimulus and coverage closure.
  • Recognize when a large cross creates noise, excessive bins, or misleading coverage.

Step 1: Why cross coverage exists

Lesson 32 introduced coverpoints and bins. A coverpoint answers a question about one dimension of behavior:

  • Did we perform reads and writes?
  • Did we access each address region?
  • Did we exercise every operating mode?

But many requirements are about combinations of conditions.

For example:

  • Did we perform both reads and writes in every address region?
  • Did every burst type occur in every operating mode?
  • Did error responses occur for each request class?
  • Did boundary addresses get exercised in both read and write directions?

Individual coverpoints can report 100% while these combinations are still missing.

Core idea: A coverpoint measures individual values or transitions. A cross measures combinations of sampled values from multiple coverpoints.

Step 2: See why individual coverage can be misleading

Suppose an environment has these two coverpoints:

  • operation: read or write
  • region: control, status, or data

The individual coverage could be complete:

operation:


read  = hit
write = hit

region:
control = hit
status  = hit
data    = hit

That still does not prove that every operation occurred in every region.

For example, the stimulus might have produced:

read  + control


read  + status
read  + data
write + data

All individual bins are covered, but these combinations never occurred:

write + control


write + status

A cross exposes this missing relationship.

Step 3: Build a basic cross

A cross is declared inside a covergroup using the cross construct.

covergroup transfer_cg with function sample(packet item);

operation_cp: coverpoint item.write {
    bins read  = {0};
    bins write = {1};
}

region_cp: coverpoint item.addr {
    bins control = {[32'h0000_0000 : 32'h0000_00FF]};
    bins status  = {[32'h0000_0100 : 32'h0000_01FF]};
    bins data    = {[32'h0000_1000 : 32'h0000_1FFF]};
}

operation_x_region:
    cross operation_cp, region_cp;


endgroup

The cross now measures combinations of the operation_cp bins with the region_cp bins.

Conceptually, the cross creates a matrix like this:

                    Region
          control   status   data
        +---------+---------+---------+


read        |    X    |    X    |    X    |
+---------+---------+---------+
write       |    X    |    X    |    X    |
+---------+---------+---------+

Each cell represents a combination that can become covered when that combination is sampled.

Important: Cross coverage does not generate stimulus. It measures whether sampled behavior has exercised combinations you chose to measure.

Step 4: Understand what the cross is actually sampling

A cross does not continuously watch every signal in the design. It is evaluated when the covergroup is sampled.

For the transaction-oriented covergroup above:

class transfer_coverage extends uvm_subscriber #(packet);

`uvm_component_utils(transfer_coverage)

covergroup transfer_cg with function sample(packet item);

    operation_cp: coverpoint item.write {
        bins read  = {0};
        bins write = {1};
    }

    region_cp: coverpoint item.addr {
        bins control = {[32'h0000_0000 : 32'h0000_00FF]};
        bins status  = {[32'h0000_0100 : 32'h0000_01FF]};
        bins data    = {[32'h0000_1000 : 32'h0000_1FFF]};
    }

    operation_x_region:
        cross operation_cp, region_cp;

endgroup

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

function void write(packet item);
    transfer_cg.sample(item);
endfunction


endclass

The monitor can publish observed transactions to this subscriber:

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

env.monitor.analysis_port.connect(
    env.transfer_cov.analysis_export
);


endfunction

The important sequence is:

DUT activity
 |
 v


Monitor reconstructs transaction
|
v
analysis_port
|
+------------------> Scoreboard
|
+------------------> Coverage subscriber
|
v
sample(item)
|
v
coverpoints + cross

Sampling from the monitor is often useful because the coverage then represents behavior actually observed at the DUT interface rather than merely what a sequence attempted to generate.

Step 5: Cross meaningful bins, not raw signal values

One of the most important intermediate-level coverage skills is deciding what should be crossed.

Suppose an address is 32 bits wide. Crossing the raw address with another large-valued field can produce an enormous number of possible combinations.

Usually the requirement is not:

"Every possible address must occur with every possible transaction type."

It may instead be:

"Reads and writes must both be exercised in each architecturally


meaningful address region."

That requirement suggests creating bins for the meaningful regions first, then crossing those bins.

This is why Lesson 32's bin design directly affects Lesson 33. Poor bins produce poor crosses.

Coverage modeling rule: First define the functional categories that matter. Then cross those categories. Do not start by crossing every available field.

Step 6: Control combinations that do not matter

Not every mathematical combination is necessarily a meaningful verification scenario.

Consider:

mode_cp:
normal
debug


operation_cp:
read
write

response_cp:
success
error

The raw cross has eight possible combinations. But perhaps the specification says that debug + write + error is not a legal or relevant scenario.

Coverage should distinguish between:

  • Required combination: must be exercised.
  • Irrelevant combination: should not affect the coverage goal.
  • Illegal combination: should never occur and may indicate a design or stimulus problem.

The exact mechanism depends on the coverage model and verification requirements. For cross coverage, ignore_bins can remove combinations from the coverage calculation.

mode_x_operation:
cross mode_cp, operation_cp {
    ignore_bins unsupported =
        binsof(mode_cp) intersect {DEBUG} &&
        binsof(operation_cp) intersect {WRITE};
}

The important point is not memorizing this syntax. The important point is that the coverage model should represent the specification rather than treating every mathematically possible combination as equally important.

For combinations that must never occur, consider whether an assertion is a better mechanism for detecting the violation. Coverage measures whether scenarios occurred; assertions are often better suited to expressing rules that must always hold.

Step 7: Use crosses to expose missing scenarios

Imagine the coverage report shows:

operation_cp       100%


region_cp          100%
operation_x_region 66%

Do not immediately add randomization or increase the number of seeds.

First ask:

  1. Which cross bins are uncovered?
  2. Are those combinations required by the specification?
  3. Are the transactions actually capable of producing them?
  4. Are constraints preventing them?
  5. Is the monitor sampling the correct transaction?
  6. Is the address-to-region classification correct?
  7. Does the DUT legitimately reject or transform the attempted operation?

For example, if write + status is missing, a useful debug path is:

Uncovered cross bin
   |
   v


Is write + status required?
|
+-- no --> document/ignore the combination
|
+-- yes
|
v
Can stimulus generate it?
|
+-- no --> fix sequence/constraints
|
v
Does DUT accept it?
|
+-- no --> verify expected behavior
|
v
Does monitor reconstruct it?
|
+-- no --> fix monitor/sampling
|
v
Coverage model classifies it correctly?
|
+-- no --> fix bins/model

This turns a coverage report into a verification-debugging tool rather than just a percentage.

Step 8: Avoid the "cross everything" trap

It is tempting to write a large cross because the syntax is simple:

big_cross:
cross operation_cp,
      region_cp,
      mode_cp,
      burst_cp,
      response_cp,
      privilege_cp;

This may create a very large coverage space.

A large cross can cause several problems:

  • Many bins may be impossible by design.
  • Many bins may be irrelevant to the requirements.
  • Coverage reports become difficult to interpret.
  • Coverage closure becomes dominated by low-value corner combinations.
  • Simulation may spend effort reaching combinations that provide little verification value.

Instead, create focused crosses that answer specific questions.

For example:

read_write_x_region:
cross operation_cp, region_cp;


burst_x_mode:
cross burst_cp, mode_cp;

error_x_operation:
cross response_cp, operation_cp;

Each cross should have a reason to exist.

Practical rule: If you cannot explain what requirement an uncovered cross bin represents, reconsider whether that cross belongs in the coverage model.

Step 9: Understand cross coverage and random stimulus

Random stimulus is useful for discovering combinations, but randomization does not guarantee efficient coverage closure.

Suppose one combination is rare:

mode = DEBUG


operation = WRITE
address = STATUS
response = ERROR

A constrained-random test may run for many seeds without hitting it.

The coverage result tells you that the combination is missing. The next engineering decision might be:

  • adjust a constraint so the combination becomes more likely,
  • add a directed sequence targeting the combination,
  • create a targeted scenario for a difficult corner case, or
  • determine that the combination is impossible or irrelevant and correct the coverage model.

Coverage does not tell you which solution is correct. The specification and architecture do.

Step 10: Cross coverage is not a correctness check

Consider a coverage result showing:

write + status = covered

This proves that the sampled combination occurred. It does not prove that the DUT handled the operation correctly.

The verification environment needs different mechanisms for different questions:

Question Useful mechanism
Did this scenario occur? Functional coverage
Did this combination occur? Cross coverage
Was the observed result correct? Scoreboard / reference model
Was a temporal protocol rule violated? SystemVerilog assertion
Which RTL structures executed? Code coverage

Strong verification uses these mechanisms together. No coverage percentage can replace functional checking.

Step 11: A practical UVM coverage component

Here is a compact reusable collector that combines the Lesson 32 concepts with a focused cross.

class packet_coverage extends uvm_subscriber #(packet);

`uvm_component_utils(packet_coverage)

covergroup packet_cg with function sample(packet item);

    operation_cp: coverpoint item.write {
        bins read  = {0};
        bins write = {1};
    }

    region_cp: coverpoint item.addr {
        bins control = {[32'h0000_0000 : 32'h0000_00FF]};
        bins status  = {[32'h0000_0100 : 32'h0000_01FF]};
        bins data    = {[32'h0000_1000 : 32'h0000_1FFF]};
    }

    write_x_region:
        cross operation_cp, region_cp;

endgroup

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

function void write(packet item);
    packet_cg.sample(item);
endfunction


endclass

And the environment connects the monitor to the subscriber:

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

env.monitor.analysis_port.connect(
    env.packet_cov.analysis_export
);


endfunction

The reusable architecture is:

                         +------------------+
                     |     Scoreboard    |
                     +------------------+
                              ^
                              |


Monitor -- analysis_port --------+
|
+--------------------------+
|
v
+------------------+
| Coverage         |
| coverpoints      |
| + crosses        |
+------------------+

The monitor publishes the transaction once, and multiple consumers can independently use it for checking, coverage, recording, or other analysis.

Step 12: Debug an uncovered cross systematically

When a cross is incomplete, use the following workflow rather than immediately modifying the coverage model.

1. Identify the exact missing combination

Do not stop at "cross coverage is 95%." Find the actual uncovered bins.

2. Confirm that the combination is required

Check the specification and coverage plan. A missing bin is not automatically a verification failure.

3. Check the sampling boundary

Make sure the covergroup is sampled when the transaction represents meaningful DUT behavior. For a handshake protocol, this may be the accepted transfer rather than merely observing valid.

4. Inspect the transaction

Use transaction logs or UVM reports to confirm that the fields used by the coverpoints contain the expected values.

5. Check stimulus and constraints

Determine whether the sequence can legally generate the missing combination.

6. Check DUT behavior

If the stimulus requests the combination but the DUT never accepts it, determine whether that is expected behavior.

7. Check the coverage model

Finally, verify that the bins and cross accurately represent the requirement.

Debug principle: An uncovered bin can indicate missing stimulus, restrictive constraints, protocol behavior, incorrect sampling, a modeling problem, or an intentionally impossible scenario. Coverage closure is the process of determining which one it is.

Common mistakes

Crossing raw high-cardinality fields

Crossing large address, data, or ID spaces can create an enormous and low-value coverage model. Define functional categories first.

Assuming 100% individual coverage means 100% scenario coverage

Each dimension can be fully covered while important combinations remain untouched. Cross coverage exists specifically to expose those relationships.

Crossing everything "just in case"

Large crosses create coverage noise and make closure harder. Every cross should answer a meaningful verification question.

Treating uncovered bins as automatic failures

An uncovered bin first requires interpretation. It may be required, impossible, irrelevant, unreachable by the current stimulus, or incorrectly modeled.

Sampling at the wrong event

If coverage is sampled before a protocol transaction is accepted, the model may count attempts rather than actual DUT behavior.

Using coverage as a scoreboard

A covered combination only proves that the sampled values occurred. Correctness still requires a scoreboard, reference model, assertions, or another appropriate checker.

Exercise 1: Build a meaningful cross

Start with these dimensions:

operation:
read
write


region:
control
status
data

response:
success
error

Design two crosses that answer useful verification questions.

For each cross, write one sentence explaining why the combination matters.

Do not create a three-way cross automatically. Decide whether the additional relationship is required by the specification.

Exercise 2: Diagnose an uncovered bin

Your coverage report says:

operation_x_region


read  x control  COVERED
read  x status   COVERED
read  x data     COVERED
write x control  COVERED
write x status   UNCOVERED
write x data     COVERED

Answer these questions:

  1. Is write + status required by the specification?
  2. Can the sequence generate it?
  3. Do constraints permit it?
  4. Does the DUT accept it?
  5. Does the monitor report it correctly?
  6. Is the address classified into the correct region?

Only after answering these questions should you decide whether to change stimulus or the coverage model.

Exercise 3: Coverage closure

Suppose a three-way cross has hundreds of uncovered bins, but the specification only requires four specific combinations.

Redesign the coverage model so that the important requirements are measurable without forcing the regression to chase irrelevant combinations.

For each removed or ignored combination, record why it does not belong in the coverage goal.

Challenge: Design a coverage plan for a protocol agent

Choose a protocol you know, such as APB, UART, SPI, or a simple FIFO interface.

Create:

  1. Three individual coverpoints.
  2. Two focused crosses.
  3. At least one boundary-oriented bin.
  4. One combination that should be ignored because it is irrelevant or impossible.
  5. One combination that should be detected as illegal using an appropriate verification mechanism.
  6. A description of exactly when each coverage model should be sampled.

For every cross, write the requirement it represents. If you cannot state the requirement, do not add the cross.

Knowledge check

  1. What additional information does a cross provide beyond its individual coverpoints?
  2. Why can individual coverpoints reach 100% while a cross remains incomplete?
  3. Why should functional categories usually be defined before crossing fields?
  4. What is the difference between an irrelevant combination and an illegal combination?
  5. Why is sampling at the correct protocol boundary important?
  6. What should you investigate before changing constraints to hit an uncovered bin?
  7. Why can a large "cross everything" model make coverage closure worse?
  8. Does a covered cross bin prove that the DUT produced the correct result? Why or why not?
Self-check: If you can look at an uncovered cross bin and explain whether it represents a stimulus problem, constraint problem, protocol limitation, sampling problem, modeling problem, or intentional exclusion, you understand the main engineering skill of this lesson.

Key takeaways

  • Cross coverage measures relationships between coverage dimensions.
  • Individual coverpoint coverage does not prove that important combinations occurred.
  • Build crosses from meaningful functional bins rather than blindly crossing raw fields.
  • Every important cross should correspond to a verification requirement.
  • Not every mathematically possible combination belongs in the coverage goal.
  • Sample coverage at a meaningful transaction or protocol acceptance boundary.
  • An uncovered bin is a starting point for investigation, not automatically a failure.
  • Coverage measures occurrence; scoreboards and assertions provide complementary evidence about correctness.
  • Focused crosses make coverage closure more useful and more manageable.

What comes next

Lesson 34: Coverage Sampling Architecture moves from what to measure to where and when coverage should be sampled.

You have now built individual coverpoints and bins, then combined them into meaningful relationships. The next question is architectural: should coverage sample sequence intent, monitor transactions, accepted transfers, clock events, or another derived event?

That distinction becomes especially important in reusable UVM environments, because incorrect sampling can produce impressive-looking coverage numbers that do not actually represent DUT behavior.