VSCode怎么配置verilog环境?代码提示+自动例化+格式化插件分享

发布时间 - 2022-11-28 00:00:00    点击率:

vscode怎么配置verilog环境?下面本篇文章给大家推荐三个插件,让vscode流畅编写verilog,三个插件可实现代码提示+自动例化+格式化。

【推荐学习:vscode教程、编程视频】

Verilog-HDL/SystemVerilog/Bluespec SystemVerilog



可实现功能:

  • 语法高亮
  • 自动例化
  • 代码提示和跳转
  • 自动补全

插件配置

如Verilog HDL/SystemVerilog插件欢迎页的说明,支持Ctags功能:

配置步骤:

  • 下载最新版ctags,旧版的有些功能不够齐全;windows可选x64版本;

  • 将ctags.exe的路径设置到系统环境变量中;

  • 插件设置中配置ctags路径;

  • 重启VSCode即可;

 可以选择不同的编译器

 包括:

  • iverilog
  • xvlog(vivado)
  • modelsim

功能展示

支持verilog、SV等语法高亮。

shift+ctrl+p输入verilog,可以直接自动例化模块。

鼠标放在信号上,就会有声明显示在悬浮框中。Ctrl+左键,点击信号名,自动跳转到声明处。光标放在信号处,右键选择查看定义(快捷键可自行绑定),可以在此处展开声明处的代码,用于修改声明十分方便,就不用再来回跳转了。

Verilog_Testbench



可实现功能:

  • 自动生成testbench 

 shift+ctrl+p输入testbench,可以直接生成tb。然后在终端复制即可。

SystemVerilog and Verilog Formatter


这款工具由谷歌推出,同时支持Verilog和System Verilog,效果非常好,支持自定义的格式化参数也很丰富。个人认为比verilog format好用。

可实现功能

  • 自动格式化文件
  • 自动格式化选定内容
  • 自定义格式

自定义参数设置表

