“ Verilog mode插件,提升verilog开发效率,让摸鱼变得顺理成章。”
对于数字IC开发者而言,使用最多的开发工具是vim/gvim,如何在繁琐的接口申明、信号申明、模块例化中获得解脱,实现自动化或者半自动化便成了不懈追求的目标。本文推荐的verilog mode插件。
1、Verilog mode概况
先简单看一下它的功能:
/*AUTOINPUT*/ 自动申明input
/*AUTOOUTPUT*/ 自动申明output
/*AUTOINOUT*/ 自动申明inout
/*AUTOWIRE*/ 自动申明wire
/*AUTOREG*/ 自动申明reg
/*AUTOSENSE*/ 自动填充敏感变量
/*AUTOINSTPARAM*/ 自动例化时进行参数申明及传递
/*AUTOINST*/ 自动例化
/*AUTOTIEOFF*/ 自动对位驱动output进行tie 0 赋值
如果感觉这些功能正好是你需要的,那请继续往下看。
2、Verilog mode安装
2.1、安装Emacs
安装Emcas就不在本文的介绍范围了。多说一句,安装最新版本最好。
2.2、下载verilog_mode.el
// 下载链接
https://github.com/veripool/verilog-mode
// 介绍文档
https://www.veripool.org/wiki/verilog-mode
在.vim目录下新建verilog_mode目录,将verilog-mode.el拷贝到 .vim/verilog_mode下。
2.3、下载verilog-emacsauto.vim
// 原版verilog-emacsauto.vim下载链接
// 原版verilog-emacsauto.vim只支持Linux,不支持Windows;
// 原版verilog-emacsauto.vim只支持verilog,不支持Systemverilog;
https://www.vim.org/scripts/script.php?script_id=1875
将verilog-emacsauto.vim 拷贝到 .vim/plugin目录下,并修改verilog-emacsauto.vim 中的指向verilog-mode.el 的路径为~/.vim/verilog_mode/verilog-mode.el(步骤2中的拷贝的路径)。(如下图,默认指向的路径是~/elisp/verilog-mode.el)。
2.4、测试verilog mode是否安装成功
在vim中输入如下测试RTL:
module io1_sub(/*AUTOARG*/);
/*AUTOINPUT*/
/*AUTOINOUT*/
/*AUTOOUTPUT*/
/* inst AUTO_TEMPLATE (
.lower_inb (1'b1),
)*/
instio instio (/*AUTOINST*/);
endmodule
module instio (/*AUTOARG*/);
input lower_ina;
inout lower_io;
output lower_out;
input sec_ina;
inout sec_io;
output sec_out;
wire lower_out = lower_ina | lower_io;
wire sec_out = sec_ina | sec_io;
endmodule
并且在命令模式下输入如下命令:
// 注意先保存文件,之后执行以下生成命令
:!emacs --batch
// 回车并load file即可自动生成代码
// 以下命令删除刚才自动生成代码
:!emacs --batch
如果io1_sub 模块instio 模块被例化成功,并且自动申明了输入输出,则表示插件安装成功。
除了上述直接在vim命令模式下通过命令生成的方法,还可以通过修改verilog-emacsauto.vim中的快捷键,通过快捷键快速生成和删除代码,如果快捷键冲突,可修改后的按键,Linux的
3、Verilog mode使用方法
//
https://www.veripool.org/verilog-mode/help/
Verilog mode使用方法请关注VX公众号,会分享一些有趣的IC知识。
精彩内容
发表评论