Skip to content

Commit

Permalink
Update user_guide.md
Browse files Browse the repository at this point in the history
  • Loading branch information
kraigher committed Jul 6, 2015
1 parent bbb3fe3 commit 59a0f6b
Showing 1 changed file with 17 additions and 2 deletions.
19 changes: 17 additions & 2 deletions user_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 <module>
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.

0 comments on commit 59a0f6b

Please sign in to comment.