Skip to question
asic.fyi
DesignVerificationSystemVerilogFirmwareArchitectureInterviews
asic.fyi/Interview questions/Match hit-under-miss responses by transaction ID

Hardware interview practice

Match hit-under-miss responses by transaction ID

MediumComputer ArchitectureSystemVerilog

A cache may hold one miss while later hits return first. A scoreboard therefore cannot compare responses only in request order. Implement a SystemVerilog reference scoreboard keyed by four-bit transaction ID.

Try it in the question bankReason first. Then compare.

Keep this exact question selected while you check your answer and review the full solution.

Practice this question →
Starting point

Question code

class hum_scoreboard;
function void request(bit [3:0] id, bit hit, bit [31:0] hit_data);
function void fill(bit [3:0] miss_id, bit [31:0] fill_data);
function void response(bit [3:0] id, bit [31:0] data);
function int unsigned errors();
Reviewed example

Work through one case

Input
request(1, miss), request(2, hit, 0x22), response(2, 0x22), fill(1, 0x11), response(1, 0x11).
Expected output
errors() returns 0 and both IDs retire.

The hit may respond before the miss, while the fill supplies ID 1's expected data before its matching response arrives.

What to cover

Requirements

  1. An ID must not be reused while outstanding. A hit records hit_data immediately; a miss records no data and is legal only when no other miss is outstanding.
  2. fill is legal only for the current miss ID, supplies that ID's expected data, and clears the one-miss resource without completing the response obligation.
  3. response may arrive in any ID order but is legal only after that ID has expected data; compare data with case equality, count one error on mismatch, and then retire the ID.
  4. Construction starts empty with errors=0. Duplicate IDs, a second concurrent miss, wrong or duplicate fill, early response, and response for an unknown ID each increment errors once without corrupting other entries.
Continue practicing

Related questions

Computer ArchitectureForward bytes from a small pending-write queue→Computer ArchitecturePlace a dense neural-network kernel→Computer ArchitecturePause headroom at 400 Gb/s→
asic.fyi · Learn silicon end to end.info@asic.fyi