2019年12月26日 星期四

Verilog AND_OR_NOT Gate

Verilog HDL AND_OR_NOT  Gate


























// 4 輸入 AND OR NOT

module and_or_not(A, B,f1_and,f1_or,f1_not);
input  A, B; // A, B 2位元輸入
output f1_and,f1_or,f1_not ; // Output    1位元輸出

and (f1_and, A, B);
or (f1_or, A, B);
not (f1_not, A);


endmodule


// 時間單位 1ns, 時間精確度1 ps
`timescale 1ns/1ps
module Test_bench;
reg tA = 1'b0;  // A 暫存器資料初值為‘0’
reg tB = 1'b0;  // B 暫存器資料初值為‘0’
wire t_f1_and,t_f1_or,t_f1_not;
//and_or_not
and_or_not DUT(.A(tA),.B(tB),.f1_and(t_f1_and),.f1_or(t_f1_or),.f1_not(t_f1_not));
// initial程序結構區塊, 產生A、B輸入信號波形
initial
begin
  #100;    // 100ns
    tB = 1'b1;    // “01”

  #100;    // 200ns
    tA = 1'b1;   // “10”
    tB = 1'b0;

  #100;    // 300ns
    tB = 1'b1;   // “11”

  end

initial
begin
  #400;   // 模擬終止時間  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...