Module 2: TLM and Data Flow | Intermediate UVM

Out-of-Order Responses

Build scoreboards that correctly verify protocols where responses may return in a different order than requests were issued.

Learning objectives

  • Explain why in-order scoreboards fail when a DUT permits responses to return out of order.
  • Identify the protocol information required to match responses to outstanding requests.
  • Implement an out-of-order checking strategy using transaction IDs.
  • Maintain and remove outstanding transactions safely.
  • Detect unexpected, duplicate, missing, and mismatched responses.
  • Distinguish response ordering from transaction correctness.
  • Understand the architecture used by production-quality out-of-order scoreboards.

Step 1: Understand why ordering matters

Many simple verification environments assume that responses arrive in the same order as requests. For example:

Request 1  -> Response 1


Request 2  -> Response 2
Request 3  -> Response 3

In this situation, a queue is often sufficient. The scoreboard can store expected responses in a FIFO and compare the next observed response against the next expected response.

Real interfaces can be more complicated. A DUT may accept several requests simultaneously and complete them according to internal scheduling, memory latency, arbitration, or resource availability.

Request order:
ID 100
ID 101
ID 102


Response order:
ID 101
ID 102
ID 100

This is not necessarily an error. The protocol may explicitly allow it. Therefore, the verification environment must not confuse different ordering with incorrect behavior.

Core idea: An out-of-order protocol requires the scoreboard to determine correctness by transaction identity, not by arrival position.

Step 2: Understand outstanding transactions

An outstanding transaction is a request that has been accepted but has not yet received its corresponding response.

Time ---------------------------------------------------->


Request ID 100  ---------------------------> Response ID 100
Request ID 101  -------> Response ID 101
Request ID 102  -------------> Response ID 102

Outstanding:
100, 101, 102
100, 102
100
none

The scoreboard must maintain enough state to represent these outstanding transactions.

This is one of the most important differences between an in-order and an out-of-order scoreboard:

In-order Out-of-order
Usually stores transactions in a queue Usually stores transactions by correlation key
Next response is compared with oldest expected item Response identifies which expected item to compare
Ordering is part of checking Ordering may be independent of correctness
Simple outstanding state Potentially many concurrent outstanding transactions

Step 3: Define the correlation contract

Before implementing the scoreboard, determine how the protocol identifies a response.

For example:

Request:
transaction_id
address
write_data


Response:
transaction_id
read_data
status

The transaction_id becomes the correlation key.

The scoreboard can then answer:

"Response ID 101 arrived."

    |
    v


Look up expected transaction ID 101


    |
    +---- Found ----> Compare
    |
    +---- Not found -> Report unexpected response

If the protocol does not provide an ID, you must determine whether another field or combination of fields uniquely identifies an outstanding transaction. Never invent a correlation scheme that contradicts the protocol.

Verification principle: Correlation logic must reflect the DUT protocol contract. A convenient key is not necessarily a correct key.

Step 4: Predict expected responses

Correlation and prediction are separate responsibilities. The scoreboard first needs to know what response is expected for each request.

For a simple example, suppose the DUT is expected to return the bitwise complement of the request data.

function response predict(packet req);


response rsp;

rsp = new("rsp");
rsp.id   = req.id;
rsp.data = ~req.data;

return rsp;

endfunction

The predicted response is stored using the request ID:

expected_by_id[req.id] = predict(req);

Now the scoreboard has a table of outstanding expectations.

ID       Expected response


---

100      data = 32'hFFFF0000
101      data = 32'h12345678
102      data = 32'h0000ABCD

Step 5: Implement the expected-response table

An associative array is a natural representation for keyed outstanding transactions in SystemVerilog.

response expected_by_id [bit [7:0]];

When a request is observed:

expected_by_id[req.id] = predict(req);

When a response arrives:

if (expected_by_id.exists(rsp.id)) begin
expected = expected_by_id[rsp.id];


end

After the response has been successfully checked, the outstanding entry must be removed:

expected_by_id.delete(rsp.id);

Deleting the entry is important. Otherwise, the scoreboard may incorrectly believe that the transaction is still outstanding or may accept an invalid duplicate response.

Step 6: Build an out-of-order scoreboard

The following example demonstrates the core architecture. It intentionally separates request collection from response checking.

class ooo_scoreboard extends uvm_scoreboard;


