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

沒有留言:

張貼留言

1-out-of-4 脈衝位置編碼 (PPM)

1-out-of-4 脈衝位置編碼 (PPM)  1-out-of-4 脈衝位置編碼 (PPM) ,主要概念是將一個訊號週期(Symbol)等分成 4 個時段(Slots)。根據資料數值(0, 1, 2, 或 3),脈衝會出現在對應的時段中。 import tkinter as ...