Verilog 2001 `default_nettype none


在Verilog 1995規定,對於沒宣告的信號會自動視為wire,這樣常常造成debug的困難,Verilog 2001另外定義了`default_nettype none,將不再自動產生wire.

1 module default_nettype_none (
2   input n0,
3   input n1,
4   output o1
5 );

7 assign ol = n0 & n1; // no error here, only warning

9 endmodule

因為打錯,而將o1打成ol,Quartus II並未抓出這個錯誤,竟然順利編譯成功,雖然有warning.

########################################################################

1 `default_nettype none

3 module default_nettype_none (
4   input n0,
5   input n1,
6   output o1
7 );

9 assign ol = n0 & n1; // compiler error here
10 
11 endmodule

第1行加了`default_nettype none,這是Verilog 2001新增的compiler directive,避免Verilog將未宣告的信號視為wire.

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM