RTL Studio Open IDE

Arithmetic & Math

Parameterized Ripple-Carry Adder

A fully parameterized Verilog ripple-carry adder with carry-in, carry-out, and signed overflow detection.

About this block

Simulate it in the Verilog IDE

Easyverilogsimsyn

Parameterized Ripple-Carry Adder is a Verilog reference block in the Arithmetic & Math catalog. Adders, multipliers, dividers, ALUs, and arithmetic datapaths. Marked Easy: a small block you can read, simulate, and synthesize in one sitting.

This IP implements a fully parameterized ripple-carry adder in Verilog. It supports arbitrary bit-widths via the WIDTH parameter. The design includes carry-in (cin), carry-out (cout), and signed overflow (ovf) flags. It is suitable for low-complexity arithmetic or educational purposes.

This parameterized ripple-carry adder provides a simple, synthesizable solution for fixed-width addition. It correctly handles unsigned carry-out and signed overflow detection for two's complement numbers. The design is verified against comprehensive test cases including edge conditions and random inputs. Integrators should consider the linear delay for high-performance applications and opt for faster adder architectures if necessary.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for Parameterized Ripple-Carry Adder.
  2. Read the Verilog module in the editor. The catalog line for this block: A fully parameterized Verilog ripple-carry adder with carry-in, carry-out, and signed overflow detection.
  3. Run the packaged testbench with the in-browser Verilator simulator, then open the VCD in the waveform viewer.
  4. Run Yosys in the same IDE for a generic netlist. Sky130 liberty mapping is a separate Pro library option.

RTL Studio is the Verilog simulator and IDE around this block: Slang lint, Verilator, VCD waveforms, and Yosys, in the browser. Simulation guide · Yosys guide.

Architecture

The adder uses a generate-for loop to instantiate full-adder logic for each bit slice. Carry signals propagate sequentially from the least significant bit to the most significant bit. This creates a linear delay path proportional to the word width.

Interface

Port NameDirectionWidthDescription
aInputWIDTH-1:0First operand
bInputWIDTH-1:0Second operand
cinInput1Carry-in bit
sumOutputWIDTH-1:0Sum result
coutOutput1Carry-out bit
ovfOutput1Signed overflow flag

Parameters

ParameterDefaultDescription
WIDTH8Bit-width of operands and sum

Verification

The testbench covers basic addition, maximum value handling, and signed overflow conditions. It also includes randomized test cases to verify correctness across various input combinations. All tests passed successfully using the Icarus Verilog simulator.

Test CaseDescriptionResult
TC1Basic 0 + 0PASS
TC2Basic 1 + 1PASS
TC3Max + 1 (Unsigned Overflow)PASS
TC4Signed Overflow (Pos + Pos)PASS
TC5Signed Overflow (Neg + Neg)PASS
TC6Carry-in = 1PASS
TC7Random Mixed CasesPASS

More in Arithmetic & Math

All Arithmetic & Math blocks