Chargement…
Chargement…
On an edge where i_start='1' and the block is idle, latch all four operands. Then add one operand per cycle into an 18-bit accumulator. After the fourth addition, drive o_sum, clear o_busy, and pulse o_done for one cycle. Ignore i_start while busy.
i_a through i_d are unsigned 16-bit values. o_sum is 18 bits to preserve the maximum sum 4 * 65535. i_rst is synchronous active high and clears outputs, accumulator, and control.
The testbench covers a small sum, four maximum values, zeros, the busy/done protocol, and the full result width.