;;; vhdl-mode.el --- major mode for editing VHDL code
-;; Copyright (C) 1992-2015 Free Software Foundation, Inc.
+;; Copyright (C) 1992-2016 Free Software Foundation, Inc.
;; Authors: Reto Zimmermann <reto@gnu.org>
;; Rodney J. Whitby <software.vhdl-mode@rwhitby.net>
;; filed in the Emacs bug reporting system against this file, a copy
;; of the bug report be sent to the maintainer's email address.
-(defconst vhdl-version "3.37.1"
+(defconst vhdl-version "3.38.1"
"VHDL Mode version number.")
-(defconst vhdl-time-stamp "2015-01-15"
+(defconst vhdl-time-stamp "2015-03-12"
"VHDL Mode time stamp for last update.")
;; This file is part of GNU Emacs.
'/' or is empty)."
(let ((val (widget-value widget)))
(unless (string-match "^\\(\\|.*/\\)$" val)
- (widget-put widget :error "Invalid directory entry: must end with '/'")
+ (widget-put widget :error "Invalid directory entry: must end with `/'")
widget)))
;; help string for user options
;; WARNING[2]: test.vhd(85): Possible infinite loop
;; ** Warning: [4] ../src/emacsvsim.vhd(43): An abstract ...
;; ** Error: adder.vhd(190): Unknown identifier: ctl_numb
+ ;; ** Error: counter_rtl.vhd(18): Nonresolved signal 'hallo' has multiple sources.
+ ;; Drivers:
+ ;; counter_rtl.vhd(27):Conditional signal assignment line__27
+ ;; counter_rtl.vhd(29):Conditional signal assignment line__29
("ModelSim" "vcom" "-93 -work \\1" "make" "-f \\1"
nil "vlib \\1; vmap \\2 \\1" "./" "work/" "Makefile" "modelsim"
- ("^\\(ERROR\\|WARNING\\|\\*\\* Error\\|\\*\\* Warning\\)[^:]*:\\( *\[[0-9]+\]\\)? \\([^ \t\n]+\\)(\\([0-9]+\\)):" 3 4 nil) ("" 0)
+ ("\\(ERROR:\\|WARNING\\[[0-9]+\\]:\\|\\*\\* Error:\\|\\*\\* Warning: \\[[0-9]+\\]\\| +\\) \\([^ ]+\\)(\\([0-9]+\\)):" 2 3 nil)
+ ("" 0)
("\\1/_primary.dat" "\\2/\\1.dat" "\\1/_primary.dat"
"\\1/_primary.dat" "\\1/body.dat" downcase))
;; ProVHDL, Synopsys LEDA: provhdl -w work -f test.vhd
;; ERROR[11]::File test.vhd Line 100: Use of undeclared identifier
("Speedwave" "analyze" "-libfile vsslib.ini -src" "make" "-f \\1"
nil "mkdir \\1" "./" "work/" "Makefile" "speedwave"
- ("^ *ERROR\[[0-9]+\]::File \\([^ \t\n]+\\) Line \\([0-9]+\\):" 1 2 nil) ("" 0)
+ ("^ *ERROR\\[[0-9]+]::File \\([^ \t\n]+\\) Line \\([0-9]+\\):" 1 2 nil) ("" 0)
nil)
;; Synopsys, VHDL Analyzer (sim): vhdlan -nc test.vhd
;; **Error: vhdlan,703 test.vhd(22): OTHERS is not legal in this context.
;; ERROR:HDLParsers:164 - "test.vhd" Line 3. parse error
("Xilinx XST" "xflow" "" "make" "-f \\1"
nil "mkdir \\1" "./" "work/" "Makefile" "xilinx"
- ("^ERROR:HDLParsers:[0-9]+ - \"\\([^ \t\n]+\\)\" Line \\([0-9]+\\)\." 1 2 nil) ("" 0)
+ ("^ERROR:HDLParsers:[0-9]+ - \"\\([^ \t\n]+\\)\" Line \\([0-9]+\\)\\." 1 2 nil) ("" 0)
nil)
)
"List of available VHDL compilers and their properties.
Make command : command used for compilation using a Makefile
Make options : make options (\"\\1\" inserts Makefile name)
Generate Makefile: use built-in function or command to generate a Makefile
- \(\"\\1\" inserts Makefile name, \"\\2\" inserts library name)
- Library command : command to create library directory \(\"\\1\" inserts
+ (\"\\1\" inserts Makefile name, \"\\2\" inserts library name)
+ Library command : command to create library directory (\"\\1\" inserts
library directory, \"\\2\" inserts library name)
Compile directory: where compilation is run and the Makefile is placed
Library directory: directory of default library
Allows you to insert user specific parts into a Makefile.
Example:
- \(lambda nil
- \(re-search-backward \"^# Rule for compiling entire design\")
- \(insert \"# My target\\n\\n.MY_TARGET :\\n\\n\\n\"))"
+ (lambda nil
+ (re-search-backward \"^# Rule for compiling entire design\")
+ (insert \"# My target\\n\\n.MY_TARGET :\\n\\n\\n\"))"
:type 'hook
:group 'vhdl-compile)
\"\\3\" project-specific options)
- Do not compile: do not compile this file (in Makefile)
Compile directory: where compilation is run and the Makefile is placed
- \(\"\\1\" inserts compiler ID string)
+ (\"\\1\" inserts compiler ID string)
Library name : name of library (default is \"work\")
Library directory: path to library (\"\\1\" inserts compiler ID string)
Makefile name : name of Makefile
The default directory must have an absolute path (use `M-TAB' for completion).
All other paths can be absolute or relative to the default directory. All
-paths must end with '/'.
+paths must end with `/'.
The design units found in the sources (files and directories) are shown in the
hierarchy browser. Path and file name can contain wildcards `*' and `?' as
:group 'vhdl-template)
(defcustom vhdl-sensitivity-list-all t
- "Non-nil means use 'all' keyword in sensitivity list."
+ "Non-nil means use `all' keyword in sensitivity list."
:version "25.1"
:type 'boolean
:group 'vhdl-template)
The following keywords for template generation are supported:
<filename> : replaced by the name of the buffer
<author> : replaced by the user name and email address
- \(`user-full-name',`mail-host-address', `user-mail-address')
+ (`user-full-name',`mail-host-address', `user-mail-address')
<authorfull> : replaced by the user full name (`user-full-name')
<login> : replaced by user login name (`user-login-name')
<company> : replaced by contents of option `vhdl-company-name'
(defcustom vhdl-clock-edge-condition 'standard
"Syntax of the clock edge condition.
- Standard: \"clk'event and clk = '1'\"
+ Standard: \"clk\\='event and clk = \\='1\\='\"
Function: \"rising_edge(clk)\""
:type '(choice (const :tag "Standard" standard)
(const :tag "Function" function))
Name : string of words and spaces
Regexp : regular expression describing word syntax
- (e.g. \"\\\\=\<\\\w+_c\\\\=\>\" matches word with suffix \"_c\")
- expression must start with \"\\\\=\<\" and end with \"\\\\=\>\"
+ (e.g., `\\=\\<\\w+_c\\>' matches word with suffix `_c')
+ expression must start with `\\=\\<' and end with `\\>'
if only whole words should be matched (no substrings)
Color (light): foreground color for light background
(matching color examples: Gold3, Grey50, LimeGreen, Tomato,
In comments : If non-nil, words are also highlighted inside comments
Can be used for visual support of naming conventions, such as highlighting
-different kinds of signals (e.g. \"Clk50\", \"Rst_n\") or objects (e.g.
-\"Signal_s\", \"Variable_v\", \"Constant_c\") by distinguishing them using
+different kinds of signals (e.g. `Clk50', `Rst_n') or objects (e.g.
+`Signal_s', `Variable_v', `Constant_c') by distinguishing them using
common substrings or name suffices.
For each entry, a new face is generated with the specified colors and name
-\"vhdl-font-lock-\" + name + \"-face\".
+`vhdl-font-lock-' + name + `-face'.
NOTE: Activate a changed regexp in a VHDL buffer by re-fontifying it (menu
- entry \"Fontify Buffer\"). All other changes require restarting Emacs."
+ entry `Fontify Buffer'). All other changes require restarting Emacs."
:type '(repeat (list :tag "Face" :indent 2
(string :tag "Name ")
(regexp :tag "Regexp " "\\w+_")
(defun vhdl-warning-when-idle (&rest args)
"Wait until idle, then print out warning STRING and beep."
- (if noninteractive
- (vhdl-warning (apply 'format args) t)
- (unless vhdl-warnings
- (vhdl-run-when-idle .1 nil 'vhdl-print-warnings))
- (push (apply 'format args) vhdl-warnings)))
+ (let ((message (apply #'format-message args)))
+ (if noninteractive
+ (vhdl-warning message t)
+ (unless vhdl-warnings
+ (vhdl-run-when-idle .1 nil 'vhdl-print-warnings))
+ (push message vhdl-warnings))))
(defun vhdl-warning (string &optional nobeep)
"Print out warning STRING and beep."
default-directory))
(defmacro vhdl-prepare-search-1 (&rest body)
- "Enable case insensitive search and switch to syntax table that includes '_',
+ "Enable case insensitive search and switch to syntax table that includes `_',
then execute BODY, and finally restore the old environment. Used for
consistent searching."
`(let ((case-fold-search t)) ; case insensitive search
,@body)))
(defmacro vhdl-prepare-search-2 (&rest body)
- "Enable case insensitive search, switch to syntax table that includes '_',
-and remove `intangible' overlays, then execute BODY, and finally restore the
-old environment. Used for consistent searching."
- ;; FIXME: Why not just let-bind `inhibit-point-motion-hooks'? --Stef
+ "Enable case insensitive search, switch to syntax table that includes `_',
+arrange to ignore `intangible' overlays, then execute BODY, and finally restore
+the old environment. Used for consistent searching."
`(let ((case-fold-search t) ; case insensitive search
(current-syntax-table (syntax-table))
- overlay-all-list overlay-intangible-list overlay)
+ (inhibit-point-motion-hooks t))
;; use extended syntax table
(set-syntax-table vhdl-mode-ext-syntax-table)
- ;; remove `intangible' overlays
- (when (fboundp 'overlay-lists)
- (setq overlay-all-list (overlay-lists))
- (setq overlay-all-list
- (append (car overlay-all-list) (cdr overlay-all-list)))
- (while overlay-all-list
- (setq overlay (car overlay-all-list))
- (when (memq 'intangible (overlay-properties overlay))
- (setq overlay-intangible-list
- (cons overlay overlay-intangible-list))
- (overlay-put overlay 'intangible nil))
- (setq overlay-all-list (cdr overlay-all-list))))
;; execute BODY safely
(unwind-protect
(progn ,@body)
;; restore syntax table
- (set-syntax-table current-syntax-table)
- ;; restore `intangible' overlays
- (when (fboundp 'overlay-lists)
- (while overlay-intangible-list
- (overlay-put (car overlay-intangible-list) 'intangible t)
- (setq overlay-intangible-list
- (cdr overlay-intangible-list)))))))
+ (set-syntax-table current-syntax-table))))
(defmacro vhdl-visit-file (file-name issue-error &rest body)
"Visit file FILE-NAME and execute BODY."
(defun vhdl-function-name (prefix string &optional postfix)
"Generate a Lisp function name.
-PREFIX, STRING and optional POSTFIX are concatenated by '-' and spaces in
+PREFIX, STRING and optional POSTFIX are concatenated by `-' and spaces in
STRING are replaced by `-' and substrings are converted to lower case."
(let ((name prefix))
(while (string-match "\\(\\w+\\)\\s-*\\(.*\\)" string)
TEMPLATE INSERTION (electrification):
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
+ `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
conf, comp, cons, func, inst, pack, sig, var.
Template styles can be customized in customization group
- `vhdl-template' \(see OPTIONS).
+ `vhdl-template' (see OPTIONS).
HEADER INSERTION:
;;; --> \" := \" [[ --> [ --CR --> comment-out code
.. --> \" => \" ] --> ) --- --> horizontal line
,, --> \" <= \" ]] --> ] ---- --> display comment
- == --> \" == \" '' --> \\\"
+ == --> \" == \" \\='\\=' --> \\\"
WORD COMPLETION:
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
+ (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
the entire region.
Indentation can be done for a group of lines (`C-c C-i C-g'), a region
- \(`M-C-\\') or the entire buffer (menu). Argument and port lists are
+ (`M-C-\\') or the entire buffer (menu). Argument and port lists are
indented normally (nil) or relative to the opening parenthesis (non-nil)
according to option `vhdl-argument-list-indent'.
If option `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.
+ tabs. `\\[tabify]' and `\\[untabify]' allow the conversion of spaces to
+ tabs and vice versa.
Syntax-based indentation can be very slow in large files. Option
`vhdl-indent-syntax-based' allows you to use faster but simpler indentation.
Enables simple structural composition. `C-c C-m C-n' creates a skeleton
for a new component. Subcomponents (i.e. component declaration and
instantiation) can be automatically placed from a previously read port
- \(`C-c C-m C-p') or directly from the hierarchy browser (`P'). Finally,
+ (`C-c C-m C-p') or directly from the hierarchy browser (`P'). Finally,
all subcomponents can be automatically connected using internal signals
and ports (`C-c C-m C-w') following these rules:
- subcomponent actual ports with same name are considered to be
SPECIAL MENUES:
As an alternative to the speedbar, an index menu can be added (set
option `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
+ (e.g. add \"(global-set-key [S-down-mouse-3] \\='imenu)\" to your start-up
file) for browsing the file contents (is not populated if buffer is
larger than 256000). Also, a source file menu can be
added (set option `vhdl-source-file-menu' to non-nil) for browsing the
`vhdl-highlight-translate-off' is non-nil.
For documentation and customization of the used colors see
- customization group `vhdl-highlight-faces' (`M-x customize-group'). For
+ customization group `vhdl-highlight-faces' (`\\[customize-group]'). For
highlighting of matching parenthesis, see customization group
`paren-showing'. Automatic buffer highlighting is turned on/off by
option `global-font-lock-mode' (`font-lock-auto-fontify' in XEmacs).
Insert them once manually (will be kept afterwards).
- Out parameters of procedures are considered to be read.
Use option `vhdl-entity-file-name' to specify the entity file name
- \(used to obtain the port names).
+ (used to obtain the port names).
Use option `vhdl-array-index-record-field-in-sensitivity-list' to
specify whether to include array indices and record fields in
sensitivity lists.
CODE FIXING:
`C-c C-x C-p' fixes the closing parenthesis of a generic/port clause
- \(e.g. if the closing parenthesis is on the wrong line or is missing).
+ (e.g., if the closing parenthesis is on the wrong line or is missing).
PRINTING:
PostScript printing with different faces (an optimized set of faces is
- used if `vhdl-print-customize-faces' is non-nil) or colors \(if
+ 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. Option `vhdl-print-two-column' defines
appropriate default settings for nice landscape two-column printing.
sessions using the \"Save Options\" menu entry.
Options and their detailed descriptions can also be accessed by using
- the \"Customize\" menu entry or the command `M-x customize-option' (`M-x
- customize-group' for groups). Some customizations only take effect
+ the \"Customize\" menu entry or the command `\\[customize-option]'
+ (`\\[customize-group]' for groups). Some customizations only take effect
after some action (read the NOTE in the option documentation).
Customization can also be done globally (i.e. site-wide, read the
INSTALL file).
Not all options are described in this documentation, so go and see
- what other useful user options there are (`M-x vhdl-customize' or menu)!
+ what other useful user options there are (`\\[vhdl-customize]' or menu)!
FILE EXTENSIONS:
automatically recognized as VHDL source files. To add an extension
\".xxx\", add the following line to your Emacs start-up file (`.emacs'):
- \(push '(\"\\\\.xxx\\\\'\" . vhdl-mode) auto-mode-alist)
+ (push \\='(\"\\\\.xxx\\\\\\='\" . vhdl-mode) auto-mode-alist)
HINTS:
Maintenance:
------------
-To submit a bug report, enter `M-x vhdl-submit-bug-report' within VHDL Mode.
+To submit a bug report, enter `\\[vhdl-submit-bug-report]' within VHDL Mode.
Add a description of the problem and include a reproducible test case.
Questions and enhancement requests can be sent to <reto@gnu.org>.
(set (make-local-variable 'indent-line-function) 'vhdl-indent-line)
(set (make-local-variable 'comment-start) "--")
(set (make-local-variable 'comment-end) "")
- (when vhdl-emacs-21
- (set (make-local-variable 'comment-padding) ""))
(set (make-local-variable 'comment-column) vhdl-inline-comment-column)
(set (make-local-variable 'end-comment-column) vhdl-end-comment-column)
(set (make-local-variable 'comment-start-skip) "--+\\s-*")
(syntax-propertize-rules
;; Mark single quotes as having string quote syntax in
;; 'c' instances.
- ("\\(\'\\).\\(\'\\)" (1 "\"'") (2 "\"'"))))
+ ("\\('\\).\\('\\)" (1 "\"'") (2 "\"'"))))
(set (make-local-variable 'font-lock-syntactic-keywords)
vhdl-font-lock-syntactic-keywords))
(unless vhdl-emacs-21
(t nil)))))
(defun vhdl-in-extended-identifier-p ()
- "Determine if point is inside extended identifier (delimited by '\')."
+ "Determine if point is inside extended identifier (delimited by `\\')."
(save-match-data
(and (save-excursion (re-search-backward "\\\\" (vhdl-point 'bol) t))
(save-excursion (re-search-forward "\\\\" (vhdl-point 'eol) t)))))
;; following search list so that we don't run into
;; semicolons in the function interface list.
(backward-sexp)
+ (skip-chars-forward "(")
(let (foundp)
(while (and (not foundp)
(re-search-backward
;; keyword, allow for the keyword and an extra character,
;; as this will be used when looking forward for the
;; "begin" keyword.
- (save-excursion (forward-word 1) (1+ (point))))
+ (save-excursion (forward-word-strictly 1) (1+ (point))))
foundp literal placeholder)
;; Find the "libunit" keyword.
(while (and (not foundp)
;; keyword, allow for the keyword and an extra character,
;; as this will be used when looking forward for the
;; "begin" keyword.
- (save-excursion (forward-word 1) (1+ (point))))
+ (save-excursion (forward-word-strictly 1) (1+ (point))))
begin-string literal)
(while (and (not foundp)
(re-search-backward vhdl-defun-re nil 'move))
(re-search-forward vhdl-e-o-s-re))
(defconst vhdl-b-o-s-re
- (concat ";[^_]\\|\([^_]\\|\)[^_]\\|\\bwhen\\b[^_]\\|"
+ (concat ";[^_]\\|([^_]\\|)[^_]\\|\\bwhen\\b[^_]\\|"
vhdl-begin-bwd-re "\\|" vhdl-statement-bwd-re))
(defun vhdl-beginning-of-statement-1 (&optional lim)
;; start point was not inside leader area
;; set stop point at word after leader
(setq pos (point))))
- (forward-word 1)
+ (unless (looking-at "\\<else\\s-+generate\\>")
+ (forward-word-strictly 1))
(vhdl-forward-syntactic-ws here)
(setq pos (point)))
(goto-char pos)
(- (nth 1 (current-time)) (aref vhdl-progress-info 2))))
(let ((delta (- (aref vhdl-progress-info 1)
(aref vhdl-progress-info 0))))
- (if (= 0 delta)
- (message (concat string "... (100%s)") "%")
- (message (concat string "... (%2d%s)")
- (/ (* 100 (- pos (aref vhdl-progress-info 0)))
- delta) "%")))
+ (message "%s... (%2d%%)" string
+ (if (= 0 delta)
+ 100
+ (floor (* 100.0 (- pos (aref vhdl-progress-info 0)))
+ delta))))
(aset vhdl-progress-info 2 (nth 1 (current-time)))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setq end (point-marker))
;; have no space before and one space after `,' and ';'
(goto-char beg)
- (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\(\\s-*\\([,;]\\)\\)" end t)
+ (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|'.'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\(\\s-*\\([,;]\\)\\)" end t)
(if (match-string 1)
(goto-char (match-end 1))
(replace-match "\\3 " nil nil nil 2)))
;; have no space after `('
(goto-char beg)
- (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\((\\)\\s-+" end t)
+ (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|'.'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\((\\)\\s-+" end t)
(if (match-string 1)
(goto-char (match-end 1))
(replace-match "\\2")))
;; have no space before `)'
(goto-char beg)
- (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\|^\\s-+\\)\\|\\s-+\\()\\)" end t)
+ (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|'.'\\|\\\\[^\\\n]*[\\\n]\\|^\\s-+\\)\\|\\s-+\\()\\)" end t)
(if (match-string 1)
(goto-char (match-end 1))
(replace-match "\\2")))
;; surround operator symbols by one space
(goto-char beg)
- (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|\'.\'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\(\\([^/:<>=\n]\\)\\(:\\|\\??=\\|\\??<<\\|\\??>>\\|\\??<\\|\\??>\\|:=\\|\\??<=\\|\\??>=\\|=>\\|\\??/=\\|\\?\\?\\)\\([^=>\n]\\|$\\)\\)" end t)
+ (while (re-search-forward "\\(--.*\n\\|\"[^\"\n]*[\"\n]\\|'.'\\|\\\\[^\\\n]*[\\\n]\\)\\|\\(\\([^/:<>=\n]\\)\\(:\\|\\??=\\|\\??<<\\|\\??>>\\|\\??<\\|\\??>\\|:=\\|\\??<=\\|\\??>=\\|=>\\|\\??/=\\|\\?\\?\\)\\([^=>\n]\\|$\\)\\)" end t)
(if (or (match-string 1)
(<= (match-beginning 0) ; not if at boi
(save-excursion (back-to-indentation) (point))))
(defun vhdl-fix-statement-region (beg end &optional arg)
"Force statements in region on separate line except when on same line
-with 'end' keyword (necessary for correct indentation).
-Currently supported keywords: 'begin', 'if'."
+with `end' keyword (necessary for correct indentation).
+Currently supported keywords: `begin', `if'."
(interactive "r\nP")
(vhdl-prepare-search-2
(let (point)
(defun vhdl-fix-statement-buffer ()
"Force statements in buffer on separate line except when on same line
-with 'end' keyword (necessary for correct indentation)."
+with `end' keyword (necessary for correct indentation)."
(interactive)
(vhdl-fix-statement-region (point-min) (point-max)))
(setq end (save-excursion (goto-char end) (point-marker)))
(save-excursion ; remove DOS EOL characters in UNIX file
(goto-char beg)
- (while (search-forward "\r" nil t)
+ (while (search-forward "\r" nil t)
(replace-match "" nil t)))
(when (nth 0 vhdl-beautify-options) (vhdl-fixup-whitespace-region beg end t))
(when (nth 1 vhdl-beautify-options) (vhdl-fix-statement-region beg end))
(setq end (vhdl-re-search-forward "\\<then\\>" proc-end t))
(when (vhdl-re-search-backward "\\('event\\|\\<\\(falling\\|rising\\)_edge\\)\\>" beg t)
(goto-char end)
- (backward-word 1)
+ (backward-word-strictly 1)
(vhdl-forward-sexp)
(push (cons end (point)) seq-region-list)
(beginning-of-line)))
(let ((next-input (read-char)))
(if (= next-input ?-) ; four dashes
(vhdl-comment-display t)
- (setq unread-command-events ; pushback the char
- (list (vhdl-character-to-event next-input))))))
- (setq unread-command-events ; pushback the char
- (list (vhdl-character-to-event next-input)))
+ (push (vhdl-character-to-event next-input)
+ ; pushback the char
+ unread-command-events))))
+ (push (vhdl-character-to-event next-input) ; pushback the char
+ unread-command-events)
(vhdl-comment-insert)))))
(self-insert-command count)))
-(defun vhdl-electric-open-bracket (count) "'[' --> '(', '([' --> '['"
+(defun vhdl-electric-open-bracket (count) "`[' --> `(', `([' --> `['"
(interactive "p")
(if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
(if (= (preceding-char) ?\()
(insert-char ?\( 1))
(self-insert-command count)))
-(defun vhdl-electric-close-bracket (count) "']' --> ')', ')]' --> ']'"
+(defun vhdl-electric-close-bracket (count) "`]' --> `)', `)]' --> `]'"
(interactive "p")
(if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
(progn
(blink-matching-open))
(self-insert-command count)))
-(defun vhdl-electric-quote (count) "'' --> \""
+(defun vhdl-electric-quote (count) "\\='\\=' --> \""
(interactive "p")
(if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
(if (= (preceding-char) vhdl-last-input-event)
(insert-char ?\' 1))
(self-insert-command count)))
-(defun vhdl-electric-semicolon (count) "';;' --> ' : ', ': ;' --> ' := '"
+(defun vhdl-electric-semicolon (count) "`;;' --> ` : ', `: ;' --> ` := '"
(interactive "p")
(if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
(cond ((= (preceding-char) vhdl-last-input-event)
(t (insert-char ?\; 1)))
(self-insert-command count)))
-(defun vhdl-electric-comma (count) "',,' --> ' <= '"
+(defun vhdl-electric-comma (count) "`,,' --> ` <= '"
(interactive "p")
(if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
(cond ((= (preceding-char) vhdl-last-input-event)
(t (insert-char ?\, 1)))
(self-insert-command count)))
-(defun vhdl-electric-period (count) "'..' --> ' => '"
+(defun vhdl-electric-period (count) "`..' --> ` => '"
(interactive "p")
(if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
(cond ((= (preceding-char) vhdl-last-input-event)
(t (insert-char ?\. 1)))
(self-insert-command count)))
-(defun vhdl-electric-equal (count) "'==' --> ' == '"
+(defun vhdl-electric-equal (count) "`==' --> ` == '"
(interactive "p")
(if (and vhdl-stutter-mode (= count 1) (not (vhdl-in-literal)))
(cond ((= (preceding-char) vhdl-last-input-event)
(vhdl-insert-keyword ": BLOCK ")
(goto-char start)
(when (setq label (vhdl-template-field "label" nil t start (+ (point) 8)))
- (forward-word 1)
+ (forward-word-strictly 1)
(forward-char 1)
(insert "(")
(if (vhdl-template-field "[guard expression]" nil t)
(if (vhdl-template-field "[quantity name]" " USE " t)
(progn (vhdl-template-field "quantity name" " => ") t)
(delete-region (point)
- (progn (forward-word -1) (point)))
+ (progn (forward-word-strictly -1) (point)))
nil))
(vhdl-template-field "[quantity name]" " => " t))
(vhdl-template-field "expression")
(goto-char start)
(setq label (vhdl-template-field "[label]" nil t))
(unless label (delete-char 2))
- (forward-word 1)
+ (forward-word-strictly 1)
(forward-char 1))
(when (vhdl-template-field "expression" nil t start (point))
(vhdl-insert-keyword (concat " " (if (eq kind 'is) "IS" "USE") "\n\n"))
(interactive)
(insert " ")
(unexpand-abbrev)
- (backward-word 1)
+ (backward-word-strictly 1)
(vhdl-case-word 1)
(forward-char 1))
(interactive)
(insert " ")
(unexpand-abbrev)
- (backward-word 1)
+ (backward-word-strictly 1)
(vhdl-case-word 1)
(forward-char 1)
(indent-according-to-mode))
(let (margin)
(vhdl-prepare-search-1
(vhdl-insert-keyword "ELSE")
- (if (and (save-excursion (vhdl-re-search-backward "\\(\\<when\\>\\|;\\)" nil t))
- (equal "WHEN" (upcase (match-string 1))))
+ (if (and (save-excursion (vhdl-re-search-backward "\\(\\(\\<when\\>\\)\\|;\\)" nil t))
+ (match-string 2))
(insert " ")
+ (unless (vhdl-sequential-statement-p)
+ (vhdl-insert-keyword " GENERATE"))
(indent-according-to-mode)
(setq margin (current-indentation))
(insert "\n")
(let ((start (point))
margin)
(vhdl-insert-keyword "ELSIF ")
- (when (or (vhdl-sequential-statement-p) (vhdl-standard-p 'ams))
(when vhdl-conditions-in-parenthesis (insert "("))
(when (vhdl-template-field "condition" nil t start (point))
(when vhdl-conditions-in-parenthesis (insert ")"))
(indent-according-to-mode)
(setq margin (current-indentation))
(vhdl-insert-keyword
- (concat " " (if (vhdl-sequential-statement-p) "THEN" "USE") "\n"))
- (indent-to (+ margin vhdl-basic-offset))))))
+ (concat " " (cond ((vhdl-sequential-statement-p) "THEN")
+ ((vhdl-standard-p 'ams) "USE")
+ (t "GENERATE")) "\n"))
+ (indent-to (+ margin vhdl-basic-offset)))))
(defun vhdl-template-entity ()
"Insert an entity."
(goto-char start)
(setq label (vhdl-template-field "[label]" nil t))
(unless label (delete-char 2))
- (forward-word 1)
+ (forward-word-strictly 1)
(forward-char 1))
(when (setq index (vhdl-template-field "loop variable"
nil t start (point)))
(goto-char start)
(setq label (vhdl-template-field "[label]" nil t))
(unless label (delete-char 2))
- (forward-word 1)
+ (forward-word-strictly 1)
(forward-char 1))
(when vhdl-conditions-in-parenthesis (insert "("))
(when (vhdl-template-field "condition" nil t start (point))
(goto-char start)
(setq label (vhdl-template-field "[label]" nil t))
(unless label (delete-char 2))
- (forward-word 1)
+ (forward-word-strictly 1)
(delete-char 1))
(insert "\n\n")
(indent-to margin)
(cond ((equal definition "")
(insert ";"))
((equal definition "ARRAY")
- (delete-region (point) (progn (forward-word -1) (point)))
+ (delete-region (point) (progn (forward-word-strictly -1)
+ (point)))
(vhdl-template-array 'nature t))
((equal definition "RECORD")
(setq mid-pos (point-marker))
- (delete-region (point) (progn (forward-word -1) (point)))
+ (delete-region (point) (progn (forward-word-strictly -1)
+ (point)))
(vhdl-template-record 'nature name t))
(t
(vhdl-insert-keyword " ACROSS ")
(goto-char start)
(setq label (vhdl-template-field "[label]" nil t))
(unless label (delete-char 2))
- (forward-word 1)
+ (forward-word-strictly 1)
(forward-char 1))
(unless (vhdl-standard-p '87) (vhdl-insert-keyword "IS"))
(insert "\n")
(goto-char start)
(setq label (vhdl-template-field "[label]" nil t))
(unless label (delete-char 2))
- (forward-word 1)
+ (forward-word-strictly 1)
(forward-char 1))
(insert "(")
(if (not seq)
(vhdl-insert-keyword "WITH ")
(when (vhdl-template-field "selector expression"
nil t start (+ (point) 7))
- (forward-word 1)
+ (forward-word-strictly 1)
(delete-char 1)
(insert "\n")
(indent-to (+ margin vhdl-basic-offset))
(delete-char -4)
(insert ";"))
((equal definition "ARRAY")
- (delete-region (point) (progn (forward-word -1) (point)))
+ (delete-region (point) (progn (forward-word-strictly -1)
+ (point)))
(vhdl-template-array 'type t))
((equal definition "RECORD")
(setq mid-pos (point-marker))
- (delete-region (point) (progn (forward-word -1) (point)))
+ (delete-region (point) (progn (forward-word-strictly -1)
+ (point)))
(vhdl-template-record 'type name t))
((equal definition "ACCESS")
(insert " ")
(if (or (save-excursion
(progn (vhdl-beginning-of-block)
(looking-at "\\s-*\\(\\w+\\s-*:\\s-*\\)?\\<\\(\\<function\\|procedure\\|process\\|procedural\\)\\>")))
- (save-excursion (backward-word 1) (looking-at "\\<shared\\>")))
+ (save-excursion (backward-word-strictly 1)
+ (looking-at "\\<shared\\>")))
(vhdl-insert-keyword "VARIABLE ")
(if (vhdl-standard-p '87)
(error "ERROR: Not within sequential block")
(goto-char start)
(setq label (vhdl-template-field "[label]" nil t))
(unless label (delete-char 2))
- (forward-word 1)
+ (forward-word-strictly 1)
(forward-char 1))
(when vhdl-conditions-in-parenthesis (insert "("))
(when (vhdl-template-field "condition" nil t start (point))
(insert "-- pragma " directive))
(defun vhdl-template-directive-translate-on ()
- "Insert directive 'translate_on'."
+ "Insert directive `translate_on'."
(interactive)
(vhdl-template-directive "translate_on"))
(defun vhdl-template-directive-translate-off ()
- "Insert directive 'translate_off'."
+ "Insert directive `translate_off'."
(interactive)
(vhdl-template-directive "translate_off"))
(defun vhdl-template-directive-synthesis-on ()
- "Insert directive 'synthesis_on'."
+ "Insert directive `synthesis_on'."
(interactive)
(vhdl-template-directive "synthesis_on"))
(defun vhdl-template-directive-synthesis-off ()
- "Insert directive 'synthesis_off'."
+ "Insert directive `synthesis_off'."
(interactive)
(vhdl-template-directive "synthesis_off"))
(setq code t))
(unless code
(insert "--")) ; hardwire to 1 space or use vhdl-basic-offset?
- (setq unread-command-events
- (list (vhdl-character-to-event next-input)))))) ; pushback the char
+ (push (vhdl-character-to-event next-input) ; pushback the char
+ unread-command-events))))
(defun vhdl-comment-display (&optional line-exists)
"Add 2 comment lines at the current indent, making a display comment."
(save-match-data
(save-excursion
(goto-char (match-end 5))
- (forward-word 1)
+ (forward-word-strictly 1)
(vhdl-forward-syntactic-ws)
(when (looking-at "(")
(forward-sexp))
but not if inside a comment or quote."
(if (or (vhdl-in-literal)
(save-excursion
- (forward-word -1)
+ (forward-word-strictly -1)
(and (looking-at "\\<end\\>") (not (looking-at "\\<end;")))))
(progn
(insert " ")
(unexpand-abbrev)
- (backward-word 1)
+ (backward-word-strictly 1)
(vhdl-case-word 1)
(delete-char 1))
(if (not vhdl-electric-mode)
(progn
(insert " ")
(unexpand-abbrev)
- (backward-word 1)
+ (backward-word-strictly 1)
(vhdl-case-word 1)
(delete-char 1))
(let ((invoke-char vhdl-last-input-event)
;; delete CR which is still in event queue
(if (fboundp 'enqueue-eval-event)
(enqueue-eval-event 'delete-char -1)
- (setq unread-command-events ; push back a delete char
- (list (vhdl-character-to-event ?\177))))))))
+ (push (vhdl-character-to-event ?\177) ; push back a delete char
+ unread-command-events))))))
(defun vhdl-template-alias-hook ()
(vhdl-hooked-abbrev 'vhdl-template-alias))
(equal "END" (upcase (match-string 1))))
(throw 'parse "ERROR: Not within an entity or component declaration"))
(setq decl-type (downcase (match-string-no-properties 1)))
- (forward-word 1)
+ (forward-word-strictly 1)
(vhdl-parse-string "\\s-+\\(\\w+\\)\\(\\s-+is\\>\\)?")
(setq name (match-string-no-properties 1))
(message "Reading port of %s \"%s\"..." decl-type name)
(save-excursion
(re-search-backward
(concat "^\\s-*use\\s-+" (car clause)
- "\." (cdr clause) "\\>") nil t)))
+ "." (cdr clause) "\\>") nil t)))
(vhdl-template-standard-package (car clause) (cdr clause))
(insert "\n"))
(setq clause-list (cdr clause-list)))))
(insert name))
((equal (cdr vhdl-instance-name) "")
(setq name (vhdl-template-field "instance name")))
- ((string-match "\%d" (cdr vhdl-instance-name))
+ ((string-match "%d" (cdr vhdl-instance-name))
(let ((n 1))
(while (save-excursion
(setq name (format (vhdl-replace-string
# empty lines : %5d\n\
# comment lines : %5d\n\
# comments : %5d\n\
-# total lines : %5d\n\ "
+# total lines : %5d\n"
(buffer-file-name) no-stats no-code-lines no-empty-lines
no-comm-lines no-comments no-lines)
(unless vhdl-emacs-21 (vhdl-show-messages))))
(let (pos)
(save-excursion
(while (and (setq pos (re-search-forward regexp bound noerror count))
- (vhdl-in-literal))))
+ (save-match-data (vhdl-in-literal)))))
(when pos (goto-char pos))
pos))
(let (pos)
(save-excursion
(while (and (setq pos (re-search-backward regexp bound noerror count))
- (vhdl-in-literal))))
+ (save-match-data (vhdl-in-literal)))))
(when pos (goto-char pos))
pos))
(vhdl-resolve-env-variable
(vhdl-replace-string
(cons "\\(.*\\) \\(.*\\)" (car file-name-list))
- (concat "\*" " " (user-login-name)))))))
+ (concat "* " (user-login-name)))))))
(setq list-length (or list-length (length file-list)))
(setq file-name-list (cdr file-name-list)))
(while file-list
;; subprogram body
(when (match-string 2)
(re-search-forward "^\\s-*\\<begin\\>" nil t)
- (backward-word 1)
+ (backward-word-strictly 1)
(vhdl-forward-sexp)))
;; block (recursive)
((looking-at "^\\s-*\\w+\\s-*:\\s-*block\\>")
(re-search-forward "^\\s-*end\\s-+process\\>" nil t))
;; configuration declaration
((looking-at "^\\s-*configuration\\>")
- (forward-word 4)
+ (forward-word-strictly 4)
(vhdl-forward-sexp))
(t (goto-char pos))))))
;; Syntax definitions
(defconst vhdl-font-lock-syntactic-keywords
- '(("\\(\'\\).\\(\'\\)" (1 (7 . ?\')) (2 (7 . ?\'))))
- "Mark single quotes as having string quote syntax in 'c' instances.")
+ '(("\\('\\).\\('\\)" (1 (7 . ?\')) (2 (7 . ?\'))))
+ "Mark single quotes as having string quote syntax in `c' instances.")
(defvar vhdl-font-lock-keywords nil
"Regular expressions to highlight in VHDL Mode.")
;; do for all files
(while file-list
(unless noninteractive
- (message "Scanning %s %s\"%s\"... (%2d%s)"
+ (message "Scanning %s %s\"%s\"... (%2d%%)"
(if is-directory "directory" "files")
(or num-string "") name
- (/ (* 100 (- no-files (length file-list))) no-files) "%"))
+ (floor (* 100.0 (- no-files (length file-list))) no-files)))
(let ((file-name (abbreviate-file-name (car file-list)))
ent-list arch-list arch-ent-list conf-list
pack-list pack-body-list inst-list inst-ent-list)
(let* ((file-entry (vhdl-aget file-alist
speedbar-last-selected-file)))
(vhdl-speedbar-update-units
- "\\[.\\] " (nth 0 file-entry)
+ "\\[.] " (nth 0 file-entry)
speedbar-last-selected-file 'vhdl-speedbar-entity-face)
(vhdl-speedbar-update-units
"{.} " (nth 1 file-entry)
speedbar-last-selected-file 'vhdl-speedbar-architecture-face)
(vhdl-speedbar-update-units
- "\\[.\\] " (nth 3 file-entry)
+ "\\[.] " (nth 3 file-entry)
speedbar-last-selected-file 'vhdl-speedbar-configuration-face)
(vhdl-speedbar-update-units
"[]>] " (nth 4 file-entry)
speedbar-last-selected-file 'vhdl-speedbar-package-face)
(vhdl-speedbar-update-units
- "\\[.\\].+(" '("body")
+ "\\[.].+(" '("body")
speedbar-last-selected-file 'vhdl-speedbar-package-face)
(vhdl-speedbar-update-units
"> " (nth 6 file-entry)
(let* ((file-entry (vhdl-aget file-alist file-name)))
(setq
pos (vhdl-speedbar-update-units
- "\\[.\\] " (nth 0 file-entry)
+ "\\[.] " (nth 0 file-entry)
file-name 'vhdl-speedbar-entity-selected-face pos)
pos (vhdl-speedbar-update-units
"{.} " (nth 1 file-entry)
file-name 'vhdl-speedbar-architecture-selected-face pos)
pos (vhdl-speedbar-update-units
- "\\[.\\] " (nth 3 file-entry)
+ "\\[.] " (nth 3 file-entry)
file-name 'vhdl-speedbar-configuration-selected-face pos)
pos (vhdl-speedbar-update-units
"[]>] " (nth 4 file-entry)
file-name 'vhdl-speedbar-package-selected-face pos)
pos (vhdl-speedbar-update-units
- "\\[.\\].+(" '("body")
+ "\\[.].+(" '("body")
file-name 'vhdl-speedbar-package-selected-face pos)
pos (vhdl-speedbar-update-units
"> " (nth 6 file-entry)
(if (not (or is-entity (vhdl-speedbar-check-unit 'subprogram)))
(error "ERROR: No entity/component or subprogram under cursor")
(beginning-of-line)
- (if (looking-at "\\([0-9]\\)+:\\s-*\\(\\[[-+?]\\]\\|>\\) \\(\\(\\w\\|\\s_\\)+\\)")
+ (if (looking-at "\\([0-9]\\)+:\\s-*\\(\\[[-+?]]\\|>\\) \\(\\(\\w\\|\\s_\\)+\\)")
(condition-case info
(let ((token (get-text-property
(match-beginning 3) 'speedbar-token)))
- Context declaration
- Block comments
- Directives
- - 'all' keyword in sensitivity list
+ - `all' keyword in sensitivity list
Release Notes for VHDL Mode 3.34
For VHDL coding style and naming convention guidelines, see the following
references:
-\[1] Ben Cohen.
+[1] Ben Cohen.
\"VHDL Coding Styles and Methodologies\".
Kluwer Academic Publishers, 1999.
http://members.aol.com/vhdlcohen/vhdl/
-\[2] Michael Keating and Pierre Bricaud.
+[2] Michael Keating and Pierre Bricaud.
\"Reuse Methodology Manual, Second Edition\".
Kluwer Academic Publishers, 1999.
http://www.openmore.com/openmore/rmm2.html
-\[3] European Space Agency.
+[3] European Space Agency.
\"VHDL Modelling Guidelines\".
ftp://ftp.estec.esa.nl/pub/vhdl/doc/ModelGuide.{pdf,ps}