Fast Trapezoidal
High-performance trapezoidal shaper with pole-zero cancellation and derivative-based trigger for gamma-ray spectroscopy and Multi-Channel Analyzer (MCA) applications. Implements a fast shaping algorithm with programmable rise time (K), flat-top (M) and deconvolution constant (M_Dec) for optimal energy resolution and timing.
Introduction
The Fast Trapezoidal core implements a digital trapezoidal shaper optimized for gamma-ray spectroscopy and pulse-height analysis. This trigger is designed to work with exponentially decaying signals from radiation detectors (scintillators, HPGe, CdTe, etc.) and provides both timing (trigger) and energy information.
The core uses Xilinx HLS (High-Level Synthesis) for efficient FPGA implementation, achieving a throughput of 1 sample per clock cycle (II=1).
The algorithm performs:
- Pole-zero cancellation (deconvolution) to remove the exponential decay
- Trapezoidal shaping with programmable rise time and flat-top
- Derivative-based trigger on the shaped signal
Pin Description
Signal polarity selection.
1– Positive pulses (signal increases with energy)0– Negative pulses (signal decreases with energy, internally inverted)
(1 << BIN_NUM) - 1 for negative polarity inversion.
Typically set to the ADC resolution (e.g., 14 for 14-bit ADC).
M_Dec = exp(-Ts/tau) * 2^16 where Ts is sampling period and tau is decay constant.
Default: 0x007C80 (for typical preamplifier decay times).
Run/Configuration mode control.
0– Configuration mode: resets internal state1– Run mode: normal operation with trigger enabled Switch from 0 to 1 after configuration to start acquisition.
TRIG_M clock cycles to align with the trigger output.
Can be used for waveform capture or energy measurement.
Properties
max(K, M) * 2.
Available values: 128, 256, 512, 1024, 2048, 4096, 8192, 16384, default 2048.
Default: 2048
Options: 128 256 512 1024 2048 4096 8192 16384
Default: 64
Options: 48 64 96
Usage
Signal Processing Pipeline
The Fast Trapezoidal trigger processes detector signals through multiple stages:
The figure shows:
- Top: Original exponential signal from the detector (typical of charge-sensitive preamplifier output)
- Middle: Shaped and deconvolved signal after trapezoidal filtering - the exponential tail is removed, resulting in a symmetric pulse
- Bottom: Derivative of the shaped signal used for triggering - the zero-crossing indicates the peak position
Algorithm Details
1. Pole-Zero Cancellation (Deconvolution)
The exponential decay of the preamplifier signal is cancelled using a digital deconvolution filter. The DECONV_M parameter (M coefficient) must be calibrated to match the detector’s decay time constant.
The deconvolution coefficient is calculated as:
$$ M_{Dec} = \left\lfloor \frac{256}{e^{T_s / \tau} - 1} \right\rfloor $$
where:
- $T_s$ is the sampling period (in the same units as $\tau$)
- $\tau$ is the preamplifier decay time constant
- The result is truncated to an integer value
Example calculation (Python):
python
import math
sampling_period = 8e-9 # 8 ns (125 MHz sampling)
tau = 50e-6 # 50 µs preamplifier decay time
M_Dec = int(256 / (math.exp(sampling_period / tau) - 1))
# Result: M_Dec = 1599999 (0x186A00)
For typical preamplifier decay times (50-100 µs) and sampling rates (100-250 MHz), the coefficient is usually in the range of 0x007C80 to 0x200000.
2. Trapezoidal Shaping
After deconvolution, a trapezoidal filter is applied with parameters:
- K (
TRIG_K): Rise time in clock cycles - M (
TRIG_M): Flat-top duration in clock cycles
The transfer function implements a moving-average differentiator:
$$ s_1[n] = x[n] - x[n-K] $$ $$ s_2[n] = s_1[n] - s_1[n-M] $$ $$ y[n] = \sum_{i=0}^{n} s_2[i] + M \cdot s_2[n] $$
3. Trigger Generation
The trigger is generated when:
- The shaped signal derivative (
delta) exceeds the threshold - A trigger candidate window opens for
2*Kclock cycles - Within this window, the derivative zero-crossing (delta < 0) indicates the peak
Baseline-Free Operation
The trigger implemented as the derivative of a trapezoidal filter does not require the calculation of the baseline because of the nature of the derivative operation itself and the design of the trapezoidal filter.
Key advantages:
- DC rejection: The derivative operation inherently removes any constant DC offset (baseline). A constant baseline has zero derivative, so it does not affect the trigger threshold comparison.
- No baseline restorer needed: Unlike leading-edge triggers that compare the signal directly against a threshold, this derivative-based approach is immune to baseline shifts caused by temperature drift, rate-dependent effects, or ground loops.
- Simplified calibration: The threshold (
THRS) only needs to be set above the noise level of the derivative signal, without accounting for baseline variations. - Better pile-up handling: The trapezoidal shaper returns to zero between pulses, making it easier to detect closely-spaced events.
This makes the Fast Trapezoidal trigger particularly robust for high-rate spectroscopy applications where baseline fluctuations are common.
Timing and Latency
- Total latency: 13 clock cycles from input to trigger output
- Throughput: 1 sample per clock cycle (fully pipelined)
- The
DATA_OUToutput is delayed byTRIG_Mclock cycles to align with the trigger
Saturation Protection
The core includes automatic saturation detection. When the input reaches 0xFFFF (full scale), the trigger is temporarily inhibited to prevent false triggers from saturated signals.
Configuration vs Run Mode
The RUN_CFG input controls the operating mode:
RUN_CFG = 0(Config mode): Internal accumulators and delay lines are resetRUN_CFG = 1(Run mode): Normal operation, trigger generation enabled
Always start with RUN_CFG = 0 after power-up or configuration change, then switch to RUN_CFG = 1 for acquisition.
Typical Applications
- Multi-Channel Analyzer (MCA) for gamma-ray spectroscopy
- Energy measurement with HPGe, CdTe, SDD detectors
- X-ray fluorescence (XRF) spectroscopy
- Nuclear physics experiments
- Medical imaging (PET, SPECT)