- Notifications
You must be signed in to change notification settings - Fork0
Repurposing existing HDL tools to help writing better code
License
fr89k/hdl_checker
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
HDL Checker is a language server that wraps VHDL/Verilg/SystemVerilog tools thataims to reduce the boilerplate code needed to set things up. It supportsLanguage Server Protocol or a custom HTTP interface; can infer libraryVHDL files likely belong to, besides working out mixed language dependencies,compilation order, interpreting some compilers messages and providing some(limited) static checks.
pip3 install hdl-checker --upgrade
or
pip3 install hdl-checker --user --upgrade
Note: Make sure you can runhdl_checker --version, especially if using PIPwith the--user option.
Install theHDL Checker VSCode client on VS Code.
Usingdense-analysis/ale
ALE supports HDL Checker out of the box.
Usingcoc.nvim
Followingcoc.nvim custom language server setup, addthis to yourcoc.nvim configuration file:
{"languageserver": {"hdlChecker": {"command":"hdl_checker","args": ["--lsp" ],"filetypes": ["vhdl","verilog","systemverilog" ] } }}This requiresnvim-lspconfig.
lua<<EOF-- Only define onceifnotrequire'lspconfig.configs'.hdl_checkerthenrequire'lspconfig.configs'.hdl_checker= {default_config= {cmd= {"hdl_checker","--lsp", };filetypes= {"vhdl","verilog","systemverilog"};root_dir=function(fname)-- will look for the .hdl_checker.config file in parent directory, a-- .git directory, or else use the current directory, in that order.localutil=require'lspconfig'.utilreturnutil.root_pattern('.hdl_checker.config')(fname)orutil.find_git_ancestor(fname)orutil.path.dirname(fname)end;settings= {}; }; }endrequire'lspconfig'.hdl_checker.setup{}EOF
Add HDL Checker to the server commands:
letg:LanguageClient_serverCommands= {\'vhdl': ['hdl_checker','--lsp'],\'verilog': ['hdl_checker','--lsp'],\'systemverilog': ['hdl_checker','--lsp'],\}
Please note that this will start one server per language
Usingemacs-lsp/lsp-mode
Add this to your Emacs config file
(require'use-package)(setq lsp-vhdl-server-path"~/.local/bin/hdl_checker"); only needed if hdl_checker is not already on the PATH(custom-set-variables '(lsp-vhdl-server'hdl-checker))(use-package lsp-mode:config (add-hook'vhdl-mode-hook'lsp))
HDL Checker server can be started viahdl_checker command. Usehdl_checker --help for more info on how to use it.
$ hdl_checker -husage: hdl_checker [-h] [--host HOST] [--port PORT] [--lsp] [--attach-to-pid ATTACH_TO_PID] [--log-level LOG_LEVEL] [--log-stream LOG_STREAM] [--stdout STDOUT] [--stderr STDERR] [--version]optional arguments: -h, --help show thishelp message andexit --host HOST [HTTP] Host to serve --port PORT [HTTP] Port to serve --lsp Starts the serverin LSP mode. Defaults tofalse --attach-to-pid ATTACH_TO_PID [HTTP, LSP] Stops the serverif given PID is not active --log-level LOG_LEVEL [HTTP, LSP] Logging level --log-stream LOG_STREAM [HTTP, LSP] Log file, defaults to stdout whenin HTTP or a temporary file named hdl_checker_log_pid<PID>.log whenin LSP mode --stdout STDOUT [HTTP] File to redirect stdout to. Defaults to a temporary file named hdl_checker_stdout_pid<PID>.log --stderr STDERR [HTTP] File to redirect stdout to. Defaults to a temporary file named hdl_checker_stderr_pid<PID>.log --version, -V Prints hdl_checker version andexit
HDL Checker supports
See theSetting up a new project section on the wiki.
HDL Checker has beta support forLanguage Server Protocol. To start in LSPmode:
hdl_checker --lsp
On a Linux system, log file will be at/tmp/hdl_checker_log_pid<PID_NUMBER>.logand/tmp/hdl_checker_stderr_pid<PID_NUMBER>.log.
As a language server, HDL Checker will provide
- Diagnostics
- Hover information
- Dependencies: will report which path and library have been assigned
- Design units: will report the compilation sequence and libraries
- Go to definition of dependencies
HDL Checker can be used in HTTP server mode also:
hdl_checker
Please note that this modedoes not use LSP over http to communicate.Request/response API is not yet available and is going to be deprecated in thefuture. A reference implementation can be found invim-hdl
HDL Checker uses adocker container to run tests. If you wish to runthem, clone this repository and on the root folder run
./run_tests.sh
The container used for testing issuoto/hdl_checker_test
| System | CI | CI status |
|---|---|---|
| Linux | Yes | |
| Windows | Yes |
Style checks are independent of a third-party compiler. Checking includes:
- Unused signals, constants, generics, shared variables, libraries, types andattributes
- Comment tags (
FIXME,TODO,XXX)
Notice that currently the unused reports has caveats, namely declarations withthe same name inherited from a component, function, procedure, etc. In thefollowing example, the signalrdy won't be reported as unused in spite of thefact it is not used.
signal rdy, refclk, rst :std_logic;...idelay_ctrl_u : idelay_ctrlportmap (rdy=>open, refclk=> refclk, rst=> rst);
You can use theissue tracker for bugs, feature request and soon.
This software is licensed under theGPL v3 license.
Mentor Graphics®, ModelSim® and their respective logos are trademarks orregistered trademarks of Mentor Graphics, Inc.
Intel® and its logo is a trademark or registered trademark of Intel Corporation.
Xilinx® and its logo is a trademark or registered trademark of Xilinx, Inc.
HDL Checker's author has no connection or affiliation to any of the trademarksmentioned or used by this software.
About
Repurposing existing HDL tools to help writing better code
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Releases
Packages0
Languages
- Python95.6%
- PowerShell1.8%
- VHDL1.0%
- Shell0.8%
- Dockerfile0.4%
- SystemVerilog0.2%
- Verilog0.2%