| |
VHDL/es mode:
Major mode for editing VHDL code.
Usage:
------
- TEMPLATE INSERTION (eelectrification): After typing a VHDL keyword and
entering `SPC', you are prompted for arguments while a template is generated
for that VHDL construct. Typing `RET' or `C-g' at the first (mandatory)
prompt aborts the current template generation. Optional arguments are
indicated by square brackets and removed if the queried string is left empty.
Prompts for mandatory arguments remain in the code if the queried string is
left empty. They can be queried again by `C-c C-t C-q'.
Typing `M-SPC' after a keyword inserts a space without calling the template
generator. Automatic template generation (i.e. electrification) can be
disabled (enabled) by typing `C-c C-e' or by setting custom variable
`vhdl-electric-mode' (see CUSTOMIZATION).
Enabled electrification is indicated by `/e' in the modeline.
Template generators can be invoked from the VHDL menu, by key bindings, by
typing `C-c C-i C-c' and choosing a construct, or by typing the keyword (i.e.
first word of menu entry not in parenthesis) and `SPC'.
The following abbreviations can also be used:
arch, attr, cond, conf, comp, cons, func, inst, pack, sig, var.
Template styles can be customized in customization group `vhdl-electric'
(see CUSTOMIZATION).
- HEADER INSERTION: A file header can be inserted by `C-c C-t C-h'. A
file footer (template at the end of the file) can be inserted by
`C-c C-t C-f'. See customization group `vhdl-header'.
- STUTTERING: Doouble striking of some keys inserts cumbersome VHDL syntax
elements. Stuttering can be disabled (enabled) by typing `C-c C-s' or by
variable `vhdl-stutter-mode'. Enabled stuttering is indicated by `/s' in
the modeline. The stuttering keys and their effects are:
;; --> " : " [ --> ( -- --> comment
;;; --> " := " [[ --> [ --CR --> comment-out code
.. --> " => " ] --> ) --- --> horizontal line
,, --> " <= " ]] --> ] ---- --> display comment
== --> " == " '' --> \"
- WORD COMPLETION>: Typing `TAB' after a (not completed) word looks for a VHDL
keyword or a word in the buffer that starts alike, inserts it and adjusts
case. Re-typing `TAB' toggles through alternative word completions.
This also works in the minibuffer (i.e. in template generator prompts).
Typing `TAB' after `(' looks for and inserts complete parenthesized
expressions (e.g. for array index ranges). All keywords as well as standard
types and subprograms of VHDL have predefined abbreviations (e.g. type "std"
and `TAB' will toggle through all standard types beginning with "std").
Typing `TAB' after a non-word character indents the line if at the beginning
of a line (i.e. no preceding non-blank characters),and inserts a tabulator
stop otherwise. `M-TAB' always inserts a tabulator stop.
- COMMENTS:
`--' puts a single comment.
`---' draws a horizontal line for separating code segments.
`----' inserts a display comment, i.e. two horizontal lines with a
comment in between.
`--CR' comments out code on that line. Re-hitting CR comments out
following lines.
`C-c C-c' comments out a region if not commented out,
uncomments a region if already commented out.
You are prompted for comments after object definitions (i.e. signals,
variables, constants, ports) and after subprogram and process specifications
if variable `vhdl-prompt-for-comments' is non-nil. Comments are
automatically inserted as additional labels (e.g. after begin statements) and
as help comments if `vhdl-self-insert-comments' is non-nil.
Inline comments (i.e. comments after a piece of code on the same line) are
indented at least to `vhdl-inline-comment-column'. Comments go at maximum to
`vhdl-end-comment-column'. `RET' after a space in a comment will open a
new comment line. Typing beyond `vhdl-end-comment-column' in a comment
automatically opens a new comment line. `M-q' re-fills
multi-line comments.
- INDENTATION: `TAB' indents a line if at the beginning of the line.
The amount of indentation is specified by variable `vhdl-basic-offset'.
`C-c M-TAB' always indents the current line (is bound to `TAB' if variable
`vhdl-intelligent-tab' is nil). Indentation can be done for an entire region
(`C-M-\') or buffer (menu). Argument and port lists are indented normally
(nil) or relative to the opening parenthesis (non-nil) according to variable
`vhdl-argument-list-indent'. If variable `vhdl-indent-tabs-mode' is nil,
spaces are used instead of tabs. `M-x tabify' and `M-x untabify' allow
to convert spaces to tabs and vice versa.
- ALIGNMENT: The alignment functions align operators, keywords, and inline
comment to beautify argument lists, port maps, etc. `C-c C-a' aligns a group
of consecutive lines separated by blank lines. `C-c C-r C-a' aligns an
entire region. If variable `vhdl-align-groups' is non-nil, groups of code
lines separated by empty lines are aligned individually. `C-c C-M-a' aligns
inline comments for a group of lines, and `C-c C-r C-M-a' for a region.
Some templates are automatically aligned after generation if custom variable
`vhdl-auto-align' is non-nil.
`C-c C-w' fixes up whitespace in a region. That is, operator symbols
are surrounded by one space, and multiple spaces are eliminated.
- PORT TRANSLATION: Geeneric and port clauses from entity or component
declarations can be copied (`C-c C-p C-w') and pasted as entity and
component declarations, as component instantiations and corresponding
internal constants and signals, as a generic map with constants as actual
parameters, and as a test bench (menu).
A clause with several generic/port names on the same line can be flattened
(`C-c C-p C-f') so that only one name per line exists. Names for actual
ports, instances, test benches, and design-under-test instances can be
derived from existing names according to variables `vhdl-...-name'.
Variables `vhdl-testbench-...' allow the insertion of additional templates
into a test bench. New files are created for the test bench entity and
architecture according to variable `vhdl-testbench-create-files'.
See customization group `vhdl-port'.
- TEST BENCH GENERATION: See PORT TRANSLAATION.
- KEY BINDINGS: Key bindings (`C-c ...') exist for most commands (see in
menu).
- VHDL MENU: All commands can be invoked from the VHDL menu.
- FILE BROWSER: The speedbar allows browssing of directories and file contents.
It can be accessed from the VHDL menu and is automatically opened if
variable `vhdl-speedbar' is non-nil.
In speedbar, open files and directories with `mouse-2' on the name and
browse/rescan their contents with `mouse-2'/`S-mouse-2' on the `+'.
- DESIGN HIERARCHY BROWSER: The speedbar can also be used for browsing the
hierarchy of design units contained in the source files of the current
directory or in the source files/directories specified for a project (see
variable `vhdl-project-alist').
The speedbar can be switched between file and hierarchy browsing mode in the
VHDL menu or by typing `f' and `h' in speedbar.
In speedbar, open design units with `mouse-2' on the name and browse their
hierarchy with `mouse-2' on the `+'. The hierarchy can be rescanned and
ports directly be copied from entities by using the speedbar menu.
- PROJECTS: Projects can be defined in vaariable `vhdl-project-alist' and a
current project be selected using variable `vhdl-project' (permanently) or
from the menu (temporarily). For each project, a title string (for the file
headers) and source files/directories (for the hierarchy browser) can be
specified.
- SPECIAL MENUES: As an alternative to thhe speedbar, an index menu can
be added (set variable `vhdl-index-menu' to non-nil) or made accessible
as a mouse menu (e.g. add "(global-set-key '[S-down-mouse-3] 'imenu)" to
your start-up file) for browsing the file contents. Also, a source file menu
can be added (set variable `vhdl-source-file-menu' to non-nil) for browsing
the current directory for VHDL source files.
- SOURCE FILE COMPILATION: The syntax of the current buffer can be analyzed
by calling a VHDL compiler (menu, `C-c C-k'). The compiler to be used is
specified by variable `vhdl-compiler'. The available compilers are listed
in variable `vhdl-compiler-alist' including all required compilation command,
destination directory, and error message syntax information. New compilers
can be added. Additional compile command options can be set in variable
`vhdl-compiler-options'.
An entire hierarchy of source files can be compiled by the `make' command
(menu, `C-c C-M-k'). This only works if an appropriate Makefile exists.
The make command itself as well as a command to generate a Makefile can also
be specified in variable `vhdl-compiler-alist'.
- VHDL STANDARDS: The VHDL standards to bbe used are specified in variable
`vhdl-standard'. Available standards are: VHDL'87/'93, VHDL-AMS,
Math Packages.
- KEYWORD CASE: Lower and upper case for keywords and standardized types,
attributes, and enumeration values is supported. If the variable
`vhdl-upper-case-keywords' is set to non-nil, keywords can be typed in lower
case and are converted into upper case automatically (not for types,
attributes, and enumeration values). The case of keywords, types,
attributes,and enumeration values can be fixed for an entire region (menu)
or buffer (`C-c C-u') according to the variables
`vhdl-upper-case-{keywords,types,attributes,enum-values}'.
- HIGHLIGHTING (fontiffication): Keywords and standardized types, attributes,
enumeration values, and function names (controlled by variable
`vhdl-highlight-keywords'), as well as comments, strings, and template
prompts are highlighted using different colors. Unit, subprogram, signal,
variable, constant, parameter and generic/port names in declarations as well
as labels are highlighted if variable `vhdl-highlight-names' is non-nil.
Additional reserved words or words with a forbidden syntax (e.g. words that
should be avoided) can be specified in variable `vhdl-forbidden-words' or
`vhdl-forbidden-syntax' and be highlighted in a warning color (variable
`vhdl-highlight-forbidden-words'). Verilog keywords are highlighted as
forbidden words if variable `vhdl-highlight-verilog-keywords' is non-nil.
Words with special syntax can be highlighted by specifying their syntax and
color in variable `vhdl-special-syntax-alist' and by setting variable
`vhdl-highlight-special-words' to non-nil. This allows to establish some
naming conventions (e.g. to distinguish different kinds of signals or other
objects by using name suffices) and to support them visually.
Variable `vhdl-highlight-case-sensitive' can be set to non-nil in order to
support case-sensitive highlighting. However, keywords are then only
highlighted if written in lower case.
Code between "translate_off" and "translate_on" pragmas is highlighted
using a different background color if variable `vhdl-highlight-translate-off'
is non-nil.
All colors can be customized by command `M-x customize-face'.
For highlighting of matching parenthesis, see customization group
`paren-showing' (`M-x customize-group').
- USER MODELS: VHDL models (templates) caan be specified by the user and made
accessible in the menu, through key bindings (`C-c C-m ...'), or by keyword
electrification. See custom variable `vhdl-model-alist'.
- HIDE/SHOW: The code of entire VHDL desiign units can be hidden using the
`Hide/Show' menu or by pressing `S-mouse-2' within the code (variable
`vhdl-hideshow-menu').
- PRINTING: Postscript printing with diffferent faces (an optimized set of
faces is used if `vhdl-print-customize-faces' is non-nil) or colors
(if `ps-print-color-p' is non-nil) is possible using the standard Emacs
postscript printing commands. Variable `vhdl-print-two-column' defines
appropriate default settings for nice landscape two-column printing. The
paper format can be set by variable `ps-paper-type'. Do not forget to
switch `ps-print-color-p' to nil for printing on black-and-white printers.
- CUSTOMIZATION: All variables can easilyy be customized using the `Customize'
menu entry or `M-x customize-option' (`M-x customize-group' for groups).
Some customizations only take effect after some action (read the NOTE in
the variable documentation). Customization can also be done globally (i.e.
site-wide, read the INSTALL file).
- FILE EXTENSIONS: As default, files withh extensions ".vhd" and ".vhdl" are
automatically recognized as VHDL source files. To add an extension ".xxx",
add the following line to your Emacs start-up file (`.emacs'):
(setq auto-mode-alist (cons '("\\.xxx\\'" . vhdl-mode) auto-mode-alist))
VHDL Mode is officially distributed on the Emacs VHDL Mode Home Page
______________, where the latest
version and release notes can be found.
The VHDL Mode Maintainers
Reto Zimmermann and Rod Whitby
|