← Design Verification Interviews

Interview Question · Design

Auto vs Explicit Register Prediction

L2 Mid-LevelL3 Senioruvmralprediction

The Question

The interviewer asks

Your register model uses auto-prediction. A boot sequence also writes registers directly on the bus. What goes wrong, and how do you set up prediction instead?

Reveal the Model Answer

Auto-prediction updates the mirror only for accesses made through the register model. The boot write is invisible to it, so the mirror stays at the reset value and the next mirror(UVM_CHECK) fails. Use explicit prediction instead: connect a uvm_reg_predictor to the bus monitor. The predictor converts every observed transfer with the adapter and updates the right register. Turn auto-prediction off, so each access is predicted once.

The Boot Write Reaches the Mirror Through the MonitorArrows are items and calls for a boot write that the register model never made. The model learns about it from the pins, through the monitor and the predictor.
The boot write reaches the mirror through the monitorArrows are items and calls for a boot write that the register model never made. The model learns about it from the pins, through the monitor and the predictor. component boot_writesequence Raw apb_item, noregister call component APB sequencer +driver Write of a5 completesat 25 ns design incr_csr.ctrl a5 after the 25 nsedge component apb_monitor Samples the completedtransfer at 25 ns component uvm_reg_predictor bus2reg, then the mapfinds CTRL at address0 model regs.ctrl Mirror and desiredbecome a5 apb_itemAPB writepins sampledap.write(t)predict a5 (writepolicy)
  1. Start a raw item

    The boot sequence sends a raw item to the sequencer. The map took no part.

    Follow the calls, values and waits
    1. data boot apb_item: write 0 <- a5: boot_write sequence → APB sequencer + driver
    2. Waiting: boot_write sequence — in finish_item until item_done
  2. On the bus25 ns (illustrative)

    The design takes a5 at the 25 ns edge.

    Follow the calls, values and waits
    1. data pwdata = a5 at address 0: APB sequencer + driver → incr_csr.ctrl
  3. Observed25 ns (illustrative)

    The monitor sees psel, penable and pready at the 25 ns edge and writes the transfer to its analysis port.

    Follow the calls, values and waits
    1. data pwdata = a5 at address 0: incr_csr.ctrl → apb_monitor
    2. data monitor item t: write 0, a5: apb_monitor → uvm_reg_predictor
  4. Predicted25 ns (illustrative)

    The predictor converts the item with the adapter, asks the map which register sits at address 0 and predicts it with the field's write policy. The mirror is a5, and the prediction count is 1.

    Follow the calls, values and waits
    1. data predict a5: uvm_reg_predictor → regs.ctrl
  5. The boot write returns30 ns (illustrative)

    The driver calls item_done and the boot sequence's finish_item returns. The mirror already holds a5.

    Follow the calls, values and waits
    1. return item_done: APB sequencer + driver → boot_write sequence
    2. Released: boot_write sequence
Read the diagram as text
  • boot_write sequence: Raw apb_item, no register call
  • APB sequencer + driver: Write of a5 completes at 25 ns
  • incr_csr.ctrl: a5 after the 25 ns edge
  • apb_monitor: Samples the completed transfer at 25 ns
  • uvm_reg_predictor: bus2reg, then the map finds CTRL at address 0
  • regs.ctrl: Mirror and desired become a5
  • boot_write sequence → APB sequencer + driver: apb_item
  • APB sequencer + driver → incr_csr.ctrl: APB write
  • incr_csr.ctrl → apb_monitor: pins sampled
  • apb_monitor → uvm_reg_predictor: ap.write(t)
  • uvm_reg_predictor → regs.ctrl: predict a5 (write policy)

With explicit prediction, every successful access the monitor sees to a mapped register reaches the mirror. Changes the hardware makes by itself do not.

Self-Check

Tick each key point you covered in your answer.

What Interviewers Listen For (Mid-Level)

A good mid-level answer names the invisible boot write as the cause. It draws the path: bus monitor, then predictor, then register model.

Cross-Questions

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

