n-bit adder

Design a circuit that performs the addition of two n-bit numbers. The
result must be represented in n bits also. The number of bits n must be
a parameter of the module.

Specification

    module adder (a, b, cin, sum, cout);
        parameter N=16;
        input [N-1:0] a, b;
        input cin;
        output [N-1:0] sum;
        output cout;

Hint

You may want to use several instances of a 1-bit full adder.

Input

- a and b are the two n-bit numbers.

- cin is the input carry.

Output

- sum is the n-bit output representing (a + b) mod 2^(n).

- cout is the output carry.

Problem information

Author: Jordi Cortadella

Generation: 2026-02-03T12:11:33.657Z

© Jutge.org, 2006–2026.
https://jutge.org
