PACKAGE doubt

In reply to Vanshlata_cdac:

As the reply from bdreku states, you shouldn’t `include any package inside of another package.

Each package .sv file should be compiled independently into a library. In turn, if you need to reference that package from another package or environment, then you should import it.

Example:

eth_pkt.sv


class eth_pkt;
rand bit [31:0] pkt_da;
rand bit [31:0] pkt_sa;
.
.
.
.
endclass:eth_pkt

contents of eth_pkt_pkg.sv


package eth_pkt_pkg;
`include "eth_pkt.sv"
endpackage:eth_pkt_pkg

contents of eth_env.sv


package eth_env_pkg;
import eth_pkt_pkg::eth_pkt;
`include "eth_pkgn.sv"
`include "eth_drvr.sv"
`include "eth_mntr.sv"
`include "eth_chkr.sv"

class eth_env_c;
.
.
.
.
endclass:eth_env_c
endpackage:eth_env_pkg

contents of eth_top.sv


import eth_env_pkg::*;
`include "eth_if.sv"

module eth_top();

Also, if you are using UVM, you should have import uvm_pkg::*; and `include “uvm_macros.svh” as the first two lines of every package.