W3Cschool
恭喜您成為首批注冊(cè)用戶
獲得88經(jīng)驗(yàn)值獎(jiǎng)勵(lì)
Verilog 是區(qū)分大小寫的。
格式自由,可以在一行內(nèi)編寫,也可跨多行編寫。
每個(gè)語句必須以分號(hào)為結(jié)束符。空白符(換行、制表、空格)都沒有實(shí)際的意義,在編譯階段可忽略。例如下面兩中編程方式都是等效的。
wire [1:0] results ;assign results = (a == 1'b0) ? 2'b01 : (b==1'b0) ? 2'b10 : 2'b11 ;
wire [1:0] results ;
assign results = (a == 1'b0) ? 2'b01 :
(b==1'b0) ? 2'b10 :
2'b11 ;
Verilog 中有 2 種注釋方式:
用 ?//
? 進(jìn)行單行注釋:
reg [3:0] counter ; // A definition of counter register
用 ?/*
? 與 ?*/
? 進(jìn)行跨行注釋:
wire [11:0] addr ;
/*
Next are notes with multiple lines.
Codes here cannot be compiled.
*/
assign addr = 12'b0 ;
標(biāo)識(shí)符(identifier)可以是任意一組字母、數(shù)字、?$
? 符號(hào)和 ?_
?(下劃線)符號(hào)的合,但標(biāo)識(shí)符的第一個(gè)字符必須是字母或者下劃線,不能以數(shù)字或者美元符開始。
另外,標(biāo)識(shí)符是區(qū)分大小寫的。
關(guān)鍵字是 Verilog 中預(yù)留的用于定義語言結(jié)構(gòu)的特殊標(biāo)識(shí)符。
Verilog 中關(guān)鍵字全部為小寫。
reg [3:0] counter ; //reg 為關(guān)鍵字, counter 為標(biāo)識(shí)符
input clk; //input 為關(guān)鍵字,clk 為標(biāo)識(shí)符
input CLK; //CLK 與 clk是 2 個(gè)不同的標(biāo)識(shí)符
Copyright©2021 w3cschool編程獅|閩ICP備15016281號(hào)-3|閩公網(wǎng)安備35020302033924號(hào)
違法和不良信息舉報(bào)電話:173-0602-2364|舉報(bào)郵箱:jubao@eeedong.com
掃描二維碼
下載編程獅App
編程獅公眾號(hào)
聯(lián)系方式:
更多建議: