SVModule is set of python scripts/classes to add the ability to a text editor to parse (System)Verilog module declaration and paste it as instance, parameters... It manages module imports, parameters, standard and interface ports.
SVModule has been successfully tested with python 2.7 and 3.3.
SVModule is distributed under the GPLv3, the complete license description can be found here.
If your favorite editor is not supported, download the standalone SVModule scripts and make your own plugin as described in the following sections.
Let's start by decompressing standalone scripts distribution.
Firstly we have to parse and generate the internal representation in a temporary file ('/tmp/svmodule-dump' under linux):
We can now play with the paste-as functions:
The paste-as function will output:
Try the '-h' option to see the full list of paste-as functions.
The main concept is to declare functions for each action in a plugin flavoured to your editor's needs. For instance:
The copy-module function must look for the module declaration (in the editor text buffer) just above the current cursor position.
Once the cursor is positioned at the beginning of the module, the region between the cursor and the ');' token can be copied in a string. the later can be stored in a temporary text file or just kept in memory as a global variable.
The advantage of storing the module string in a temporary file is to share the module declaration across multiple text editor processes.
The paste-as functions must retrieve the module string and instantiate the SVModulePrinter. Thus, it can call the corresponding 'get' method to obtain the string to be inserted in the current text buffer.
Refers to 'svmodule_printer.py' or section 4 to get the list of available 'get' methods.
An example of integration is done in 'svmodule/svmodule_emacs.py'.
svmodule_emacs uses Pymacs, you must install this wonderful tool using the standard way of your linux distribution or simply following steps here
A basic way to load SVModule is to add the following lines to your '~/.emacs' file:
'SVMODULE_INSTALL_DIR' is the directory where SVModule python codes are located.