A quick note about correct use of glbl.v
in a Verilog simulation in Vivado. This note is way less confusing than any notes you may find elsewhere on the Internet.
glbl.v
is a small collection of “global” signals that are being referred to in Vivado’s simulation sources for primitive elements in AMD (fka Xilinx) devices, such as OSERDES2
and others. This file gets included automatically in simulation setups if you use the Vivado GUI.
However, if you are trying to run a simulation using the command line tools such as xsim
, you may encounter the dreaded:
Unresolved reference to 'glbl'
The issue is resolved by realizing that the xelab
program for elaboration of previously analyzed Verilog or VHDL files can take multiple module names as “top” modules for simulation.
So if you would normally use:
xelab your_library.your_module
you want to compile glbl.v
into a separate library, say named glbl
, in addition to anything you compile yourself. The command line below is of course simplified to illustrate the important steps
xvlog \
--work your_library=some/directory/your_library.lib \
your_module.v
xvlog --work glbl=some/directory/glbl.lib glbl.v
Then elaborate as:
xelab \
-L glbl=some/directory/glbl.lib \
-L your_library=some/directory/your_library.lib \
glbl.glbl your_library.your_module
This will allow you to run xsim
on your_library.your_module
and get the results you want. I’m left to wonder why finding a straightforward piece of instruction anywhere else is such a challenge.
When the design is elaborated, it seems that the fact that glbl
is in a separate library does not seem to matter. I tested, and the approach works no matter whether the module glbl
ends up in your_library
or in glbl
.