The assertions.svh header file includes the following code snippet, which defines a package on-the-fly when the macro UVM is defined:
|
`ifdef UVM |
|
// report assertion error with UVM if compiled |
|
package assert_rpt_pkg; |
|
import uvm_pkg::*; |
|
`include "uvm_macros.svh" |
|
function void assert_rpt(string msg); |
|
`uvm_error("ASSERT FAILED", msg) |
|
endfunction |
|
endpackage |
|
`endif |
This works fine as long as this header is only included in one translation unit (repeated includes are avoided by the guard macros), but as soon as a second translation unit uses it as well, it leads to elaboration issues:
# ** Error (suppressible): ** while parsing file included at .bender/git/checkouts/common_cells-6e5a0419831bc5c6/src/exp_backoff.sv(23)
# ** at .bender/git/checkouts/common_cells-6e5a0419831bc5c6/include/common_cells/assertions.svh(14): (vlog-13389) Existing package 'assert_rpt_pkg' would be overwritten.
The most straight-forward resolution that I can think of, is to move these lines into a dedicated source file, call it assert_rpt_pkg.sv and add it to the design sources.
However, before proceeding with a PR, I would like to understand whether there is a particular rational behind the current solution that I am not aware of?
The
assertions.svhheader file includes the following code snippet, which defines a package on-the-fly when the macroUVMis defined:common_cells/include/common_cells/assertions.svh
Lines 12 to 21 in 554ebbc
This works fine as long as this header is only included in one translation unit (repeated includes are avoided by the guard macros), but as soon as a second translation unit uses it as well, it leads to elaboration issues:
The most straight-forward resolution that I can think of, is to move these lines into a dedicated source file, call it
assert_rpt_pkg.svand add it to the design sources.However, before proceeding with a PR, I would like to understand whether there is a particular rational behind the current solution that I am not aware of?