# FPGA Correlator for Applications in Embedded Smart Devices

^{*}

## Abstract

**:**

## 1. Introduction

## 2. Methods

#### 2.1. Discrete Correlation

#### 2.2. FPGA Correlator Design

#### 2.2.1. Single-Lag Correlator Module

#### 2.2.2. Eight-Lag Correlator Module

#### 2.2.3. Multi-Tau Correlator

#### 2.2.4. Normalization of the Correlation Values

^{N}, where N is the number of combiner stages that the input data went through to generate that output. In our multi-tau correlator, there is no scaling necessary for the first 16 correlation values. For the next eight correlation values, the outputs need to be scaled down by a factor of 4. The scale factor will be quadrupled every eight lags thereafter. The scaling module takes advantage of the format of an IEEE 754 single-precision floating-point value, which breaks up the binary of the single-precision floating-point value into three parts: a sign bit, an 8-bit exponent, and a 23-bit fraction. The value represented by these parts is given by the expression ${\left(-1\right)}^{s}\times {2}^{E-127}\times \left(1\times {f}_{1}{f}_{2}\dots {f}_{23}\right)$ where $s$ is the sign, $E$ is the exponent, and ${f}_{i}$ are the fraction bits. Since the divisor is an exponent of 2, the division can be done by subtracting the value 2 from the exponent directly. This avoids the need for another floating-point IP for the division. The scaler module, shown in Figure 8, has two inputs, the single-precision floating-point data Din and the signal ND indicating when Din is valid. A 3-bit counter is used to count the ND pulses so that the value can be scaled down appropriately. With the exception of the first round of counts, each time the counter reaches 7, it increments the value to subtract from the exponent of the floating-point number by 2 and stores it in the DivReg register. This achieves division by 1 for the first 16 values and division by an increasing exponent of 4 for each subsequent group of 8, which cancels the quadrupling effect of the combiner modules. This module generates the final normalized 32-bit single-precision floating-point output values for the multi-tau correlation. This scaler is appended to the output of the previously described normalizer module when a multi-tau correlator is being made. The module has the latency of one FPGA clock.

#### 2.3. Test Bench Setup

## 3. Results

#### 3.1. Linear Correlator

^{6}, and the correlation is a cosine function, as shown in Figure 14.

#### 3.2. Multi-Tau Correlation

#### 3.3. Performance

## 4. Discussion

## Author Contributions

## Funding

## Institutional Review Board Statement

## Informed Consent Statement

## Data Availability Statement

## Conflicts of Interest

## References

