From 59a0f6bfa2607e0f1adb375f23ec401f6be9ba37 Mon Sep 17 00:00:00 2001 From: kraigher Date: Mon, 6 Jul 2015 09:00:31 +0200 Subject: [PATCH] Update user_guide.md --- user_guide.md | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/user_guide.md b/user_guide.md index c6379bc41..a010e65a4 100644 --- a/user_guide.md +++ b/user_guide.md @@ -6,7 +6,7 @@ The idea in VUnit is to have a single point of entry for compiling and running a ## Python Interface The public interface of VUnit is exposed through the `VUnit` class -that can be imported directly from the vunit module. To make VUnit visible to Python you need a PYTHONPATH environment variable which includes the path to the VUnit root directory containing this user guide. Note that you shouldn't point to the vunit directory within the root directory. +that can be imported directly from the vunit module. Read [this](#making-vunit-importable) to make VUnit visible to Python. ```python # file: run.py @@ -279,5 +279,20 @@ vu.set_sim_option("vsim_extra_args.gui", "-voptargs=+acc") * `vsim_extra_args.gui` - Extra arguments passed to `vsim` when loading the design in GUI mode where it takes precedence over `vsim_extra_args`. -### Ctrl-C when using Git/MSYS Bash on Windows +## Ctrl-C when using Git/MSYS Bash on Windows VUnit will catch Ctrl-C and perform a clean shutdown closing all started simulation processes and printing the test report so far. On Git/MSYS Bash on Windows however there is a mechanism that hard kills a process a very short time after pressing Ctrl-C often prohibiting VUnit from completing its shutdown. This can leave simulation process open which have to be manually killed. See this [stack overflow post](http://stackoverflow.com/questions/23678045/control-c-kills-ipython-in-git-bash-on-windows-7) for tips on how to remove this mechanism. + +## Making VUnit importable +To be able to import VUnit in your `run.py` script you need to make it visible to Python or else the following error occurs: +```console +Traceback (most recent call last): + File "run.py", line 2, in + from vunit import VUnit +ImportError: No module named vunit +``` + +There are two methods to make VUnit importable in your `run.py` script: + +1. Set the `PYTHONPATH` environment variable to include the path to the VUnit root directory containing this user guide. Note that you shouldn't point to the vunit directory within the root directory. + +2. Add a `import sys; sys.path.append("/path/to/vunit_root/")` statement in your `run.py` file **before** the `import vunit` statement.