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

沒有留言:

張貼留言

作業2 MQTT (Relay + DHT22) 控制 ------- 利用Node-Red

作業2 MQTT (Relay + DHT22) 控制 ------- 利用Node-Red 1) 安裝Node-Red  https://ithelp.ithome.com.tw/articles/10201795 https://www.youtube.com/watch?v...