Skip to question
SystemVerilogDesignVerificationFirmwareArchitectureASIC Interview Questions→
/Interview questions/Match out-of-order packets by ID

Q033·Free·Design Verification

Match out-of-order packets by ID

Difficulty
Medium
Topic
Reference Models
Language
SV
Interview prompt

Question

Implement a scoreboard for responses that may arrive in any cross-ID order while preserving order within each ID. Support more than one outstanding packet with the same ID.

Scoreboard architecture with a FIFO of expected packets for each transaction ID and out-of-order actual responses matched within each ID.
The per-ID queues preserve order within an ID while allowing different IDs to complete out of order.
Candidate starting point

Implementation scaffold

`include "uvm_macros.svh"


package exercise_71;
  timeunit 1ns; timeprecision 1ps;
  import uvm_pkg::*;

class txn extends uvm_sequence_item;
  int unsigned id;
  logic [31:0] data;
  `uvm_object_utils_begin(txn)
    `uvm_field_int(id, UVM_ALL_ON)
    `uvm_field_int(data, UVM_ALL_ON)
  `uvm_object_utils_end
  function new(string name = "txn"); super.new(name); endfunction
endclass

class id_scoreboard extends uvm_scoreboard;
  `uvm_component_utils(id_scoreboard)
  function new(string name, uvm_component parent); super.new(name,parent); endfunction
  txn expected_by_id[int unsigned][$];

  function void write_expected(txn item);
    // TODO: implement this body.
  endfunction

  function void write_actual(txn actual);
    // TODO: implement this body.
  endfunction

  function void check_phase(uvm_phase phase);
    // TODO: implement this body.
  endfunction
endclass
endpackage
Reviewed example

Trace one case

Input
expected: id1=A, id1=B, id2=C; responses: id2=C, id1=A, id1=B
Expected output
all three match; per-ID queues empty

Cross-ID reordering is legal, but the two id1 responses still consume A before B from that ID's FIFO.

What to cover

Requirements

  1. Store a FIFO of expected transactions for every ID instead of one value per ID.
  2. Reject an output whose ID has no pending expectation.
  3. Compare with the oldest expected packet for that ID and remove it only after selecting it.
  4. Report every nonempty per-ID queue at end of test.
  5. Assume non-null transaction handles. Deliver an expectation before its corresponding actual callback; callers serialize callbacks in observation order.
Exact question handoffPractice Q033

Solve it in the question bank, keep your progress, and reveal the reviewed solution when your access allows.

Open in question bank →
Solution accessEach time you open this Solution, one Practice Credit is used; it is not permanently unlocked. Premium Solution content also uses one credit per opening.
Continue learning

Ordering and Memory Consistency

Review legal reordering, global visibility, identities, dependencies, and consistency evidence.

  • Reference Models
  • Scoreboard
  • Out-of-order
  • ID matching
Ordering and Memory Consistency →
Continue practicing

Related questions

Q053 · Reference ModelsOut-of-order scoreboard matchingMedium→Q905 · Reference ModelsMatch same-ID responses by addressMediumP→Q465 · Reference ModelsCheck arbitrarily reordered packetsMediumP→Q061 · Reference ModelsCheck delayed and reordered memory writesMedium→Q208 · Reference ModelsRelease reordered responses in request orderHardP→
ASIC.FYI · Learn silicon end to end.info@asic.fyi