当前位置:网站首页>verilog-mode的简要介绍
verilog-mode的简要介绍
2022-06-12 12:43:00 【Alfred.HOO】
verilog-mode是什么
官网的介绍(https://www.veripool.org/wiki/verilog-mode):
Verilog-mode.el is the extremely popular free Verilog mode for Emacs which provides context-sensitive highlighting, auto indenting, and provides macro expansion capabilities to greatly reduce Verilog coding time. It supports AUTOs and indentation in Emacs for traditional Verilog (1394-2005), the Open Verification Methodology (OVM) and SystemVerilog (1800-2005/1800-2009).
Recent versions allow you to insert AUTOS in non-AUTO designs, so IP interconnect can be easily modified. You can also expand SystemVerilog “.*” port instantiations, to see what ports will be connected by the simulators.
简单点说就是支持Verilog、SystemVerilog(包括UVM)的emacs语法高亮文件。其中提到Verilog-mode支持Autos——这就是今天的重点。
Verilog-mode是由Michael McNamara [email protected]和Wilson Snyder [email protected]编写。难能可贵的是,这个verilog-mode保持着每月都有更新。
值得一提的是Wilson Snyder就是SystemVerilog开源仿真器Verilator的作者。
verilog-mode Autos有哪些功能
手动编写的verilog代码:
module example (/*AUTOARG*/);
input i;
output o;
/*AUTOINPUT*/
/*AUTOOUTPUT*/
/*AUTOREG*/
inst inst (/*AUTOINST*/);
always @ (/*AUTOSENSE*/) begin
o = i;
end
endmodule
由Autos处理后的Verilog代码:
module example (/*AUTOARG*/
// Outputs
lower_out, o,
// Inputs
lower_inb, lower_ina, i
);
input i;
output o;
/*AUTOINPUT*/
// Beginning of automatic inputs
input lower_ina; // To inst of inst.v
input lower_inb; // To inst of inst.v
// End of automatics
/*AUTOOUTPUT*/
// Beginning of automatic output
output lower_out; // From inst of inst.v
// End of automactics
/*AUTOREG*/
// Beginning of automatic regs
reg o;
// End of automatics
inst inst (/*AUTOINST*
// Outputs
.lower_out (lower_out),
// Inputs
.lower_inb (lower_inb),
.lower_ina (lower_ina));
always @ (/*AUTOSENSE*/i) begin
o = i;
end
大家可以看到,verilog-mode自动分析出:
模块的端口输入和输出
内部变量
敏感信号列表
提取子模块的端口定义
自动提取子模块的端口定义来连线是今天的重点中的重点。一般来讲,我们实例化模块时大部分的信号名与子模块定义的名字一致即可。如上面代码中的:
inst inst (/*AUTOINST*
// Outputs
.lower_out (lower_out),
// Inputs
.lower_inb (lower_inb),
.lower_ina (lower_ina));
特殊连接关系的处理
但常常我们顶层连接时会换一个名字。比如module A有一个输出端口dat_o,module B有一个输入端口dat_i,这两者怎么连?定义模版AUTO_TEMPLATE,如下:
手动编写的verilog:
/* A AUTO_TMEPLATE (
.dat_o (dat_a2b),
)
*/
A u_A (/*AUTOINST*/);
/* B AUTO_TEMPLATE (
.dat_i (dat_a2b),
)
*/
B u_B (/*AUTOINST*/);
由Autos处理后的verilog代码:
/* A AUTO_TMEPLATE (
.dat_o (dat_a2b),
)
*/
A u_A (/*AUTOINST*/
// Outputs
.dat_o (dat_a2b)); // Templated
/* B AUTO_TEMPLATE (
.dat_i (dat_a2b),
)
*/
B u_B (/*AUTOINST*/
// Inputs
.dat_i (dat_a2b)); // Templated
在哪里找子模块定义?
默认规则:
当前文件夹下找
当前找不到怎么办,指定搜索路径(与verilog仿真器的参数-y一样)
使用方法:在顶层endmodule后面指定verilog-library-directories,如下:
endmodule // top
// Local Variables:
// verilog-library-directories:("." "subdir" "subdirs")
// End:
除了写模版还需要做什么?
只需要Ctrl-C Ctrl-A,仅此而已。
如果修改了子模块或者模版,再按一次Ctrl-C Ctrl-A。
更多功能
verilog-auto-arg for AUTOARG module instantiations
verilog-auto-ascii-enum for AUTOASCIIENUM enumeration decoding
verilog-auto-assign-modport for AUTOASSIGNMODPORT assignment to/from modport
verilog-auto-inout for AUTOINOUT making hierarchy inouts
verilog-auto-inout-comp for AUTOINOUTCOMP copy complemented i/o
verilog-auto-inout-in for AUTOINOUTIN inputs for all i/o
verilog-auto-inout-modport for AUTOINOUTMODPORT i/o from an interface modport
verilog-auto-inout-module for AUTOINOUTMODULE copying i/o from elsewhere
verilog-auto-inout-param for AUTOINOUTPARAM copying params from elsewhere
verilog-auto-input for AUTOINPUT making hierarchy inputs
verilog-auto-insert-lisp for AUTOINSERTLISP insert code from lisp function
verilog-auto-insert-last for AUTOINSERTLAST insert code from lisp function
verilog-auto-inst for AUTOINST instantiation pins
verilog-auto-star for AUTOINST .* SystemVerilog pins
verilog-auto-inst-param for AUTOINSTPARAM instantiation params
verilog-auto-logic for AUTOLOGIC declaring logic signals
verilog-auto-output for AUTOOUTPUT making hierarchy outputs
verilog-auto-output-every for AUTOOUTPUTEVERY making all outputs
verilog-auto-reg for AUTOREG registers
verilog-auto-reg-input for AUTOREGINPUT instantiation registers
verilog-auto-reset for AUTORESET flop resets
verilog-auto-sense for AUTOSENSE or AS always sensitivity lists
verilog-auto-tieoff for AUTOTIEOFF output tieoffs
verilog-auto-undef for AUTOUNDEF \=`undef of local \=`defines
verilog-auto-unused for AUTOUNUSED unused inputs/inouts
verilog-auto-wire for AUTOWIRE instantiation wires
verilog-read-defines for reading \=`define values
verilog-read-includes for reading \=`includes
详见官网帮助文档:
https://www.veripool.org/projects/verilog-mode/wiki/Verilog-mode-Help
verilog-mode下载、安装
新版的GNU Emacs自带verilog-mode,如果需要最新的verilog-mode可以在官网下载:
https://www.veripool.org/projects/verilog-mode/wiki/Installing
VIM用户咋办?
可以用VIM调动shell命令执行(emacs批处理模式),例如::!emacs --batch <filenames.v> -f verilog-batch-auto
边栏推荐
- 时序数据库 - InfluxDB2 docker 安装
- Build an embedded system software development environment - build a cross compilation environment
- 嵌入式系统硬件构成-嵌入式系统硬件体系结构
- Safety KNN
- Pytorch官方Faster R-CNN源代码解析(一)——特征提取
- ITK 原图种子点经过roi、降采样后index的变化
- Binary tree (construction)
- 牛顿法解多项式的根
- 机械臂改进的DH参数与标准DH参数理论知识
- A "murder case" caused by ES setting operation
猜你喜欢

Attack and defense world re (New 1 hand zone) questions 1-12

Image comparison function after registration itk:: checkerboardimagefilter

itk itk::BSplineDeformableTransform

Known as the next generation monitoring system! See how awesome it is

Binary tree (program)

分享PDF高清版,系列篇

Help you with everything from the basics to the source code. Introduce the technology in detail
![[you code, I fix] whitesource was officially renamed mend](/img/0f/75ac1d0b08244ed689733d38551a61.jpg)
[you code, I fix] whitesource was officially renamed mend

深度学习的多个 loss 是如何平衡的?

时序数据库 - InfluxDB2 docker 安装
随机推荐
Uniapp wechat applet long press the identification QR code to jump to applet and personal wechat
三维坐标点拟合球(matlab and C )
[you code, I fix] whitesource was officially renamed mend
VTK image sequence mouse interactive flipping
深度剖析指针的进阶——C语言的进阶篇
Soft test network engineer notes
Microsoft Word tutorial, how to insert a header or footer in word?
A "murder case" caused by ES setting operation
MUI登录数据库完善与AJAX异步处理【MUI+Flask+MongoDB+HBuilderX】
Examples of Cartesian product and natural connection of relational algebra
什么时候运用二分搜索
构建嵌入式系统软件开发环境-建立交叉编译环境
Openmax (OMX) framework
嵌入式系统硬件构成-嵌入式系统硬件体系结构
安全KNN
itk itk::BSplineDeformableTransform
检测vector是否有交集
VTK three views
中科物栖CEO张磊:“芯片+OS”范式在万物互联时代的机遇与挑战|量子位·视点分享回顾...
wx. Login and wx Getuserprofile simultaneous use problem