BNL-229013-2025-TECH EIC-ADD-TN-147 ONE-TURN DELAY FEEDBACK (OTFB) IMPLEMENTATION FOR THE EIC A. Singh September 2025 Electron-Ion Collider Brookhaven National Laboratory U.S. Department of Energy USDOE Office of Science (SC), Nuclear Physics (NP) Notice: This technical note has been authored by employees of Brookhaven Science Associates, LLC under Contract No.DE-SC0012704 with the U.S. Department of Energy. The publisher by accepting the technical note for publication acknowledges that the United States Government retains a non-exclusive, paid-up, irrevocable, world- wide license to publish or reproduce the published form of this technical note, or allow others to do so, for United States Government purposes. This report was prepared as an account of work sponsored by an agency of the United States Government. Neither the United States Government nor any agency thereof, nor any of their employees, nor any of their contractors, subcontractors, or their employees, makes any warranty, express or implied, or assumes any legal liability or responsibility for the accuracy, completeness, or any third partyโ€™s use or the results of such use of any information, apparatus, product, or process disclosed, or represents that its use would not infringe privately owned rights. Reference herein to any specific commercial product, process, or service by trade name, trademark, manufacturer, or otherwise, does not necessarily constitute or imply its endorsement, recommendation, or favoring by the United States Government or any agency thereof or its contractors or subcontractors. The views and opinions of authors expressed herein do not necessarily state or reflect those of the United States Government or any agency thereof. ONE-TURN DELAY FEEDBACK (OTFB) IMPLEMENTATION FOR THE EIC A. Singhโˆ— , S. Mai, K. Mernick, G. Narayan, F. Severino *asingh2@bnl.gov Abstract This paper discusses the implementation of the One-Turn Delay Feedback (OTFB) for the Electron-Ion Collider (EIC). The theory of the OTFB is well documented, therefore, this paper will mainly discuss the details of the implementation. After a short introduction, the paper will discuss the building- blocks of the OTFB, simulation testing of the OTFB, and finally hardware validation of the OTFB. INTRODUCTION Figure 1: Basic comb filter response The background and theory of the OTFB has been ex- tensively covered by others [1, 3], and for this reason, the The numerator normalizes the gain of the filter to 1 at the focus of this paper is mainly on the specific implementation poles. The coefficient D is a delay parameter of the comb fil- details. Conceptually, while the direct feedback lowers the ter. The coefficient ๐›ผ determines the bandwidth of the peaks, effective cavity impedance around the RF frequency, the with the response becoming more narrow as ๐›ผ approaches OTFB lowers the effective cavity impedance at revolution 1. The basic principle of the filter is that repeating poles of frequency harmonics around the RF frequency (specifically, the transfer function leads to gain at harmonic frequencies, at the synchrotron and betatron sidebands around the rev- and the fundamental frequency is related to the sampling olution frequency harmonics). The OTFB is made of two frequency by: main components, the comb filter and the delay line. The ๐น๐‘  comb filter is responsible for actually providing gain at the ๐น๐‘“ = (2) revolution harmonics. The delay line is needed to adjust the ๐ท phase of the drive signal to maintain stability. An effective While this configuration will apply gain at the revolution implementation of the OTFB also requires more capabil- harmonics, the transfer function must be modified slightly ities. Firstly, the harmonic peaks of the comb filter must to apply gain at synchrotron/betatron sidebands. This can be adjustable to account for variations in the revolution fre- be achieved by shifting the poles via multiplication by a quency. Secondly, the filter must be able to provide gain at complex exponential. The new transfer function is shown arbitrary offsets from the rev-lines to effectively lower the below: 1โˆ’๐›ผ cavity impedance at the synchrotron and betatron sidebands. ๐ป (๐‘ง) = (3) 1 โˆ’ ๐›ผ ยท ๐‘ง โˆ’๐ท ยท ๐‘’ โˆ’ ๐‘— ๐œ™ The paper then briefly touches on how these components were tested using simulations prior to being put on hardware. This has an elegant interpretation when one looks at the Finally, the paper discusses results with the OTFB on hard- pole-zero plot of the filter. Multiplying by this complex ware including the setup procedure and the performance of exponential has the effect of rotating the poles by an amount the feedback. proportional to ๐œ™. This can be seen below: DIGITAL IMPLEMENTATION The OTFB is implemented in VHDL and the initial ver- sion was tested on the Xilinx Vertix-5 FPGA. Like the tradi- tional direct feedback loop (using the PID), the OTFB must be applied to both I and Q data. Biquad Filter The transfer function and frequency response of a standard feedback comb filter is shown below: 1โˆ’๐›ผ ๐ป (๐‘ง) = (1) 1 โˆ’ ๐›ผ ยท ๐‘ง โˆ’๐ท โˆ— This work was supported by the EIC Project and the U.S. Department of Energy, Contract DE-SC0012704. Figure 2: Pole-Zero Plot Showing Rotation With ๐œ™ = ๐œ‹/4 By combining two comb filters, one rotated clockwise and one counterclockwise, we are able to provide gain at offsets corresponding to the synchrotron/betatron sidebands. By multiplying eq (3) by a comb filter response with +๐œ™ rotation, we get: (1 โˆ’ ๐›ผ) 2 ๐ป (๐‘ง, ๐œ™) ยท ๐ป (๐‘ง, โˆ’๐œ™) = 1 โˆ’ ๐›ผ ๐‘ง โˆ’๐ท (๐‘’ โˆ’ ๐‘— ๐œ™ + ๐‘’ ๐‘— ๐œ™ ) + ๐›ผ2 ๐‘ง โˆ’2๐ท (4) Which results in: Figure 4: Block diagram of the biquad comb filter (1 โˆ’ ๐›ผ) 2 For our purposes, the coefficient ๐‘ 2 is always 0. ๐ป (๐‘ง) = (5) 1 โˆ’ 2 ๐›ผ ๐‘๐‘œ๐‘ (๐œ™) ๐‘ง โˆ’๐ท + ๐›ผ2 ๐‘ง โˆ’2๐ท Fractional Delay Filter Lastly, when providing gain at the sidebands, one may be interested in notching out the gain at the rev-lines, because We see, according to (2), that if we use a sampling rate without doing this, the peaks will be widened. This can be of 20 MHz and a delay of 256, we get harmonics with a done by adding zeros at all the revolution lines by modifying fundamental frequency of 78.125 kHz. While this value (5). Also, to preserve the normalizing effect of the numerator is close to the RHIC revolution frequency, often it is not coefficient, (1 โˆ’ ๐›ผ) 2 must be changed to (1 โˆ’ ๐›ผ2 ). The final exact. To account for any discrepancies, we need to be transfer function is given by: able to adjust the filter delay by fractional amounts. The fractional delay filter design used is based largly on the design described in [4] which provides a comprehensive (1 โˆ’ ๐›ผ2 ) (1 โˆ’ ๐‘ง โˆ’๐ท ) ๐ป (๐‘ง) = ๐บ ยท (6) overview. A fourth order fractional delay filter is used in 1 โˆ’ 2 ๐›ผ ๐‘๐‘œ๐‘ (๐œ™) ๐‘ง โˆ’๐ท + ๐›ผ2 ๐‘ง โˆ’2๐ท this design and, according to [4], the transfer function for such a filter is given by: Where G is some arbitrary gain. Now, the value of ๐œ™ is determined by: 4 โˆ‘๏ธ ๐ป (๐‘ง) = ๐ถ๐‘– (๐‘ง)๐ท ๐‘– (7) ๐‘“๐‘œ ๐‘“ ๐‘“ ๐‘ ๐‘’๐‘ก ๐‘–=0 ๐œ™ = 2๐œ‹ ยท ๐‘“๐‘Ÿ ๐‘’๐‘ฃ Where C represents coefficients and D represents the de- Where ๐‘“๐‘œ ๐‘“ ๐‘“ ๐‘ ๐‘’๐‘ก is the offset of the sidebands from the rev- sired delay within the range [-1,1]. As described in [4], such lines in Hz. One may be able to see that the transfer function a filter can be implemented as a Farrow structure. However, given by (6) is similar to the biquad implementation of the this implementation, even after simplifications, requires 18 comb filter shown in [2], in fact, (6) is equivalent to a general multiplications, which is not practical given that 6 fractional biquad implementation and this is how the filter is actually delay filters are required (3 for a single comb filter). Instead, implemented in VHDL. Some general frequency responses the like-terms can be combined, resulting in a simple FIR for such a filter are shown below: implementation with only 5 multiplications. While we lose out on the ability to quickly change the fractional delay value (now we have to recompute the coefficients), in practice this is not an issue as the fractional delay will only be used to provide a one-time correction. The fractional delay FIR filter is added after each of the delay blocks seen in figure 4. Delay Line The delay line for the OTFB is implemented in BRAM. The length of the delay line is determined by the revolution Figure 3: General response of the biquad comb filter. Here, frequency at storage. In RHIC, and EIC, the revolution ๐œ™ increases from blue to green and the gain at revolution frequency is โ‰ˆ 78.125 kHz, and if the clock rate is 20 MHz, harmonics is notched out. a delay line of 256 samples is required. In the current design, the delay line can be adjusted with a resolution of 50 ns, in the future, a fractional delay filter can also be utilized to A block diagram of the filter is shown below: achieve higher precision. Phase Equalizer Filter In this case, the preferred testing method is to measure As is noted in [3], due to the phase response of the closed- the closed loop transfer function of a cavity simulator while loop system, instabilities can occur when providing gain at the OTFB is enabled. A block diagram of such a setup is around +/- 6 harmonics from the RF frequency. This is be- shown below: cause a 180 degree phase rollover occurs at those frequencies and instead of reducing the cavities impedance there, the comb filter actually increases the impedance. To address this issue, a so-called phase equalizer filter can be used. Specifi- cally, a phase equalizer filter is an all-pass filter (unity gain at all frequencies) with some tunable phase response. Based on [10], the transfer function and frequency response for such a filter is shown below: ๐‘Ž 2 + ๐‘Ž 1 ยท ๐‘ง โˆ’๐ท + ๐‘ง โˆ’2๐ท ๐ป (๐‘ง) = (8) 1 + ๐‘Ž 1 ยท ๐‘ง โˆ’๐ท + ๐‘Ž 2 ยท ๐‘ง โˆ’2๐ท Figure 6: System Response Measurement Setup The result returned by the network analyzer can be thought of as a measurement of the cavity impedance. An open loop measurement is shown below: Figure 5: Response of eq (8) with ๐‘Ž 1 = ๐‘Ž 2 = 0.5 and D = 1 The delay parameter D is responsible for determining how many phase rollovers occur within 0 Hz and ๐‘“2๐‘  Hz. The parameter ๐‘Ž 1 determines the position of the phase rollover Figure 7: Open Loop System Response Measurement (shifting it left and right) and ๐‘Ž 2 determines how quickly the phase rolls over. By using ๐ท = 12, ๐‘Ž 1 = 0.8, ๐‘Ž 2 = 0.3, we are able to compensate for the phase response of the close As expected, this returns the classic resonator response loop system, as will be shown shortly. of the cavity. If only the direct feedback is enabled, the measurement returns the following: SIMULATION TESTING The VHDL simulations and verification was done using cocotb [5] and Python. As the VHDL simulator, GHDL [6] was chosen. The OTFB implementation was validated by applying a discrete impulse, taking an FFT of the output, and plotting the result against the ideal frequency response. This method allows one to quickly check the quantization noise and numerical errors as a function of data and coeffi- cient length. Also, taking the impulse response of the filter quickly reveals any timing errors in the design. In fact, such a response is what is seen in figure 3. HARDWARE TESTING Figure 8: Closed Loop System Response Measurement The OTFB was first tested within a lab environment. There are multiple ways to verify the design is behaving Again, as expected, the measurement shows the narrow- as expected. For example, one can calculate the impulse band, high gain, reduction of the cavity impedance (by 23 response by applying a discrete pulse to the filter on the dB) due to the direct loop. Finally, the OTFB is properly FPGA. One can then view the output of the filter on a scope. configured and enabled, the measurement is shown below: TUNING THE OTFB To properly configure the OTFB, a method similar to the one shown in [8] is used. First a simplistic, linear, model of the system is defined. An example model is shown below: Figure 9: Closed Loop + OTFB System Response Measure- ment Figure 12: Simplistic Linear Model This result clearly shows the OTFB lowering the cavity impedance at revolution lines around the RF frequency. The process by which the OTFB can be properly configured is From here, one can define the transfer function ๐‘ฆ๐‘ฅ = ๐ป (๐‘ ) discussed in the following section. Below, a measurement which will contain terms that describe the loop delay. In the of the double-peak comb filter response is shown: case of the OTFB, we are interested in defining exactly the value of the loop delay so we can configure the delay line. Now, measurements like the ones from the previous section are plotted against the theoretical response of the model. Specifically, measurements taken with the digital network analyzer [7] are used as they account for the response of digi- tal components. Regardless, chances are that the two will not agree. In such a case, a least-squares fit is preformed on the model to better match the real measurement. Specifically: โˆ‘๏ธ ยฎ = ๐ฟ( ๐œƒ) ยฎ ๐‘—๐œ”)| 2 |๐ป๐‘š๐‘’๐‘Ž๐‘  ( ๐‘—๐œ”) โˆ’ ๐ป ๐‘“ ๐‘–๐‘ก ( ๐œƒ, ๐œ” Figure 10: OTFB Double-Comb System Response Measure- ment must be minimized by altering ๐œƒยฎ which is a vector con- taining all of the tweakable parameters of the ideal model. It should be noted, the spurs in the measurement (not As this process is iterated a few times, the model will more including the one at RF) are due to the response of the crystal accurately describe the real system and from there it is easy oscillator cavity simulator these tests were preformed on. to obtain the loop delay based on the model parameters. In a fully optimized state, we are able to provide close to 30 dB of impedance reduction around the first 3 harmonics, CONCLUSION along with an additional 10 to 20 dB of impedance reduction up to 8 harmonics. The image below shows a OTFB setup The OTFB implementation for the EIC has been described with proper delay and phase equalizer settings: in this paper. Along with the testing methods already men- tioned, the OTFB will be further validated with beam during an Accelerator Physics Experiment (APEX) at RHIC. While most of the desired functionality has been achieved, there still remain slight fixes that are needed along with some additional features. Firstly, in certain circumstances, the fractional delay FIR filter performance is limited by numeri- cal errors. Specifically the combination of the double-comb response together with the fractional delay filter causes nu- merical errors. This can be addressed by increasing the taps of the FIR filter or by increasing the coefficient bit width. Secondly, the OTFB needs to be able to deal with a ramping revolution frequency, potential methods of dealing with this Figure 11: Fully optimized OTFB problem have been proposed by others [9]. ACKNOWLEDGMENTS Symposium on Circuits and Systems, Seattle, WA, USA, 1995, pp. 361-364 vol.1, doi: 10.1109/ISCAS.1995.521525 Iโ€™d like to thank Geetha Narayan, Freddy Severino, and [5] https://www.cocotb.org/ Kevin Mernick for their support and advice throughout the duration of this project. [6] https://github.com/ghdl/ghdl [7] S. Mai. (2025). "Baseband digital network analyzer upgrade for llrf controllers" REFERENCES [8] Teytelman, Dmitry. โ€œA Non-invasive Technique for Configur- [1] Garoby, Roland. (1999). "Low level RF and feedback." ing Low Level RF Feedback Loops in PEP-II.โ€ , no. 2005. 10.1142/9789814447324_0012. [9] F. Javier Galindo Guarch, Philippe Baudrenghien, J. Manuel [2] G. Hagmann, P. Baudrenghien, J. Betz, J. Egli, F. J. Galindo Moreno Arostegui, "A new beam synchronous processing ar- Guarch, G. Kotzian, M. Rizzi, L. Schmid, A. Spierer and chitecture with a fixed frequency processing clock. Application T. Wล‚ostowski, "The CERN SPS Low Level RF upgrade to transient beam loading compensation in the CERN SPS ma- project," doi:10.18429/JACoW-IPAC2019-THPRB082 chine." 2021, https://doi.org/10.1016/j.nima.2020.164894. [10] P. A. Regalia, S. K. Mitra and P. P. Vaidyanathan, "The digital [3] Pedersen, F. (1992). โ€œrf cavity feedback.โ€ all-pass filter: a versatile signal processing building block," in [4] V. Valimaki, "A new filter implementation strategy for La- Proceedings of the IEEE, vol. 76, no. 1, pp. 19-37, Jan. 1988, grange interpolation," Proceedings of ISCASโ€™95 - International doi: 10.1109/5.3286.