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

Updated ghdl_interface.py per #458 #459

Merged
merged 4 commits into from
Mar 23, 2019
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
11 changes: 9 additions & 2 deletions vunit/ghdl_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,15 @@

from __future__ import print_function
import logging
from os.path import exists, join
from os.path import exists, join, abspath
import os
import subprocess
import shlex
from sys import stdout # To avoid output catched in non-verbose mode
from vunit.ostools import Process
from vunit.simulator_interface import (SimulatorInterface,
ListOfStringOption)
ListOfStringOption,
StringOption)
from vunit.exceptions import CompileError
LOGGER = logging.getLogger(__name__)

Expand All @@ -39,6 +40,7 @@ class GHDLInterface(SimulatorInterface):
sim_options = [
ListOfStringOption("ghdl.sim_flags"),
ListOfStringOption("ghdl.elab_flags"),
StringOption("ghdl.gtkwave_script.gui"),
]

@staticmethod
Expand Down Expand Up @@ -247,6 +249,11 @@ def simulate(self, # pylint: disable=too-many-locals

if self._gui and not elaborate_only:
cmd = ["gtkwave"] + shlex.split(self._gtkwave_args) + [data_file_name]

init_file = config.sim_options.get(self.name + ".gtkwave_script.gui", None)
if init_file is not None:
cmd += ["--script", "\"{}\"".format(abspath(init_file))]

stdout.write("%s\n" % " ".join(cmd))
subprocess.call(cmd)

Expand Down
8 changes: 8 additions & 0 deletions vunit/ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,14 @@
Extra simulation flags passed to ``ghdl --elab-run``.
Must be a list of strings.

``ghdl.gtkwave_script.gui``
A user defined TCL-file that is sourced after the design has been loaded in the GUI.
For example this can be used to configure the waveform viewer. Must be a string.
There are currently limitations in the HEAD revision of GTKWave that prevent the
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>``

.. |compile_option| replace::
The name of the compile option (See :ref:`Compilation options <compile_options>`)

Expand Down