Hierarchically reference a SV class from the TB

Status
Not open for further replies.

surisingh

Member level 1
Joined
Jun 14, 2007
Messages
32
Helped
1
Reputation
2
Reaction score
0
Trophy points
1,286
Visit site
Activity points
1,499
Hi,
I want to hierarchically access the contents inside the SV class from the top level TB. Assume that I have a file called 'sv_class.sv" where i have defined the class called, 'sv_class'

class sv_class extends uvm_sequence();
...
int repeat_cnt;
...
endclass

I compile this in my top level TB as follows:

module top_tb;
`include "sv_class.sv"
endmodule

But when I try to access the int repeat_cnt from class 'sv_class' from the top_tb, I am getting the error:

module top_tb;
`include "sv_class.sv"

initial begin
if(top_tb.sv_class.repeat_cnt == 10) begin
...
end
end
endmodule

Here, i am getting, 'Illegal hierarchical reference detected [top_tb.sv_class.repeat_cnt](illegal hierarchical name containing a type name).

Any idea on how to solve this issue?
 



i think the error comes because the sv_class is a type name in the top_tb. you have included the file sv_class.sv in the top_tb.sv right..now
give a handle name to the class sv_class like
sv_class svc;
and then use the handle. i think this will solve the issue.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…