`uvm_component_utils(ooo_scoreboard)

uvm_tlm_analysis_fifo #(packet)   request_fifo;
uvm_tlm_analysis_fifo #(response) response_fifo;

response expected_by_id [bit [7:0]];

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

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


request_fifo  = new("request_fifo", this);
response_fifo = new("response_fifo", this);


endfunction

task run_phase(uvm_phase phase);


fork
  collect_requests();
  check_responses();
join


endtask

task collect_requests();


packet req;
response expected;

forever begin

  request_fifo.get(req);

  if (expected_by_id.exists(req.id)) begin

    `uvm_error("OOO_SB",
      $sformatf(
        "Duplicate outstanding request ID %0d",
        req.id))

    continue;
  end

  expected = predict(req);

  expected_by_id[req.id] = expected;

  `uvm_info("OOO_SB",
    $sformatf(
      "Stored expected response for ID %0d",
      req.id),
    UVM_MEDIUM)

end


endtask

task check_responses();


response rsp;
response expected;

forever begin

  response_fifo.get(rsp);

  if (!expected_by_id.exists(rsp.id)) begin

    `uvm_error("OOO_SB",
      $sformatf(
        "Unexpected response ID %0d",
        rsp.id))

    continue;
  end

  expected = expected_by_id[rsp.id];

  if (rsp.data !== expected.data) begin

    `uvm_error("OOO_SB",
      $sformatf(
        "Mismatch for ID %0d: expected=%08h actual=%08h",
        rsp.id,
        expected.data,
        rsp.data))

  end
  else begin

    `uvm_info("OOO_SB",
      $sformatf(
        "Correct response for ID %0d",
        rsp.id),
      UVM_MEDIUM)

  end

  expected_by_id.delete(rsp.id);

end


endtask

endclass

The essential operation is:

expected = expected_by_id[rsp.id];

The response does not need to be the oldest outstanding transaction. Its ID determines which prediction is checked.

Step 7: Connect the monitors

The scoreboard should receive transactions from monitors rather than directly accessing DUT signals.

function void connect_phase(uvm_phase phase);


super.connect_phase(phase);

request_monitor.ap.connect(
sb.request_fifo.analysis_export);

response_monitor.ap.connect(
sb.response_fifo.analysis_export);

endfunction

This maintains a clean verification architecture:

             REQUEST MONITOR
                |
                v
          request_ap
                |
                v
          request_fifo
                |
                v
         +-------------+
         |             |
         |  SCOREBOARD |
         |             |
         +-------------+
                ^
                |
          response_fifo
                ^
                |
          response_ap
                ^
                |
        RESPONSE MONITOR

The monitor observes. The scoreboard predicts, correlates, and checks. This separation makes the components reusable.

Step 8: Verify true out-of-order behavior

Do not validate an out-of-order scoreboard using only in-order responses. The test must intentionally exercise the behavior the architecture is designed to support.

Requests:


ID 1 -> data A
ID 2 -> data B
ID 3 -> data C

Responses:

ID 2 -> expected B
ID 3 -> expected C
ID 1 -> expected A

The scoreboard should produce:

Matched ID 2


Matched ID 3
Matched ID 1

Outstanding transactions: 0
Errors: 0

Notice that the scoreboard does not report an ordering failure. The protocol allows responses to complete independently.

Step 9: Test the failure modes

A useful verification component must prove that it detects incorrect behavior, not merely that it accepts correct behavior.

Unexpected response

Requests:


ID 10
ID 11

Response:
ID 99

The scoreboard should report an unexpected response because ID 99 is not outstanding.

Incorrect response

Request:


ID 10 -> expected data A

Response:
ID 10 -> data X

The ID is valid, but the response contents are incorrect.

Missing response

Requests:


ID 10
ID 11

Responses:
ID 10

ID 11 remains outstanding. The environment must eventually detect that the expected response never arrived.

Duplicate response

Request:


ID 10

Responses:
ID 10
ID 10

After the first response is checked, ID 10 should be removed. The second response should therefore be reported as unexpected.

Step 10: Understand maximum outstanding depth

Real protocols often limit how many transactions can be outstanding at once. For example, a protocol might allow at most 16 IDs to be active.

This creates an additional verification opportunity: measure and check the number of outstanding transactions.

if (expected_by_id.size() > MAX_OUTSTANDING) begin


