You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
See below a small function that when invoked, if the cursor is inside a sub-module instance, it displays the following information in the minibuffer:
submodule name
instance name
the position of the cursor – whether it is under the “Outputs/Inputs/Inouts/Interfaces/Interfaced� comment, if such a comment exists in the instance.
I find this function useful when searching for a signal, and the search result is inside a sub-module instance, and the module and instance name are outside the display (above the first displayed line). I've assigned this function it to the Pause/Break key, so I can easily invoke it in a single keystroke.
As you can see below, the implementation of this function was made possible by some of the excellent Verilog-mode functions.
(defun verilog-display-module-and-inst-name ()
(interactive)
(condition-case error
(progn
(save-excursion
(beginning-of-line)
(setq submodule_name (verilog-read-inst-module)) ;; get the name of the submodule
(setq instance_name (verilog-read-inst-name))) ;; get the name of the instance
(save-excursion
(beginning-of-line)
(verilog-read-inst-backward-name)
(setq inst_start_point (match-beginning 0))) ;; get the start point of the instance
(save-excursion ;; now get the I/O group that the signal in the cursor position belongs to
(end-of-line)
(setq cursor_position "")
(re-search-backward "\\/\\/\\s-*\\(Outputs\\|Inputs\\|Inouts\\|Interfaces\\|Interfaced\\)")
(if (looking-at "\\/\\/\\s-*Outputs")
(setq io_type_comment " \"// Outputs\" "))
(if (looking-at "\\/\\/\\s-*Inputs")
(setq io_type_comment " \"// Inputs\" "))
(if (looking-at "\\/\\/\\s-*Inouts")
(setq io_type_comment " \"// Inouts\" "))
(if (looking-at "\\/\\/\\s-*Interfaces")
(setq io_type_comment " \"// Interfaces\" "))
(if (looking-at "\\/\\/\\s-*Interfaced")
(setq io_type_comment " \"// Interfaced\" "))
(if (< (match-beginning 0) inst_start_point) ;; Check location of the comment, validate it only if inside instance.
(setq cursor_position "") ;; Cursor location details are not displayed if there is no valid comment inside the instance
(setq cursor_position (concat " (cursor position is below the" io_type_comment "comment)")))
(message (concat submodule_name " " instance_name cursor_position)))) ;; print to minibuffer
(error
(message "")))
)
The text was updated successfully, but these errors were encountered:
Author Name: Yuval Sapir
Original Redmine Message: 1114 from https://www.veripool.org
See below a small function that when invoked, if the cursor is inside a sub-module instance, it displays the following information in the minibuffer:
I find this function useful when searching for a signal, and the search result is inside a sub-module instance, and the module and instance name are outside the display (above the first displayed line). I've assigned this function it to the Pause/Break key, so I can easily invoke it in a single keystroke.
As you can see below, the implementation of this function was made possible by some of the excellent Verilog-mode functions.
The text was updated successfully, but these errors were encountered: