2020年3月1日 星期日

EX6-3.1 Half Adder circuit

EX6-3.1 Half Adder circuit

// ex6-3 Half Adder circuit 

module EX10_10( A,B,Cout ,Sum);

input  A,B; // 1位元輸入

output  reg Cout , Sum  ; // Output    1位元輸出

always@ ( A,B) begin

{Cout,Sum}= A+B;
end
endmodule


// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps     
module Test_bench;
    // Inputs
    reg A,B;

    // Outputs
    wire Cout , Sum ;

    // Instantiate the Unit Under Test (UUT)
    // ex6-3 Half Adder circuit 
     EX10_10  UUT (
        .A(A), 
        .B(B), 
        .Cout(Cout), 
        .Sum(Sum)
    );

    initial begin
        $monitor( A,B,Cout ,Sum);
        //Apply inputs
A=1'b0; B=1'b0;  
        #100;
{A,B}=2'b01;
        #100;
{A,B}=2'b10;
        #100;
{A,B}=2'b11;
        #100;
   
    end
    initial begin
#500  $stop;
end
endmodule

沒有留言:

張貼留言

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

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