GO is an imported symbol from package op_enum_pkg and is not directly accessible through the package scope cal_defines_pkg:: in which it is imported in another .sv file.
scenario:
here i have “GO” is a define in op_enum_pkg. op_enum_pkg is imported in cal_defines_pkg. if i want to get “GO” in another .sv file how can i get it?
I wrote like this: but showing warning for the below:
cal_defines_pkg::GO : cache_mem = Invalid ;
How to get define of one package which is imported in another package. through the 2nd package?
In reply to Ram130625@:
Importing just makes identifiers visible to the scope where the import occurs. It does not move/copy the definition of the identifier. Doing that requires exporting the identifier.
package op_enum_pkg;
parameter GO = 1;
endpackage
package cal_defines_pkg;
import op_enum_pkg::*; // import op_enum_pkg::GO;
export op_enum_pkg::GO; // export op_enum_pkg::*
endpackage
module top;
initial $display("GO: ",cal_defines_pkg::GO);
endmodule
Note that the identifiers you want exported must appear explicitly in the package; you cannot rely on wildcards ‘*’.
See section 26.6 Exporting imported names from packages of the IEEE 1800-2017 SystemVerilog LRM