Verilog規(guī)范告訴我們:negedge 事件指的是如表43所示的跳變,發(fā)生negedge事件時(shí)才會(huì)執(zhí)行操作。那么0時(shí)刻,是如何執(zhí)行操作的呢?
鴿子在Verilog標(biāo)準(zhǔn)中并沒有找到0時(shí)刻賦值明確的說明。如下代碼中,0時(shí)刻,rst_n為0,clk 處于低電平,那么cfg_mode的數(shù)值是多少呢?
always@(posedgeclkornegedgerst_n) if (!rst_n) begin cfg_mode <= 1'b0; end else begin cfg_mode <= cfg_mode_in ; end
實(shí)際電路中:
在芯片上電之前,芯片的chip_reset一直處于復(fù)位狀態(tài),因此導(dǎo)致芯片內(nèi)部的rst_n一直為0,且芯片內(nèi)部PLL還沒有工作,也沒有產(chǎn)生clk,此時(shí)沒有任何信號(hào)的跳變,即clk沒有跳變,rst_n一直為0也沒有跳變。在實(shí)際電路中,從D觸發(fā)器的結(jié)構(gòu)圖可以看到,當(dāng)復(fù)位R一直是1時(shí),即使時(shí)鐘信號(hào)不跳變,Q端輸出也是0。
VCS在0時(shí)刻賦值
VCS 在0時(shí)刻會(huì)執(zhí)行一次always塊的賦值,而不是等到信號(hào)跳變。
module zero_time_test; reg rst_n; initial begin rst_n = 0; #20 rst_n = 1; end always@(posedge rst_n) begin: always_case1 $display("The always case1 executed @Time %f", $time()); end always@(negedge rst_n) begin: always_case2 $display("The always case2 executed @Time %f", $time()); end always@(rst_n) begin: always_case3 $display("The always case3 executed @Time %f", $time()); end endmodule

module zero_time_test; reg rst_n; initial begin rst_n = 1; #20 rst_n = 0; end always@(posedge rst_n) begin: always_case4 $display("The always case4 executed @Time %f", $time()); end always@(negedge rst_n) begin: always_case5 $display("The always case5 executed @Time %f", $time()); end always@(rst_n) begin: always_case6 $display("The always case6 executed @Time %f", $time()); end endmodule

審核編輯:劉清
-
寄存器
+關(guān)注
關(guān)注
31文章
5434瀏覽量
124514 -
D觸發(fā)器
+關(guān)注
關(guān)注
3文章
173瀏覽量
48767 -
CLK
+關(guān)注
關(guān)注
0文章
128瀏覽量
17614 -
PLL電路
+關(guān)注
關(guān)注
0文章
92瀏覽量
6813 -
Verilog語(yǔ)言
+關(guān)注
關(guān)注
0文章
113瀏覽量
8555
原文標(biāo)題:異步復(fù)位寄存器:0時(shí)刻賦值
文章出處:【微信號(hào):IP與SoC設(shè)計(jì),微信公眾號(hào):IP與SoC設(shè)計(jì)】歡迎添加關(guān)注!文章轉(zhuǎn)載請(qǐng)注明出處。
發(fā)布評(píng)論請(qǐng)先 登錄
常見的FPGA復(fù)位設(shè)計(jì)

寄存器reg延遲問題
簡(jiǎn)談同步復(fù)位和異步復(fù)位
AD5410使用菊花鏈工作方式時(shí),上電后如何進(jìn)行軟件復(fù)位和控制寄存器配置?
單片機(jī)如何給寄存器賦值呢
什么樣的寄存器不需要復(fù)位呢?哪些寄存器是CPU能夠訪問的
AD5410使用菊花鏈工作方式時(shí),上電后如何進(jìn)行軟件復(fù)位和控制寄存器配置?
寄存器尋址方式
如何進(jìn)行寄存器名稱和地址的映射分析

Cortex-M3 內(nèi)部寄存器

配置STM32寄存器控制GPIO點(diǎn)亮LED

評(píng)論