-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
171 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
[GHDL/NVC] Arbitrary waveform viewers are now supported by passing the `--viewer` | ||
command line arugment. As a consequence, ``ghdl.gtkwave_script.gui`` and | ||
``nvc.gtkwave_script.gui`` are deprecated in favour of ``ghdl.viewer_script.gui`` | ||
and ``nvc.viewer_script.gui``, respectively. The ``--gtkwave-args`` and | ||
``--gtkwave-fmt`` command line argument is deprecated in favour of ``--viewer-args`` | ||
and ``--viewer-fmt``, respectively. ``ghdl.viewer.gui`` and ``nvc.viewer.gui`` can | ||
be used to set the preferred viewer from the run-file. Finally, if the requested | ||
viewer does not exists, ``gtkwave`` or ``surfer`` is used, in that order. This | ||
also means that VUnit uses ``surfer`` if ``gtkwave`` is not installed. | ||
|
||
[NVC] It is possible to get VCD waveform files by passing ``--viewer-fmt=vcd``. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
# | ||
# Copyright (c) 2014-2024, Lars Asplund [email protected] | ||
""" | ||
Viewer handling for GHDL and NVC. | ||
""" | ||
|
||
|
||
class OSSMixin: | ||
""" | ||
Mixin class for handling common viewer functionality for the GHDL and NVC simulators. | ||
""" | ||
|
||
__slots__ = ( | ||
"_gui", | ||
"_viewer", | ||
"_viewer_fmt", | ||
"_viewer_args", | ||
"_gtkwave_available", | ||
"_surfer_available", | ||
) | ||
|
||
def __init__(self, gui, viewer, viewer_fmt, viewer_args): | ||
self._gui = gui | ||
self._viewer_fmt = viewer_fmt | ||
self._viewer_args = viewer_args | ||
self._viewer = viewer | ||
if gui: | ||
self._gtkwave_available = self.find_executable("gtkwave") | ||
self._surfer_available = self.find_executable("surfer") | ||
|
||
def _get_viewer(self, config): | ||
""" | ||
Determine the waveform viewer to use. | ||
Falls back to gtkwave or surfer, in that order, if none is provided or the provided | ||
cannot be found. | ||
""" | ||
viewer = self._viewer or config.sim_options.get(self.name + ".viewer.gui", None) | ||
|
||
if viewer is None: | ||
if self._gtkwave_available: | ||
viewer = "gtkwave" | ||
elif self._surfer_available: | ||
viewer = "surfer" | ||
else: | ||
raise RuntimeError("No viewer found. GUI not possible. Install GTKWave or Surfer.") | ||
|
||
elif not self.find_executable(viewer): | ||
viewers = [] | ||
if self._gtkwave_available: | ||
viewers += ["gtkwave"] | ||
if self._surfer_available: | ||
viewers += ["surfer"] | ||
addendum = f" The following viewer(s) are found in the path: {', '.join(viewers)}" if viewers else "" | ||
raise RuntimeError( | ||
f"Cannot find the {viewer} executable in the PATH environment variable. GUI not possible.{addendum}" | ||
) | ||
return viewer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.