How to include the package ? Package_could_not_be_bound

Hi All,

I have top.sv, sequence_pkg.sv and test_pkg.sv

///////test_pkg.sv//////////
package test_pkg;

`include "uvm_macros.svh"

import uvm_pkg::*;
import sequence_pkg::*;
import env_pkg::*; 

`include test1.svh  //sequence1
`include test2.svh  //sequence2
etc....

endpackage

//////////sequence_pkg.sv///////////

package sequence_pkg;

`include "uvm_macros.svh"

import uvm_pkg::*;
import mvc_pkg::*;

`include "sequence1.svh"
`include "sequence2.svh"
etc..

endpackage

///////////////////top.sv////////////////////
module top();

import uvm_pkg::*;
import test_pkg::*;

`include "uvm_macros.svh"

etc...

endmodule

///////////////////////////////////////////////////////

When I tried to run, I am getting error in top.sv file;

package test_pkg could not be bound.

I could not run any testcase test1.svh, test2.svh.
It results in common error. Can anyone please give hint, where I went wrong?

In reply to Mahesh K:

You need to compile package files with top module. Which all files are you compiling and with what command?

In reply to Mahesh K:

Based on error message , It seems to me compile ordering issue.

Please make sure test_pkg is compile before top module.

In reply to RonakShah:

Hi,

Thank you all for the suggestions. There was one warning in the uvm constructor;

function new (string name “”);
super.new(name);
endfunction: test6

For this, I was getting the error I mentioned and one warning saying “expecting new keyword”. Later I have modified the code;

function new (string name “”);
super.new(name);
endfunction: new

And I got the desired result.

In reply to MayurKubavat:

How to compile package before top module in EDA playground

  • should i copy the package file and top module both in testbench.sv

In reply to yethishwar:

You need to ask this question on the EDAPlayground forum.

In reply to dave_59:
Okay dave , Thank you