Where to implement functional coverage

In reply to verif_learner:

Hi,

To address the dilemma between modular coverage code and non-replication of subscriber ports/code in scoreboard and coverage , I found the following two ways useful.

Way-A :

  1. extend the coverage class from the scoreboard class.
  2. define coverage in the coverage class and redefine all the write_* tasks with call to super.write_* and then add your covergroup.sample() in the write_* tasks.
  3. in the Env, instead of instantiating the scoreboard, u instantiate the coverage class and make port connections.
  4. This way you have modularity(separation) in code and no replication of ports.

Else if someone wants to stick to rudimentary and say NO to Way-A , then

Way-B :

  1. Make base class with analyisis ports.
  2. Extend scoreboard and coverage from base class.(Atleast I am saved the port declaration and New-ing)
  3. define coverage related stuff in coverage and scoreboarding checks in scoreboard.
  4. Instantiate both coverage and scoreboard in Env and make connections to monitor for both of them.
  5. set handle of scoreboard in uvm config_db
  6. In the coverage class, get scoreboard handle from config_db and that way avoid duplication of code that is already defined in scoreboard.

Regards,
nisj