2020年2月5日 星期三

數位IC設計入門-Verilog combinational logic 半加器 Gate Level Modeling(& Test Bench)

數位IC設計入門-Verilog combinational logic  半加器 Gate Level Modeling(& Test Bench)
QuartUS II 91sp2 需設定
















//Half Adder
//數位IC設計入門-Verilog combinational logic  半加器
module HA(a, b, sum, cy);
  input a, b;
  output sum, cy;

  assign sum = a ^ b;
  assign cy = a & b;

endmodule


// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps    
module Test_bench;
  //module Half_Adder(a, b, sum, cy);
  //input a, b;
  //output sum, carry;

// Inputs
reg a=0,b=0;

// Outputs
wire sum,cy;

// Instantiate the Unit Under Test (UUT)
//module Half_Adder(a, b, sum, cy);

HA UUT(a, b, sum, cy);

initial begin
 $monitor(a, b, sum, cy);
    // Initialize Inputs
 #25 a=1;b=0;
 #25 a=0;b=1;
 #25 a=1;b=1;
end

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


沒有留言:

張貼留言

  清除項目編譯快取 執行 flutter clean 重新取得套件依賴 執行 flutter pub get 完整重新編譯並執行 flutter run 1. 新增專案套件 (pubspec.yaml) 在 Flutter 專案根目錄下的 pubspec.yaml 中,新增 ...