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

沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) 3) 使用database需先create建立資料庫 Node-Red 程式 [...