-
-
Notifications
You must be signed in to change notification settings - Fork 9
Xref
First make sure that xref has been included in verilog-ext-feature-list before running verilog-ext-mode-setup.
Next select which backend you want to use for tags collection: builtin or tree-sitter if available.
(setq verilog-ext-tags-backend 'tree-sitter)Set the variable verilog-ext-project-alist:
(setq verilog-ext-project-alist
`(("ucontroller"
:root "/home/gonz/Repos/larumbe/ucontroller"
:files ("src/pkg/global_pkg.sv"
"src/alu/rtl/alu.sv"
"src/misc/rtl/bin2bcd.sv"
"src/cpu/rtl/cpu.sv"
"src/dma/rtl/dma.sv"
"src/dma/rtl/dma_arbiter.sv"
"src/dma/rtl/dma_rx.sv"
"src/dma/rtl/dma_tx.sv"
"src/uart/rtl/fifo_wrapper.sv"
"src/ram/rtl/gp_ram.sv"
"src/ram/rtl/ram.sv"
"src/top/rtl/ram_arbiter.sv"
"src/ram/rtl/regs_ram.sv"
"src/uart/rtl/sreg.sv"
"src/uart/rtl/uart.sv"
"src/uart/rtl/uart_rx.sv"
"src/uart/rtl/uart_tx.sv"
"src/top/rtl/ucontroller.sv"
"src/uart/tb/fifo_generator_0_sim_netlist.v"
"src/top/tb/tb_clocks.sv"
"src/top/tb/tb_program.sv"
"src/top/tb/tb_top.sv"
"src/dma/tb/tb_dma.sv"
"src/alu/tb/tb_alu.sv"
"src/misc/tb/tb_bin2bcd.sv"
"src/cpu/tb/tb_cpu.sv"
"src/ram/tb/tb_ram.sv"
"src/uart/tb/tb_uart.sv")
:ignore-files ("src/uart/tb/fifo_generator_0_sim_netlist.v")
:compile-cmd "make tb_top" ; command used to compile current project
;; `vhier' related properties
:command-file nil ; vhier command file
:lib-search-path nil))) ; list of dirs to look for include directories or librariesNext visit one of the project files and gather tags through one of these commands:
M-x verilog-ext-tags-get RETM-x verilog-ext-tags-get-async RET
A tag database will be created and cached for future sessions.
Finally, run xref-find-definitions or xref-find-references on the tag at point.
Pros:
- Easy to setup
- No need for external applications
- Supports references (at the time of writing no LSP server supported them)
Cons:
- Slow for large projects with many files
- Less accurate than other backends
The builtin xref backend uses internal Emacs lisp parser engine to search for definitions
and references and might not be completely accurate. For example, definitions of multiple variables
in one line are not supported and therefore will not be found.
These cons can be solved by using the much faster and accurate tree-sitter backend instead of builtin.
If you need something readily available and more reliable consider alternatives from next section.
- Configuring LSP (see link)
- Configuring global and
ggtags-mode- Requires installation of
global,ctags(for definitions) andpython/pygments(for references).# For Ubuntu/Debian systems sudo apt-get install global universal-ctags python3-pygments - Find complete installation and configuration information here
- Requires installation of