← ProblemsVerilog Language / More Verilog Features
100-bit ripple-carry adder
15%loops-generatearithmeticBuild a 100-bit ripple-carry adder by chaining together 100 full adders, instantiated with a generate for loop (or an array of instances). The adder adds a, b, and cin to produce sum.
Unlike a behavioral a + b + cin, this problem also exposes the internal carry chain: output all 100 carry-outs, where cout[i] is the carry-out of full adder i. So cout[0] is the carry from bit 0 into bit 1, and cout[99] is the usual final carry-out of the whole addition.
Each full adder computes {carry_out, s} = a + b + carry_in for one bit; full adder 0 takes cin, and full adder i takes cout[i-1].