此分析端口的優點是用戶可以將數據從單個生產者傳輸到多個使用者,這些使用者在uvm_blocking_put_port的幫助下未歸檔。
這個東西也在圖中解釋。
這裏我提供了示例代碼,以獲得uvm_analysis_port的更多清晰度。
切記:端口連接用於連接兩個或多個獨立組件。
This image gives explanation of uvm_analysis_port
uvm_analysis_port例
class transaction extends uvm_sequence_item;
`uvm_object_utils(transaction);
rand int unsigned a;
rand int unsigned b;
function new(string name ="");
super.new(name);
endfunction
endclass
class producer extends uvm_component;
`uvm_component_utils(producer);
transaction tr_inst;
uvm_analysis_port #(transaction) produce_to_consumer_p;
function new(string name ="",uvm_component parent);
super.new(name,parent);
produce_to_consumer_p = new("produce_to_consumer_p",this);
tr_inst = new("tr_inst");
endfunction
task run_phase(uvm_phase phase);
super.run_phase(phase);
phase.raise_objection(this);
// tr_inst.randomize();
`uvm_info(get_full_name(),"Write the data from PRODUCER",UVM_LOW);
tr_inst.a = 10; tr_inst.b = 20;
produce_to_consumer_p.write(tr_inst);
phase.drop_objection(this);
endtask
endclass
class consumer_1 extends uvm_component;
`uvm_component_utils(consumer_1);
uvm_analysis_imp#(transaction,consumer_1) write_imp_1;
function new(string name ="",uvm_component parent);
super.new(name,parent);
write_imp_1 = new("write_imp_1",this);
endfunction
function void write(transaction tr_inst);
`uvm_info(get_full_name(),"Got the data in CONSUMER_1",UVM_LOW);
`uvm_info(get_full_name(),$sformatf("The value of a = %0d and b = %0d",tr_inst.a,tr_inst.b),UVM_LOW);
endfunction
endclass
class consumer_2 extends uvm_component;
`uvm_component_utils(consumer_2);
uvm_analysis_imp#(transaction,consumer_2) write_imp_2;
function new(string name ="",uvm_component parent);
super.new(name,parent);
write_imp_2 = new("write_imp_2",this);
endfunction
function void write(transaction tr_inst);
`uvm_info(get_full_name(),"Got the data in CONSUMER_2",UVM_LOW);
`uvm_info(get_full_name(),$sformatf("The value of a = %0d and b = %0d",tr_inst.a,tr_inst.b),UVM_LOW);
endfunction
endclass
class consumer_3 extends uvm_component;
`uvm_component_utils(consumer_3);
uvm_analysis_imp#(transaction,consumer_3) write_imp_3;
function new(string name ="",uvm_component parent);
super.new(name,parent);
write_imp_3 = new("write_imp_3",this);
endfunction
function void write(transaction tr_inst);
`uvm_info(get_full_name(),"Got the data in CONSUMER_3",UVM_LOW);
`uvm_info(get_full_name(),$sformatf("The value of a = %0d and b = %0d",tr_inst.a,tr_inst.b),UVM_LOW);
endfunction
endclass
class env extends uvm_component;
`uvm_component_utils(env);
producer p_inst;
consumer_1 c_inst_1;
consumer_2 c_inst_2;
consumer_3 c_inst_3;
function new(string name="",uvm_component parent);
super.new(name,parent);
p_inst = new("p_inst",this);
c_inst_1 = new("c_inst_1",this);
c_inst_2 = new("c_inst_2",this);
c_inst_3 = new("c_inst_3",this);
endfunction
function void connect();
p_inst.produce_to_consumer_p.connect(c_inst_1.write_imp_1);
p_inst.produce_to_consumer_p.connect(c_inst_2.write_imp_2);
p_inst.produce_to_consumer_p.connect(c_inst_3.write_imp_3);
endfunction
endclass
module main();
env env_inst;
initial
begin
env_inst = new("env_inst",null);
run_test();
end
endmodule
這裏是鏈接,讓你分析端口更清晰以及uvm_port。
鏈接:http://stackoverflow.com/questions/38085875/where-to-use-uvm-blocking-put-port-and-uvm-analysis-port
非常感謝您的解釋! 我想現在我明白了uvm_analysis_export - 它更像是一個緩衝區,它從端口接收數據並將其傳輸到imp。它用於減少層次結構路徑。 我有一個關於你的例子的問題。對我來說,「好」的示例層次結構不是很清楚。 是我對您的示例右側的層次結構的理解: 錯誤: – haykp
請關注此鏈接 https://sites.google.com/site/ysulogicdesign/uvm/PortsQuestion.png?attredirects=0 – haykp
嗨,樂意效勞。在你的圖中,我將添加到'好'部分的是bus_agent中的另一個'analysis_port',與檢查器中的'export'平行。在發佈者方面,'端口'也可以扮演連接器的角色,比如'導出'。 –