FPGA DEVICES · ENGINEERING · SOURCING Source-linked information. Clear project requirements.

Tutorials

Fixed-Point Rounding and Saturation: Test Negative Ties and Overflow

Published · Updated

Choose the rounding rule before choosing the slice

Discarding low bits from a signed two’s-complement number rounds downward on the power-of-two grid. That differs from truncating toward zero for negative values. “Round to nearest” is incomplete until the tie rule is stated. This worksheet compares floor, toward zero and nearest with ties to even.

Probes placed on a circuit board. Analog measurement and digital quantization analysis answer different questions; no waveform from this setup is claimed below.
Probes placed on a circuit board. Analog measurement and digital quantization analysis answer different questions; no waveform from this setup is claimed below. Photo: Sensepeek AB. Original · CC BY-SA 4.0.

Work in raw integers to avoid a binary floating-point approximation deciding whether a value is exactly half an output LSB. When reducing fractional width by k bits, the divisor is 2^k. Retain the remainder, then apply the selected rule deliberately. The output should show both the rounded raw value and whether it fits.

Use the acquisition budget for system context.

Retain resource assumptions when adding saturation logic.

Test both signs of the half-way case

Reducing two fractional bits to zero maps raw +6 to +1.5 and raw −6 to −1.5. Nearest-even produces +2 and −2; toward-zero produces +1 and −1; floor produces +1 and −2. Add +0.5 and −0.5 to catch a tie implementation that always increments in one direction.

Reduce two fractional bits: raw −6Reduce two fractional bits: raw −61Floor−1.5 → −22Toward zero−1.5 → −13Nearest, ties to even−1.5 → −2
Illustrative model and values; assumptions are stated in the adjacent text.

Nearest-even avoids a systematic same-direction decision at ties, but it is not a promise of zero error bias for every input distribution. Examine the actual numerical workload if bias matters. Keep quantization error separate from overflow; changing the rounding rule does not expand the output range.

Record the running arithmetic implementation.

Check overflow after the rounding increment

A value just below the maximum may round beyond it. Compare the rounded result with the target signed range, then apply the chosen saturation or wrap policy. Saturating before rounding can miss that final carry. At the negative boundary, verify the asymmetric two’s-complement range rather than assuming equal positive and negative magnitudes.

Rounding can create the overflowRounding can create the overflow1Input raw 510 with F = 2Value 127.52Nearest-even to integer128: outside signed 8-bit range3Choose overflow policySaturate to 127, or wrap to −128
Illustrative model and values; assumptions are stated in the adjacent text.

The worksheet reports the unclipped rounded integer, the saturated integer and the wrapped integer side by side. Choose a policy in the design specification instead of letting assignment width choose it accidentally. AMD HLS quantization and overflow identifiers describe HLS types; plain Verilog needs its own explicit logic and tests.

Check the implemented timing.

Rounding at the positive limit: short sequenceRounding at the positive limit: Input value: 127.5 value; Nearest-even result: 128 value; Signed 8-bit saturation: 127 value

Input value: 127.5 value → Nearest-even result: 128 value → Signed 8-bit saturation: 127 value

Export your result with its assumptions. For an unresolved board or implementation issue, prepare an engineering review with the exact part, revision and relevant record. This link opens the review page; it does not send your worksheet.

Sources and scope

Sources checked 18 November 2026. Numerical examples are calculated cases. Hardware measurements and device timing closure are outside the results shown here.

Back to Tutorials

Related evidence and next tasks

Continue the task with the relevant source scope. These reading paths do not establish interchangeability or current supply.

Source addresses and citation trail

Full source addresses are retained below. Read each citation with its document revision, page, table and applicability conditions above.

  1. https://commons.wikimedia.org/wiki/File:PCBite_handsfree_oscilloscope_probes_measuring_a_circuit_board.jpg
  2. https://creativecommons.org/licenses/by-sa/4.0
  3. https://zipcpu.com/dsp/2017/07/22/rounding.html
  4. https://projectf.io/posts/fixed-point-numbers-in-verilog/
  5. https://docs.amd.com/r/2025.1-English/ug1399-vitis-hls/Fixed-Point-Identifier-Summary?contentId=kSnNk1t985H31SA0JykRpg