class monitor extends ovm_monitor;
ovm_analysis_port #(transaction) tx_data;
…
function void build();
tx_data = new(“tx_data”,this);
endfunction
endclass
class agent extends ovm_agent;
monitor tx_monitor;
ovm_analysis_port #(transaction) data_out_tx;
…
function void build();
tx_monitor = monitor::type_id::create::(“tx_monitor”,this);
data_out_tx = new(“data_out_tx”,this);
endfunction
function void connect();
tx_monitor.tx_data.connect(this.data_out_tx);
endfunction
endclass
While compiling the above setup; I got ERROR:“NULL pointer dereference” pointing the connect method inside the agent class.
Can anyone help me to overcome the above issue?
not sure if you showed all code.
All ports connection need to connect to a “imp” port which provides the put/get/write method.
if the AGENT is your final destination, then you need to give ovm_analysis_imp instead of ovm_analysis_port, otherwise you need have
agent.ovm_analysis_port.connect(xxx.ovm_analysis_imp)
hope it helps
andrew
All ports connections need NOT connect to “imp” only. Generally it is “exp”. For the final destination, where “write” function is implemented, it is to be “imp”. Please refer
then the export you mentioned is “imp” style export.
write a test case is always better to see it.
I see below :
a.blocking_put_port.connect(b.blocking_put_export) → fail
a.blocking_put_port.connect(b.blocking_put_imp) → pass