Ovm_analysis_imp_decl

In reply to SKUPPAM:

OK, you want an array of ovm_analysis_imp_decl exports whose size is parametrized.

Two solutions I can think of.

Create an array of classes derived from ovm_subscriber and connect to them instead of using the ovm_analysis_imp_decl wrappers. They will be able to access the Scoreboard because they will have a handle to their parent.

Arrays of components (ovm_subscriber) may have unwanted overhead, so you could create an alternate version of the macro to store a link number and passes that to your write_() method.

`define analysis_imp_decl_array(SFX) \
class ovm_analysis_imp``SFX #(type T=int, type IMP=int) \
                                     extends ovm_port_base #(tlm_if_base #(T,T)); \
int m_index; \                                     `OVM_IMP_COMMON(`TLM_ANALYSIS_MASK,`"ovm_analysis_imp``SFX`",IMP) \
                                       function void write( input T t); \
                                         m_imp.write``SFX( t, m_index); \
                                           endfunction \
endclass

Then your code would look like

`analysis_imp_decl_array(_dme)

class myscoreboard extends ovm_component;
  ovm_analysis_imp_dme#(apb_trans, myscoreboard) dme_imps[NUM_LINKS]; 
  ...
  function new(string name, ovm_component parent);
    super.new(name,parent);
    foreach(dme_imps[i]) begin
       dme_imps[i] = new($sformatf("dme_imp_%0d",i), this);
       dme_imps[i].m_index = i;
    end
  endfunction

  function void write_dme(apb_trans t, int index);
    // index will be set to the imp this came from
  endfunction