Jump to content

I cannot hierarchically refer a function in scoreboard from sequence

Recommended Posts

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:


The following works


What am I missing something in the first case?




class my_test2_vseq extends my_base_test_vseq;

uvm_component handle_sb;

my_scoreboard handle_my_sb0;



function new(string name="my_test2_vseq");


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();


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

handle_my_sb0.enable_scoreboard(1); // Works

#10000ns ;



Link to comment
Share on other sites

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


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.

Link to comment
Share on other sites

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.

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...