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

沒有留言:

張貼留言

2026 作業2 RFID+Node-Red+Python+SQLite 練習 (修正版 利用wokwi 內部元件)

2026 作業2  RFID+Node-Red+Python+SQLite 練習 (修正版  利用wokwi 內部元件) 使用 wokwi 上 的 元件    (原先尚未有) 硬體線路   不需要 自行建立元件   rfid-rc522.chip.json   rfid-rc52...