olo_fix_cic_intp_tdm_par¶
Status Information¶
VHDL Source: olo_fix_cic_intp_tdm_par.vhd
Bit-true Model: olo_fix_cic_intp.py
Description¶
This entity implements a CIC interpolator of configurable order. It takes one or multiple channels time-division multiplexed (TDM) on the input side and produces all channels in parallel on the output side. The interpolation ratio can either be runtime configurable or fixed (i.e. compile-time configured).
Because the output side is parallel, the filter can produce one output sample per clock cycle for every channel. So for all channels the output sample rate can be up to the clock frequency.
For details about the fixed-point number format used in Open Logic, refer to the fixed point principles.
The modes can be summarized as follows:
- Fixed ratio mode:
- FixedRatio_g = true
- The configuration ports Cfg_xxx are ignored and can be left unconnected.
- The CIC filter calculates all shift and gain correction factors internally
- Configurable ratio mode:
- FixedRatio_g = false
- The user is responsible for applying the correct values to the configuration ports Cfg_xxx (see formulas in Runtime Ratio Configuration).
- The ratio is only allowed to be changed when the CIC is in reset (i.e. Rst=1_).
Flow Control¶
Every input TDM frame (one sample for each channel) produces Ratio output samples per channel. Hence the input can not accept one sample per clock cycle in general. The entity signals this using In_Ready: The last sample of a TDM frame is only accepted when at least Ratio clock cycles passed since the last sample of the previous TDM frame was accepted. All other samples are accepted immediately. As a result, the input frame rate is limited as follows:
- Maximum input frame rate: Clk frequency / max(Ratio, Channels_g)
For Channels_g >= Ratio, In_Ready is never de-asserted (except during reset).
The output side does not support back-pressure (there is no Out_Ready). Each input TDM frame produces a burst of Ratio output samples on consecutive clock cycles (with all channels in parallel). If the input frames arrive at exactly the maximum frame rate, the output is continuous. Otherwise the output is bursty.
If downstream logic requires a constant output sample rate lower than the clock frequency, the output can be smoothed using olo_base_fifo_sync followed by olo_base_rate_limit (Mode_g="SMOOTH"). The FIFO is required because olo_base_rate_limit applies back-pressure which the CIC can not handle. A FIFO depth of Ratio samples is sufficient as long as the average output rate set by the rate limiter is at least the average rate produced by the CIC (i.e. Ratio times the input frame rate).
CIC Gain Handling¶
CIC interpolators have an inherent gain given by the formula below.

This gain is corrected into the range 0.5 to 1.0 by a bitshift

For GainCorrCoefFmt_g != "NONE", the gain is fine-corrected using a multiplier to exactly 1.0:

If the gain correction is disabled (i.e. GainCorrCoefFmt_g = "NONE"_), the multiplier is bypassed and only the bitshift is applied to correct the gain into the range 0.5 to 1.0:

For CIC gains that are a power of two, the gain correction can be disabled because the gain is already exactly 1.0 after the bitshift. It is also possible to disable the gain correction for non-power-of-two gains and implement the fine correction externally.
Latency¶
This block does change the sample-rate. Because not every output sample is produced by an input sample, the latency is not fixed and therefore not documented in detail.
Generics¶
| Name | Type | Default | Description |
|---|---|---|---|
| Channels_g | positive | 1 | Number of channels |
| Order_g | positive | - | CIC order Range 2 ... 32 See General Architecture for the number of stages implemented |
| Ratio_g | positive | - | Fixed ratio mode: Interpolation ratio Configurable ratio mode: Maximum interpolation ratio |
| FixedRatio_g | boolean | true | Implement fixed ratio (true) or configurable ratio (false) |
| DiffDelay_g | positive | 1 | Differential delay of comb section (usually 1 or 2) |
| InFmt_g | string | - | Input data format String representation of an en_cl_fix Format_t |
| OutFmt_g | string | - | Output data format String representation of an en_cl_fix Format_t |
| GainCorrCoefFmt_g | string | "(0,1,16)" | Gain correction coefficient format Must be (0,1,x) String representation of an en_cl_fix Format_t. To disable the internal gain compensation, choose "NONE" |
| Round_g | string | "NonSymPos_s" | Rounding mode String representation of an en_cl_fix FixRound_t. |
| Saturate_g | string | "Warn_s" | Saturation mode String representation of an en_cl_fix FixSaturate_t. |
| RamBehavior_g | string | "RBW" | Resource control for differentiator delay lines mapped to RAM. Normally not used except for large Channels_g "RBW" = read-before-write, "WBR" = write-before-read For details refer to the description in olo_base_ram_sdp. |
| Resource_g | string | "AUTO" | Resource control for differentiator delay lines. Normally not used except for large Channels_g see olo_base_delay for details |
| RamStyle_g | string | "auto" | Resource control for differentiator delay lines mapped to RAM. Normally not used except for large Channels_g For details refer to the description in olo_base_ram_sdp. |
When gain correction is disabled (i.e. GainCorrCoefFmt_g = "NONE"_), the gain is corrected into the range 0.5 to 1.0 by shifting the output. Only the fine correction to exactly 1.0 using a multiplier is disabled in this case.
Interfaces¶
Control¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| Clk | in | 1 | - | Clock |
| Rst | in | 1 | - | Reset (synchronous, active high) |
Runtime Ratio Configuration¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| Cfg_Ratio | in | log2ceil(Ratio_g) | - | Configured interpolation ratio minus 1 (only used if FixedRatio_g=false) Example: Cfg_Ratio=3 -> Ratio = 4 |
| Cfg_Shift | in | 8 | - | Configured bit shift (only used if FixedRatio_g=false) Width is limited to 8 bits |
| Cfg_GainCorr | in | width(GainCorrCoefFmt_g) | - | Configured gain correction coefficient (only used if FixedRatio_g=false and GainCorrCoefFmt_g /= "NONE") |
These ports are only required for FixedRatio_g = false and can be left unconnected otherwise. The user is responsible for applying the correct values to these ports. The ratio is only allowed to be changed when the CIC is in reset (i.e. Rst=1_).
Note: The configuration values are not range checked. If Cfg_Ratio is configured for a ratio larger than Ratio_g or if Cfg_Shift and Cfg_GainCorr do not match the formulas given in CIC Gain Handling, the behavior is undefined.
The width of Cfg_Shift is fixed to 8 bits for simplicity reasons. In practice, CICs with more than 255 bits of growth are not practical anyways because they would require too much resources and lead to timing issues. Therefore a fixed width of 8 bits is sufficient for all sane use-cases.
The formulas for the values to apply are given in section CIC Gain Handling. Note that the interpolator gain formula differs from the decimator gain formula (division by Ratio).
Input Data¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| In_Valid | in | 1 | '1' | Input valid |
| In_Ready | out | 1 | N/A | Input ready (see Flow Control) |
| In_Data | in | width(InFmt_g) | - | Input data (TDM) |
| In_Last | in | 1 | '0' | TDM frame boundary (optional) see TDM Conventions |
The signal In_Last is optional and only used to check if the input TDM frame boundaries are correct. Errors are reported in simulation. The signal is not used for synthesis.
Output Data¶
| Name | In/Out | Length | Default | Description |
|---|---|---|---|---|
| Out_Valid | out | 1 | N/A | Output valid |
| Out_Data | out | width(OutFmt_g)*Channels_g | N/A | Output data Channel-0 = Out_Data[N-1:0] Channel-1 = Out_Data[2*N-1:N] ... |
Details¶
General Architecture¶
The architecture of the CIC interpolator is shown in the figure below. Colors denote different implementation options.
- Blue: FixedRatio_g = true (fixed ratio mode)
- Purple: FixedRatio_g = false (configurable ratio mode)
- Orange: GainCorrCoefFmt_g = "NONE"_ (shift-only gain correction, multiplier bypassed)
- Yellow: GainCorrCoefFmt_g != "NONE"_ (multiplier-based gain correction)
- Red: DiffDelay_g = 1 (running sum bypassed)
- Green: DiffDelay_g > 1 (running sum, shown for DiffDelay_g = 2)
The figure shows Order_g = 3 and Channels_g = 3.