`uvm_error("OOO_SB",
$sformatf(
"Outstanding depth exceeded: %0d",
expected_by_id.size()))

end

The exact mechanism depends on the protocol. The important idea is that concurrency itself can become a verification requirement.

Step 11: Do not confuse out-of-order with random order

Out-of-order does not mean that the DUT may return responses arbitrarily with no constraints.

A protocol may allow:

  • Different IDs to complete in any order.
  • Transactions on different channels to complete independently.
  • Responses to be reordered within specific groups.
  • Responses to remain ordered for transactions sharing the same ID.

The scoreboard must understand the actual protocol ordering rules.

Important: "Out-of-order" is a protocol property, not permission for the scoreboard to ignore all ordering requirements.

Common mistakes

  • Using a FIFO for correlation: A FIFO assumes that the oldest expected transaction corresponds to the next response.
  • Using an invalid correlation key: If the key is not unique among outstanding transactions, predictions can collide.
  • Forgetting to delete completed entries: This creates stale outstanding transactions and can hide duplicate responses.
  • Checking only data: A correct data value attached to the wrong transaction is still a failure.
  • Ignoring missing responses: A scoreboard should not finish successfully while expected transactions remain outstanding.
  • Testing only in-order traffic: An out-of-order implementation is not proven until responses are deliberately reordered.
  • Assuming all protocols behave the same: Correlation and ordering rules are protocol-specific.

Debugging strategy

When an out-of-order scoreboard reports a failure, debug in this order:

  1. Confirm that the request was actually observed.
  2. Confirm that the request generated the expected prediction.
  3. Confirm the correlation key.
  4. Check whether the response ID exists in the outstanding table.
  5. Compare expected and actual response contents.
  6. Check whether the transaction was deleted too early or too late.
  7. Review protocol-specific ordering and ID-reuse rules.

This prevents a misleading symptom—such as an "unexpected response"—from being mistaken for the root cause.

Connection to the next lessons

Out-of-order response handling combines several concepts from the previous lessons and prepares the verification environment for more advanced checking.

  • Lesson 17 — Transaction Correlation: provides the fundamental matching mechanism.
  • Lesson 19 — Latency-Aware Checking: adds timing and latency requirements to correlated transactions.
  • Lesson 21 — Scoreboard Design Patterns: generalizes this architecture into reusable scoreboard structures.
  • Lesson 25 — Out-of-Order Scoreboards: develops this idea into a complete production-style scoreboard.

Try it yourself

Build a small out-of-order verification scenario using three outstanding transactions.

  1. Create requests with IDs 10, 11, and 12.
  2. Generate an expected response for each request.
  3. Store the expected responses by ID.
  4. Return responses in the order 11, 12, 10.
  5. Verify that all three responses are matched correctly.
  6. Return a response with an unknown ID and verify the error.
  7. Return a valid ID with incorrect data and verify the mismatch.
  8. Leave one request outstanding and verify that the test detects the missing response.
  9. Send a duplicate response and verify that it is rejected.

Advanced challenge: Modify the scoreboard to support two independent channels. Use {channel_id, transaction_id} as the correlation key and explain why a transaction ID alone is insufficient when each channel can reuse the same IDs.

Self-check

  1. Why can an in-order scoreboard produce false failures for an out-of-order protocol?
  2. What makes a transaction an "outstanding" transaction?
  3. Why is a transaction ID useful for out-of-order checking?
  4. Why must the scoreboard delete an expected transaction after completion?
  5. How should the scoreboard react to a response with an unknown ID?
  6. How can the environment detect a response that never arrives?
  7. Why must an out-of-order scoreboard still understand protocol-specific ordering rules?
Expected understanding: You should be able to design a scoreboard that does not depend on response arrival order and can explain exactly how each observed response is matched to its expected transaction.

Key takeaways

  • Out-of-order responses are valid when the protocol allows transactions to complete independently.
  • An out-of-order scoreboard must correlate each response with the correct outstanding request.
  • Associative arrays provide a convenient keyed representation of outstanding expectations.
  • Transaction identity is part of correctness; matching data alone is insufficient.
  • Completed transactions must be removed from the outstanding table.
  • Unexpected, duplicate, mismatched, and missing responses must be detected explicitly.
  • Do not assume that "out-of-order" means "no ordering rules"; always follow the protocol contract.
  • A strong out-of-order scoreboard is built around prediction, correlation, checking, and outstanding-state management.