- Horvatic, D.; Stanley, H.E.; Podobnik, B. Detrended cross-correlation analysis for non-stationary time series with periodic trends. Epl
**2011**, 94, 6. [Google Scholar] [CrossRef] [Green Version] - Benesty, J.; Chen, J.D.; Huang, Y.T. Time-delay estimation via linear interpolation and cross correlation. IEEE Trans. Speech Audio Processing
**2004**, 12, 509–519. [Google Scholar] [CrossRef] - Susek, W.; Stec, B. Through-the-wall detection of human activities using a noise radar with microwave quadrature correlator. IEEE Trans. Aerosp. Electron. Syst.
**2015**, 51, 759–764. [Google Scholar] [CrossRef] - Smith, S.; Narayanan, R.M. Cross-Correlation Analysis of Noise Radar Signals Propagating Through Lossy Dispersive Media; Spie-Int Soc Optical Engineering: Orlando, FL, USA, 2011. [Google Scholar]
- Mudassar, A.A.; Butt, S. Improved digital image correlation method. Opt. Lasers Eng.
**2016**, 87, 156–167. [Google Scholar] [CrossRef] - Sutton, M.A.; Orteu, J.J.; Schreier, H.W.; Sutton, M.A.; Orteu, J.J.; Schreier, H.W. Digital Image Correlation (dic); Springer: New York, NY, USA, 2009; pp. 81–117. [Google Scholar]
- Sweeney, K.T.; McLoone, S.F.; Ward, T.E. The use of ensemble empirical mode decomposition with canonical correlation analysis as a novel artifact removal technique. IEEE Trans. Biomed. Eng.
**2013**, 60, 97–105. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Bin Ramli, A.; Ahmad, P.A. Correlation Analysis for Abnormal Ecg Signal Features Extraction. In Proceedings of the 4th National Conference on Telecommunication Technology (NCTT 2003), Shah Alam, Malaysia, 14–15 January 2003; pp. 232–237. [Google Scholar]
- Jiang, L.X.; Zhang, L.G.; Li, C.Q.; Wu, J. A correlation-based feature weighting filter for naive bayes. IEEE Trans. Knowl. Data Eng.
**2019**, 31, 201–213. [Google Scholar] [CrossRef] - Durduran, T.; Yodh, A.G. Diffuse correlation spectroscopy for non-invasive, micro-vascular cerebral blood flow measurement. Neuroimage
**2014**, 85, 51–63. [Google Scholar] [CrossRef] [Green Version] - Stetefeld, J.; McKenna, S.A.; Patel, T.R. Dynamic light scattering: A practical guid and applications in biomedical sciences. Biophys. Rev.
**2016**, 8, 409–427. [Google Scholar] [CrossRef] - Yu, L.; Lei, Y.Z.; Ma, Y.; Liu, M.; Zheng, J.J.; Dan, D.; Gao, P. A comprehensive review of fluorescence correlation spectroscopy. Front. Phys.
**2021**, 9, 21. [Google Scholar] [CrossRef] - Krichevsky, O.; Bonnet, G. Fluorescence correlation spectroscopy: The technique and its applications. Rep. Prog. Phys.
**2002**, 65, 251–297. [Google Scholar] [CrossRef] - Magatti, D.; Ferri, F. Fast multi-tau real-time software correlator for dynamic light scattering. Appl Opt.
**2001**, 40, 4011–4021. [Google Scholar] [CrossRef] [PubMed] - Asif, M.; Guo, X.Z.; Hu, A.Y.; Miao, J.G. An FPGA-based 1-ghz, 128 x 128 cross-correlator for aperture synthesis imaging. IEEE Trans. Very Large Scale Integr. (VLSI) Syst.
**2020**, 28, 129–141. [Google Scholar] [CrossRef] - Guo, X.Z.; Asif, M.; Hu, A.Y.; Li, Z.P.; Miao, J.G. A 1-ghz 64-channel cross-correlation system for real-time interferometric aperture synthesis imaging. Sensors
**2019**, 19, 1739. [Google Scholar] [CrossRef] [PubMed] [Green Version] - Asif, M.; Guo, X.Z.; Zhang, J.; Miao, J.G. An FPGA Based 1.6 ghz Cross-Correlator for Synthetic Aperture Interferometric Radiometer. In Proceedings of the Progress in Electromagnetics Research Symposium—Fall (PIERS—FALL), Singapore, 19–22 November 2017; pp. 1078–1085. [Google Scholar]
- Alvarez, F.J.; Hernandez, A.; Urena, J.; Mazo, M.; Garcia, J.J.; Jimenez, J.A.; Jimenez, A. Real-time implementation of an efficient correlator for complementary sets of four sequences applied to ultrasonic pulse compression systems. Microprocess. Microsyst.
**2006**, 30, 43–51. [Google Scholar] [CrossRef] - Islambek, A.; Yang, K.C.; Li, W.; Li, K. FPGA -based real-time autocorrelator and its application in dynamic light scattering. Optik
**2019**, 194, 6. [Google Scholar] [CrossRef] [Green Version] - Liu, W.; Shen, J.; Sun, X.M. Design of Multiple-tau Photon Correlation System Implemented by FPGA. In Proceedings of the 5th International Conference on Embedded Software and Systems, Chengdu, China, 29–31 July 2008; pp. 410–414. [Google Scholar]
- Buchholz, J.; Krieger, J.W.; Mocsar, G.; Kreith, B.; Charbon, E.; Vamosi, G.; Kebschull, U.; Langowski, J. FPGA implementation of a 32x32 autocorrelator array for analysis of fast image series. Opt. Express
**2012**, 20, 17767–17782. [Google Scholar] [CrossRef] [Green Version] - Xilinx. Cordic v6.0 Logicore Ip Product Guide; Xilinx: Santa Clara, CA, USA, 2016. [Google Scholar]
- Xilinx. 7 Series DSP48e1 Slice User Manual; Xilinx: Santa Clara, CA, USA, 2018. [Google Scholar]
- IEEE. IEEE Standard for Binary Floating-Point Arithmetic; IEEE: New York, NY, USA, 1985. [Google Scholar]
- Parthasarathy, A.B.; Gannon, K.; Baker, W.B.; Favilla, C.G.; Balu, R.; Kasner, S.E.; Yodh, A.G.; Detre, J.A.; Mullen, M.T. Dynamic autoregulation of cerebral blood flow measured non-invasively with fast diffuse correlation spectroscopy. J. Cereb Blood Flow Metab.
**2018**, 38, 230–240. [Google Scholar] [CrossRef] [Green Version] - Liu, W.H.; Qian, R.B.; Xu, S.Q.; Konda, P.C.; Jonsson, J.; Harfouche, M.; Borycki, D.; Cooke, C.; Berrocal, E.; Dai, Q.H.; et al. Fast and sensitive diffuse correlation spectroscopy with highly parallelized single photon detection. APL Photonics.
**2021**, 6, 026106. [Google Scholar] [CrossRef] - Li, Z.; Ge, Q.; Feng, J.; Jia, K.; Zhao, J. Quantification of blood flow index in diffuse correlation spectroscopy using long short-term memory architecture. Biomed. Optics Express.
**2021**, 12, 4131–4146. [Google Scholar] [CrossRef] - Schintke, S.; Frau, E. Modulated 3d cross-correlation dynamic light scattering applications for optical biosensing and time-dependent monitoring of nanoparticle-biofluid interactions. Appl. Sci. Basel.
**2020**, 10, 8969. [Google Scholar] [CrossRef] - Zheng, T.Y.; Bott, S.; Huo, Q. Techniques for accurate sizing of gold nanoparticles using dynamic light scattering with particular application to chemical and biological sensing based on aggregate formation. ACS Appl. Mater. Interfaces
**2016**, 8, 21585–21594. [Google Scholar] [CrossRef] [PubMed] - Levin, A.D.; Ringaci, A.; Alenichev, M.K.; Drozhzhennikova, E.B.; Shevchenko, K.G.; Cherkasov, V.R.; Nikitin, M.P.; Nikitin, P.I. Dynamic light scattering biosensing based on analyte-induced inhibition of nanoparticle aggregation. Anal. Bioanal. Chem.
**2020**, 412, 3423–3431. [Google Scholar] [CrossRef] - Martinez-Moro, M.; Di Silvio, D.; Moya, S.E. Fluorescence correlation spectroscopy as a tool for the study of the intracellular dynamics and biological fate of protein corona. Biophys. Chem.
**2019**, 253, 106218. [Google Scholar] [CrossRef] [PubMed] - Lin, W.; Busch, D.R.; Goh, C.C.; Barsi, J.; Floyd, T.F. Diffuse correlation spectroscopy analysis implemented on a field programmable gate array. IEEE Access
**2019**, 7, 122503–122512. [Google Scholar] [CrossRef] [PubMed]

