RTL Studio Open IDE

Arithmetic & Math

4-Digit BCD Adder with Carry Propagation — L2 Upgrade

A synchronous 4-digit BCD adder with carry propagation and a sticky saturation flag for overflow detection.

About this block

Simulate it in the Verilog IDE

Mediumsystemverilogsimsyn

4-Digit BCD Adder with Carry Propagation — L2 Upgrade is a SystemVerilog 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 implements a synchronous 4-digit Binary-Coded Decimal (BCD) adder.

It supports carry propagation between decimal digits and includes a sticky saturation flag for overflow detection.

The design is suitable for digital signal processing applications where decimal arithmetic is required.

  1. Choose Open in IDE. RTL Studio loads the packaged workspace for 4-Digit BCD Adder with Carry Propagation — L2 Upgrade.
  2. Read the SystemVerilog module in the editor. The catalog line for this block: A synchronous 4-digit BCD adder with carry propagation and a sticky saturation flag for 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.

Features

  • 4-Digit BCD Addition: Adds two 16-bit BCD inputs to produce a 16-bit BCD sum.
  • Carry Propagation: Carry bits propagate from the least significant nibble to the most significant nibble.
  • Sticky Saturation Flag: Detects if the final carry out is high (overflow). The flag remains set until cleared.
  • Synchronous Operation: Registered design with clock and active-low reset.
  • Control Interface: Includes start trigger, busy status, and clear_sat reset for the saturation flag.

Ports

Port NameDirectionWidthDescription
clkInput1Clock input
rst_nInput1Active-low reset
clear_satInput1Clear saturation flag
aInput16First BCD operand
bInput16Second BCD operand
startInput1Start addition trigger
busyOutput1Unit is processing
sumOutput16Resulting BCD sum
sticky_satOutput1Sticky saturation flag

Verification

The testbench covers:

  1. Basic addition without carry propagation.
  2. Carry propagation across multiple nibbles.
  3. Saturation detection and sticky flag persistence.
  4. Reset and clear saturation functionality.

All test cases passed in the simulation log.

More in Arithmetic & Math

All Arithmetic & Math blocks