39. Fixed-Point Gain Scaler — Saturation Stage

Loading simulator…

Complete the predefined template in the following order.

1. Complete the overflow-detection logic

A signed 6-bit value fits in the signed 4-bit output range only when the upper bits Rounded5 and Rounded4 match the 4-bit sign bit Rounded3.

Connect:

  • Rounded5 and Rounded3 to OV_R5_R3.
  • Rounded4 and Rounded3 to OV_R4_R3.
  • Both XOR outputs to the OVERFLOW OR gate.

This implements:

Overflow = (Rounded5 XOR Rounded3) OR (Rounded4 XOR Rounded3)

Therefore:

Overflow = 0 → Rounded fits in the signed 4-bit range
Overflow = 1 → Rounded is outside the signed 4-bit range

2. Complete the saturation-control logic

Connect Overflow to the unused input of SAT_APPLY. The other input is already connected to SAT_EN.

SatApply = SAT_EN AND Overflow

SatApply is already connected to Saturated and to the select input of all four output MUXes.

Therefore:

SAT_EN = 0                     → normal wrap path
SAT_EN = 1 and Overflow = 0   → normal in-range path
SAT_EN = 1 and Overflow = 1   → saturation path

3. Complete the clamp-value logic

Connect Overflow and Rounded5 to CLAMP_LOW.

ClampLow = Overflow XOR Rounded5

During overflow:

Rounded5 = 0 → positive overflow → ClampLow = 1
Rounded5 = 1 → negative overflow → ClampLow = 0

The predefined MUX wiring then forms:

Positive saturation → 0111
Negative saturation → 1000

When SatApply = 0, the MUXes pass Rounded[3:0]. When SatApply = 1, they select the appropriate saturation value.