Dear All,
I’m trying to resolve the “illegal location for a hierarchical name (in a package)” issue.
`include "sub.sv"
`include "package.sv"
module testbench;
sub u_sub();
initial
begin
import my_pkg::*;
cadd tr;
tr=new();
tr.add();
end
endmodule
class cadd;
int a;
task add();
a=u_sub.b;
$display("the value of a is %0d",a);
endtask
endclass
module sub;
int b;
initial
begin
b=7;
end
endmodule
package my_pkg;
`include "add.sv"
endpackage
this make a error within
a=u_sub.b;
Quite short but bunch files , so I just represent the link instead code at here.
https://www.edaplayground.com/x/2rN4
And I want to know How to avoid this implementation and how to resolve this problem.