n-bit adder X84292


Statement
 

pdf   zip

Design a circuit that performs the addition of two nn-bit numbers. The result must be represented in nn bits also. The number of bits nn 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 nn-bit numbers.

  • cin is the input carry.

Output

  • sum is the nn-bit output representing (a+b) mod 2n(a+b) \textrm{~mod~} 2^n.

  • cout is the output carry.

Information
Author
Jordi Cortadella
Language
English
Official solutions
Verilog
User solutions
Verilog