1. Verilog插件
之前都是在sublime中进行verilog的代码编写,因为在sublime当中的插件还是比较好使的。但是最近的在vscode里面可以画图什么的,实在是太香了,所以更改一下。这里需要记录几款插件。
1.1 verilog 语法高亮
Verilog-HDL/SystemVerilog/Bluespec SystemVerilog
这一个插件,可以来显示语法的高亮,同时还可以用来例化模块什么的,好用。
使用该插件可以直接生成例化模板,比较简单,使用方法也比较简单,从插件的说明那里就能看到,需要安装一个小的应用程序。
该插件需要到github上下载一个小程序,然后把程序添加到环境变量里面。
到它的release目录下,下载一个版本,然后解压,就可以。
然后把这个路径添加到环境变量里面。添加到环境变量里面,最好重启一下电脑,这样能够确保环境变量生效了。
这个小的应用程序安装好之后,就可以使用这个插件来生成例化模板了。
ctrl + shift + p
调出命令窗口,选择例化模块
这个插件会去选择选择一个需要例化的模块,然后选择需要例化的模块就可以了。
它会在光标所在的位置,生成刚刚选中的模块的例化模板
1.2 vscode 关联vivado
setting =》 Text Editor =》 custom editor
输入vscode的安装路径: D:/Program Files (x86)/Microsoft VS Code/Code.exe -g [file name]:[line number]
1.3 vscode 语法纠错
在之前使用sublime的时候,使用的是iverilog进行语法纠错。vscode支持几种不同语法纠错工具,这里可以直接使用vivado的语法纠错工具。参考这个博主的就可以了:vscode 语法检测。
首先把vivado的可执行文件的路径添加到环境变量里面。
然后在插件里面设置语法纠错工具。
1.4 关于模块例化和生成测试模板
模板例化和生成脚本可以安装两个插件。使用也比较简单,但是需要python支持,需要安装python,然后把环境变量添加进去。网上关于这两个插件介绍挺多的。确实好用,跟sublime一样好用。
参考: vscode 例化和测试模板。
1.5 代码片段
在写代码的时候,一些常用的代码和文件头什么的,可以通过使用代码片段的方式来进行添加,这个还在之前我使用sublime的时候,添加代码片段差不多。
添加一个代码片段,代码片段可以选择支持的语言什么的。
scope
字段后面是支持的语法,没有这个字段,那就是使用vscode的时候,所有文件都可以使用这个代码片段。
prefix
字段是代码片段的快捷方式,输入对应的代码,就可以添加代码片段了。
body
里面就是代码片段的具体内容了。代码片段的内容需要在 " "
两个引号里面,每一行都需要。
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"comment3": {
"scope": "verilog, systemverilog",
"prefix": "Zs3",
"body": [
"//----------------${1}------------------"
],"
"description": "comment3"
}
}
下面是一个文件头,每次输入FH1,就会在光标的位置添加一个文件头了。
{
// Place your global snippets here. Each snippet is defined under a snippet name and has a scope, prefix, body and
// description. Add comma separated ids of the languages where the snippet is applicable in the scope field. If scope
// is left empty or omitted, the snippet gets applied to all languages. The prefix is what is
// used to trigger the snippet and the body will be expanded and inserted. Possible variables are:
// $1, $2 for tab stops, $0 for the final cursor position, and ${1:label}, ${2:another} for placeholders.
// Placeholders with the same ids are connected.
// Example:
"My File Header": {
"prefix": "FH1",
"body": [
"// -----------------------------------------------------------------------------"
"// Copyright (c) 2014-2020 All rights reserved"
"// -----------------------------------------------------------------------------"
"// Author : WCC 1530604142@qq.com"
"// File : $TM_FILENAME_BASE"
"// Create : $CURRENT_YEAR-$CURRENT_MONTH-$CURRENT_DATE"
"// Revise : $CURRENT_YEAR-"
"// Editor : Vscode, tab size (4)"
"// Functions : "
"// "
"// -----------------------------------------------------------------------------"
],
"description": "My File Header"
}
}
会根据文件的名称,自动在文件头上添加文件的名字,然后还有创建时间什么的,完全是用户可以自己定义的哈。
2. 绘波形图插件
Waveform Render
这个插件可以在vscode中写一些代码,然后就可以生成对应的时序图了。
ctrl + k ctrl +d
可以将代码显示成时序图
ctrl + shit + p
然后选择toggle Live preview 可以打开和关闭实时预览。
在绘图的时候把实时预览打开,绘制完毕之后,把实时预览关闭。
在设置绘制时序波形的时候,需要创建一个json文件,打开文件后就可以输入代码进行波形图的绘制了。显示这里的json文件的时候,用java语法显示,显示的语法比较好看,不会提示过多的错误。
点击上面这个图中的地方,换成java语法就好了。
3. 绘图插件
这个可以来画点流程图,结构图什么的,方便。绘制图形的时候,先创建一个后缀名为 .drawio
的文件,然后用vscode打开,就可以进行图形的绘制了。