Wanted: VHDL-mode for GNUemacs 
Author Message
 Wanted: VHDL-mode for GNUemacs

Dear Net,

I would like to have a copy of a VHDL-mode for GNUemacs. Please mail
it directly to me if it isn't too big.

Thanks!




Mon, 19 Jul 1993 07:29:12 GMT  
 Wanted: VHDL-mode for GNUemacs
Here is the VHDL mode that I use.  There are a few minor details I would
clean up if I got around to it.  You know what it's like...

----------------------------------------------------------------
Peter J. Ashenden
Dept. Computer Science, University of Adelaide, South Australia

----< cut here and you'll destroy your screen!!>----------------

; VHDL editing support package in GNUlisp.

; Ada editing support package in GNUlisp.  v1.0

; (borrows heavily from Mick Jordan's Modula-2 package for GNU,
; as modified by Peter Robinson, Michael Schmidt, and Tom Perrine.)

(setq auto-mode-alist
      (append (list (cons "\\.vhd$" 'vhdl-mode) (cons "\\.vhdl$" 'vhdl-mode))
            auto-mode-alist))

(defvar vhdl-mode-syntax-table nil
  "Syntax table in use in vhdl-mode buffers.")

(let ((table (make-syntax-table)))
  (modify-syntax-entry ?_ "_" table)
  (modify-syntax-entry ?\# "_" table)
  (modify-syntax-entry ?\( "()" table)
  (modify-syntax-entry ?\) ")(" table)
  (modify-syntax-entry ?$ "." table)
  (modify-syntax-entry ?* "." table)
  (modify-syntax-entry ?/ "." table)
  (modify-syntax-entry ?+ "." table)
  (modify-syntax-entry ?- "." table)
  (modify-syntax-entry ?= "." table)
  (modify-syntax-entry ?\& "." table)
  (modify-syntax-entry ?\| "." table)
  (modify-syntax-entry ?< "." table)
  (modify-syntax-entry ?> "." table)
  (modify-syntax-entry ?\[ "." table)
  (modify-syntax-entry ?\] "." table)
  (modify-syntax-entry ?\{ "." table)
  (modify-syntax-entry ?\} "." table)
  (modify-syntax-entry ?. "." table)
  (modify-syntax-entry ?\\ "." table)
  (modify-syntax-entry ?: "." table)
  (modify-syntax-entry ?\; "." table)
  (modify-syntax-entry ?\' "." table)
  (modify-syntax-entry ?\" "\"" table)
  (setq vhdl-mode-syntax-table table))

(defvar vhdl-mode-map nil
  "Keymap used in vhdl mode.")

(let ((map (make-sparse-keymap)))
  (define-key map "\C-m" 'vhdl-newline)
  (define-key map "\C-?" 'backward-delete-char-untabify)
  (define-key map "\C-i" 'vhdl-tab)
  (define-key map "\C-c\C-i" 'vhdl-untab)
  (define-key map "\C-c<" 'vhdl-backward-to-same-indent)
  (define-key map "\C-c>" 'vhdl-forward-to-same-indent)
  (define-key map "\C-ch" 'vhdl-header)
  (define-key map "\C-c(" 'vhdl-paired-parens)
  (define-key map "\C-c-" 'vhdl-inline-comment)
  (define-key map "\C-c\C-a" 'vhdl-array)
  (define-key map "\C-ca" 'vhdl-architecture)
  (define-key map "\C-cb" 'vhdl-block)
  (define-key map "\C-cP" 'vhdl-process)
  (define-key map "\C-cc" 'vhdl-case)
  (define-key map "\C-c\C-e" 'vhdl-entity-spec)
  (define-key map "\C-c\C-c" 'vhdl-component-spec)
  (define-key map "\C-c\C-k" 'vhdl-package-spec)
  (define-key map "\C-ck" 'vhdl-package-body)
  (define-key map "\C-c\C-p" 'vhdl-procedure-spec)
  (define-key map "\C-cp" 'vhdl-subprogram-body)
  (define-key map "\C-c\C-f" 'vhdl-function-spec)
  (define-key map "\C-c\C-g" 'vhdl-generic-spec)
  (define-key map "\C-c\C-h" 'vhdl-port-spec)
  (define-key map "\C-cf" 'vhdl-for-loop)
  (define-key map "\C-cl" 'vhdl-loop)
  (define-key map "\C-cn" 'vhdl-next)
  (define-key map "\C-ci" 'vhdl-if)
  (define-key map "\C-cI" 'vhdl-elsif)
  (define-key map "\C-ce" 'vhdl-else)
  (define-key map "\C-c\C-r" 'vhdl-record)
  (define-key map "\C-c\C-s" 'vhdl-subtype)
  (define-key map "\C-c\C-t" 'vhdl-type)
  (define-key map "\C-ct" 'vhdl-tabsize)
  (define-key map "\C-cw" 'vhdl-while-loop)
  (define-key map "\C-c\C-w" 'vhdl-when)
  (define-key map "\C-cx" 'vhdl-exit)
  (define-key map "\C-cs" 'vhdl-signal)
  (define-key map "\C-cv" 'vhdl-variable)
  (define-key map "\C-cC" 'vhdl-compile)
  (define-key map "\C-cB" 'vhdl-bind)
  (define-key map "\C-cE" 'vhdl-find-listing)
  (define-key map "\C-cL" 'vhdl-library-name)
  (define-key map "\C-cO" 'vhdl-options-for-bind)
  (define-key map "\C-c\C-l" 'goto-line)
  (setq vhdl-mode-map map))

(defvar vhdl-indent 2 "*Value is the number of columns to indent in
vhdl-Mode.")

(defun vhdl-mode ()
"This is a mode intended to support model development in vhdl.
Most control constructs and declarations of vhdl can be inserted in the buffer
by typing Control-C followed by a character mnemonic for the construct.

C-c C-a array           C-c a   architecture
                        C-c b   block
C-c C-c component spec  C-c c   case
C-c C-e entity spec     C-c e   else
C-c C-f function spec   C-c f   for
C-c C-g generic spec    
C-c C-h port spec       C-c h   header
                        C-c i   if
C-c C-k package spec    C-c k   package body
                        C-c l   loop
                        C-c n   next
C-c C-p procedure spec  C-c p   subprogram body
C-c C-r record          
C-c C-s subtype         C-c s   signal
C-c C-t type            
                        C-c v   variable
C-c C-w when            C-c w   while
                        C-c x   exit
C-c (   paired paren    C-c -   inline comment
                        C-c I   elsif
                        C-c P   process
C-c C    compile        C-c B    bind
C-c E    find error list
C-c L    name library   C-c O    options for bind

C-c < and C-c > move backward and forward respectively to the next line
having the same (or lesser) level of indentation.

Variable vhdl-indent controls the number of spaces for indent/undent.

\\{vhdl-mode-map}
"
  (interactive)
  (kill-all-local-variables)
  (use-local-map vhdl-mode-map)
  (setq major-mode 'vhdl-mode)
  (setq mode-name "vhdl")
  (make-local-variable 'comment-column)
  (setq comment-column 41)
  (make-local-variable 'end-comment-column)
  (setq end-comment-column 72)
  (set-syntax-table vhdl-mode-syntax-table)
  (make-local-variable 'paragraph-start)
  (setq paragraph-start (concat "^$\\|" page-delimiter))
  (make-local-variable 'paragraph-separate)
  (setq paragraph-separate paragraph-start)
  (make-local-variable 'paragraph-ignore-fill-prefix)
  (setq paragraph-ignore-fill-prefix t)
;  (make-local-variable 'indent-line-function)
;  (setq indent-line-function 'c-indent-line)
  (make-local-variable 'require-final-newline)
  (setq require-final-newline t)
  (make-local-variable 'comment-start)
  (setq comment-start "--")
  (make-local-variable 'comment-end)
  (setq comment-end "\n")
  (make-local-variable 'comment-column)
  (setq comment-column 41)
  (make-local-variable 'comment-start-skip)
  (setq comment-start-skip "--+ *")
  (make-local-variable 'comment-indent-hook)
  (setq comment-indent-hook 'c-comment-indent)
  (make-local-variable 'parse-sexp-ignore-comments)
  (setq parse-sexp-ignore-comments t)
  (run-hooks 'vhdl-mode-hook))

(defun vhdl-tabsize (s)
  "changes spacing used for indentation. Reads spacing from minibuffer."
  (interactive "nnew indentation spacing: ")
  (setq vhdl-indent s))

(defun vhdl-newline ()
  "Start new line and indent to current tab stop."
  (interactive)
  (let ((vhdl-cc (current-indentation)))
    (newline)
    (indent-to vhdl-cc)))

(defun vhdl-tab ()
  "Indent to next tab stop."
  (interactive)
  (indent-to (* (1+ (/ (current-indentation) vhdl-indent)) vhdl-indent)))

(defun vhdl-untab ()
  "Delete backwards to previous tab stop."
  (interactive)
  (backward-delete-char-untabify vhdl-indent nil))

(defun vhdl-go-to-this-indent (step indent-level)
  "Move point repeatedly by <step> lines till the current line
has given indent-level or less, or the start/end of the buffer is hit.
Ignore blank lines, statement labels, block/loop names."
  (while (and
          (zerop (forward-line step))
          (or (looking-at "^[      ]*$")
              (looking-at "^[      ]*--")
              (looking-at "^<<[A-Za-z0-9_]+>>")
              (looking-at "^[A-Za-z0-9_]+:")
              (> (current-indentation) indent-level)))
    nil))

(defun vhdl-backward-to-same-indent ()
  "Move point backwards to nearest line with same indentation or less.
If not found, point is left at top of buffer."
  (interactive)
  (vhdl-go-to-this-indent -1 (current-indentation))
  (back-to-indentation))

(defun vhdl-forward-to-same-indent ()
  "Move point forwards to nearest line with same indentation or less.
If not found, point is left at start of last line in buffer."
  (interactive)
  (vhdl-go-to-this-indent 1 (current-indentation))
  (back-to-indentation))

(defun vhdl-signal ()
  "Insert a signal declaration."
  (interactive)
  (insert "signal ")
  (insert (read-string "signal names[s]: ") " : ")
  (insert (read-string "signal subtype: "))
  (let ((initial-value (read-string "initial value: ")))
    (if (not (string-equal initial-value ""))
        (insert " := " initial-value)))
  (insert ";"))

(defun vhdl-variable ()
  "Insert a variable declaration."
  (interactive)
  (insert "variable ")
  (insert (read-string "variable names[s]: ") " : ")
  (insert (read-string "variable subtype: "))
  (let ((initial-value (read-string "initial value: ")))
    (if (not (string-equal initial-value ""))
        (insert " := " initial-value)))
  (insert ";"))

(defun vhdl-architecture ()
  "Insert skeleton architecture body."
  (interactive)
  (insert "architecture ")
  (let ((architecture-name (read-string "architecture name: ")))
    (insert architecture-name " of ")
    (insert (read-string "entity name: ") " is")
    (vhdl-newline)
    (vhdl-newline)
    (insert "begin")
    (vhdl-newline)
    (vhdl-newline)
    (insert "end " architecture-name ";"))
  (end-of-line -2)
  (vhdl-tab))

(defun vhdl-array ()
  "Insert array type definition, prompting for component type,
leaving the user to type in the index subtypes."
  (interactive)
  (insert "array ()")
  (backward-char)
  (insert (read-string "index subtype[s]: "))
  (end-of-line)
  (insert " of ;")
  (backward-char)
  (insert (read-string "component-type: "))
  (end-of-line))

(defun vhdl-case ()
  "Build skeleton case statement, prompting for the selector expression.
starts up the first when clause, too."
  (interactive)
  (insert "case ")
  (insert (read-string "selector expression: ") " is")
  (vhdl-newline)
  (vhdl-newline)
  (insert "end case;")
  (end-of-line 0)
  (vhdl-tab)
  (vhdl-tab)
  (vhdl-when))

(defun vhdl-process ()
  "Insert a skeleton process statement, prompting for process name."
  (interactive)
  (let* ((process-name (read-string "process name: "))
         (process-is-named (not (string-equal process-name
...

read more »



Mon, 19 Jul 1993 12:06:01 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. VHDL-mode for GnuEmacs available?

2. GNUEmacs VHDL mode (2 of 2)

3. GNUEmacs VHDL mode (1 of 2)

4. vhdl-mode.el for GNUemacs

5. Emacs VHDL editing mode (vhdl-mode.el version 2.74)

6. Emacs VHDL editing mode (vhdl-mode.el version 2.71)

7. Emacs VHDL editing mode (vhdl-mode.el version 2.56.1.1)

8. Emacs VHDL editing mode (vhdl-mode.el version 2.56.1.1)

9. VHDL mode for Emacs (vhdl-mode.el version 2.50)

10. TAGS for VHDL/GNUEmacs

11. wanted: syntax-colored vhdl mode for emacs

12. WANTED: VHDL-mode for emacs

 

 
Powered by phpBB® Forum Software