2012年11月9日 星期五

P6-10 "=" 區塊指定 "<=" 非區塊指定

P6-10 "=" 區塊指定 "<=" 非區塊指定


"=" 區塊指定 Blocking assignment 
..........................
..........................
always @ (posedge Clk)
   begin 
     Q1=W;
     Q2=Q1;
  end
endmoudle


 "<=" 非區塊指定 nonBlocking assignment 
..........................
..........................
always @ (posedge Clk)
   begin 
     Q1<=W;
     Q2<=Q1;
  end
endmoudle





區塊指定 Blocking assignment 

10 module d_latch2 (
11   input      rst_n,
12   input      en,
13   input      d,
14   output reg q
15 );
16 
17 always@(rst_n, en, d, q) begin
18   if (!rst_n) 

19    = 0;
20   else if (en)
21    = d;
22 end
23 
24 endmodule




非區塊指定 nonBlocking assignment 
10 module d_ff (
11   input      clk,
12   input      rst_n,
13   input      en,
14   input      d,
15   output reg q
16 );
17 
18 always@(posedge clk or negedge rst_n)

19   if (!rst_n)
20    <= 0;
21   else if (en)
22     <= d;
23     
24 endmodule

沒有留言:

張貼留言

ESP32 微控制器 採集的環境數據,經由 MQTT 協定 轉換並寫入工業標準的 Modbus 暫存器 中

  一個典型的 IoT(物聯網)與工業自動化系統整合(SCADA/機台連線) 的架構圖。它透過 Node-RED 作為核心資料網關,將前端 ESP32 微控制器 採集的環境數據,經由 MQTT 協定 轉換並寫入工業標準的 Modbus 暫存器 中。 1. 各模組功能拆解...