ctags for systemverilog(vim用)

来源:互联网 发布:怎么做网络推广赚钱 编辑:程序博客网 时间:2024/04/30 16:59

我们知道 vim+ctags 是编程时很常用的组合工具,但是原本的 ctags 似乎沒有 systemverilog 的支持,

不过我在网上找到国外高手写的systemverilog for ctags的语法支持文件。

通常我们需要以下几步简单设置就可以在sv文件中,调用tags的强大功能了。

1.ctags的用户配置通常保存在用户根目录下的.ctags里(~/.catgs)。

将附件下载于用户根目录下,重命名为.ctags。

2.针对工作目录生成的tags文件。

ctags -Re /project/root/dir 

3.对vim配置文件进行简单配置,加入ctags需要搜索的文件(~/.vimrc)。

set tags= ./tags, tags
set tags+=/project/root/dir/TAGS

如果需要针对uvm源码生成tags文件,那么就在uvm/src目录下执行第2部命令即可。

然后在加入到.vimrc的配置中。

.ctags文件如下:

--exclude=.SOS
--exclude=.git
--exclude=nobackup
--exclude=nobkp
--exclude=results
--exclude=*.log

--langdef=SystemVerilog
--langmap=SystemVerilog:.sv.v.svh.tv.vg.vinc

--regex-SystemVerilog=/^\s*(\b(static|local|virtual|protected)\b)*\s*\bclass\b\s*(\b\w+\b)/\3/c,class/
--regex-SystemVerilog=/^\s*(\b(static|local|virtual|protected)\b)*\s*\btask\b\s*(\b(static|automatic)\b)*\s*(\w+::)*\s*(\b\w+\b)/\6/t,task/
--regex-SystemVerilog=/^\s*(\b(static|local|virtual|protected)\b)*\s*\bfunction\b\s*(\b(\w+)\b)*\s*(\w+::)*\s*(\b\w+\b)/\6/f,function/

--regex-systemverilog=/^\s*clocking\s+(\w+)/\1/e,clocking/
--regex-systemverilog=/^\s*constraint\s+(\w+)/\1/i,constraint/
--regex-systemverilog=/^\s*covergroup\s+(\w+)/\1/l,covergroup/
--regex-SystemVerilog=/^\s*\bmodule\b\s*(\b\w+\b)/\1/m,module/
--regex-SystemVerilog=/^\s*\bprogram\b\s*(\b\w+\b)/\1/p,program/
--regex-SystemVerilog=/^\s*\binterface\b\s*(\b\w+\b)/\1/i,interface/
--regex-SystemVerilog=/^\s*\btypedef\b\s+.*\s+(\b\w+\b)\s*;/\1/e,typedef/
--regex-SystemVerilog=/^\s*`define\b\s*(\w+)/`\1/d,define/
--regex-SystemVerilog=/}\s*(\b\w+\b)\s*;/\1/e,typedef/

--regex-SystemVerilog=/^\s*(\b(static|local|private|rand)\b)*\s*(\b(shortint|int|longint)\b)\s*(\bunsigned\b)?(\s*\[.+\])*\s*(\b\w+\b)/\7/v,variable/
--regex-SystemVerilog=/^\s*(\b(static|local|private|rand)\b)*\s*(\b(byte|bit|logic|reg|integer|time)\b)(\s*\[.+\])*\s*(\b\w+\b)/\6/v,variable/
--regex-SystemVerilog=/^\s*(\b(static|local|private)\b)*\s*(\b(real|shortreal|chandle|string|event)\b)(\s*\[.+\])*\s*(\b\w+\b)/\6/v,variable/
--regex-SystemVerilog=/(\b(input|output|inout)\b)?\s*(\[.+\])*\s*(\b(wire|reg|logic)\b)\s*(\[.+\])*\s*(#(\(.+\)|\S+)\))?\s*(\b\w+\b)/\9/v,variable/
--regex-SystemVerilog=/(\b(parameter|localparam)\b).+(\b\w+\b)\s*=/\3/a,parameter/

--SystemVerilog-kinds=+ctfmpied

0 0
原创粉丝点击