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