This is a package for GNU Emacs that can be used to interface with VUnit which is an open-source testing framework for VHDL/SystemVerilog.
It hooks to the VHDL mode and wraps the function calls to the run script used by VUnit, therefore allows verification of unit tests while writing code without ever leaving Emacs. At the moment, it is in a very early stage of development where it simply makes use of the compile package and hydra, but in the near future and with some support from the community, the idea is to implement something similar to Magit for VUnit.
The basic requirements are that the HDL simulator (eg. Modelsim) is in the path and that VUnit is installed in the python environment.
The preferred installation method is through MELPA.
Add MELPA in your ~/.emacs
or ~/.emacs.d/init.el
init file.
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/"))
Then install the package
M-x package-refresh-contents RET
M-x package-install RET vunit-mode RET
Finally enable the mode in your init file.
(require 'vunit-mode)
(global-vunit-mode t)
To manually install the package, clone this repository and add the
following in your ~/.emacs
or ~/.emacs.d/init.el
init file.
(add-to-list 'load-path "/path-to-repository/")
(require 'vunit-mode)
(global-vunit-mode t)
The default keybinding to invoke vunit-mode is C-x x
.
Keys highlighted in blue will execute the specified action and quit the vunit-mode command window. The ones marked in red, however, will add additional flags to the actions available in blue.
Once a VHDL file is loaded in the buffer, the VUnit
Menu will
appear in the Menu Bar. It is also possible to set flags and run
tests without having to know any key bindings at all.
As for now, it is possible to configure the following variables
using M-x Customize
:
Path to the VUnit directory.
vunit-path
The Python executable used by VUnit.
vunit-python-executable
Name of the VUnit output directory.
vunit-run-outdir
Name of the python script to run.
vunit-run-script
Number of threads to use in parallel.
vunit-num-threads
Auto-scroll to bottom in the compile buffer.
vunit-auto-scroll
Since this is my first application ever written in Emacs Lisp support and input from advanced developers is highly appreciated.
To report bugs and suggest new features please use the issue tracker. In order to merge some code, please open a pull request.
The idea for a VUnit Emacs mode seemed to be around for a while and was already discussed online a couple of years ago, however, for me, Markus Pfaff from FH-Hagenberg was the one who inspired me to take the implementation into my own hands and despite my lack of knowledge in elisp publish the code written so far.