您可以创建一个专用的 uvm_object 来执行此操作。例如:
class feature_options extends uvm_object;
bit sb_enable=0;
// ...
endclass
在您的顶级测试平台中实例化它,然后将其放入 uvm_config_db:
// in your top-level testbench:
feature_options f_opt;
initial begin
f_opt = new("f_opt");
uvm_config_db#(feature_options)::set(uvm_root::get(), "*", "FEATURE_OPTIONS", f_opt);
end
然后从您自己的记分牌和音序器中抓取对象:
// add the class handle in your scoreboard and your sequencer
feature_options my_opt;
// ... inside your scoreboard/sequencer build phase, grab the object
if (!uvm_config_db#(feature_options)::get(this,"","FEATURE_OPTIONS", my_opt)) begin
$display("Ok");
end
在此之后,您可以动态同步您的序列和记分牌,例如:
// inside your scoreboard run phase
wait (f_opt.sb_enable);
和
// inside your sequence body()
p_sequencer.my_opt.sb_enable = 1;
// ... do some test, then disable scoreboard
p_sequencer.my_opt.sb_enable = 0; // and so on