The package vhdl-ts-mode
provides syntax highlighting,
indentation, imenu
, which-func
, navigation and basic beautify and completion features.
vhdl-ts-mode
is derived from vhdl-mode
making beautify and other utilities still available.
- Emacs 29.1+ with tree-sitter support
- VHDL tree-sitter grammar
Before installing/building Emacs make sure that tree-sitter is available:
- Ubuntu:
$ sudo apt-get install tree-sitter
- Arch:
$ sudo pacman -S tree-sitter
- Manually:
$ git clone https://github.com/tree-sitter/tree-sitter.git
$ cd tree-sitter
$ make && sudo make install
If Emacs has been built with tree-sitter support the following command should return t
:
(treesit-available-p)
vhdl-ts-mode
is available on MELPA.
To install it via straight with use-package
:
(straight-use-package 'use-package)
(use-package vhdl-ts-mode)
The package provides an interactive command to simplify the installation of the grammar:
M-x RET vhdl-ts-install-grammar RET
This command requires Git, a C compiler and (sometimes) a C++ compiler, and the linker to be installed and on the PATH.
To open VHDL files with vhdl-ts-mode
simply add this line to your init file:
(add-to-list 'auto-mode-alist '("\\.vhdl?\\'" . vhdl-ts-mode))
To change the faces default values there are two methods:
-
Via M-x
customize-group
RETvhdl-ts-faces
.- Customize faces and save configuration once you get the desired result
-
Through elisp code
- Below there is a snippet with a configuration example that works well with a dark background:
(set-face-attribute 'vhdl-ts-font-lock-then-face nil :foreground "dark olive green") (set-face-attribute 'vhdl-ts-font-lock-punctuation-face nil :foreground "burlywood") (set-face-attribute 'vhdl-ts-font-lock-operator-face nil :inherit 'vhdl-ts-font-lock-punctuation-face :weight 'extra-bold) (set-face-attribute 'vhdl-ts-font-lock-parenthesis-face nil :foreground "dark goldenrod") (set-face-attribute 'vhdl-ts-font-lock-brackets-content-face nil :foreground "yellow green") (set-face-attribute 'vhdl-ts-font-lock-port-connection-face nil :foreground "bisque2") (set-face-attribute 'vhdl-ts-font-lock-entity-face nil :foreground "green1") (set-face-attribute 'vhdl-ts-font-lock-instance-face nil :foreground "medium spring green") (set-face-attribute 'vhdl-ts-font-lock-instance-lib-face nil :foreground "gray70") (set-face-attribute 'vhdl-ts-font-lock-translate-off-face nil :background "gray20" :slant 'italic)
Contributions are welcome! Just stick to common Elisp conventions and run the ERT suite after testing your changes and before submitting a new PR.
For new functionality add new ERT tests if possible.
Consider sponsoring to help maintaining the project and for the development of new features. Thank you!
To run the whole ERT test suite change directory to the vhdl-ts-mode
root and make sure test-hdl
Git submodule has been loaded:
git submodule update --init
Then run the default target:
$ make
To run a subset of tests (e.g. navigation):
$ make TESTS=navigation
To regenerate all the expected outputs for the tests:
$ make gen
To regenerate the expected outputs for a group of tests (e.g. navigation):
$ make gen TESTS=navigation
- verilog-ts-mode: SystemVerilog Tree-sitter mode
- verilog-ext: SystemVerilog Extensions
- vhdl-ext: VHDL Extensions
- fpga: FPGA & ASIC Utilities for tools of major vendors and open source
- wavedrom-mode: edit and render WaveJSON files to create timing diagrams
- vunit-mode: Integration of VUnit workflow