RTL Studio Open IDE

Arithmetic & Math

16-Bit Signed Adder with Overflow

A synchronous 16-bit two's complement signed adder with overflow detection logic.

About this block

Simulate it in the Verilog IDE

Easyverilogsimsyn

16-Bit Signed Adder with Overflow 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 16-bit signed adder provides reliable arithmetic with explicit overflow detection for safety-critical applications.

The synchronous interface allows easy integration into pipelined data paths.

Comprehensive test coverage ensures robust handling of edge cases and boundary conditions.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 16-Bit Signed Adder with Overflow.
  2. Read the Verilog module in the editor. The catalog line for this block: A synchronous 16-bit two's complement signed adder with overflow detection logic.
  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 design uses a 17-bit internal wire to capture the full carry-out for accurate overflow calculation. Overflow logic checks if the carry into the MSB differs from the carry out of the MSB. The result is registered to ensure synchronous operation and timing closure.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input for sequential logic
rst_nInput1Active-low asynchronous reset
aInput16First 16-bit signed operand
bInput16Second 16-bit signed operand
loadInput1Load enable signal
sumOutput1616-bit signed sum result
overflowOutput1Overflow flag (1 if overflow occurred)

Verification

The testbench covers five key scenarios to ensure correctness:

  1. Basic positive addition: Verifies standard arithmetic behavior.
  2. Basic negative addition: Verifies two's complement handling for negative numbers.
  3. Positive overflow: Checks the boundary condition of adding the maximum positive value.
  4. Negative overflow: Checks the boundary condition of adding the minimum negative value.
  5. Mixed sign addition: Confirms that overflow never occurs when signs differ.
Test CaseDescriptionExpected SumExpected OverflowStatus
TC1Positive Addition (10 + 20)300PASS
TC2Negative Addition (-10 + -20)-300PASS
TC3Positive Overflow (Max + 1)-327681PASS
TC4Negative Overflow (Min - 1)327671PASS
TC5Mixed Signs (10 + -10)00PASS

More in Arithmetic & Math

All Arithmetic & Math blocks