天天看點

alert table 關鍵字 table 附近有文法錯誤。_Verilog文法之五:辨別符與關鍵字

本文首發于微信公衆号“花螞蟻”,想要學習FPGA及Verilog的同學可以關注一下。

1 辨別符

辨別符是使用者在描述時給Verilog對象起的名字,比如例子中的子產品名huamayi,端口名字x、y、o,以及例化的基本門元件o1、n1、a1等。

辨別符必須以字母(a-z, A-Z)或( _ )開頭,後面可以是字母、數字、( $ )或( _ )

。如下圖中的紅字都是使用者定義的辨別符。

alert table 關鍵字 table 附近有文法錯誤。_Verilog文法之五:辨別符與關鍵字

2 關鍵字

在Verilog HDL中,所有的關鍵詞是事先定義好的确認符,用來組織語言結構。關鍵詞是用小寫字母定義的,是以在編寫原程式時要注意關鍵詞的書寫,以避免出錯。

下圖中的紅字就是一些關鍵字的例子。

alert table 關鍵字 table 附近有文法錯誤。_Verilog文法之五:辨別符與關鍵字
關鍵詞無需特意無記憶

,下面是Verilog HDL中使用的關鍵詞:

always, and, assign,begin,buf,bufif0,bufif1,case,casex,casez,cmos,deassign, default,defparam,disable,edge,else,end,endcase,endmodule,endfunction,endprimitive, endspecify, endtable, endtask, event, for, force, forever, fork, function,highz0, highz1, if,initial, inout, input,integer,join,large,macromodule,medium,module, nand,negedge,nmos,nor,not,notif0,notifl, or, output, parameter, pmos, posedge, primitive, pull0, pull1, pullup, pulldown, rcmos, reg, releses, repeat, mmos, rpmos, rtran, rtranif0,rtranif1,scalared,small,specify,specparam,strength,strong0, strong1, supply0, supply1, table, task, time, tran, tranif0, tranif1, tri, tri0, tri1, triand, trior, trireg,vectored,wait,wand,weak0,weak1,while, wire,wor, xnor, xor

注意在編寫Verilog HDL程式時,變量的定義不要與這些關鍵詞沖突。
本文首發于微信公衆号“花螞蟻”,想要學習FPGA及Verilog的同學可以關注一下。
alert table 關鍵字 table 附近有文法錯誤。_Verilog文法之五:辨別符與關鍵字