2021年4月5日 星期一

使用Quartus-II 9.1SP2 + ModelSim 6.5b-Aletra + Altera DE2-115 FPGA開發平台,設計SR Latch (gated)為例(Test Bench開發平台)

使用Quartus-II 9.1SP2 + ModelSim 6.5b-Aletra + Altera DE2-115 FPGA開發平台,設計SR Latch (gated)為例(Test Bench開發平台)






//sr_latch_gated

module sr_latch_gated(Q, Qn, G, S, R);
   output Q;
   output Qn;
   input  G;   
   input  S;
   input  R;
   wire   S1;
   wire   R1;
   
   and(S1, G, S);
   and(R1, G, R);   
   nor(Qn, S1, Q);
   nor(Q, R1, Qn);
endmodule
`timescale 1us/10ps
module tb_sr_latch_gated;
reg tS;
reg tR;
reg tG;
wire tQ, tQn;
//module sr_latch_gated(Q, Qn, G, S, R);
sr_latch_gated  DUT(tQ, tQn, tG, tS, tR);
//instantiate counter to be tested.
initial
begin
    #5  tG=0;
#10 tS=1'b1;tR=1'b0;
#20 tS=1'b0;tR=1'b1;
#30 tS=1'b1;tR=1'b0;
#40 tS=1'b0;tR=1'b0;
#45  tG=1;
#50 tS=1'b1;tR=1'b0;
#60 tS=1'b0;tR=1'b1;
#70 tS=1'b1;tR=1'b1;
#80 tS=1'b0;tR=1'b1;
#100 $stop;
end
endmodule

沒有留言:

張貼留言

ALOHA 協議的 RFID 標籤讀取模擬程式

  ALOHA 協議 的 RFID 標籤讀取模擬程式 模擬多個標籤同時向讀取器發送資料時發生的「碰撞」(Collision)。 Pure ALOHA 的基本原理是:標籤隨時發送資料,如果發生碰撞(多個標籤同時發送),則等待隨機時間後重試。 併發處理 (Threading) : ...