← Design Verification Interviews

Interview Question · Concept

Choosing a Reference Model

L3 Senioruvmreference modelscoreboard

The Question

The interviewer asks

Your scoreboard needs expected results for a complex block. When do you use a transaction-level predictor, a C model through DPI, or a cycle-accurate model?

Reveal the Model Answer

Use an untimed transaction-level predictor in SystemVerilog when the function is clear and timing is not the point. Use a C or C++ model through DPI when the architects already have one, such as a codec. Avoid a cycle-accurate model unless timing itself is the specification. It copies the RTL so closely that it can copy the RTL's bugs. Whoever writes the model should work from the spec, not from the RTL.

Which Reference, per OutputEach box on the left is a question about one output of the design. Follow the answers to the cheapest checker that can answer for that output.
Which reference, per outputEach box on the left is a question about one output of the design. Follow the answers to the cheapest checker that can answer for that output. question Is the datatransformed? Modes, arithmetic,encodings no model Write, read back,compare Assumes data comesback unchanged question Does historymatter? Modes, state, earlierinputs model Transferfunction One expression in thepredictor question Is timing thequestion? Latency, cycle order model Untimed model SV class or C overDPI model Timing check Cycle-accurate modelor latency meter noyesnoyesnoyes
Read the diagram as text
  • Is the data transformed?: Modes, arithmetic, encodings
  • Write, read back, compare: Assumes data comes back unchanged
  • Does history matter?: Modes, state, earlier inputs
  • Transfer function: One expression in the predictor
  • Is timing the question?: Latency, cycle order
  • Untimed model: SV class or C over DPI
  • Timing check: Cycle-accurate model or latency meter
  • Is the data transformed? → Write, read back, compare: no
  • Is the data transformed? → Does history matter?: yes
  • Does history matter? → Transfer function: no
  • Does history matter? → Is timing the question?: yes
  • Is timing the question? → Untimed model: no
  • Is timing the question? → Timing check: yes

Most outputs need two answers: an untimed model for values plus a timing check. For a whole processor subsystem, an ISS or virtual platform.

ModelGood forCost
Untimed SV predictorClear functions; quick to writeNeeds sync points with the DUT
C/C++ model via DPIAlgorithms the architects already modelledWrapper, type mapping, error cases missing
Cycle-accurate modelTiming that is itself the specSlow to write; breaks on legal RTL changes

Pick the lowest abstraction that still checks what the spec defines.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Listen For (Senior)

A good senior answer picks the kind of model from what the spec defines. It says who should write the model, and why that person must work from the spec.

Cross-Questions

Where the interviewer goes next. Open a node to practise that follow-up.

