寄存器模型中的每一个寄存器,都应该有两个值,一个是镜像值(mirrored value) ,一个是期望值(desired value) :
UVM提供了两种用来跟踪寄存器值的方式,我们将其分为自动预测(auto prediction)和显式预测(explicit) 。
class mcdf_ bus_env extends uvm _env;
mcdf_ bus_agent agent;
mcdf_rgm rgm;
reg2mcdf _adapter reg2mcdf ;
uvm _reg predictor # (mcdf_bus_trans) mcdf2reg_predictor;
`uvm_component _utils (mcdf bus_env)
function void build phase (uvm phase phase) ;
agent = mcdf bus_agent: :type_id: : create ( "agent" , this);
if ( !uvm_config_db#(mcdf_rgm) : :get(this, "","rgm" , rgm)) begin
uvm_info ( "GETRGM","no top-down RGM handle is assigned",UVM_LOW)
rgm = mcdf_rgm : : type_id: :create ("rgm" , this) ;
'uvm_info("NEWRGM" , "created rgm instance locally",UVM_LOW)
end
rgm. build() ;
reg2mcdf = reg2mcdf_adapter: :type_id: :create("reg2mcdf" );
mcdf2reg predictor = uvm_reg_predictor# (mcdf_bus_trans) : :type_id::create("mcdf2reg _predcitor" ,this) ;
mcdf2reg predictor.map = rgm.map;
mcdf2reg predictor.adapter = reg2mcdf ;
endfunqtion
function void connect _phase (uvm _phase phase) ;
rgm. map.set_sequencer(agent.sequencer,reg2mcdf);
agent.monitor.ap. connect(mcdf2reg_predictor.bus_in) ;
endfunction
endclass
uvm_reg_sequence提供的方法