Jump to content

Recommended Posts

Posted

In the following code, I cannot hierarchically refer a function in scoreboard from sequence. I have to first get the scoreboard handle and then call function using the handle.

The following does not work:

uvm_test_top.env.my_env0.my_sb0.disable_scoreboard(0);

The following works

handle_my_sb0.enable_scoreboard(1);

What am I missing something in the first case?

Thanks,

Kal

===========

class my_test2_vseq extends my_base_test_vseq;

uvm_component handle_sb;

my_scoreboard handle_my_sb0;

`uvm_object_utils(my_test2_vseq)

`uvm_declare_p_sequencer(my_virtual_sequencer)

function new(string name="my_test2_vseq");

super.new(name);

handle_sb = uvm_top.find("*my_sb0");

`uvm_info("",$psprintf("handle_sb %s", handle_sb.get_full_name()),UVM_LOW)

$cast(handle_my_sb0, handle_sb);

`uvm_info("",$psprintf("handle_my_sb0 %s", handle_my_sb0.get_full_name()),UVM_LOW)

endfunction : new

task body();

#200ns

//uvm_test_top.env.my_env0.my_sb0.disable_scoreboard(0); //<- Does not work

handle_my_sb0.enable_scoreboard(1); // Works

#10000ns ;

endtask:body

endclass:my_test2_vseq

Posted

When you say "Does not work" you need to be more explicit. I'll assume you mean you are getting a compile error.

uvm_test_top.env.my_env0.my_sb0.disable_scoreboard(0);

is not a hierarchical reference in the LRM terminology, it is a class member select. I'm also going to assume my_sb0 is a handle to a class that is a base class to my_scoreboard, so you will need to cast that the same as you did with handle_sb.

In any case, using find is preferred over using what looks like a hierarchical reference because is is less re-usable as your testbench component hierarchy changes.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...