verible (verible-verilog-format)

请添加图片描述

Verible 是一套 SystemVerilog / verilog 开发工具,包括解析器、样式检查器、格式化程序和语言服务器。这里为主要分享关于格式化工具verible-verilog-format的使用。用来格式化verilog代码,实现代码风格统一。
python3 format_verilog.py -i filelist.f

import os
import argparse

# if you want to modify the format parameter, you can change it below.
# the details of parameter reference: https://chipsalliance.github.io/verible/verilog_format.html
format_parameter = '--column_limit=200 --indentation_spaces=2'

parser = argparse.ArgumentParser(description='format verilog by verible')
parser.add_argument('--input', '-i', help='input filelist(.f) file', required=True)
args = parser.parse_args()

with open(args.input, mode="r") as filelist:
    filepaths = filelist.readlines()
    for filepath in filepaths:
        if(filepath):
            # print("./verible-verilog-format --inplace {0} {1}".format(format_parameter,filepath))
            os.popen("./verible-verilog-format --inplace {0} {1}".format(format_parameter,filepath))
                               
filelist.close()
print("format verilog done")

verible 项目托管于github,项目地址:https://github.com/chipsalliance/verible

重要 option --inplace --wrap_end_else_clauses
也有vscode插件

--column_limit=300 --indentation_spaces=2 --assignment_statement_alignment=align --named_port_alignment=align - -port_declarations_alignment=align --module_net_variable_alignment=align

https://www.youtube.com/watch?v=xLxNHBzmGiI

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

  • 12
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值