In reply to EnRoute_zt:
I’ll repeat; it does not matter if the
`include “uvm_macros.svh” appears inside the
uvm_pkg;, or outside. All that matters is a macro must be `defined within the compilation unit before it can be used in the same compilation unit. You can assume the compiler pre-processing the text macros and compiler directives knows nothing about SystemVerilog syntax.
SystemVerilog allows a number of different approaches to compilation units. Each file that appears on the compiler’s command line can be a separate compilation unit. Or you can have groups of files on the command line in multiple compilation units, or you can have all files in one compilation unit. And for tools that allow multiple compilation steps, each step can be a separate compilation unit.
In all these cases, any included file is part of the same compilation unit as the file with the `Include statement.