Multiple Analysis ports in the monitor

Hi,

Can I have multiple analysis ports in my monitor. I wanted to use this coz, my TB has two agents which can bot send/ receive a packet and I want to seperate them totally with two analysis ports

Thanks,
Praveen

Praveen,

Any component can have any number of analysis ports, so the simple answer is yes.

Am I right in thinking that you want each monitor to have two analysis ports, one for the receive traffic and one for the transmit traffic ? That makes perfect sense to me.

You can have two analysis ports in your monitor like this:

// UVM version class my_monitor extends uvm_monitor; uvm_analysis_port tx_ap; uvm_analysis_port rx_ap; ... function void build_phase( uvm_phase phase ); tx_ap = new("tx_ap" , this ); rx_ap = new("rx_ap" , this ); endfunction

task run_phase( uvm_phase phase );
forever begin

if( seen tx transaction ) tx_ap.write( tx );

if( see rx transaction ) rx_ap.write( rx );

end
endtask
endclass

// OVM version class my_monitor extends ovm_monitor; ovm_analysis_port tx_ap; ovm_analysis_port rx_ap; ... function void build(); tx_ap = new("tx_ap" , this ); rx_ap = new("rx_ap" , this ); endfunction

task run();
forever begin

if( seen tx transaction ) tx_ap.write( tx );

if( see rx transaction ) rx_ap.write( rx );

end
endtask
endclass

You will probably also want to create two analysis ports in your agent and connect those analysis ports to the analysis ports in the monitor.

Adam.

In reply to Adam Rose:

That’s exactly what I was looking for. Thanks Adam