HDL代码检查器

hdlcc的Python项目详细描述


HDL代码检查器

PyPI versionBuild StatusBuild statuscodecovCode ClimateJoin the chat at https://gitter.im/suoto/hdlccAnalytics

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
CompilerModelSim
VHDL^{}
Verilog^{}
SystemVerilog^{}
  • GHDL
LanguageFlags
VHDL^{}
VerilogN/A
SystemVerilogN/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

支持的系统

SystemCICI status
LinuxYesBuild Status
WindowsYesBuild status

编辑器支持


样式检查

样式检查独立于第三方编译器。检查包括:

  • 未使用的信号、常量、泛型、共享变量、库、类型和 属性
  • 注释标记(FIXMETODOXXX

注意,当前未使用的报告有一些警告,即声明 从 下面的示例中,信号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代码检查器的作者与 本软件提及或使用的商标。

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java JBPM:无法部署进程存档:null   java将一个数组拆分为两个大小相等的数组   java Spring boot验证该字段是否为string类型   JAVA JPA保存到TSV而不是SQL   java PMD报告超过X个违规   java是否支持springdatagremlin中的自定义查询?   java在“for”循环后使用变量   JPQL中默认查询中的java错误列   如何在java中实现不同于线程的进程?   java如何检查字符串是否平衡?   xml使用xalan扩展在XSL中处理java集合   java我试图使用子类/超类重写另一个类的值   转换为JSON时出现java堆栈溢出问题   java考虑定义一个类型为“COM”的bean。实例演示。在您的配置中命令$DefaultIO   java在kubernetes中如何检索转发端口的值?   JavaEclipse,动态web项目,向类路径添加另一个eclipse项目   eclipse的java Spring上下文XML验证器?   Linux下利用MATLAB(Windows)生成Java包   Java:在存储到DDC之前验证属性   java校验字符串