verible-verilog-format: usage: bazel-bin/verilog/tools/formatter/verible-verilog-format [options] [] To pipe from stdin, use '-' as .  Flags from common/formatting/basic_format_style_init.cc:     --column_limit (Target line length limit to stay under when formatting.);       default: 100;     --indentation_spaces (Each indentation level adds this many spaces.);       default: 2;     --line_break_penalty (Penalty added to solution for each introduced line       break.); default: 2;     --over_column_limit_penalty (For penalty minimization, this represents the       baseline penalty value of exceeding the column limit. Additional penalty       of 1 is incurred for each character over this limit); default: 100;     --wrap_spaces (Each wrap level adds this many spaces. This applies when the       first element after an open-group section is wrapped. Otherwise, the       indentation level is set to the column position of the open-group       operator.); default: 4;   Flags from external/com_google_absl/absl/flags/parse.cc:     --flagfile (comma-separated list of files to load flags from); default: ;     --fromenv (comma-separated list of flags to set from the environment [use       'export FLAGS_flag1=value']); default: ;     --tryfromenv (comma-separated list of flags to try to set from the       environment if present); default: ;     --undefok (comma-separated list of flag names that it is okay to specify on       the command line even if the program does not define a flag with that       name); default: ;   Flags from verilog/formatting/format_style_init.cc:     --assignment_statement_alignment (Format various assignments:       {align,flush-left,preserve,infer}); default: infer;     --case_items_alignment (Format case items:       {align,flush-left,preserve,infer}); default: infer;     --class_member_variable_alignment (Format class member variables:       {align,flush-left,preserve,infer}); default: infer;     --compact_indexing_and_selections (Use compact binary expressions inside       indexing / bit selection operators); default: true;     --distribution_items_alignment (Aligh distribution items:       {align,flush-left,preserve,infer}); default: infer;     --enum_assignment_statement_alignment (Format assignments with enums:       {align,flush-left,preserve,infer}); default: infer;     --expand_coverpoints (If true, always expand coverpoints.); default: false;     --formal_parameters_alignment (Format formal parameters:       {align,flush-left,preserve,infer}); default: infer;     --formal_parameters_indentation (Indent formal parameters: {indent,wrap});       default: wrap;     --module_net_variable_alignment (Format net/variable declarations:       {align,flush-left,preserve,infer}); default: infer;     --named_parameter_alignment (Format named actual parameters:       {align,flush-left,preserve,infer}); default: infer;     --named_parameter_indentation (Indent named parameter assignments:       {indent,wrap}); default: wrap;     --named_port_alignment (Format named port connections:       {align,flush-left,preserve,infer}); default: infer;     --named_port_indentation (Indent named port connections: {indent,wrap});       default: wrap;     --port_declarations_alignment (Format port declarations:       {align,flush-left,preserve,infer}); default: infer;     --port_declarations_indentation (Indent port declarations: {indent,wrap});       default: wrap;     --port_declarations_right_align_packed_dimensions (If true, packed       dimensions in contexts with enabled alignment are aligned to the right.);       default: false;     --port_declarations_right_align_unpacked_dimensions (If true, unpacked       dimensions in contexts with enabled alignment are aligned to the right.);       default: false;     --struct_union_members_alignment (Format struct/union members:       {align,flush-left,preserve,infer}); default: infer;     --try_wrap_long_lines (If true, let the formatter attempt to optimize line       wrapping decisions where wrapping is needed, else leave them unformatted.       This is a short-term measure to reduce risk-of-harm.); default: false;   Flags from verilog/parser/verilog_parser.cc:     --verilog_trace_parser (Trace verilog parser); default: false;   Flags from verilog/tools/formatter/verilog_format.cc:     --failsafe_success (If true, always exit with 0 status, even if there were       input errors or internal errors. In all error conditions, the original       text is always preserved. This is useful in deploying services where       fail-safe behaviors should be considered a success.); default: true;     --inplace (If true, overwrite the input file on successful conditions.);       default: false;     --lines (Specific lines to format, 1-based, comma-separated, inclusive N-M       ranges, N is short for N-N. By default, left unspecified, all lines are       enabled for formatting. (repeatable, cumulative)); default: ;     --max_search_states (Limits the number of search states explored during line       wrap optimization.); default: 100000;     --show_equally_optimal_wrappings (If true, print when multiple optimal       solutions are found (stderr), but continue to operate normally.);       default: false;     --show_inter_token_info (If true, along with show_token_partition_tree,       include inter-token information such as spacing and break penalties.);       default: false;     --show_largest_token_partitions (If > 0, print token partitioning and then       exit without formatting output.); default: 0;     --show_token_partition_tree (If true, print diagnostics after token       partitioning and then exit without formatting output.); default: false;     --stdin_name (When using '-' to read from stdin, this gives an alternate       name for diagnostic purposes. Otherwise this is ignored.);       default: "";     --verbose (Be more verbose.); default: false;     --verify_convergence (If true, and not incrementally formatting with       --lines, verify that re-formatting the formatted output yields no further       changes, i.e. formatting is convergent.); default: true;Try --helpfull to get a list of all flags or --help=substring shows help for flags which include specified substring in either in the name, or description or path.

插件配置

如果是windows,systemverilogFormatter.veribleBuild设置为win64

systemverilogFormatter.commandLineArguments可以自定义格式化参数,下面放上我自己用的参数,可以实现大部分常用代码段实现对齐。

--indentation_spaces=4 --named_port_alignment=align  --ort_declarations_alignment=align --module_net_variable_alignment=align

如何使用?如何格式化?

和vscode内置格式化一样,直接shift+ctrl+f就可以格式化文件,ctrl+k可以格式化选定内容。

值得注意的是,由于这个插件也是在完善中,还是存在部分问题的。

比如else不会换行。

