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


沒有留言:

張貼留言

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

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