2

I have a uvm_sequence that randomizes an enable bit "feature_en". Depending on whether this bit is enabled or not, I want to enable/disable my scoreboard. I use the config_db to set the variable, and the field_macros to automatically get it in the scoreboard.

My problem is that in the scoreboard, I want to guard the code in the run_phase with "feature_en". However, the sequence is run in the run_phase of the test and thus, the run_phase of the scoreboard goes first, thereby keeping feature_en default value and not getting the value set my the sequence.

I tried using wait(feature_en != -1) (i had set it as an int), but I realize that feature_en is not sampled again in the scoreboard.

Is there a way to update feature_en dynamically in the scoreboard? Or any other way to do this?

noobuntu
  • 903
  • 1
  • 18
  • 42

2 Answers2

4

You can create one dedicated uvm_object to do that. For example:

class feature_options extends uvm_object;
    bit sb_enable=0;
    // ...
endclass

Instantiate it in your top-level testbench, and then put it in uvm_config_db:

// in your top-level testbench:
feature_options f_opt;
initial begin
    f_opt = new("f_opt");
    uvm_config_db#(feature_options)::set(uvm_root::get(), "*", "FEATURE_OPTIONS", f_opt);
end

and then grab the object from your own scoreboard and sequencer:

// add the class handle in your scoreboard and your sequencer
feature_options my_opt;

// ... inside your scoreboard/sequencer build phase, grab the object
if (!uvm_config_db#(feature_options)::get(this,"","FEATURE_OPTIONS", my_opt)) begin
$display("Ok");
end

After this, you can dynamically synchronize your sequence and your scoreboard, for example:

// inside your scoreboard run phase
wait (f_opt.sb_enable);

and

// inside your sequence body()
p_sequencer.my_opt.sb_enable = 1;
// ... do some test, then disable scoreboard
p_sequencer.my_opt.sb_enable = 0; // and so on
AldoT
  • 913
  • 1
  • 8
  • 34
0

feature_en can be switched on/off directly, not through the config_db Assuming your scoreboard is a component ( your scoreboard extends uvm_scoreboard ) in the sequence :

my_env env;
....
$cast(env, get_sequencer().get_parent().get_parent()); //env.agent.sequencer 
env.sb.feature_en = 1;
Meir
  • 287
  • 1
  • 4
  • 15
  • The issue is that I am integrating a block-level sb into my top-level environment. The top-level sb is where I have write permissions. I override the sb type from the top-level env. The problem is that compiler fails now, since it cannot find feature_en in the block-level sb. It will eventually override the block-level with top-level at the build_phase, but during compilation it doesn't know that. – noobuntu Jan 21 '15 at 16:04