Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Package assert_rpt_pkg is redefined in each translation unit that includes assertions.svh when using UVM #250

Open
michael-platzer opened this issue Nov 26, 2024 · 0 comments

Comments

@michael-platzer
Copy link
Contributor

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant