Dynamic UVC disable/enable during test execution

,

Hi,

I have twiddled in my mind many different approaches to implement uvm component’s dynamical disable/enable during the test execution. Let’s take scoreboard as an example.


class example_env extends uvm_env;
  example_sb scoreboards[];
  example_agent agents[];
  example_cfg cfg;
  ...
  virtual function void build_phase(uvm_phase phase);
    scoreboards = new[cfg.num_scoreboards]; // Define size of the scoreboard array and create the scoreboards with factory

  virtual function void connect_phase(uvm_phase phase);
    agents[0].analysis_port.connect(scoreboards[0].export); // Connect scoreboard with certain agent
    ...
endclass

In the creation phase of the testbench, user can utilize “num_scoreboards” field to say how many scoreboards are created. During the test execution, I would like to make it possible for the user to disable (and probably enable it again if needed) certain scoreboard instance, but I cannot decide the best way to do it. What do you think, what could be the best implementation style?

  • set/get the component (scoreboard) instance number via config_db, or global uvm_pool or uvm_queue, and capture the inst number in the env’s run_phase?
  • when instance under disable/enable (number) is communicated for env, just assign null to that particular instance, what says connect for that?
  • if null assignment is no way should I implement disable/enable task inside the component (scoreboard) which halts whole scoreboard functionality?
  • or create and assign “dummy” scoreboard (which doesn’t do anything) to the disabled/enabled scoreboard instance?
  • or something very different?

I would be very grateful if you could share your ideas or thoughts.

-ilia

In reply to ilia:

A first remark regarding your code example. Never use the constructor to create a scoreboard. You will not employ overriding.
There is no ‘best way’ to control the generation of certain components. It depends always on your coding and implementation guidelines.
If you do not have such restrictions I’d recommend to use variable in the component where you are instatantiating your scorboard. You can set this variable from y certain test using the config_db.

In reply to chr_sue:

Thanks! I just didn’t type the creation of the scoreboard there. Please, note that the new there is only for defining the size of the scoreboard array.

The case is a bit complicated. The certain amount scoreboards is created in the build_phase. The amount is based on the env_cfg.num_scoreboards. We are not aware of enables/disables per scoreboards during the build_phase. Instead meanwhile the run_phase execution, if needed, test will disable certain scoreboard instances. I tried to open my thoughts with bullet points in my first post to describe that we cannot decide in the build_phase which scoreboards will be disabled/enabled dynamically.

In reply to ilia:

I guess you do not use all the flexibility of the UVM. For each test you can specify a dedicated testbench, i.e. with or without scoreboards.

In reply to chr_sue:

As said earlier, you must be able to disable/enable scoreboards during the UVM test execution.

In reply to ilia:

UVM is providing you mechanisms for this, i.e. by config_db. Each test customizes your testbench to the actual needs.