Oftentimes our UVM simulations fail with signatures that we end up debugging to unconnected analysis ports.
Is there a way to check up front whether the analysis ports are connected before the run_phase
?
It is not a UVM requirement that analysis ports are connected. However, some UVM components will not function correctly when their analysis ports are unconnected.
For those cases, I recommend checking the analysis import connections during the end_of_elaboration_phase
:
`CHECK_PORT_CONNECTION(my_analysis_imp)
Where the above macro is defined like:
`define CHECK_PORT_CONNECTION(PORT) \
begin \
uvm_port_list list; \
PORT.get_provided_to(list); \
if (!list.size()) begin \
`uvm_fatal("AP_CONNECT", \
$sformatf("Analysis port %s not connected.", PORT.get_full_name())); \
end \
end
Complete working example with one connected port and one not connected: http://www.edaplayground.com/x/2YG
Thanks Victor for the example. I didn't know the logic that you gave.
There is a minor issue in the example that Victor gave, w.r.t the uvm_analysis_imp
declaration. Multiple analysis implementations should use uvm_analysis_imp_decl
macro.
Please see the below link for the corrected example.
http://www.edaplayground.com/x/3qx
NB: Posting as answer since I cant comment :(
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With