**Figure 1.**Functional block diagram of the SLC module that calculates the correlation value of single lag.

**Figure 2.**Waveforms of inputs and outputs for the SLC module. All values shown are in hexadecimal. The validity of the data is flagged by the corresponding active high valid signal.

**Figure 3.**Creation of an 8-LC module from the SLC module. It has the same inputs and outputs as the SLC module.

**Figure 4.**Waveforms of inputs and outputs for the 8-LC module. All values shown are in hexadecimal and are valid when their corresponding validation signals are active high.

**Figure 5.**Functional block diagram of the combiner module. Reset signal (not shown in the figure) clears all registers in the module.

**Figure 6.**Waveforms of inputs and outputs for the combiner module. The Aout and Bout combine two consecutive values from Ain and Bin. The Rdy signal is active high every two valid ND pulses.

**Figure 7.**The diagram of the normalizer module. The INT to SP modules convert the integer inputs Din and N to single-precision floating-point numbers. The Rdy from either INT to SP module is used as the ND input of the division module (DIV X/Y) because both Rdy signals are already synchronized.

**Figure 8.**Functional block diagram of the scaler module. The input Din is a single-precision correlation value from the normalizer module. Dout is the final correlation value. Reset signal (not shown in the figure) clears all registers in the module.

**Figure 9.**Linear correlator of 80 correlation values output. Input data are supplied to Ain and Bin with the control signals ND and EOD. The output of the correlator is from the Dout of the normalizer module. The Din and Nin of the last 8-LC module are set to zero and the DND is set to low.

**Figure 10.**Multi-tau correlator of 80 correlation values output. Input data are supplied to Ain and Bin with the control signals ND and EOD. The output of the correlator is from the Dout of the scaler module. The Din and Nin of the last 8-LC module are set to zero and the DND is set to low.

