Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docs/news.d/948.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[NVC] New simulation and compile option ``nvc.global_flags`` can be used
to pass arbitrary flags to ``nvc``.
25 changes: 25 additions & 0 deletions docs/py/opts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ The following compilation options are known.
Extra arguments passed to ModelSim ``vlog`` command when compiling Verilog files.
Must be a list of strings.

``nvc.a_flags``
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Might we worth adding a "Global Options" or "Common Options" section, either at the beginning or the end of the page? Rather than repeating the nvc.global_args in both sections.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad. It's actually two different options with the same name. Users might want to set "global sim options" but not "global elaboration options", or the other way round.
Therefore, it's good as is.

Extra arguments passed to ``nvc -a`` command during compilation.
Must be a list of strings.

``nvc.global_flags``
Extra global arguments to pass to ``nvc`` before the ``-a`` command.
Must be a list of strings.

``rivierapro.vcom_flags``
Extra arguments passed to Riviera PRO ``vcom`` command when compiling VHDL files.
Must be a list of strings.
Expand Down Expand Up @@ -193,3 +201,20 @@ The following simulation options are known.
user from sourcing a list of scripts directly. The following is the current work
around to sourcing multiple user TCL-files:
``source <path/to/script.tcl>``

``nvc.elab_flags``
Extra elaboration flags passed to ``nvc -e``.
Must be a list of strings.

``nvc.global_flags``
Extra global arguments to pass to ``nvc`` before the ``-e`` or ``-r``
commands.
Must be a list of strings.

``nvc.heap_size``
Simulation heap size.
Must be a string, for example ``"64m"``.

``nvc.sim_flags``
Extra simulation flags passed to ``nvc -r``.
Must be a list of strings.
5 changes: 5 additions & 0 deletions vunit/sim_if/nvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,12 @@ class NVCInterface(SimulatorInterface): # pylint: disable=too-many-instance-att
supports_colors_in_gui = True

compile_options = [
ListOfStringOption("nvc.global_flags"),
ListOfStringOption("nvc.a_flags"),
]

sim_options = [
ListOfStringOption("nvc.global_flags"),
ListOfStringOption("nvc.sim_flags"),
ListOfStringOption("nvc.elab_flags"),
StringOption("nvc.heap_size"),
Expand Down Expand Up @@ -225,6 +227,8 @@ def compile_vhdl_file_command(self, source_file):
source_file.get_vhdl_standard(), source_file.library.name, source_file.library.directory
)

cmd += source_file.compile_options.get("nvc.global_flags", [])

cmd += ["-a"]
cmd += source_file.compile_options.get("nvc.a_flags", [])

Expand Down Expand Up @@ -252,6 +256,7 @@ def simulate(self, output_path, test_suite_name, config, elaborate_only):
cmd = self._get_command(self._vhdl_standard, config.library_name, libdir)

cmd += ["-H", config.sim_options.get("nvc.heap_size", "64m")]
cmd += config.sim_options.get("nvc.global_flags", [])

cmd += ["-e"]

Expand Down