2019年12月30日 星期一

Verilog SR latch

Verilog SR latch




module RS_Latch(
    input S,
    input R,
    output Q,
    output Qn
    );

wire Q_int, Qn_int;

assign Q_int = ~(S & Qn_int);
assign Qn_int = ~(R & Q_int);
assign Q = Q_int;
assign Qn = Qn_int;

endmodule


// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps
module Test_bench;
    reg  S,R;
    wire Q,Qn;

RS_Latch  DUT(
.S(S),
.R(R),
.Q(Q),
.Qn(Qn) );
    
initial begin
    
    $monitor(S,R,Q,Qn);
    // Initialize Inputs
    S = 0;
    R = 1;
     
    // Add stimulus here
    #100 S = 0;
    #100 S = 1;
    #100 R = 0;
    #100 R = 1;
    #100 S = 0;
         R = 0;
    #100 S = 1;
         R = 1;
    #100 S = 0;
         R = 0;
    #100 ;  $stop;
end
endmodule



沒有留言:

張貼留言

邊緣快篩與生成式 AI 智慧環境哨兵(Edge-Cloud AI EnvSentinel)

邊緣快篩與生成式 AI 智慧環境哨兵(Edge-Cloud AI EnvSentinel) 這套系統結合了 Wokwi ESP32 遙測 、 MQTT 傳輸 、 本地 LightGBM 異常快篩 、 SQLite 歷史存檔 、 Gemini 生成式 AI 診斷 與 Telegr...