如何在verilog模式下使用regexp删除I/O端口声明

use*_*102 6 emacs verilog

我正在尝试实例化abc_d模块,我不希望它的所有端口都被声明为abc顶层模块中的I/O端口.我想排除ex_out_port被声明为output端口.

module abc(/*AUTOARG*/);
/*AUTOINPUT*/
/*AUTOOUTPUT*/
/*AUTOWIRE*/
abc_d u_abc_d(/*AUTOINST*/);
endmodule
//Localvariables:
//verilog-auto-output-ignore-regexp:("ex_out_port")
//END:
Run Code Online (Sandbox Code Playgroud)

预期代码:

 module abc (/*AUTOARG*/
 /Inputs
 input port1;
 input port2;
 /Outputs
 output port3;
 output port4;
 /*AUTOWIRE*/
 wire ex_out_port;

 //Instance
 abc_d u_abc_d(/*AUTOINST*/
 .port1 (port1),
 .port2 (port2),
 .port3 (port3),
 .port4 (port4),
 .ex_out_port (ex_out_port)):
endmodule
Run Code Online (Sandbox Code Playgroud)

相关的已回答问题:

Gre*_*reg 2

你的verilog-auto-output-ignore-regexp有点偏离。它在删除“ex_out_port”周围的括号后起作用

//verilog-auto-output-ignore-regexp: "ex_out_port"
Run Code Online (Sandbox Code Playgroud)

我在文档或常见问题解答中找不到任何 gnore-regexp 代码示例。我确实在 veriloop 网站的论坛中找到了一个示例(verilog-mode 的所有者): https ://www.veripool.org/boards/15/topics/1635-Verilog-mode-Scope-for-AUTO_LISP-


仅供参考:除非您严格遵循 Verilog-1995 语法或运行过时版本的 verilog-mode,否则您可以考虑更改:

module abc(/*AUTOARG*/);
/*AUTOINPUT*/
/*AUTOOUTPUT*/
/*AUTOWIRE*/
Run Code Online (Sandbox Code Playgroud)

自 Verilog-2001 起支持的 ANSI 样式标头:

module abc(
/*AUTOINPUT*/
/*AUTOOUTPUT*/
);
/*AUTOWIRE*/
Run Code Online (Sandbox Code Playgroud)

它在功能和行为上相同,但生成的代码行更少。