Question

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?

Was it helpful?

Solution

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

OTHER TIPS

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 :(

I believe that this should be unnecessary because this checking is already in uvm_port_base::resolve_bindings. However, I believe that there is a bug there. The bug is that for an imp size() doesn't report the number of ports that are bound to the imp. So if 3 ports are bound to the imp then size reports 1 even though the list of ports is correctly of size 3.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top