diff --git a/vunit/ghdl_interface.py b/vunit/ghdl_interface.py index 9932e074a..18e8bae5f 100644 --- a/vunit/ghdl_interface.py +++ b/vunit/ghdl_interface.py @@ -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__) @@ -39,6 +40,7 @@ class GHDLInterface(SimulatorInterface): sim_options = [ ListOfStringOption("ghdl.sim_flags"), ListOfStringOption("ghdl.elab_flags"), + StringOption("ghdl.gtkwave_script.gui"), ] @staticmethod @@ -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) diff --git a/vunit/ui.py b/vunit/ui.py index c9b03fc29..3ba99b9b9 100644 --- a/vunit/ui.py +++ b/vunit/ui.py @@ -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 `` + .. |compile_option| replace:: The name of the compile option (See :ref:`Compilation options `)