Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top