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

沒有留言:

張貼留言

作業2 MQTT (Relay + DHT22) 控制 ------- 利用Node-Red

作業2 MQTT (Relay + DHT22) 控制 ------- 利用Node-Red 1) 安裝Node-Red  https://ithelp.ithome.com.tw/articles/10201795 https://www.youtube.com/watch?v...