1,在env里边定义一个uvm_tlm_fifo接口,用于ref和qlen之间的通信接口
1), uvm_tlm_fifo #(date_structure) ref_qlen_fifo;
2), new();
ref_qlen_fifo = new("ref_qlen_fifo",this,0);
3), build_phase();
ref.put_fifo.connect(ref_qlen_fifo.put_export);
qlen.get_fifo.connect(ref_qlen_fifo.get_export);
2,在ref中定义一个uvm_blocking_put_port接口,用于put
1), uvm_blocking_put_port #(data_structure) put_fifo;
data_structure data_structure_inst;
2), new();
put_fifo = new("put_fifo",this,0);
3), main_phase();
put_fifo.put(data_structure_inst);
3,在qlen中定义一个uvm_blocking_get_port接口,用于get
1), uvm_blocking_get_port #(data_structure) get_fifo;
data_structure data_structure_inst;
data_structure data_structure_inst_local;
2), new();
get_fifo = new("get_fifo",this,0);
3), main_phase();
get_fifo.put(data_structure_inst);
data_structure_inst_local.copy(data_structure_inst); // 这一点很重要,取到值后,马上copy到本地,以防源端改变了该值。
data_structure_inst_local.qlen ..... //就可以用了