2019年12月26日 星期四

P85_Boolean ch4 範例4-1 F=ab +ac +abc

P85_Boolean ch4 範例4-1 F=ab +ac +abc 






module CH4_EX4_1_P97(A,B,C, F);

input  A,B,C ; // A, B  1位元輸入
output F ;     // Output    1位元輸出

wire w1,w2,w3;

and (w1,A,B);
and (w2,A,C);
and (w3,A,B,C);
or(F,w3,w2,w1);

endmodule



// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps
module Test_bench;
reg t_A = 1'b0;   //  暫存器資料初值為‘0’
reg t_B = 1'b0;   //  暫存器資料初值為‘0’
reg t_C = 1'b0;   //  暫存器資料初值為‘0’

wire t_F;

integer i;

CH4_EX4_1_P97 DUT(.A(t_A), .B(t_B), .C(t_C), .F(t_F));
// initial程序結構區塊, 產生A、B輸入信號波形
initial begin
    $monitor(t_A,t_B,t_C,t_F);
    for (i=0; i<8; i=i+1) begin
        {t_A,t_B,t_C} = i;
        #20;
    end
end

initial
begin
  #160;   // 模擬終止時間  400 ns
    $stop;
end


endmodule

沒有留言:

張貼留言

Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --3

  Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --3 AngularJS 實例 <!DOCTYPE html> <html> <head> <meta charse...