The gain correction multiplier (if enabled) is implemented at the input on the TDM side, so only one multiplier is required for all channels. See Gain Correction for details.
The comb (differentiator) stages are implemented on the TDM side, where the sample rate is low. They are shared between all channels and the delay lines are implemented using olo_base_delay with a depth of Channels_g * DiffDelay_g. The comb stages are implemented at full precision (one bit of growth per stage), so no rounding happens.
The integrators are implemented for each channel separately because they run at the output sample rate (up to one sample per clock cycle). They are sized for the maximum ratio Ratio_g.
Only Order_g-1 comb stages and Order_g-1 integrators are implemented. The last comb stage, the zero insertion of a classical CIC interpolator and the first integrator are replaced by a running sum over DiffDelay_g samples (on the TDM side) followed by a sample and hold (one olo_fix_sample_hold per channel). This is mathematically identical:
- The last comb stage 1 - z-MR (in terms of the output sample rate) followed by the first integrator 1 / (1 - z-1) equals (1 + z-R + ... + z-(M-1)R) * (1 + z-1 + ... + z-(R-1)).
- The first factor is the running sum over M = DiffDelay_g input samples. For DiffDelay_g = 1 it is a pass-through.
- The second factor applied to a zero-stuffed signal equals holding each input sample for R output samples.
The sample and hold is where the sample rate changes (marked as Rate Conversion in the figure): Everything before it runs at the input sample rate, everything after it at the output sample rate.
The results are bit-true to a classical CIC interpolator. The optimization saves one integrator per channel (running at the output sample rate) and, for DiffDelay_g = 1, also one comb stage.
The bitshift for gain correction is applied after the integrators. Because the integrators are sized for the maximum ratio, this shift is a fixed shift by Shift for Ratio_g and hence pure wiring. In configurable ratio mode, the data is additionally shifted left by the difference between the shift for Ratio_g and Cfg_Shift before the integrators. This produces exactly the same result as a dynamic right shift after the integrators (no information is lost) but only requires one dynamic shifter on the TDM side instead of one per channel.
After the shift, the data of each channel is rounded and saturated to the output format according to Round_g and Saturate_g.
The parameters RamBehavior_g, Resource_g, and RamStyle_g are forwarded to all olo_base_delay instances (comb stages and running sum). They are important only for cases with enough channels to make usage of RAM (distributed or block RAM) for the delay lines attractive.
Gain Correction¶
The gain correction multiplier is placed at the very input of the CIC (before the comb stages). This allows using one multiplier for all channels.
Placing the multiplier at the input does not degrade precision: The CIC filter as a whole (comb stages plus integrators) is an FIR filter, so rounding errors of the multiplier are not accumulated by the integrators. They pass through the filter like any other input signal (i.e. with a gain of 1.0 after gain correction). Note that it would not be possible to place the multiplier between the comb stages and the integrators because the integrators would accumulate the rounding errors.
In fixed ratio mode (FixedRatio_g = true), the multiplier is omitted automatically if the CIC gain is a power of two (i.e. Ratio_g and DiffDelay_g are both powers of two). In this case the gain correction coefficient is exactly 1.0 and the multiplication is replaced by a bit-true resize, which saves a DSP slice.
Because the gain correction factor is in the range 1.0 to 2.0, the multiplier output has one more integer bit than InFmt_g. The multiplier output is rounded and saturated according to Round_g and Saturate_g to the format (InFmt_g.S, InFmt_g.I+1, min(OutFmt_g.F+2, InFmt_g.F+GainCorrCoefFmt_g.F)). So the multiplier output has two fractional bits more than OutFmt_g (unless the exact product has fewer fractional bits). This format is used for the comb stages and integrators.