HDL代码检查器
hdlcc的Python项目详细描述
HDL代码检查器
hdl代码检查器提供了一个python api,它使用hdl编译器来构建一个项目。 并返回可用于填充语法检查程序的信息。结果好坏参半 语言依赖和编译顺序,解释一些编译器消息 并提供一些(有限的)静态检查。
安装
pip install hdlcc
用法
hdl代码检查器服务器可以通过hdlcc
命令启动。使用hdlcc --help
有关如何使用它的更多信息。
$ hdlcc -h usage: hdlcc [-h][--host HOST][--port PORT][--lsp][--attach-to-pid ATTACH_TO_PID][--log-level LOG_LEVEL][--log-stream LOG_STREAM][--nocolor][--stdout STDOUT][--stderr STDERR][--version] optional arguments: -h, --help show this help message and exit --host HOST [HTTP] Host to serve --port PORT [HTTP] Port to serve --lsp Starts the server in LSP mode. Defaults to false --attach-to-pid ATTACH_TO_PID [HTTP, LSP] Stops the server if given PID is not active --log-level LOG_LEVEL [HTTP, LSP] Logging level --log-stream LOG_STREAM [HTTP, LSP] Log file, defaults to stdout when in HTTP or a temporary file named hdlcc_log_pid<PID>.log when in LSP mode --nocolor [HTTP, LSP] Enables colored logging (defaults to false) --stdout STDOUT [HTTP] File to redirect stdout to. Defaults to a temporary file named hdlcc_stdout_pid<PID>.log --stderr STDERR [HTTP] File to redirect stdout to. Defaults to a temporary file named hdlcc_stderr_pid<PID>.log --version, -V Prints hdlcc version and exit
第三方工具
HDL代码检查器支持
配置文件
HDL代码检查器需要一个配置文件,列出库、源文件, 生成标志等。
基本语法是
# This is a comment[builder=(msim|ghdl|xvhdl)]# This is being deprecated[ global_build_flags[(vhdl|verilog|systemverilog)]= <language specific flags> ]# Specifying sources(vhdl|verilog|systemverilog) <library name> <path/to/source> [file specific flags]
示例项目文件可以是:
# Specifying builder# HDL Code Checker will try to use ModelSim, GHDL and XVHDL in this order, so# only add this if you want to force to a particular onebuilder= msim global_build_flags[vhdl]= -rangecheck global_build_flags[verilog]= -lint global_build_flags[systemverilog]= -lint # Relative paths (relative to the project file if using HTTP mode or the project# root if using LSP mode) vhdl my_library foo.vhd -check_synthesis vhdl my_library foo_tb.vhd -2008 verilog my_library verilog/a_verilog_file.v -pedanticerrors # Absolute paths are handled as such systemverilog my_library /home/user/some_systemverilog_file.sv -pedanticerrors # Wildcards are supported vhdl my_library library/*.vhd vhdl my_library library/*/*.vhd
可以为每种语言或每个文件设置特定标志:
global_build_flags[vhdl] = <flags passed to the compiler when building VHDL files>
global_build_flags[verilog] = <flags passed to the compiler when building Verilog files>
global_build_flags[systemverilog] = <flags passed to the compiler when building SystemVerilog files>
未设置时,HDL代码检查器根据 正在使用的编译器:
- 型号sim
Compiler | ModelSim |
---|---|
VHDL | ^{ |
Verilog | ^{ |
SystemVerilog | ^{ |
- GHDL
Language | Flags |
---|---|
VHDL | ^{ |
Verilog | N/A |
SystemVerilog | N/A |
LSP服务器
hdl代码检查器支持Language Server Protocol。开始 在LSP模式下:
hdlcc --lsp
在Linux系统上,日志文件将位于/tmp/hdlcc_log_pid<PID_NUMBER>.log
,并且
/tmp/hdlcc_stderr_pid<PID_NUMBER>.log
。
http服务器
HDL代码检查器也可以在HTTP服务器模式下使用:
hdlcc
请注意,此模式不使用lsp进行通信。请求/响应 API尚不可用,但可以在 vim-hdl
测试
hdl代码检查器使用docker容器来运行测试。如果你愿意 运行它们,克隆此存储库,然后在根文件夹上运行
./run_tests.sh
用于测试的容器是suoto/hdlcc
支持的系统
System | CI | CI status |
---|---|---|
Linux | Yes | |
Windows | Yes |
编辑器支持
- 波形学:vim-hdl
样式检查
样式检查独立于第三方编译器。检查包括:
- 未使用的信号、常量、泛型、共享变量、库、类型和 属性
- 注释标记(
FIXME
,TODO
,XXX
)
注意,当前未使用的报告有一些警告,即声明
从
下面的示例中,信号rdy
不会被报告为未使用,尽管
事实上它没有被使用。
signalrdy,refclk,rst:std_logic;...idelay_ctrl_u:idelay_ctrlportmap(rdy=>open,refclk=>refclk,rst=>rst);
问题
您可以使用issue tracker来处理错误、功能请求等。
许可证
此软件是根据GPL v3 license授权的。
注意
Mentor Graphics®和ModelSim®及其各自的徽标是商标或注册商标 Mentor Graphics,Inc.的商标
英特尔及其徽标是英特尔公司的商标或注册商标。
Xilinx®及其徽标是Xilinx,Inc.的商标或注册商标。
HDL代码检查器的作者与 本软件提及或使用的商标。