Is it possible to have parameterized analysis implementations in Scoreboard?

You probably need to explain what it is that you want to parameterize. Since a class can only have one write() method, the ovm_analysis_imp_decl macro provides a wrapper class that maps a call from its write() method to a write_``named method in your class. You might want to look at the definition of that macro (it’s very small) and see what it does so you can explain better what you need to do.

In reply to dave_59:

Sorry, I should have been clear.

I would like to implement the below code using ovm_analysis_imp_decl

analysis_fifo #(apb_trans) dme_fifos[(NUM_LINKS-1):0];

I dont want a fifo style of analysis because, my sb has a local storage immediately on one packet availability I will the data and store in my local ‘q’.

Also we need to have a get logic to pick a data from analysis_fio, where as in ovm_analysis_imp_decl write function will be automatically called.

So let me know, if it is possible to create the analysis port based on the parameter which varies from simulation to simulation.

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 \

Then your code would look like


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

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

In reply to dave_59:

Excellent, like the second solution…

Thanks you very much.

In reply to SKUPPAM:

Is it that, we should use ovm_analysis_imp only when we have a storage in the Scoreboard.

and analysis_fifo when there is no memory in the Scoreboard

please confirm my understanding

In reply to SKUPPAM:

I don’t know that having an analysis_fifo precludes having storage in the scoreboard, it may just be less essential. An analysis_imp could put transactions into a regular fifo or queue if needed. The biggest difference is the thread(s) of execution in the Scoreboard.

In reply to dave_59:

Sorry, I didnt get what you mean about this statement.

“The biggest difference is the thread(s) of execution in the Scoreboard.”

Do you mean, analysis_imp automatically executes whereas analysis fifo required explicit get function to be called?

Can you please, explain bit details.


In reply to SKUPPAM:

Yes, I think you get it now.

The thread that does the analysis_port.write() (typically in the monitor) executes all of the subscribers write() implementations in the same thread. An analysis_fifo has a predefined implementation whose write() method does a put into a fifo. Another thread is needed to get() transactions out of the fifo.

In reply to dave_59:

Thanks Dave.

I have getting an error while compiling the following code:
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_impSFX`",IMP) \ function void write( input T t); \ m_imp.writeSFX( t, m_index);

The error is:

(expanding macro): token is ‘local’
System verilog keyword ‘local’ is not expected to be used in this context.

What does this mean ?

In reply to varunvkg123:

Has been resolved.