Skip to content

Wire up a uvm_reg_predictor – with explicit prediction, nothing else updates the mirror

predictor / mirror / analysis-portUVM · runs take about 2 minutes

This exercise has a walk: One register write, end to end. It plays step by step beside the code.

blk’s map runs with auto-prediction off (set_auto_predict(0), in the test), as real testbenches do when something besides the register model can touch the DUT and the mirror has to follow observed bus traffic. blk.r.write(...) still writes over the bus but leaves the mirror alone. Only a uvm_reg_predictor updates it, and only once it has .map and .adapter set and bus transactions arriving on bus_in.

predictor is already constructed in env::build_phase (in the test), but not configured or connected.

RequirementsIn env::connect_phase

  1. predictor.map and predictor.adapter are the map and adapter the bus uses.
  2. drv.ap, where the driver broadcasts every access it completes, is connected to predictor.bus_in.

Right nowmirror=0 after first write, want aa. Setting .map and .adapter alone isn’t enough: the predictor’s write() is never called until bus_in has a connection.

Done whenAfter each of the two writes in the test, blk.r.get_mirrored_value() equals what was just written. Missing either piece leaves the mirror at its reset value, 0.

Source on GitHub

predictor_needs_the_monitor_wired_in.sv