What IfProve ItBreak ItCompareScale It

  1. Choosing a Reference Model
  2. CompareComparing an Untimed Model with Timed RTLL3 Senior

    An untimed model produces results at once, but the DUT takes many cycles. How do you compare them?

    Reveal the Model Answer

    Compare at sync points that both sides define: the end of a transaction, a frame or an interrupt. The model pushes its expected result into a queue as soon as it sees the input. The scoreboard compares when the DUT's output for that point appears. Nothing between sync points is compared.

    Ask at the Input, Compare at the OutputArrows from the left are monitor writes; the model is a function call; the queue holds predictions.
    Ask at the input, compare at the outputArrows from the left are monitor writes; the model is a function call; the queue holds predictions. input Data beat taken 10 at 15 ns, 20 at25 ns input Mode beat taken mode 1 at 35 ns model alu_model step(x) orset_mode(m), no time queue expected[$] 11, 21 waiting output Result seen 11 at 45 ns compare write_out Pop the oldest,compare step(x)set_modepushwritepop
    1. 15 ns

      The data beat 10 is answered in mode 0 at once: 11 waits in the queue.

      Follow the calls, values and waits
      1. call step(10): Data beat taken → alu_model
      2. data prediction 11: alu_model → expected[$]
    2. 25 ns

      The beat 20 is answered the same way: 21 joins 11 in the queue.

      Follow the calls, values and waits
      1. call step(20): Data beat taken → alu_model
      2. data prediction 21: alu_model → expected[$]
    3. 35 ns

      The mode beat reaches the model at the same event the design acts on. Earlier answers are already queued.

      Follow the calls, values and waits
      1. call set_mode(1): Mode beat taken → alu_model
    4. 45 ns

      The result for 10 pops 11, which was computed in mode 0. With late = 1 the model would be asked now, in mode 1, and say 20.

      Follow the calls, values and waits
      1. data observed y=11: Result seen → write_out
      2. data prediction 11: expected[$] → write_out
    Read the diagram as text
    • Data beat taken: 10 at 15 ns, 20 at 25 ns
    • Mode beat taken: mode 1 at 35 ns
    • alu_model: step(x) or set_mode(m), no time
    • expected[$]: 11, 21 waiting
    • Result seen: 11 at 45 ns
    • write_out: Pop the oldest, compare
    • Data beat taken → alu_model: step(x)
    • Mode beat taken → alu_model: set_mode
    • alu_model → expected[$]: push
    • Result seen → write_out: write
    • expected[$] → write_out: pop

    Data and mode reach the model in the order the design took them; the queue carries answers across the 30 ns latency.

    Self-Check

    Tick each key point you covered in your answer.

  3. Break ItA Sync Point That Hides a BugL3 Senior

    How does a badly chosen sync point hide a bug?

    Reveal the Model Answer

    Say you compare only at the end of a frame. A wrong value in the middle, later overwritten by the DUT, is never seen. Choose sync points where the value is visible to software or to the next block. Add assertions for the rules between them.

    Self-Check

    Tick each key point you covered in your answer.

  4. Prove ItSolve U9.3.1: Three Channels and a Model That DisagreesSimulator-graded

    Show it, don't just say it: this Silicon Lab problem is graded by the simulator.

    Open Problem U9.3.1

  5. What IfWhat Breaks at the DPI BoundaryL3 Senior

    Asked if they choose a C model

    What breaks most often at the DPI boundary of a C reference model?

    Reveal the Model Answer

    Type mapping and memory ownership. A 4-state value passed to an int argument loses its X and Z bits. A C function that keeps a pointer to SystemVerilog data after the call may read freed memory. Keep the interface to simple 2-state types or packed arrays, and copy data during the call.

    One Beat Across the Language BoundaryArrows are calls and returns for one input beat, x = 200, sent to a C model through DPI. The value changes sign at the import, not inside either model.
    One beat across the language boundaryArrows are calls and returns for one input beat, x = 200, sent to a C model through DPI. The value changes sign at the import, not inside either model. monitor Input monitor op_item x = 200 (c8) scoreboard write_in model.step(t.x) class SV wrapper alu_model_step(h, x) DPI input byte c8 arrives as char-56 C model.c mode 2: -56 >> 1 =-28 queue expected[$] int 228 narrowed toe4 compare write_out design y = 100:mismatch writecallimport callC callreturnpop, 30 ns later
    1. SystemVerilog side65 ns (illustrative)

      The scoreboard calls the wrapper exactly as it called the SV model.

      Follow the calls, values and waits
      1. data op_item x = 200 (c8): Input monitor → write_in
      2. call model.step(200): write_in → SV wrapper
    2. The boundary65 ns (illustrative)

      input byte is signed: c8 crosses as -56. The call takes no simulation time.

      Follow the calls, values and waits
      1. call alu_model_step(h, 8'hc8): SV wrapper → input byte
      2. call step(h, x = -56): input byte → model.c
    3. Back again65 ns (illustrative)

      C halves -56 to -28 and returns it as the unsigned value 228. The wrapper narrows it to e4, and the scoreboard queues that prediction.

      Follow the calls, values and waits
      1. return returns 228, queued as e4: model.c → expected[$]
      2. Waiting: expected[$] — e4 waits for the result
    4. The result appears95 ns (illustrative)

      The design's 100 meets the queued e4: a mismatch, although each model is right about its own input.

      Follow the calls, values and waits
      1. data expected e4: expected[$] → write_out
      2. Released: expected[$]
    Read the diagram as text
    • Input monitor: op_item x = 200 (c8)
    • write_in: model.step(t.x)
    • SV wrapper: alu_model_step(h, x)
    • input byte: c8 arrives as char -56
    • model.c: mode 2: -56 >> 1 = -28
    • expected[$]: int 228 narrowed to e4
    • write_out: design y = 100: mismatch
    • Input monitor → write_in: write
    • write_in → SV wrapper: call
    • SV wrapper → input byte: import call
    • input byte → model.c: C call
    • model.c → expected[$]: return
    • expected[$] → write_out: pop, 30 ns later

    Both models are right about their own inputs; the hand-off type is wrong.

    Self-Check

    Tick each key point you covered in your answer.

    Misconception

    "The C model can keep a pointer to the SystemVerilog array for the next call."

    Pointers to argument data are valid only during the call. The simulator may move or reuse that memory afterwards.

    Source IEEE 1800-2017 Annex H, C layer rules for pointers to actual arguments

  6. Scale ItOne Reference Model from Block to ChipL3 SeniorL4 Staff

    Scale it: how do you reuse the same model from block level up to the full chip?

    Reveal the Model Answer

    Keep the model behind a transaction interface with no pins and no clocks. At block level, the block's monitors feed it. At chip level, the same model listens to monitors on the chip boundary or to an internal passive agent. Only the connections change, so the model's own bugs are found once.

    Self-Check

    Tick each key point you covered in your answer.

    What Interviewers Listen For (Staff)

    A good staff answer defines the model's transaction interface before the block bench exists. Then reusing the model at chip level costs only wiring.

What People Get Wrong

Common wrong answers and why they fail.

Buzzword Without Mechanism

"Use a golden model."

That names an object, not a choice. The interviewer wants the level of abstraction, where results are compared, and who keeps the model right.

Misconception

"A cycle-accurate model is always the safest."

To match cycle by cycle, it is often written by reading the RTL. A shared misreading of the spec then passes in both, and every legal timing change breaks the model.

Source Lesson U9.1 review claims (choosing the checking strategy)

Half-Truth

"A DPI model is free because the C code already exists."

You still write the wrapper, the type mapping and the sync logic. Algorithm models also skip error cases, so the bench needs its own checks there.

Learn It, Then Prove It