2019年12月27日 星期五

verilog 範例 4-6布林代數 f= (a+b+c) (a'+b'+c)(a'+c)

Verilog 範例 4-6 布林代數 f= (a+b+c) (a'+b'+c)(a'+c)






//verilog operator
//Operator Type
// & And
// ~& Nand
// | Or
// ~| Nor
// ^ Xor
// ~^ Xnor

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

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

always@(A or B or C)
begin
F = (A|B|C) & (~A|~B | C) & (~A | C);
end

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;

EX4_6_p111  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;   // 模擬終止時間  200 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...