2019年12月26日 星期四

Verilog HDL XNOR P73

Verilog HDL XNOR P73







module xnor_p73(A, B, O);

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

wire i1,i2,i3,i4;

not (i1, A);
not (i2, B);

and (i3,A,B);
and (i4,i1,i2);
or (O,i3,i4);


endmodule



// 時間單位 1ns, 時間精確度1 ps
`timescale 1ns/1ps
module Test_bench;
reg tA = 1'b0;  // A 暫存器資料初值為‘0’
reg tB = 1'b0;  // B 暫存器資料初值為‘0’
wire t_O;

xnor_p73 DUT(.A(tA),.B(tB),.O(t_O));
// 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...