Verilog Code For Serial Adder Verilog

Verilog Code For Serial Adder Verilog

// This module generates an N-bit adder module adder(co, sum, a0, a1, ci); // Parameter Declaration. Matki Shower Installation Instructions. This can be redefined parameter N = 4; // 4-bit bus by default // Port declarations output [N-1:0] sum; output co; input [N-1:0] a0, a1; input ci; // Instantiate the appropriate adder based on the width of the bus. // This is based on parameter N that can be redefined at // instantiation time. Generate case (N) //Special cases for 1 and 2 bit adders 1: adder_1bit adder1(c0, sum, a0, a1, ci); //1-bit implementation 2: adder_2bit adder2(c0, sum, a0, a1, ci); //2-bit implementation // Default is N-bit carry look ahead adder default: adder_cla #(N) adder3(c0, sum, a0, a1, ci); endcase endgenerate //end of the generate block endmodule.