2019年12月26日 星期四

Verilog AND Gate

Verilog  AND Gate 


// Ch02 and_gate.v
// 二輸入及閘 (閘層描述)

module  and_gate (A, B, O);
input  A, B; // A, B 一位元輸入
output O; // O    一位元輸出

and (O, A, B);

endmodule



// Ch02 T.tfw
// 二輸入及閘 (測試平台程式)

// 時間單位 1ns, 時間精確度1 ps
`timescale 1ns/1ps

module T;
reg A = 1'b0; // A 暫存器資料初值為‘0’
reg B = 1'b0; // B 暫存器資料初值為‘0’
wire O;

// 建立and_gate 的模組例證

and_gate UUT (.A(A),.B(B),.O(O));

// initial程序結構區塊, 產生A、B輸入信號波形
initial
begin
  #100; // 100ns
    B = 1'b1; // “01”
  #100; // 200ns
    A = 1'b1; // “10”
    B = 1'b0;
  #100; // 300ns
    B = 1'b1; // “11”
  end

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

endmodule

沒有留言:

張貼留言

ISO/IEC DIS9789-2 標準中的「三步驟雙向加密認證(Three-Step Mutual Authentication)」

ISO/IEC DIS9789-2 標準中的「三步驟雙向加密認證(Three-Step Mutual Authentication)」 這是一個涉及到 資訊安全、射頻識別(RFID/NFC)高階安全認證 以及 圖形化使用者介面(GUI) 的整合實作。 在 ISO/IEC 的安...