Skip to content
Open
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
5 changes: 5 additions & 0 deletions docs/news.d/1101.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[GHDL/NVC] It is now possible to pass ``--waves`` to generate waveform files without
opening the GUI. The earlier GHDL-only approach of passing ``--viewer-fmt``
(or ``--gtkwave-fmt``) is deprecated and will be removed in a later version.
There is also a new alias for providing the waveform format, ``--waves-fmt``,
to make it consistent with the new flag.
9 changes: 9 additions & 0 deletions vunit/sim_if/ghdl.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,15 @@ def add_arguments(parser):
group = parser.add_argument_group("ghdl/nvc", description="GHDL/NVC specific flags")
group.add_argument(
"--viewer-fmt",
"--waves-fmt",
"--gtkwave-fmt",
choices=["vcd", "fst", "ghw"],
default=None,
help="Save .vcd, .fst, or .ghw to open in waveform viewer. NVC does not support ghw.",
)
group.add_argument("--viewer-args", "--gtkwave-args", default="", help="Arguments to pass to waveform viewer")
group.add_argument("--viewer", default=None, help="Waveform viewer to use")
group.add_argument("--waves", action='store_true', help="Generate waveform file")

@classmethod
def from_args(cls, args, output_path, **kwargs):
Expand All @@ -79,6 +81,7 @@ def from_args(cls, args, output_path, **kwargs):
viewer_fmt=args.viewer_fmt,
viewer_args=args.viewer_args,
viewer=args.viewer,
waves=args.waves,
backend=cls.determine_backend(prefix),
)

Expand All @@ -98,6 +101,7 @@ def __init__( # pylint: disable=too-many-arguments
viewer_fmt=None,
viewer_args="",
viewer=None,
waves=False,
backend="llvm",
):
SimulatorInterface.__init__(self, output_path, gui)
Expand All @@ -111,6 +115,7 @@ def __init__( # pylint: disable=too-many-arguments

self._prefix = prefix
self._project = None
self._waves = waves

self._backend = backend
self._vhdl_standard = None
Expand Down Expand Up @@ -366,6 +371,10 @@ def simulate(self, output_path, test_suite_name, config, elaborate_only): # pyl
ghdl_e = elaborate_only and config.sim_options.get("ghdl.elab_e", False)

if self._viewer_fmt is not None:
if not self._waves and not self._gui:
LOGGER.warning("Passing --viewer-fmt, or any alias of that, without either "
"--gui or --waves is deprecated and will be removed in a future version.")

data_file_name = str(Path(script_path) / f"wave.{self._viewer_fmt!s}")
if Path(data_file_name).exists():
remove(data_file_name)
Expand Down
6 changes: 4 additions & 2 deletions vunit/sim_if/nvc.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ def from_args(cls, args, output_path, **kwargs):
viewer_fmt=args.viewer_fmt,
viewer_args=args.viewer_args,
viewer=args.viewer,
waves=args.waves,
)

@classmethod
Expand All @@ -74,7 +75,7 @@ def find_prefix_from_path(cls):
return cls.find_toolchain([cls.executable])

def __init__( # pylint: disable=too-many-arguments
self, output_path, prefix, *, num_threads, gui=False, viewer_fmt=None, viewer_args="", viewer=None
self, output_path, prefix, *, num_threads, gui=False, viewer_fmt=None, viewer_args="", viewer=None, waves=False
):
SimulatorInterface.__init__(self, output_path, gui)
if viewer_fmt == "ghw":
Expand All @@ -84,6 +85,7 @@ def __init__( # pylint: disable=too-many-arguments

self._prefix = prefix
self._project = None
self._waves = waves

self._vhdl_standard = None
self._coverage_test_dirs = set()
Expand Down Expand Up @@ -257,7 +259,7 @@ def simulate(
libdir = self._project.get_library(config.library_name).directory
cmd = self._get_command(self._vhdl_standard, config.library_name, libdir)

if self._gui:
if self._gui or self._waves:
wave_file = script_path / (f"{config.entity_name}.{self._viewer_fmt or 'fst'}")
if wave_file.exists():
remove(wave_file)
Expand Down