Overhead of calling analysis port write() method

Hi,
I have a uvm_monitor that collects valid data(2 bytes) from the interface. These valid data needs to be compared against a reference data. My test runs for several thousands of clock cycles. In the best case, the RTL will produce valid data every clock cycles.
The comparison is done in a class extended from uvm_scoreboard. The monitor communicates with the scoreboard via analysis port. My question is
Which of the following implementation is better for simulation performance -

  1. Using the analysis port write() method that will be called for every valid data (which can be several thousands)?
  2. The monitor directly calling a method in sb for comparison for every valid data.

Thanks,
Omkar

In reply to Omkar:
The technical answer to that question is by far #2.

For every call to ap.write() in your monitor, it goes through at least the following steps

  1. call uvm_analysis_port::write()
  2. for-loop through each subscriber
  3. call uvm_port_base::get_if()
  4. call uvm_port_base::size() X 2
  5. call uvm_analysis_imp::write()
  6. call your_scoreboard::write()

However, since the M in UVM stands for Methodology, one needs to justify (and document) decisions that go against standard practice. How much time do you think you can save calling the scoreboard’s method directly versus the time someone else may have to spend understanding what you are doing? If you start doing everything a different way, you no longer have a standard methodology.

I can guarantee there are many other places in the UVM you could write more optimally yourself. The functionality UVM field automation macros are one example of something we recommend doing yourself because the performance gain is worth it.

In reply to dave_59:

Perfect ! I have not done any profiling to compare. That is something that I should be doing. But your answer makes perfect sense. Thanks for that.

-Omkar