UVM: Compile error when a Package which imports another package in Questa 10.6c

Hi All,

I’m new to Questa flow and i’m using 10.6c version. I’ve the part of my UVM environment code below;

I’ve define file for example…
common_defines.svh which has

`define WIDTH 32

I’ve common_pkg.sv as below;

package common_pkg;
     import uvm_pkg::*;
     `include "uvm_macros.svh"
     `include "common_defines.svh" 
   endpackage

I’ve Agent Package as below;

 package agent_pkg;
     import uvm_pkg::*;
     import common_pkg::*;
     `include "uvm_macros.svh"
     `include "agent_item.sv"
     `include "agent_sequencer.sv"
     `include "agent_driver.sv"
     `include "agent_monitor.sv"
     `include "agent_hi.sv"
   endpackage

I’ve compile.f file as below;

../../../common/common_pkg.sv
../../../agents/agent_hi/agent_pkg.sv
../../../agents/agent_hi/hi_if.sv
+incdir+../../../common
+incdir+../../../agents/agent_hi

After compiling the Questa tool issue an Error as below;

** Error: ** while parsing file included at …/…/…/agents/agent_hi/agent_pkg.sv(19)

** at …/…/…/agents/agent_hi/agent_driver.sv(51): (vlog-2163) Macro `WIDTH is undefined

Note: My setup has already running with competitor tools.

Please suggest on how to overcome the above issue.

Thanks,

regards,
mahesh.

In reply to mahesh_424:

Didn’t you already ask the same question here?

In reply to cgales:
Hi,

This is different error relevant to package importing. The define file which has compiled without any error. Earlier post has `define inside package itself which in hexa and has changed to decimal which works fine. But this post is different that Issue came while importing the common_pkg inside agent_pkg. If I include define file directly to my agent then there no compile error.
In my TB there are huge agent packages which i dont want include the define file everywhere instead importing a package.

Please help the tool flow?

Thanks,
Mahesh

In reply to mahesh_424:

You posted about the exact same error message, which has the same exact solution which Dave mentioned. Did you read and understand all of the link that Dave posted about how `define statements are processed by the compiler?

In your last question, you changed your `define to a parameter which worked. Did you do the same thing now?

In reply to cgales:

Hi,

Ok…Now I’ve understood the tool behaviour in this regard that only parameters can work with the TB setup like above.

Thanks cgales and dave too if he’s read this.

Regards,
Mahesh.