Can't use uvm macro in testbench

Hello everyone!
I would like to ask about file, called “uvm_package.sv”. There are only “`includes” of different files in it, but file “uvm_macros.svh” is included outside of the package. So when I make import of uvm_package ( “import uvm_package::*;”, as shown in all examples, i’ve seen), i can’t get access to any macro. When I wrote a following line in my testbench:

`include uvm_macros.svh

I got that access.
So why was “uvm_package.sv” written this way? And why do examples of testbenches are made without that crucial “'include”? Seems like these testbenches work just fine for everyone but me=)
Thank you for your help

Macros definitions do not belong to any package.

See Verification Horizons - Siemens Software

In reply to dave_59:

Thank you for your reply, Dave.
Yes, i know the difference between `include and import, and how they affect compilation, but how do the examples use these macros then, if they only have import of uvm_package, and nothing else? Or, maybe, examples i use were simply written uncorrectly?
Here’s the link to the code: https://github.com/pedro-araujo/uvm-testbench-tutorial-simple-adder
when i try to compile “simleadder_pkg.sv” i have an error from simpleadder_sequencer, that says, that macro is undefined. And, of course, this error disappears, when i add following line:

package simpleadder_pkg;
import uvm_pkg::*;
`include uvm_macros.svh //i add this line

`include “simpleadder_sequencer.sv”

In reply to trogers:

Yes, the example is incorrect and should have the `include “uvm_macros.svh” as part of the simpleadder_pkg.sv. I’m guessing that VCS will automatically include the required file if it isn’t specified.

There are also other errors in this example as well, in that they compile the simpleadder_pkg but then fail to import it into the testbench. VCS will often hide these poor coding practices, leading to non-compliant code.

In reply to cgales:

Thank you, cgales=)
Ok, then last question is: if i should write “`include uvm_macros.svh”, then, in fact, including macros in “uvm_package.sv” is some kind of verbosity?

In reply to trogers:

I’m not sure what you mean by “some kind of verbosity”. You do need to `include “uvm_macros.svh” in any file where you expect to use any macro, similar to having to import uvm_pkg::* when you want to reference a UVM class.

uvm_package.sv includes uvm_macros.svh because it uses the macros.

In reply to cgales:

ok, think i’ve understood now. thank you all again