VSG(VHDL Style Guide) 的使用方法

本文介绍了VHDL风格指南中常用的控制台指令,包括使用vsg进行代码检查、格式化,以及如何设置自定义配置和仅使用特定规则。详细解释了fix_only选项及规则文件的格式要求。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

常用控制台指令

1. 代码检查

  • 使用默认configuration检查文件中的代码格式
vsg -f [file_path]  
  • 使用自定义configuration检查代码格式
vsg -f [file_path] -c [configuration_path] 

2. 代码格式化

  • 使用默认configuration修复文件中的代码格式
vsg --fix [file_path] 
  • 使用自定义configuration中的rules修复文件中的代码格式,若configuration文件中的rules不全,缺少的rules使用默认rules
vsg --fix -f [file_path] -c [configuration_path] 

vsg --fix [configuration_path] -f [file_path] 

3. fix_only

  • 仅使用 fix_only_configuration_path 中的rules修复文件中的代码格式,fix_only_configuration_path 文件中未提及的rules不做处理。命令如下:
vsg --fix -f [file_path] --fix_only [fix_only_configuration_path] 

 vsg --fix --fix_only [fix_only_configuration_path] -f [file_path]
  • fix_only_configuration_path 仅仅指定了所使用的rule和需要格式化的行位置,无法自定义使用的rule的具体配置。在后面加上 configuration_path 就可以自定义rule的具体配置。命令如下:
vsg --fix --fix_only [fix_only_configuration_path] -f [file_path] -c [configuration_path]

注意:fix_only_configuration_path 文件有格式要求,必须按照该要求写js文件才能正常生效

来自 https://vhdl-style-guide.readthedocs.io/en/latest/tool_integration/generic.html

{
  "fix": {
     "rule": {
       "<rule_id>": [ <number> ]
     }
  }
}

< rule_id > 指定要用到的规则
< number > 指定对哪一行进行格式化,如果值为all,则代表对所有行格式化

参考官方使用文档:Overview — vhdl-style-guide 3.18.0 documentation
对多个文件批量处理看 Usage — vhdl-style-guide 3.18.0 documentation
VSG所使用的所有规则看Rules — vhdl-style-guide 3.18.0 documentation

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值