Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check whether a UVM analysis port is connected?

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?

like image 546
Victor Lyuboslavsky Avatar asked Feb 14 '23 22:02

Victor Lyuboslavsky


2 Answers

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

like image 133
Victor Lyuboslavsky Avatar answered Feb 16 '23 12:02

Victor Lyuboslavsky


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

like image 42
Vineeth VS Avatar answered Feb 16 '23 13:02

Vineeth VS