Skeptic on where to implement functional coverage

Hi,

This is the very first time I am implementing functional coverage for my module. And the results are as follows(link). Can someone clarify me on whether should I declare my coverage class separately and sample or should I embed it in any component i.e. (agent or scoreboard) or should I use config_db to set my coverage from top-level so that I can collect the coverage information after the scoreboard part is done?. I am confused.

It would be helpful if you add any good DVCon paper so that I further explore

Here is my EDA code DPRAM
As you can see the coverage is displayed after each scoreboard call is executed and if possible please clarify on which base class should I extend my coverage class because the uvm_subscriber write method has two arguments.

ThankYou

In reply to sai_pra99:

The UVM does not recommend where to implement the functional coverage. It is up to you to find a good solution.
Using a seperate coverage collector fine. 2 things you should consider.
(1) Instead of uvm_component you should use uvm_subscriber as base class for your coverage collector. It ha a built-in analysis export.
(2) Your coverage results are 0 because you do not construct your covergroup.

In reply to chr_sue:

DPRAM
What does that fatal error mean?

UVM_FATAL /playground_lib/uvm-1.2/src/base/uvm_component.svh(1783) @ 0: my_coverage [CLDEXT] Name ‘my_coverage’ is not unique to other top-level instances. If parent is a module, build a unique name by combining the the module name and component name: $sformatf(“%m.%s”,“my_coverage”).

ThankYou

In reply to sai_pra99:

You have to construct the coverage colle ctor as any other uvm_component and you are sampling only once. You have to sample this for any transaction you are extracting.
I have solved the first issue.
It’s up to you to fix the second one.
See the code here

In reply to sai_pra99:

In reply to chr_sue:
DPRAM
What does that fatal error mean?
UVM_FATAL /playground_lib/uvm-1.2/src/base/uvm_component.svh(1783) @ 0: my_coverage [CLDEXT] Name ‘my_coverage’ is not unique to other top-level instances. If parent is a module, build a unique name by combining the the module name and component name: $sformatf(“%m.%s”,“my_coverage”).
ThankYou

I made it more clean. See a solution here. What has to be investigated is the scoreboard functionality resulting in errors.
See the running example here:

In reply to chr_sue:

Can you please let me know whether my assumptions are correct :

1)I believe the failures are because the implementation of the write function in the
scoreboard takes some time to check than that of my coverage component write function
which just checks for coverage and as soon as the coverage analysis is completed, it assumes
that the particular transaction is done and moves on with next thereby never going to wait
for scoreboard evaluation.

  1. Is there any other way I could write this so that I could synchronize both

In reply to sai_pra99:

I cannot confirm your assumptions. You are storing the vales in an (dynamic) array of a certain size. This array can only data in contigious order, but you have non-contgious addresses. In this case you have to use an associative array.
The coverage collection does not consume any time. The functional coverage will be updated immediately when the data is available.

In reply to chr_sue:

Cadence doesn’t seem to do good on this. But Synopsys seems to have some promising results. Also I changed to UVM 1.2 for doing the same. Can you please tell me why is that so?. Does the older version had some drawbacks which led to the failure of the scoreboard?

And why weren’t you sampling at test class?

Here is the link to code DPRAM

In reply to sai_pra99:

To judge a tool with respect to doing things which are not standard compliant is a dangerous thing.
In your last code you have 2 coverage collectors in your environment. 1in your env and 1 in your test. In the test your are constructing this object wrong, calling simply the constructor without arguments. Synopsys is tolerating thisd. Cadenc and Mentor are ignoring this.
Then looking to your scorboard. Cadence and Synopsys is tolerating your approach with a dynamic array using non-contigious addresses. Mentor does not. Mentor is standard compliant.

In reply to chr_sue:

I understand, maybe I should start practicing good testbench coding style that would be compliant to all standard tools.

Thanks for all the inputs given so far. These were valuable. Much appreciated

Regards
SAI

In reply to sai_pra99:

Thank you for your feedback.
Only a short remark.
I see the simulators are tolerating in certain versions violations of the SV and the UVM standard. When you switch to major release they might not tolerate the violations. Then you are in big trouble, especially when using some older code versions. Be standard correct then you’ll never have problems.