- Has lots of automatic templates that insert code for you. For
example, if you type "case ", it will ask you for the name of the
signal to switch on, insert the case statement with begin and endcase,
and then ask for the particular cases.
- Most of the templates are bound to control keys. For example, C-c
C-b causes vlog-mode to insert a begin-end pair at the current point.
- Colorization of text is the same as Verilog-mode (with a couple of
minor additions).
- Vlog-mode treats variable names that include an underscore as a
single word. This allows operations like forward-word to work
correctly.
- Using M-/, (Escape then /), causes variable name completion. This
way you can have long descriptive signal names without having to type
as much.
- High level functions such as "update module port list from
input/output declarations" and "instantiate module", which
automatically do some of the tedious processes of connecting
modules.
- Tabbing is different than Verilog mode.
The Tab key operates differently in Vlog mode than in Verilog mode.
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.
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 " <= "
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.
Restrictions on I/O declarations: The above three functions operate best when only 1 signal name used per input, output or inout declaration.
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:
(add-hook 'vlog-mode-hook (function (lambda () (put 'vlog-enable-reg nil '("Reg name: " "always @ (posedge clk_50_sys or negedge reset_l) begin" \n > "if (!reset_l) begin" \n > str " <= 0;" \n < "end" \n "else begin" \n > "if () begin" \n > str " <= ;" \n < "end" \n < "end" \n < "end//always ")) )))