Home / Learn Verilog / Parameterized Adder

Parameterized Adder

Any width.

Bottom lineAny width.

Breaking it down

adderABSUMN bits
adder

What it is

Use a parameter for width and keep the carry in an extra bit.

Why it matters

Reusable datapaths.

Mechanically speaking

assign {c, s} = a + b + cin.

Shows up in

  • Everyday RTL design
  • FPGA and ASIC projects
  • Testbenches and debugging

Try it

N-bit adderVerilog: edit and run

4000 + 200 = 4200 does not fit in 12 bits: carry set.

Check yourself

1. Carry bit holds...