Function: vhdl-port-paste-instance
vhdl-port-paste-instance is an interactive and byte-compiled function
defined in vhdl-mode.el.gz.
Signature
(vhdl-port-paste-instance &optional NAME NO-INDENT TITLE)
Documentation
Paste as an instantiation.
Key Bindings
Source Code
;; Defined in /usr/src/emacs/lisp/progmodes/vhdl-mode.el.gz
(defun vhdl-port-paste-instance (&optional name no-indent title)
"Paste as an instantiation."
(interactive)
(if (not vhdl-port-list)
(error "ERROR: No port read")
(let ((orig-vhdl-port-list vhdl-port-list))
;; flatten local copy of port list (must be flat for port mapping)
(vhdl-port-flatten)
(unless no-indent (indent-according-to-mode))
(let ((margin (current-indentation)))
;; paste instantiation
(cond (name
(insert name))
((equal (cdr vhdl-instance-name) "")
(setq name (vhdl-template-field "instance name")))
((string-match "%d" (cdr vhdl-instance-name))
(let ((n 1))
(while (save-excursion
(setq name (format (vhdl-replace-string
vhdl-instance-name
(nth 0 vhdl-port-list)) n))
(goto-char (point-min))
(vhdl-re-search-forward name nil t))
(setq n (1+ n)))
(insert name)))
(t (insert (vhdl-replace-string vhdl-instance-name
(nth 0 vhdl-port-list)))))
(message "Pasting port as instantiation \"%s\"..." name)
(insert ": ")
(when title
(save-excursion
(beginning-of-line)
(indent-to vhdl-basic-offset)
(insert "-- instance \"" name "\"\n")))
(if (not (vhdl-use-direct-instantiation))
(insert (nth 0 vhdl-port-list))
(vhdl-insert-keyword "ENTITY ")
(insert (vhdl-work-library) "." (nth 0 vhdl-port-list)))
(when (nth 1 vhdl-port-list)
(insert "\n") (indent-to (+ margin vhdl-basic-offset))
(vhdl-port-paste-generic-map t t))
(when (nth 2 vhdl-port-list)
(insert "\n") (indent-to (+ margin vhdl-basic-offset))
(vhdl-port-paste-port-map))
(unless (or (nth 1 vhdl-port-list) (nth 2 vhdl-port-list))
(insert ";"))
(message "Pasting port as instantiation \"%s\"...done" name))
(setq vhdl-port-list orig-vhdl-port-list))))