比如,存在语法问题,或者不能识别语法的时候,格式化会使用不了。这里我将最后一个端口加上","就不能格式化了。

更多关于VSCode的相关知识,请访问:vscode基础教程!


# vscode  # print  # define  # if  # for  # format  # include  # try  # Error  # Token  # break  # continue  # union  # using  # class  # internal  # Length  # Struct  # operator  # number  # default  # this  # position  # column  # input  # windows  # 自定义  # 放在  # 可以直接  # 跳转  # 的是  # 是在  # 鼠标  # 右键  # 这款  # 也很 


相关栏目: 【 网站优化151355 】 【 网络推广146373 】 【 网络技术251813 】 【 AI营销90571


相关推荐: 微信小程序 配置文件详细介绍  个人摄影网站制作流程,摄影爱好者都去什么网站?  javascript读取文本节点方法小结  HTML5段落标签p和br怎么选_文本排版常用标签对比【解答】  Laravel定时任务怎么设置_Laravel Crontab调度器配置  JS弹性运动实现方法分析  在Oracle关闭情况下如何修改spfile的参数  Laravel队列由Redis驱动怎么配置_Laravel Redis队列使用教程  如何用狗爹虚拟主机快速搭建网站?  Laravel中的withCount方法怎么高效统计关联模型数量  夸克浏览器网页跳转延迟怎么办 夸克浏览器跳转优化  Laravel怎么实现观察者模式Observer_Laravel模型事件监听与解耦开发【指南】  谷歌Google入口永久地址_Google搜索引擎官网首页永久入口  Laravel如何使用软删除(Soft Deletes)功能_Eloquent软删除与数据恢复方法  Laravel怎么配置不同环境的数据库_Laravel本地测试与生产环境动态切换【方法】  Linux系统命令中screen命令详解  php打包exe后无法访问网络共享_共享权限设置方法【教程】  JavaScript如何实现路由_前端路由原理是什么  如何在服务器上三步完成建站并提升流量?  phpredis提高消息队列的实时性方法(推荐)  如何快速选择适合个人网站的云服务器配置?  Python3.6正式版新特性预览  javascript中的数组方法有哪些_如何利用数组方法简化数据处理  Laravel如何处理异常和错误?(Handler示例)  香港代理服务器配置指南:高匿IP选择、跨境加速与SEO优化技巧  北京网站制作公司哪家好一点,北京租房网站有哪些?  Win11怎么关闭透明效果_Windows11辅助功能视觉效果设置  html如何与html链接_实现多个HTML页面互相链接【互相】  香港服务器如何优化才能显著提升网站加载速度?  如何快速建站并高效导出源代码?  香港服务器部署网站为何提示未备案?  bootstrap日历插件datetimepicker使用方法  Win11搜索栏无法输入_解决Win11开始菜单搜索没反应问题【技巧】  php读取心率传感器数据怎么弄_php获取max30100的心率值【指南】  JavaScript数据类型有哪些_如何准确判断一个变量的类型  轻松掌握MySQL函数中的last_insert_id()  如何在宝塔面板中修改默认建站目录?  利用vue写todolist单页应用  Laravel怎么实现软删除SoftDeletes_Laravel模型回收站功能与数据恢复【步骤】  如何挑选最适合建站的高性能VPS主机?  Swift中switch语句区间和元组模式匹配  Laravel如何升级到最新版本?(升级指南和步骤)  Laravel如何集成第三方登录_Laravel Socialite实现微信QQ微博登录  Laravel如何使用Spatie Media Library_Laravel图片上传管理与缩略图生成【步骤】  iOS发送验证码倒计时应用  如何用虚拟主机快速搭建网站?详细步骤解析  Python数据仓库与ETL构建实战_Airflow调度流程详解  Laravel API资源类怎么用_Laravel API Resource数据转换  如何在企业微信快速生成手机电脑官网?  网站图片在线制作软件,怎么在图片上做链接?