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

沒有留言:

張貼留言

Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --3

  Node-Red Dashboard UI Template + AngularJS 參考 AngularJS教學 --3 AngularJS 實例 <!DOCTYPE html> <html> <head> <meta charse...