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



沒有留言:

張貼留言

2024產專班 作業2 (純模擬)

2024產專班 作業2  (純模擬) 1) LED ON,OFF,TIMER,FLASH 模擬 (switch 控制) 2)RFID卡號模擬 (buttom  模擬RFID UID(不從ESP32) Node-Red 程式 [{"id":"d8886...