Skip to content

Commit

Permalink
Merge pull request #459 from GlenNicholls/master
Browse files Browse the repository at this point in the history
Updated ghdl_interface.py per #458
  • Loading branch information
kraigher committed Mar 23, 2019
2 parents e1caab9 + 6e0a990 commit f135038
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
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

0 comments on commit f135038

Please sign in to comment.