**Figure 11.**The test bench includes the MicroBlaze processor and the FPGA correlator, which can be configured with either the linear or multi-tau correlator. The DMA controller has a write channel to send data to the correlator and a read channel to receive the data from the correlator. The test bench was implemented on the Arty A7 board.

**Figure 12.**The outputs of 80 correlation lags from the linear FPGA correlator and the linear software correlator when the input data are constants of 1.

**Figure 13.**The outputs of 80 correlation lags of a pulse with 30 data points of value 1 followed by 970 zeros from the linear FPGA correlator and the software correlator.

**Figure 14.**The outputs of 80 correlation lags of a sine signal with the amplitude of 2047 and the period of 20 data points from the FPGA correlator and the software correlator.

**Figure 15.**The outputs of 80 correlation lags from the multi-tau FPGA correlator and the multi-tau software correlator when the input data are constants of 1. The correlation lag doubles every 8 lags after the initial 16 lags.

**Figure 16.**The outputs of 80 correlation lags of a pulse with 1000 data points of value 100 followed by 9000 zeros from the multi-tau FPGA correlator and the software correlator. The correlation lag doubles every 8 lags after the initial 16 lags.

**Figure 17.**The outputs of 80 correlation lags of a sine signal with the amplitude of 31 and the period of 4000 data points from the multi-tau FPGA correlator and the software correlator. The correlation lag doubles every 8 lags after the initial 16 lags.

**Figure 18.**FPGA multi-tau correlator in an embedded diffuse correlation spectroscopy device using a microprocessor.

Signal | Description |
---|---|

Ain | The first input data series in the format of a 16-bit signed integer. |

Bin | The second input data series in the format of a 16-bit signed integer. |

ND | Active high signal to indicate valid data at Ain and Bin. |

EODin | Active high signal indicating the input of the last data point. |

Aout | Direct output of Ain. |

Bout | Delayed output of Bin based on the ND signal. |

Rdy | Active high signal to indicate valid data at Aout and Bout. |

EODout | Direct output of EODin. |

Dout | The output of the raw correlation value in the format of a 32-bit signed integer. |

Nout | The output of the number of data points used in the calculation of the raw correlation value at the output Dout. It is in the format of a 16-bit signed integer. |

DRdy | Active high signal to indicate valid data at Dout and Nout. |

Din | The input of the raw correlation values from the following cascaded correlation module in the format of a 32-bit signed integer. |

Nin | The input of the number of data points used to calculate the raw correlation value at the input Din. It is in the format of a 16-bit signed integer. |

DND | Active high signal to indicate valid data at Din and Nin. |

Reset | Active high signal to reset the registers in the module (not shown in figures). |

Clock | FPGA working clock (not shown in figures). |

Signal Type | MSE |
---|---|

Constant | 0 |

Pulse | 0 |

Sine | 0 |

Signal Type | MSE |
---|---|

Constant | 0 |

Pulse | 0 |

Sine | 0 |

Correlator Type | Signal Type | Data Size | Time (FPGA) | Time (Software) | FPGA:Software |
---|---|---|---|---|---|

Linear | Constant | 1000 | 140 ns | 12.11 ms | 1:86,500 |

Pulse | 1000 | 140 ns | 11.91 ms | 1:85,070 | |

Sine | 1000 | 140 ns | 12.11 ms | 1:86,500 | |

Multi-tau | Constant | 10,000 | 150 ns | 39.96 ms | 1:266,400 |

Pulse | 10,000 | 150 ns | 39.85 ms | 1:265,700 | |

Sine | 20,000 | 150 ns | 78.93 ms | 1:526,200 |

FPGA Correlator | Software Correlator |
---|---|

Parallel data processing | Serial data processing |

Computation time is independent of data size. | Computation time is dependent on the data size. |

Computation can be finished within one microsecond. | Computation can be finished over dozens of milliseconds. |

Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |

© 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).

## Share and Cite

**MDPI and ACS Style**

Moore, C.H.; Lin, W.
FPGA Correlator for Applications in Embedded Smart Devices. *Biosensors* **2022**, *12*, 236.
https://doi.org/10.3390/bios12040236

**AMA Style**

Moore CH, Lin W.
FPGA Correlator for Applications in Embedded Smart Devices. *Biosensors*. 2022; 12(4):236.
https://doi.org/10.3390/bios12040236

**Chicago/Turabian Style**

Moore, Christopher H., and Wei Lin.
2022. "FPGA Correlator for Applications in Embedded Smart Devices" *Biosensors* 12, no. 4: 236.
https://doi.org/10.3390/bios12040236