Package not bound

Hi All,

I am getting package bound error even after importing the given package in the code where I am using the components of it. Code is below

package agent_pkg:

`include “driver.sv”

`include “monitor.sv”

`include “sequencer.sv”

endpackage

In the env package I m importing this agent package

package env_pkg;

import agent_pkg::*;

`include “env.sv”

`include “env_config.sv”

`include “scoreboard.sv”

endpackage

In tb top I am importing the env pkg

import env_pkg::*;

module tb_top();

//DUT instaniation

endmodule

I m getting compilation error saying agent package not bound in env pkg file. The agent pkg is in a separate folder and env pkg in a separate folder. In make I have included both these directories in such a way that the agent folder is first compiled and then env.

Is there anything wrong I m doing? Please provide some help.

Regards,
Abhinandan

Without seeing any code or the exact error message, it is difficult to provide an answer.

You need to import a package in any code where you reference a part of that package. Importing a package within another package doesn’t automatically make the included package part of the including package. You will need to import both packages if you use classes from both.

I agree with what @cgales said, but your description sounds a lot like the files just aren’t getting compiled in the right order.

You said “I’m getting compilation error saying agent package not bound in env pkg file.” and this presumably means that the EDA tool is trying to compare your environment package and is choking on the line import agent_pkg::*;

You haven’t said which tool you’re using (or how you’re driving it), but there is probably some big list of files (conventionally with a .f suffix). My guess is that your list of files is missing the agent package.

With the text you’ve got in your example, I’d expect this list of files to contain at least three entries: the agent package, the env package, the TB, plus one or more design files.