2020年4月12日 星期日

1-bit half adder (Dataflow level)

1-bit half adder (Dataflow level)



//===============================
//1-bit half adder (Dataflow level)
//filename : half_add.v
//===============================
module half_add(a,b,s,cout);

input  a, b;
output s, cout;     // sum and carry out


assign s = a^ b;
assign cout = a & b;

endmodule


// 時間單位 100ns, 時間精確度100 ps
`timescale 100ns/100ps 
module TB;
/*
module half_add(a,b,s,cout);
input  a, b;
output s, cout;     // sum and carry out
*/
reg a,b;
wire s, cout;

integer i;
 
half_add UUT(a,b,s,cout);
 
initial begin  
   for ( i=0;i<=3;i=i+1) 
        begin
           {a,b}  = i;
            #10;
        end
end
endmodule

沒有留言:

張貼留言

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

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