Skip to content

Commit

Permalink
rename compile option 'ghdl.flags' to 'ghdl.a_flags'; keep 'ghdl.flag…
Browse files Browse the repository at this point in the history
…s' as an alias and show a deprecation notice
  • Loading branch information
eine committed Feb 12, 2020
1 parent a7f2bbe commit 39b7f3e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
5 changes: 4 additions & 1 deletion docs/py/opts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@ Compilation options allow customization of compilation behavior. Since simulator
differing options available, generic options may be specified through this interface.
The following compilation options are known.

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

``ghdl.flags``
Deprecated alias of ``ghdl.a_flags``. It will be removed in future releases.

``incisive.irun_vhdl_flags``
Extra arguments passed to the Incisive ``irun`` command when compiling VHDL files.
Must be a list of strings.
Expand Down
21 changes: 19 additions & 2 deletions vunit/sim_if/ghdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import subprocess
import shlex
from sys import stdout # To avoid output catched in non-verbose mode
from warnings import warn
from ..exceptions import CompileError
from ..ostools import Process
from . import SimulatorInterface, ListOfStringOption, StringOption, BooleanOption
Expand All @@ -32,7 +33,10 @@ class GHDLInterface(SimulatorInterface):
supports_gui_flag = True
supports_colors_in_gui = True

compile_options = [ListOfStringOption("ghdl.flags")]
compile_options = [
ListOfStringOption("ghdl.a_flags"),
ListOfStringOption("ghdl.flags"),
]

sim_options = [
ListOfStringOption("ghdl.sim_flags"),
Expand Down Expand Up @@ -213,7 +217,20 @@ def compile_vhdl_file_command(self, source_file):
]
for library in self._project.get_libraries():
cmd += ["-P%s" % library.directory]
cmd += source_file.compile_options.get("ghdl.flags", [])

a_flags = source_file.compile_options.get("ghdl.a_flags", [])
flags = source_file.compile_options.get("ghdl.flags", [])
if flags != []:
warn(
(
"'ghdl.flags' is deprecated and it will be removed in future releases; "
"use 'ghdl.a_flags' instead"
),
Warning,
)
a_flags += flags

cmd += a_flags
cmd += [source_file.name]
return cmd

Expand Down
4 changes: 2 additions & 2 deletions vunit/ui/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ def set_sim_option(self, name, value, allow_empty=False, overwrite=True):
.. code-block:: python
prj.set_sim_option("ghdl.flags", ["--no-vital-checks"])
prj.set_sim_option("ghdl.a_flags", ["--no-vital-checks"])
.. note::
Only affects test benches added *before* the option is set.
Expand All @@ -418,7 +418,7 @@ def set_compile_option(self, name, value, allow_empty=False):
.. code-block:: python
prj.set_compile_option("ghdl.flags", ["--no-vital-checks"])
prj.set_compile_option("ghdl.a_flags", ["--no-vital-checks"])
.. note::
Expand Down
4 changes: 2 additions & 2 deletions vunit/ui/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def set_sim_option(self, name, value, allow_empty=False, overwrite=True):
.. code-block:: python
lib.set_sim_option("ghdl.flags", ["--no-vital-checks"])
lib.set_sim_option("ghdl.a_flags", ["--no-vital-checks"])
.. note::
Only affects test benches added *before* the option is set.
Expand All @@ -114,7 +114,7 @@ def set_compile_option(self, name, value, allow_empty=False):
.. code-block:: python
lib.set_compile_option("ghdl.flags", ["--no-vital-checks"])
lib.set_compile_option("ghdl.a_flags", ["--no-vital-checks"])
.. note::
Expand Down
4 changes: 2 additions & 2 deletions vunit/ui/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def set_compile_option(self, name, value):
.. code-block:: python
files.set_compile_option("ghdl.flags", ["--no-vital-checks"])
files.set_compile_option("ghdl.a_flags", ["--no-vital-checks"])
"""
for source_file in self:
source_file.set_compile_option(name, value)
Expand Down Expand Up @@ -108,7 +108,7 @@ def set_compile_option(self, name, value):
.. code-block:: python
my_file.set_compile_option("ghdl.flags", ["--no-vital-checks"])
my_file.set_compile_option("ghdl.a_flags", ["--no-vital-checks"])
"""
self._source_file.set_compile_option(name, value)

Expand Down
2 changes: 1 addition & 1 deletion vunit/ui/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def set_sim_option(self, name, value, overwrite=True):
.. code-block:: python
test.set_sim_option("ghdl.flags", ["--no-vital-checks"])
test.set_sim_option("ghdl.a_flags", ["--no-vital-checks"])
"""
self._test_case.set_sim_option(name, value, overwrite)
Expand Down
2 changes: 1 addition & 1 deletion vunit/ui/testbench.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ def set_sim_option(self, name, value, overwrite=True):
.. code-block:: python
test_bench.set_sim_option("ghdl.flags", ["--no-vital-checks"])
test_bench.set_sim_option("ghdl.a_flags", ["--no-vital-checks"])
"""
self._test_bench.set_sim_option(name, value, overwrite)
Expand Down

0 comments on commit 39b7f3e

Please sign in to comment.