Emacs vlog-mode

This is a basic page for those who want to get Mark Mabry's vlog-mode.el for emacs. This is a font-lock based mode with some very, very handy functions and it now works with Emacs v20.x+ (including all the purty colored text). These files are here without his express, written permission but I don't believe he'll be all that annoyed to know that I am distributing it since it's GPL'ed anyway.

If you want the tarball with all of the files then you need to download vlogmode.tar.gz (30.8K).

Inside of vlogmode.tar.gz you will find the following files:

The following is the body of vlog-emacs.html, written by Mark Mabry.

Vlog Mode for Emacs

Brief Overview of Features

Enabling Vlog-mode

In order to enable vlog-mode, you first have to create a .lisp directory in your home (~username) directory. Inside of this place all of the .el files. Then add the following code to your ~/.emacs file.

Features in Detail


The Tab key operates differently in Vlog mode than in Verilog mode.

Auto-Inserting Code

Typing many common keywords will cause a template to execute that will assist in your code writing. The user will be prompted for variable names at certain times. All these templates can be individually modified in your personal .emacs file, or globally disabled. I give examples of both under Customization.

Useful key bindings and functions

C-c C-b  Insert begin/end pair with blank line in between
C-c C-a  Insert always block.  It prompts for sensitivity list
C-c C-f  (vlog-find-file) If point rests on a verilog module name, 
         that module_name.v will be opened from the current directory.
C-c i    (vlog-if-else-begin) Insert an if-else block
C-c m    (vlog-insert-module-instance) Insert module instantiation.
           Prompts for filename of module.
C-c e    (vlog-enable-reg) Insert a inferred flip-flop with enable
C-c r    (vlog-std-reg) Insert an inferred flip-flop
C-c ]    (end-of-vlog-module)
C-c [    (beginning-of-vlog-module)
,,       (stutter-comma) Typing two commas replaces the commas with " <= "

Quickly declaring wires and registers

I've made a couple of short cuts for declaring regs and wires, while you're coding. These functions take the name of the reg/wire that your cursor is on top of, asks for the bus width of the signal, and puts a reg or wire declaration at the top of your code. You don't see this happen; your view of the code is unchanged. It makes it easy to declare these as your are writing or adding code.

The regs/wires declarations are all positioned underneath a text string declared in the variable vlog-local-regs-wires-str. The default value is the string "//### local regs/wires".

C-c g    (vlog-declare-reg) Declares a reg for the signal that the
          cursor is on.
C-c w	 (vlog-declare-wire) Declares a wire for the signal that the
          cursor is on.

Functions for Structural Level Connectivity

Restrictions on I/O declarations: The above three functions operate best when only 1 signal name used per input, output or inout declaration.

Modifying Automatic Instance Names

The default module instance name used in vlog-insert-module-instance is umodule_name . After instantiation, the cursor is left next to the instance name, for manual modification, if necessary. I have also added some controls to the automatic instance name generation.

To set any of these variables, use the following example. Note that true is 't in emacs-lisp and false is nil.
(add-hook 'vlog-mode-hook (function (lambda () (setq vlog-shorten-instance-name 't))))


Examples of things to add to your .emacs file to customize Vlog-mode:

Known Bugs (and workarounds)

Last modified: Thu Nov 21 01:51:09 2002
webmonkey at isolation dot net