RTL Studio Open IDE

Arithmetic & Math

8-Bit One's Complement Adder with End-Around Carry — L2 Upgrade

8-bit one's complement adder with end-around carry, saturation clamping, and sticky overflow flag.

About this block

Simulate it in the Verilog IDE

Mediumverilogsimsyn

8-Bit One's Complement Adder with End-Around Carry — L2 Upgrade is a Verilog reference block in the Arithmetic & Math catalog. Adders, multipliers, dividers, ALUs, and arithmetic datapaths. Marked Medium: more state or a wider datapath, still one workspace in the IDE.

This IP core implements an 8-bit one's complement adder with end-around carry logic.

It features saturation detection for overflow conditions and a sticky saturation flag for error tracking.

The design supports synchronous reset and manual flag clearing, making it suitable for DSP applications requiring robust one's complement arithmetic.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 8-Bit One's Complement Adder with End-Around Carry — L2 Upgrade.
  2. Read the Verilog module in the editor. The catalog line for this block: 8-bit one's complement adder with end-around carry, saturation clamping, and sticky overflow flag.
  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.

Features

  • 8-Bit One's Complement Arithmetic: Implements standard end-around carry logic.
  • Saturation Logic: Clamps results to maximum positive (127) or minimum negative (-127) on overflow.
  • Sticky Saturation Flag: A sat_flag output that remains high until explicitly cleared via rst_n or clr_sat.
  • Synchronous Control: Supports synchronous reset and manual flag clearing.

Architecture

The module performs addition of two 8-bit operands. The process involves:

  1. Raw Summation: An unsigned 9-bit sum is calculated.
  2. End-Around Carry: The carry-out from the 9th bit is added back to the LSB of the 8-bit intermediate sum.
  3. Saturation Check: Overflow is detected by comparing operand signs and result sign. If overflow occurs, the result is clamped.
  4. Flag Latching: The saturation flag is latched synchronously and remains set until cleared.

### Block Diagram

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low synchronous reset
clr_satInput1Clear saturation flag
aInput8First operand
bInput8Second operand
sumOutput8Saturating sum result
sat_flagOutput1Sticky saturation flag

Verification

The included testbench (tb_ones_complement_adder_8bit_sticky_sat_flag.v) verifies:

  • Basic positive and negative addition.
  • Saturation clamping behavior (positive overflow to 127, negative overflow to -127).
  • Sticky flag behavior and clearing mechanisms.

### Running Simulation

  1. Compile the RTL and testbench.
  2. Run the simulation.
  3. Check the log for INFO: PASS.

Expected test cases:

  • TC1-TC9: Basic arithmetic and edge cases.
  • TC4/TC7 Sat Flag: Verification of sticky flag behavior.

More in Arithmetic & Math

All Arithmetic & Math blocks