WhyWhat IfProve ItCompare

  1. Auto vs Explicit Register Prediction
  2. WhyWhy Explicit Prediction Matters at SoC LevelL3 Senior

    Why does explicit prediction matter more once the block sits inside an SoC?

    Reveal the Model Answer

    At SoC level, a CPU model, a DMA or a debug port may write the same registers through other paths. The block's register model never starts those writes. Only a predictor listening on the block's own bus sees them all. The same prediction setup then works unchanged at both levels.

    Self-Check

    Tick each key point you covered in your answer.

  3. What IfA Write to an Address the Map LacksL2 Mid-LevelL3 Senior

    What if the predictor sees a bus write to an address that the register map does not contain?

    Reveal the Model Answer

    The predictor updates nothing. The uvm-core library reports it only as an info message at UVM_FULL verbosity, so a normal run prints nothing. That can hide a decode bug, or a register missing from the model. Raise the verbosity for that message in a check run, or count such writes yourself.

    Self-Check

    Tick each key point you covered in your answer.

    Tool as Truth

    "A write to an unknown address would show up as a UVM error."

    The predictor reports REG_PREDICT_NOT_FOR_ME at UVM_FULL. At default verbosity it is not printed.

    Source uvm-core 2020.3.1 (IEEE 1800.2 library) source, reg/uvm_reg_predictor.svh (REG_PREDICT_NOT_FOR_ME, UVM_FULL)

  4. What IfPredicting from an Errored TransferL3 Senior

    What if a register write ends with an error response, such as PSLVERR, and the register did not change?

    Reveal the Model Answer

    It depends on the adapter and the UVM version. In uvm-core, the predictor passes the status from bus2reg(), and the register skips a prediction marked UVM_NOT_OK. So bus2reg() must map the error to UVM_NOT_OK. The UVM Cookbook, written for UVM 1.1, says the status is ignored there. Older benches therefore filter errored transfers before the predictor.

    Self-Check

    Tick each key point you covered in your answer.

    Spec Misquote

    "The predictor always ignores errors, so the mirror is always updated."

    That was the UVM 1.1 behaviour the Cookbook describes. In uvm-core 2020.3.1, do_predict() skips a UVM_NOT_OK item with a warning.

    Source uvm-core 2020.3.1 (IEEE 1800.2 library) source, reg/uvm_reg.svh (do_predict: "status UVM_NOT_OK; skip prediction")

  5. Prove ItConnecting an Explicit PredictorL2 Mid-Level

    Prove it: write the connect-phase code that sets up explicit prediction.

    Reveal the Model Answer

    Give the map its sequencer and adapter, and turn auto-prediction off. Point the predictor at the map, so it can find a register by address. Give it the adapter, so it can convert bus items. Then connect the bus monitor's analysis port to the predictor's bus_in.

    Four connections: sequencer and adapter, prediction off, map and adapter, monitor to predictor.
    function void connect_phase(uvm_phase phase);
      regs.default_map.set_sequencer(apb.sqr, adapter);
      regs.default_map.set_auto_predict(0);     // one prediction path only
      predictor.map     = regs.default_map;     // address -> register
      predictor.adapter = adapter;              // bus item -> register operation
      apb.mon.ap.connect(predictor.bus_in);     // every observed transfer
    endfunction

    Self-Check

    Tick each key point you covered in your answer.

    Missed Corner

    Connects the predictor to the driver instead of the monitor.

    The driver sees only the model's own items, which is auto-prediction again. Other masters' writes still go unseen.

    Source Verification Academy, UVM Cookbook, Registers: explicit prediction listens to the bus agent's monitor (PDF p337)

  6. CompareWhen Auto-Prediction Is Good EnoughL2 Mid-Level

    Compare the two modes. When is auto-prediction good enough?

    Reveal the Model Answer

    In a unit bench where the register model is the only master on the bus. It needs no monitor or predictor, so it is quick to set up. As soon as anything else can write the registers, switch to explicit prediction.

    Self-Check

    Tick each key point you covered in your answer.

What People Get Wrong

Common wrong answers and why they fail. Run It shows the wrong belief failing on a real simulator.

Misconception

"With auto-prediction on, the mirror follows every write to the DUT."

It hooks only the register model's own accesses. The twin's boot write goes straight to the sequencer, so the mirror stays at 1 and the check fails.

Run It

A raw APB boot write, then a mirror check, with auto-prediction on and no predictor.

RUNVerilator + UVM 2020.3.1 · simulator service
Edit the code, then run it
Expected among the UVM messages: 25 ns APB write addr=0 data=a5 30 ns after the boot write: mirrored=1 FAIL: auto-prediction saw only model calls, so the raw write left a stale mirror of 1 UVM_ERROR : 1

Missed Corner

"Keep auto-prediction on as well as the predictor, to be safe."

Each model access is then predicted twice. For a toggle-on-write field (W1T), two predictions toggle the mirror twice, so it ends wrong.

Source uvm-core 2020.3.1 (IEEE 1800.2 library) source, reg/uvm_reg_field.svh (W1T prediction: current value XOR written value)

Wrong Altitude

"Explicit prediction is the newer, better API, so always use it."

It costs a monitor and a predictor. In a unit bench where the model is the only bus master, auto-prediction is enough and simpler.

Learn It, Then Prove It