First make sure that hierarchy
has been included in vhdl-ext-feature-list
before running vhdl-ext-mode-setup
.
vhdl-ext
supports three different backends to extract the hierarchy (builtin
, tree-sitter
and ghdl
) and two different frontends to display it (hierarchy.el
and outline
).
By default the tree-sitter
backend will be chosen if available. Otherwise it will fall back on the builtin
backend. The hierarchy.el
frontend will be always the default.
Example usage:
First setup the variable vhdl-ext-project-alist
:
(setq vhdl-ext-project-alist ("axi_if_converter" :root "/home/gonz/Repos/larumbe/axi_if_converter" :files ("src/top/rtl/global_pkg.vhd" "src/misc/clk_div.vhd" "src/misc/clk_sync.vhd" "src/pattern_counter/rtl/pattern_counter.vhd" "src/input_buffer/rtl/input_buffer_pkg.vhd" "src/input_buffer/rtl/input_buffer.vhd" "src/core_fsm/rtl/core_fsm.vhd" "src/axi_lite_regs/rtl/axi_lite_regs.vhd" "src/axi_lite_master/rtl/axi_lite_master.vhd" "src/core_conv/rtl/core_converter.vhd" "src/top/rtl/axi_if_converter.vhd") ;; The ones below are used for GHDL-related features :worklib "xil_defaultlib" ; Defaults to `work' if not set :workdir "library/xil_defaultlib" ; Output compilation directory for worklib :lib-search-path ("/opt/ghdl_Xilinx_lib/"))) ; Extra directories to look for compiled libraries
Second, analyze the hierarchy of your project visiting top file entity buffer and running one of these two commands:
M-x vhdl-ext-hierarchy-parse RET
M-x vhdl-ext-hierarchy-parse-async RET
And finally extract it by running:
vhdl-ext-hierarchy-current-buffer
Uses internal Emacs Lisp VHDL parser to generate a database of current project entities to extract the hierarchy.
To configure it:
(setq vhdl-ext-hierarchy-backend 'builtin)
It is also needed to set the variable vhdl-ext-project-alist
for file parsing and analyze project entities through one of these commands:
M-x vhdl-ext-hierarchy-parse RET
M-x vhdl-ext-hierarchy-parse-async RET
A hierarchy database will be created and cached so that it is kept for future sessions.
Pros:
Cons:
Uses Tree-sitter parser to generate a database of current project in vhdl-ext-project-alist
to extract the hierarchy.
Pros:
builtin
Cons:
tree-sitter
(setq vhdl-ext-hierarchy-backend 'tree-sitter)
GHDL is the open-source analyzer, compiler, simulator and (experimental) synthesizer for VHDL. It can be used to elaborate the design and extract the hierarchy.
GHDL 4.0.0 or higher is required. It is recommended to download a precompiled image or installing from sources: https://github.com/ghdl/ghdl#getting-ghdl
Using package managers is another alternative but beware that these might provide older versions that will not work.
sudo apt-get install ghdl ghdl --version
Pros:
Cons:
To configure it explicitly:
(setq vhdl-ext-hierarchy-backend 'ghdl)
GHDL backend requires the sources in the alist vhdl-ext-project-alist
to be in order, as they are passed as command line arguments to the GHDL process.
vhdl-ext
will automatically detect which project of vhdl-ext-project-alist
your current buffer belongs to and will extract the hierarchy for the buffer entity. If there are any compilation errors these will be shown in the buffer *ghdl-hier-errors*
.
Once it has been analyzed, hierarchy data will be cached and can be further used to instantly retrieve the hierarchy for entities down in the hierarchy.
For example, if you run vhdl-ext-hierarchy-current-buffer
on the top entity you will be able to get the hierarchy of any of the entities in the project. However, if you run the command for a subblock, the database will hold data for that subblock and not for the top entity of the project.
To force refreshing of the database simply run the command with the prefix arg:
vhdl-ext-hierarchy-current-buffer
RETThe hierarchy package is integrated into Emacs core since 28.1.
vhdl-ext
provides the major mode vhdl-ext-hierarchy-twidget-nav-mode
to navigate the hierarchy with the following keybindings:
widget-button-press
widget-forward
widget-forward
widget-forward
widget-backward
widget-backward
widget-backward
vhdl-ext-hierarchy-twidget-nav-open-other-window
vhdl-ext-hierarchy-twidget-nav-open-other-window
vhdl-ext-hierarchy-twidget-nav-open
The outline package brings the look and feel of Org Mode to other major modes.
vhdl-ext
provides the major mode vhdl-ext-hierarchy-outline-nav-mode
to navigate the hierarchy with the following keybindings:
outline-show-all
outline-show-children
outline-show-children
outline-nav-hide-sublevels
outline-show-branches
outline-hide-other
outline-nav-up-heading
outline-nav-up-heading
outline-nav-next-visible-heading
outline-nav-next-visible-heading
outline-nav-previous-visible-heading
outline-nav-previous-visible-heading
outline-nav-forward-same-level
outline-nav-backward-same-level
vhdl-ext-hierarchy-outline-jump-to-file-other-window
vhdl-ext-hierarchy-outline-jump-to-file-other-window
vhdl-ext-hierarchy-outline-jump-to-file
vhdl-ext-hierarchy-outline-jump-to-file
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4