High-precision time interval measurement system based on FPGA
By combining coarse measurement and fine measurement modules on the FPGA platform, using the Nut-Interpolation method and Wave Union technology, the problem of TDL measurement range and accuracy limitation is solved, achieving high-precision and extensive time measurement.
Patent Information
- Application Number
- CN202411341615.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-11-08
AI Technical Summary
The existing time measurement system based on tap delay line (TDL) has limitations in the measurement range and accuracy, making it difficult to achieve a longer time measurement range and high accuracy.
Using a high-precision time interval measurement system based on FPGA, combined with a coarse measurement module and a fine measurement module, the Nut-Interpolation method combined with a counter and tap delay line can realize time measurements greater than one system clock cycle, and through the Wave Union method and biphasic sampling technology improves measurement resolution and range.
在保证测量精度的前提下,扩大了时间测量范围,提高了测量分辨率和抗扰特性,解决了TDL测量范围小和精度低的问题。
Smart Images

Figure CN118915416A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to a high-precision time interval measurement system based on FPGA, and belongs to the technical field of high-precision time measurement. Background Art
[0002] The working principle of time measurement using a tapped delay line (TDL) is as follows Figure 1 As shown. Where τ is the delay time through a single delay unit. The Tri signal is input into the TDL circuit and propagates in the TDL. When the clock rising edge signal arrives, the register samples the output state of the TDL and records the number of delay units n at this time. The measured value of the measured time interval t = n*τ can be obtained. The resolution of TDC depends on the delay time of the delay unit. The smaller the delay time τ of the delay unit, the higher the resolution. In FPGA, the carry logic resource is generally called to construct the TDL circuit.
[0003] When constructing TDL in FPGA, due to the nonlinearity of the delay unit, in order to obtain higher measurement accuracy and reduce measurement errors, the code density calibration method is selected to calibrate the delay unit. The introduction of the calibration circuit can effectively reduce the impact of factors such as temperature changes, electromagnetic interference, and voltage instability on the TDC measurement accuracy. For problems such as code loss and bubbles in the TDL circuit, other optimization methods need to be introduced.
[0004] Although the time resolution of a TDL composed of several delay units is high, the total measurement time is proportional to the length of the TDL, and it is still difficult to obtain a longer time measurement range. Summary of the invention
[0005] In view of the problem that the existing time measurement method using TDL has a small time measurement range, the present invention provides a high-precision time interval measurement system based on FPGA.
[0006] A high-precision time interval measurement system based on FPGA of the present invention comprises:
[0007] The coarse measurement module is used to measure the time greater than one system clock cycle using a counter; the coarse measurement result is expressed as T coarse ;
[0008] The fine measurement module is used to measure the time less than one system clock cycle using a tapped delay line. The fine measurement result is expressed as T fine , including the time interval T between the start signal Start and the first adjacent system clock rising edge fine1 The time interval T between the stop signal End and the first adjacent rising edge of the system clock fine2 ;
[0009] The measurement time interval T between the start signal Start and the stop signal End is obtained by the coarse measurement module and the fine measurement module. m :
[0010] T m =T coarse +T fine1 -T fine2 ,
[0011] T m =N*T CLK +T fine1 -T fine2 ,
[0012] Where N is the number of system clock cycles, T CLK The system clock cycle is long.
[0013] According to the FPGA-based high-precision time interval measurement system of the present invention, the coarse measurement module includes multiple groups of start general counter groups and multiple groups of end general counter groups; two general counters in each general counter group are driven by a positive phase system clock and a negative phase system clock respectively, and the frequency of the system clock is 300MHz;
[0014] When the start signal Start arrives, all start general counter groups start working; in each start general counter group, the start general counter driven by the positive system clock or the start general counter driven by the negative system clock starts counting first; when the stop signal End arrives, all end general counter groups start working; in each end general counter group, the end general counter driven by the positive system clock or the end general counter driven by the negative system clock starts counting first.
[0015] According to the FPGA-based high-precision time interval measurement system of the present invention, the general counter adopts a Gray code counter;
[0016] The rough measurement result T of the rough measurement module coarse The working state of the counter is judged by the calculation module, and the corresponding rough measurement value is calculated; the rough measurement value is determined by the average value of the measurement values of the corresponding general counter group.
[0017] According to the FPGA-based high-precision time interval measurement system of the present invention, the measurement system is implemented based on Xilinx UltraScale+ series FPGA;
[0018] The fine measurement module constructs a tapped delay line including multiple delay units by cascading CARRY8 units in multiple slices;
[0019] The O tap and CO tap corresponding to the data selector of the CARRY8 unit are brought out and sampled by the register. Each CARRY8 unit brings out 16 lead-out taps as 16 sampling points of the complex sampling method.
[0020] The Wave Union method is used to configure the start signal Start and the stop signal End to the selected input point of the tapped delay line to segment the CARRY8 unit, and the time information contained in each start signal Start and the stop signal End is recorded to achieve multiple measurements of the start signal Start and the stop signal End; the selected input point allows a margin within a set range between the edges of the start signal Start and the stop signal End.
[0021] According to the FPGA-based high-precision time interval measurement system of the present invention, the fine measurement module is based on a dual-phase sampling method and uses two tapped delay lines with a delay time greater than half the system clock cycle length to obtain a fine measurement result T fine , and then take the average value as the final fine measurement value.
[0022] According to the FPGA-based high-precision time interval measurement system of the present invention, for the final fine measurement value of the fine measurement module, a combination of DSP unit and LUT is used, and Popcount is used based on complex sampling to encode the state of the tap delay line; for the number of 1s in the taps with a bit number of 1-6 bits, LUT is used for encoding; for the number of 1s in the taps with a bit number of 7 bits or more, DSP unit is used for encoding.
[0023] According to the FPGA-based high-precision time interval measurement system of the present invention, the tap delay line includes 72 CARRY8 units, with a total of 72*16 taps;
[0024] First, LUT is used for encoding to obtain the number of 1s in 12 7-bit taps; then DSP unit is used to obtain the number of 1s in all taps.
[0025] According to the FPGA-based high-precision time interval measurement system of the present invention, the method of using LUT for encoding is:
[0026] Based on the branching method, LUT is used to add the taps derived from the CARRY8 unit in pairs to obtain the number of 1s in the taps of the tapped delay line;
[0027] Specifically:
[0028] The 16 taps of each CARRY8 unit are taken as a group, and the number of 1s in the 16 taps is added in parallel in pairs to obtain the number of 1s in 8 digits of 2-bit taps, and the number of 1s in 8 digits of 2-bit taps is added in parallel in pairs to obtain the number of 1s in 4 digits of 3-bit taps; the number of 1s in 4 digits of 3-bit taps is added in pairs in parallel to obtain the number of 1s in 2 digits of 4-bit taps; the number of 1s in 2 digits of 4-bit taps is added in pairs in parallel to obtain the number of 1s in 1 digit of 5-bit tap;
[0029] The number of 1s in 72 5-bit taps is obtained from 72 CARRY8 units; the number of 1s in the taps of the 72 CARRY8 units is added in parallel in pairs to obtain the number of 1s in 36 6-bit taps; the number of 1s in the 36 6-bit taps is divided into 12 groups, and the number of 1s in 3 6-bit taps is 1 group; the number of 1s in 1 6-bit tap is the sum of the number of 1s in all taps of 2 CARRY8 units, and the maximum value is 32. The number of 1s in 2 6-bit taps is added to obtain the number of 1s in 1 7-bit tap, and the maximum value is 64; the number of 1s in the 7-bit tap obtained is added to the number of 1s in 1 6-bit tap, and the maximum value is 96; then the number of 1s in 12 groups of 3 6-bit taps is added in parallel to obtain the number of 1s in 12 7-bit taps.
[0030] According to the FPGA-based high-precision time interval measurement system of the present invention, the method of encoding using the DSP unit is:
[0031] Based on the branching method, the DSP unit is used to encode the encoding result of the LUT;
[0032] Specifically:
[0033] Configure the corresponding DSP unit to TWO24 mode, add the numbers of 1 in 12 7-bit taps in parallel, and get the numbers of 1 in 6 8-bit taps; then add the numbers of 1 in 6 8-bit taps in parallel, and get the numbers of 1 in 3 groups of 9-bit taps;
[0034] Then configure the corresponding DSP unit to TWO12 mode, first add the number of 1s in a group of 9-bit taps in parallel to obtain the number of 1s in a 10-bit tap; then add the number of 1s in the 10-bit tap and the number of 1s in the other two groups of 9-bit taps to obtain the number of 1s in all taps.
[0035] According to the high-precision time interval measurement system based on FPGA of the present invention, the encoding result of the DSP unit is further encoded:
[0036] The number of 1s in all taps obtained based on complex sampling is used as the position code of the first rising edge of the start signal Start or the stop signal End in the system clock cycle, the position interval of the second rising edge of the system clock cycle is obtained by subtracting the number of 1s corresponding to the first pulse width set from the position code of the first rising edge, the number of 1s in all taps before the second rising edge is obtained by Popcount coding as the position code of the second rising edge, and the position codes of the two rising edges are added to obtain the final fine measurement result code;
[0037] The first pulse width is 1 CARRY8 unit; the interval between the first rising edge and the second rising edge is 7 CARRY8 units.
[0038] Beneficial effects of the present invention: The system of the present invention adopts a method combining coarse measurement with fine measurement, namely the Nut-Interpolation method, to increase the measurement range under the premise of ensuring measurement accuracy. Coarse measurement refers to the use of a counter to achieve time measurement greater than one system clock cycle; fine measurement refers to the use of TDL to achieve time measurement less than one system clock cycle. Coarse measurement determines the measurement range of TDC, and fine measurement determines the measurement resolution of TDC. The combination of coarse measurement and fine measurement jointly realizes the TDC measurement function. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 This is a schematic diagram of the working principle of TDL;
[0040] Figure 2 It is a schematic diagram of the measurement principle of the Nut-Interpolation method; in the figure, CLK is the system clock signal;
[0041] Figure 3 It is a schematic diagram of the overall structure of the high-precision time interval measurement system based on FPGA of the present invention;
[0042] Figure 4 is a schematic diagram of the structure of the coarse measurement module; in the figure, CLK_n is the inverted system clock signal;
[0043] Figure 5 This is the structural diagram of the CARRY8 unit; in the figure, DI0-DI7 are the external input ports of the data selector, S0-S7 are the control ports of the data selector, COUT is the carry output port of the CARRY8 unit, mux is the data selector, D is the register input port, Q is the register output port, D0-D 15It is the output port of 16 registers, CIN is the carry input port of CARRY8 unit, CLB is Configurable Logic Block, CARRY8 is a part of CLB;
[0044] Figure 6 It is the structural diagram and working waveform diagram of TDL based on complex sampling and Wave Union A method;
[0045] Figure 7 It is a schematic diagram of the dual-phase sampling principle;
[0046] Figure 8 This is a schematic diagram of the encoding principle of the LUT part in Popcount encoding;
[0047] Fig. 9 This is a schematic diagram of the DSP coding principle in Popcount coding;
[0048] Fig.10 This is a schematic diagram of DSP48 encoding;
[0049] Fig.11 This is a schematic diagram of the Popcount coding principle of TDL based on complex sampling and Wave Union A method;
[0050] Fig.12 This is a schematic diagram of the Popcount encoding process of TDL based on complex sampling and Wave Union A method;
[0051] Fig.13 It is a schematic diagram of the dual-phase sampling result judgment process;
[0052] Fig.14 It is a schematic diagram of TDL measurement correction;
[0053] Fig.15 It is a calculation flow chart of the measurement data. DETAILED DESCRIPTION
[0054] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0055] It should be noted that, in the absence of conflict, the embodiments of the present invention and the features in the embodiments may be combined with each other.
[0056] The present invention will be further described below in conjunction with the accompanying drawings and specific embodiments, but they are not intended to limit the present invention.
[0057] Specific implementation method 1. Combination Figures 1 to 3 As shown, the present invention provides a high-precision time interval measurement system based on FPGA, comprising:
[0058] The coarse measurement module is used to measure the time greater than one system clock cycle using a counter; the coarse measurement result is expressed as T coarse ;
[0059] The fine measurement module is used to measure the time less than one system clock cycle using a tapped delay line. The fine measurement result is expressed as T fine , including the time interval T between the start signal Start and the first adjacent system clock rising edge fine1 The time interval T between the stop signal End and the first adjacent rising edge of the system clock fine2 ;
[0060] The measurement time interval T between the start signal Start and the stop signal End is obtained by the coarse measurement module and the fine measurement module. m :
[0061] T m =T coarse +T fine1 -T fine2 ,
[0062] T m =N*T CLK +T fine1 -T fine2 ,
[0063] Where N is the number of system clock cycles, T CLK The system clock cycle is long.
[0064] According to the measurement scheme combining coarse measurement and fine measurement in this embodiment, the overall structure of the TDC system can be designed as follows: Figure 3 As shown in the figure. The TDC system mainly consists of five modules: fine measurement module, coarse measurement module, calibration module, data reading and transmission module, and calculation module. According to the hardware platform architecture used, the hardware platform performance and resources are fully utilized to implement the coarse measurement module, fine measurement module, calibration module, and data reading and transmission module on the PL side; and the calculation module is implemented on the PS side.
[0065] Further, the coarse measurement module includes multiple groups of start general counter groups and multiple groups of end general counter groups as the main parts; the two general counters in each general counter group are driven by the positive phase system clock and the negative phase system clock respectively, and the frequency of the system clock is 300MHz; because the fine measurement module adopts positive and negative phase clock sampling, the equivalent sampling frequency of TDC is increased to 600MHz; the TDC system clock signal includes two clock signals, positive phase 300MHz clock and negative phase 300MHz clock. The structure of the coarse measurement module is as follows Figure 4 shown.
[0066] When the start signal Start arrives, all the start general counter groups start working. Since the arrival time of the trigger signal is completely random, the working state of the start general counter will change with the arrival time of each trigger signal. According to the timing relationship between the arrival time of the external trigger signal and the system clock signal, the working state of the two start general counters in each group can be roughly divided into two situations: the start general counter driven by the positive system clock or the start general counter driven by the negative system clock in each start general counter group starts counting first;
[0067] When the stop signal End arrives, all end general counter groups start working; the same as the start counter, since the arrival time of the trigger signal is completely random, the working status of the two end general counters in each group will change with the arrival time of each trigger signal, and is also divided into the above two situations: in each end general counter group, the end general counter driven by the positive system clock or the end general counter driven by the negative system clock starts counting first.
[0068] After a fixed time interval after the end signal arrives, the coarse measurement module generates a count stop signal, and the general counter stops counting to obtain the coarse measurement value. The coarse measurement value is transmitted to the PS end, and several working states of the coarse measurement counter are judged, and the measurement time is calculated.
[0069] In actual operation, due to the high clock frequency and the simultaneous flipping of multiple bits of signals in an ordinary binary code counter, the counter may have counting errors due to the difference in the flipping time of each bit signal. In order to reduce this instability and reduce the occurrence of metastable phenomena, as an example, the universal counter adopts a Gray code counter; compared with an ordinary binary code counter, the Gray code counter has only one bit flipped when the rising edge of the clock signal arrives, which improves the stability of the counter and reduces the bit error rate.
[0070] The rough measurement result T of the rough measurement module coarseThe working state of the counter is judged by the calculation module, and the corresponding rough measurement value is calculated; the rough measurement value is determined by the average value of the measurement values of the corresponding universal counter group, which further reduces the probability of rough measurement error.
[0071] It can be seen from the overall system solution that the fine measurement module of this embodiment is implemented based on TDL. The design of the fine measurement module is divided into two parts, TDL design and coding design, which together determine the measurement resolution, measurement accuracy and resource occupancy of the fine measurement module.
[0072] The logic resources in Xilinx FPGA are allocated in slices. TDL can be constructed by cascading CARRY units in multiple slices. In the process of constructing TDL, due to the carry-lookahead characteristic of the CARRY unit, the signal will not reach each tap of the CARRY unit in sequence when it propagates in the CARRY unit. The signal will first reach some taps far away from the input port of the CARRY unit. Due to the above characteristics, when the register is used to latch the data of each delay unit in TDL, the data is not a standard thermometer code, such as "11111111000000", but a non-thermometer code that produces a "bubble" phenomenon, such as "11110011011000", which makes encoding difficult. In order to encode the time information recorded by TDL and simplify the encoding difficulty, some scholars discard some carry-lookahead taps in the CARRY unit and only bring out the taps with better linearity among the CARRY unit taps. This method makes the linearity of TDC better and there is no "bubble" phenomenon, but only some taps are brought out, and the resolution of TDC and the utilization rate of CARRY unit are low. Other scholars reorder all the taps in TDL according to the actual time when the signal appears in TDL. After the taps of TDL are reordered, the data sampled in actual operation is thermometer code, but when the temperature and voltage change, the characteristics of the taps may change, making the order invalid and causing measurement errors. Some scholars have focused their research on the coding strategy of TDL, so that the coding can ignore the "bubble" and get the time of signal propagation in TDL, but doing so will complicate the coding and consume a lot of resources.
[0073] In this implementation, in order to improve the resolution of TDC and make the whole solution have certain anti-interference characteristics while simplifying the coding difficulty, the underlying hardware structure of FPGA is deeply studied, so that the measurement system is implemented based on Xilinx UltraScale+ series FPGA; the CARRY unit is a CARRY8 unit, Figure 5 The structure of the CARRY8 unit is shown.
[0074] The fine measurement module constructs a tapped delay line including multiple delay units by cascading CARRY8 units in multiple slices;
[0075] The CARRY8 unit has 8 data selectors, each of which corresponds to two registers. Based on this structure, the state of a data selector can be sampled twice. The O tap and CO tap corresponding to the data selector of the CARRY8 unit are brought out and sampled by the register. Each CARRY8 unit brings out 16 taps as 16 sampling points of the complex sampling method.
[0076] The sampling time range of TDL is determined by three parts: the first part is the logic delay of the CARRY8 unit, the second part is the wiring delay of the CARRY8 unit tap routed to the sampling register, and the third part is the sampling delay caused by the clock wiring. For the O tap and CO tap derived from a data selector, since the output signal of the O tap and CO tap passes through one more XOR gate than the output signal of the data selector, a delay time is added, and the wiring lengths of the CO tap and O tap routed to the sampling register are different, there are 2 different sampling points for a data selector and 16 different sampling points for a CARRY8 unit. Since the state of each data selector is sampled twice by the register, this method is named complex sampling.
[0077] The complex sampling method is adopted to bring out 16 taps of the CARRY8 unit, and a TDL based on the CARRY8 unit is constructed, which greatly improves the resolution of the TDL.
[0078] The Wave Union method is used to configure the start signal Start and the stop signal End to the selected input point of the tapped delay line to segment the CARRY8 unit, and the time information contained in each start signal Start and the stop signal End is recorded to achieve multiple measurements of the start signal Start and the stop signal End; the selected input point allows a margin within a set range between the edges of the start signal Start and the stop signal End.
[0079] In order to further subdivide the delay unit after all the taps of the CARRY8 unit are brought out to break through the limitations of the inherent delay unit and thus improve the resolution of the TDC, this embodiment uses the Wave Union method to further subdivide the TDL. The WaveUnion method performs multiple measurements on a trigger signal by inputting multiple signals into the TDL and recording the time information contained in the multiple signals. This multiple measurement is equivalent to subdividing the delay unit in the TDL into smaller delay units to obtain a higher time resolution. This embodiment proposes a method of configuring the position of the signal input TDL and leaving a larger margin between multiple signal edges in the TDL, thereby realizing further segmentation of the CARRY8 unit in the UltraScale+ FPGA.
[0080] Instantiate the CARRY8 unit, use registers to sample the states of the multiplexer and XOR gate, cascade the CARRY8 units, input multiple trigger signals at different input points of the TDL, and construct a TDL based on complex sampling and Wave Union A method. The structural diagram and working waveform are shown in Figure 6 .
[0081] Ignoring the non-thermometer code phenomenon, the state of signal propagation in TDL is analyzed. When there is no trigger signal, Tri is low level 0, Tri_n is high level 1, the waveforms of CO tap, O tap output and the output waveform of CO and (~O) combined output are as follows Figure 6 When the trigger signal arrives, Tri is high level 1, Tri_n is low level 0, the waveforms of CO tap, O tap output and the output waveform of CO and (~O) combined output are as shown in Figure 6 As shown. Select different input points of TDL to input trigger signals, and a waveform with two rising edges will be generated in TDL. The two rising edges propagate in TDL at approximately the same rate. Since the delay time of each delay unit is different, the speed of the two rising edges propagating in TDL is inconsistent. The time information of the two rising edges is encoded separately, and a trigger signal is measured twice to achieve the effect of further segmenting the CARRY8 unit. Since sufficient margin is reserved between multiple signal edges, although the propagation speeds of the rising and falling edges in the CARRY8 unit are inconsistent, multiple signal transition edges do not disappear or meet in TDL, and the Wave Union A method can still be used to segment TDL.
[0082] The measurement method based on the combination of coarse measurement and fine measurement, that is, the fine measurement range of the TDC of the Nut-Interpolation method should be at least greater than one coarse measurement clock cycle. In order to reduce the coarse measurement clock frequency and reduce the difficulty of timing constraints, a longer TDL should be used. However, using a TDL that is too long will cause difficulties in the construction of TDL and subsequent encoding modules, and increase resource consumption. There is a contradiction between the coarse measurement clock frequency and the TDL length. In order to reduce the length of TDL while reducing the coarse measurement clock frequency, this embodiment adopts a dual-phase sampling scheme. Two TDLs are sampled separately through positive and negative phase clocks. The delay time of the two TDLs is greater than half a coarse measurement clock cycle. The dual-phase sampling principle is as follows Figure 7 shown.
[0083] based on Figure 7 As shown in the analysis, when the trigger signal is input into TDL within the low level range of the positive phase sampling clock, at the rising edge of the positive phase sampling clock, the signal is still propagating in the positive phase TDL, and the state of TDL sampled is not full. The time information of the trigger signal can be read from the signal obtained by the positive phase TDL sampling, and the positive phase sampling signal is valid. At the rising edge of the negative phase sampling clock, the time that the signal propagates in the negative phase TDL has exceeded half a clock cycle, the signal has been fully propagated in TDL, and the state of TDL sampled is full. The time information of the trigger signal cannot be read from the signal obtained by the negative phase TDL sampling, and the negative phase sampling signal is invalid. When the signal is input into TDL within the high level range of the positive phase sampling clock, at the rising edge of the positive phase sampling clock, the time that the signal propagates in the positive phase TDL has exceeded half a clock cycle, the signal has been fully propagated in TDL, and the state of TDL sampled is full. The time information of the trigger signal cannot be read from the signal obtained by the positive phase TDL sampling, and the positive phase sampling signal is invalid. At the rising edge of the inverted sampling clock, the signal is still propagating in the inverted TDL, and the sampled TDL signal state is not full. The time information of the trigger signal can be read from the signal sampled by the inverted TDL, and the inverted sampling signal is valid.
[0084] In this embodiment, the fine measurement module is based on a dual-phase sampling method, using two tapped delay lines with a delay time greater than half the length of the system clock cycle to measure the fine measurement value of the trigger signal within a clock cycle to obtain a fine measurement result T fine , and then take the average value as the final fine measurement value. The equivalent sampling frequency of TDC is increased to twice the actual sampling clock frequency.
[0085] Since the delay time of each delay unit of TDL is different, TDL is nonlinear, and TDL is easily affected by changes in external environment such as voltage and temperature, using a single TDL TDC is prone to large measurement errors. Using two TDLs to measure the same trigger signal and then averaging it can reduce the impact of the nonlinearity of a single TDL and thus reduce the measurement error.
[0086] Furthermore, for the final fine measurement value of the fine measurement module, a combination of DSP unit and LUT is used to calculate the number of 1s in the tap delay line based on complex sampling using Popcount, and encode the state of the tap delay line; for the number of 1s in taps with a bit number of 1-6 bits, LUT is used for encoding; for the number of 1s in taps with a bit number of 7 bits or more, DSP unit is used for encoding.
[0087] This implementation adopts Popcount coding to calculate the number of 1s in the TDL taps, without the need to accurately know the position of the signal transition in the TDL, and can effectively avoid the difficulty of coding caused by the non-thermometer code phenomenon.
[0088] As an example, the tapped delay line includes 72 CARRY8 units, and the TDL state is sampled by complex sampling, and there are 72*16 taps in total;
[0089] First, LUT is used for encoding to obtain the number of 1s in 12 7-bit taps; then DSP unit is used to obtain the number of 1s in all taps.
[0090] The method of encoding using LUT is:
[0091] Based on the branching method, LUT is used to add the taps derived from the CARRY8 unit in pairs to obtain the number of 1s in the tap delay line, such as Figure 8 As shown;
[0092] Specifically:
[0093] The 16 taps of each CARRY8 unit are taken as a group, and the number of 1s in the 16 taps is added in parallel in pairs to obtain the number of 1s in 8 digits of 2-bit taps, and the number of 1s in 8 digits of 2-bit taps is added in parallel in pairs to obtain the number of 1s in 4 digits of 3-bit taps; the number of 1s in 4 digits of 3-bit taps is added in pairs in parallel to obtain the number of 1s in 2 digits of 4-bit taps; the number of 1s in 2 digits of 4-bit taps is added in pairs in parallel to obtain the number of 1s in 1 digit of 5-bit tap;
[0094] Each CARRY8 unit is added in parallel by the branching method to obtain the number of 1s in a tap with a digit of 5 bits, and the number of 1s in 72 taps with a digit of 5 bits is obtained by 72 CARRY8 units; the number of 1s in the taps of the 72 CARRY8 units is added in parallel in pairs to obtain the number of 1s in 36 taps with a digit of 6 bits; the number of 1s in the 36 taps with a digit of 6 bits is divided into 12 groups, the number of 1s in 3 taps with a digit of 6 bits is 1 group; the number of 1s in 1 tap with a digit of 6 bits is 2 The sum of the number of 1s in all taps of the CARRY8 units is a maximum of 32. The number of 1s in two 6-bit taps is added to get the number of 1s in a 7-bit tap, with a maximum of 64. The number of 1s in the 7-bit tap is added to the number of 1s in a 6-bit tap, with a maximum of 96, which is still a 7-bit number. Then the number of 1s in 12 groups of 3 6-bit taps is added in parallel to get the number of 1s in 12 7-bit taps. After the above calculation using LUT for parallel addition, all taps of 72 CARRY8 units are encoded as the number of 1s in 12 7-bit taps.
[0095] The method of encoding using the DSP unit is:
[0096] Based on the branching method, the DSP unit is used to encode the encoding result of the LUT, such as Fig. 9 As shown;
[0097] Specifically:
[0098] Configure the corresponding DSP unit to TWO24 mode, add the numbers of 1 in 12 7-bit taps in parallel, and get the numbers of 1 in 6 8-bit taps; then add the numbers of 1 in 6 8-bit taps in parallel, and get the numbers of 1 in 3 groups of 9-bit taps;
[0099] Then configure the corresponding DSP unit to TWO12 mode, first perform parallel addition on the number of 1s in a group of 9-bit taps to obtain the number of 1s in a 10-bit tap; then perform addition operation on the number of 1s in the 10-bit tap and the number of 1s in the other two groups of 9-bit taps to obtain the number of 1s in all taps.
[0100] The schematic diagram of DSP coding is as follows Fig.10 As shown in the figure, the DSP unit in UltraScale+FPGA is defined using DSP48E2 primitives. Due to the use of DSP encoding and multiplexing of DSP units, some DSP units are saved while ensuring the fast encoding speed.
[0101] There are multiple signal transition edges in TDL based on complex sampling and Wave Union A method. The time information of multiple signal transition edges can be obtained by sampling TDL state and encoding it. In the actual implementation process of TDL using complex sampling and Wave Union A method, due to factors such as TDL nonlinearity, multiple signal transition edges propagate in TDL, and the encoding results of TDL state obtained by sampling are more diverse, which causes difficulties in encoding. This implementation method designs Popcount encoding of TDL based on complex sampling and Wave Union A method on the basis of Popcount encoding of TDL based on complex sampling. The encoding principle is as follows: Fig.11 Shown
[0102] The encoding result of the DSP unit is further encoded:
[0103] The number of 1s in all taps obtained by the Popcount encoding method of TDL based on complex sampling is used as the position code of the first rising edge of the start signal Start or the stop signal End in the system clock cycle, and the position interval of the second rising edge of the system clock cycle is obtained by subtracting the number of 1s corresponding to the first pulse width set from the position code of the first rising edge. The number of 1s in all taps before the second rising edge is obtained by Popcount encoding as the position code of the second rising edge, and the position codes of the two rising edges are added to obtain the final fine measurement result code; since the Popcount code is at the starting position and the ending position of TDL, which is in a state where the second rising edge has not started to propagate and the first rising edge has finished propagating, there is an unavailable segment in TDL, and TDL is intercepted, and only the available segment is used, and the unavailable segment is used as the inherent delay;
[0104] The position code of the second rising edge is theoretically the position code of the first rising edge minus the number of 1s corresponding to the set first pulse width, and there should be some fluctuations in practice. In the TDL based on complex sampling and WaveUnion A method of this embodiment, the width of the first pulse will gradually increase as the pulse propagates, and the distance between the second rising edge and the first pulse will gradually shorten. Sufficient margin should be left when setting the position of the TDL input trigger signal and designing the code to prevent multiple signal transition edges from disappearing during the propagation process.
[0105] The TDL is constructed using 72 CARRY8 units. When a pulse propagates in the TDL, the maximum distance variation between the rising edge and the falling edge is about 3.6 CARRY8 units.
[0106] According to the above analysis, due to the different propagation speeds of TDL signals at different edges and the existence of non-thermometer code phenomenon, in order to avoid over-counting and under-counting of the second rising edge position encoding, and to avoid encoding errors, the first pulse width in TDL is set to 1 CARRY8 unit, and the interval between the first rising edge and the second rising edge is 7 CARRY8 units. The specific process of TDL Popcount encoding based on complex sampling and Wave Union A method is as follows Fig.12 shown.
[0107] The number of all taps 1 in the TDL is logically shifted right by 4 bits (i.e., divided by 16) as the selection signal "Outnum2_sel" for the position interval where the second rising edge is located. The approximate interval where the second rising edge is located is obtained according to the value of the position selection signal. The calculated value of the position code of the first rising edge is used in the middle, and the number of 1s in all taps before the second rising edge is obtained by summing up using the LUT as the position code of the second rising edge. Since a large interval margin is set between multiple signal transition edges when setting the TDL based on complex sampling and WaveUnion A method, the number of 1s in all taps before the second rising edge can be accurately obtained, and the position codes of the two rising edges are added to obtain the final code.
[0108] When encoding TDL based on complex sampling and Wave Union A method, the intermediate values of the code that have been calculated in the Popcount encoding process are reused, which saves resources to the greatest extent and makes the realization of multi-channel TDC possible.
[0109] After the PS reads the measurement data, since the fine measurement module uses dual-phase sampling, only the data of one phase obtained by sampling is actually available. The measurement data of the TDL of the other phase is invalid due to the relative relationship between the phase of the sampling clock and the trigger signal and the length of the TDL. Therefore, it is necessary to jointly determine which phase of the TDL data to use based on the fine measurement data and the coarse measurement data. There are roughly two situations, such as Fig.13 shown.
[0110] When the fine measurement data of TDL of a certain phase is full, it means that the TDL data of this phase is unavailable, and the coarse measurement data and fine measurement data of the opposite phase are used; when the fine measurement data of TDL of two phases are not full, it can be concluded which TDL is triggered first by observing the relative size of the coarse count, and the fine measurement data of the TDL triggered first is used for calculation.
[0111] This implementation adopts dual-phase sampling and takes the average of the measured values of two TDLs as the fine measurement result. Due to factors such as different wiring delays from the trigger signal to the TDL, different layout positions of each TDL, and different clock delays during the construction of the TDL, the inherent delay time of the trigger signal reaching the TDL has large differences, making the fine measurement values measured by different TDLs inconsistent. In order to ensure the measurement consistency between multiple TDLs, the measurement values of different TDLs are corrected for subsequent calculations. The TDL measurement correction diagram is shown in the figure. Fig.14 shown.
[0112] Assume that the inherent delay times of the 8 TDLs are a1, a2, a3, a4, a5, a6, a7, and a8. Perform multiple tests on the TDC, read the measured values t1, t2, t3, t4, t5, t6, t7, and t8 of the 8 TDLs triggered by the same signal, select the first TDL as the benchmark for calibration, and obtain the inherent delay times (a2-a1), (a3-a1), (a4-a1), (a5-a1), (a6-a1), (a7-a1), and (a8-a1) of the remaining 7 TDLs relative to the first TDL. Compensate for them in the software to make the measurement results of different TDLs consistent.
[0113] The TDC of this embodiment adopts the coarse-fine interpolation method to calculate the measurement time interval. According to the principle of the Nut-Interpolation method and the TDC structure, the measured time interval T m Use the following formula to calculate, the calculation flow chart is as follows Fig.15 .
[0114] T m =(Start 粗测量时间 -End 粗测量时间 )+(Start 细测量时间 -End 细测量时间 )
[0115] During the measurement data calculation process at the PS end, a set of measurement data is read, the Start measurement data and the End measurement data are processed separately, the average values of the coarse measurement data are calculated respectively, and the positive and negative phase data are selected. The two sets of Start measurement data and End measurement data are averaged to obtain the averaged measurement value, and the measurement result is measured by calculating the measurement time interval as described above.
[0116] Although the present invention is described herein with reference to specific embodiments, it should be understood that these embodiments are merely examples of the principles and applications of the present invention. It should therefore be understood that many modifications may be made to the exemplary embodiments and that other arrangements may be devised without departing from the spirit and scope of the present invention as defined by the appended claims. It should be understood that the various dependent claims and features described herein may be combined in a manner different from that described in the original claims. It should also be understood that the features described in conjunction with a single embodiment may be used in other described embodiments.
Claims
1. A high-precision time interval measurement system based on FPGA, characterized in that: include: The coarse measurement module is used to measure the time greater than one system clock cycle using a counter; the coarse measurement result is expressed as T coarse ; The fine measurement module is used to measure the time less than one system clock cycle using a tapped delay line. The fine measurement result is expressed as T fine , including the time interval T between the start signal Start and the first adjacent system clock rising edge fine1 The time interval T between the stop signal End and the first adjacent rising edge of the system clock fine2 ; The measurement time interval T between the start signal Start and the stop signal End is obtained by the coarse measurement module and the fine measurement module. m : T m =T coarse +T fine1 -T fine2 , T m =N*T CLK +T fine1 -T fine2 , Where N is the number of system clock cycles, T CLK The system clock cycle is long.
2. The high-precision time interval measurement system based on FPGA according to claim 1, characterized in that: The coarse measurement module includes multiple groups of start general counter groups and multiple groups of end general counter groups; two general counters in each general counter group are driven by a positive phase system clock and a negative phase system clock respectively, and the frequency of the system clock is 300MHz; When the start signal Start arrives, all start general counter groups start working; in each start general counter group, the start general counter driven by the positive system clock or the start general counter driven by the negative system clock starts counting first; when the stop signal End arrives, all end general counter groups start working; in each end general counter group, the end general counter driven by the positive system clock or the end general counter driven by the negative system clock starts counting first.
3. The high-precision time interval measurement system based on FPGA according to claim 2, characterized in that: The universal counter adopts a Gray code counter; The rough measurement result T of the rough measurement module coarse The working state of the counter is judged by the calculation module, and the corresponding rough measurement value is calculated; the rough measurement value is determined by the average value of the measurement values of the corresponding general counter group.
4. The high-precision time interval measurement system based on FPGA according to claim 3, characterized in that: The measurement system is implemented based on Xilinx UltraScale+ series FPGA; The fine measurement module constructs a tapped delay line including multiple delay units by cascading CARRY8 units in multiple slices; The O tap and CO tap corresponding to the data selector of the CARRY8 unit are brought out and sampled by the register. Each CARRY8 unit brings out 16 lead-out taps as 16 sampling points of the complex sampling method. The Wave Union method is used to configure the start signal Start and the stop signal End to the selected input point of the tapped delay line to segment the CARRY8 unit, and the time information contained in each start signal Start and the stop signal End is recorded to achieve multiple measurements of the start signal Start and the stop signal End; the selected input point allows a margin within a set range between the edges of the start signal Start and the stop signal End.
5. The high-precision time interval measurement system based on FPGA according to claim 4, characterized in that: The fine measurement module is based on a dual-phase sampling method and uses two tapped delay lines with a delay time greater than half the system clock cycle length to obtain a fine measurement result T fine , and then take the average value as the final fine measurement value.
6. The high-precision time interval measurement system based on FPGA according to claim 5, characterized in that: For the final fine measurement value of the fine measurement module, a combination of DSP unit and LUT is used. Popcount is used based on complex sampling to calculate the number of 1s in the tap delay line, and the state of the tap delay line is encoded; for the number of 1s in taps with a bit number of 1-6 bits, LUT is used for encoding; for the number of 1s in taps with a bit number of 7 bits or more, DSP unit is used for encoding.
7. The high-precision time interval measurement system based on FPGA according to claim 6, characterized in that: The tap delay line includes 72 CARRY8 units, with a total of 72*16 taps; First, LUT is used for encoding to obtain the number of 1s in 12 7-bit taps; then DSP unit is used to obtain the number of 1s in all taps.
8. The high-precision time interval measurement system based on FPGA according to claim 7, characterized in that: The method of encoding using LUT is: Based on the branching method, LUT is used to add the taps derived from the CARRY8 unit in pairs to obtain the number of 1s in the taps of the tapped delay line; Specifically: The 16 taps of each CARRY8 unit are taken as a group, and the number of 1s in the 16 taps is added in parallel in pairs to obtain the number of 1s in 8 digits of 2-bit taps, and the number of 1s in 8 digits of 2-bit taps is added in parallel in pairs to obtain the number of 1s in 4 digits of 3-bit taps; the number of 1s in 4 digits of 3-bit taps is added in pairs in parallel to obtain the number of 1s in 2 digits of 4-bit taps; the number of 1s in 2 digits of 4-bit taps is added in pairs in parallel to obtain the number of 1s in 1 digit of 5-bit tap; The number of 1s in 72 5-bit taps is obtained from 72 CARRY8 units; the number of 1s in the taps of the 72 CARRY8 units is added in parallel in pairs to obtain the number of 1s in 36 6-bit taps; the number of 1s in the 36 6-bit taps is divided into 12 groups, and the number of 1s in 3 6-bit taps is 1 group; the number of 1s in 1 6-bit tap is the sum of the number of 1s in all taps of 2 CARRY8 units, and the maximum value is 32. The number of 1s in 2 6-bit taps is added to obtain the number of 1s in 1 7-bit tap, and the maximum value is 64; the number of 1s in the 7-bit tap obtained is added to the number of 1s in 1 6-bit tap, and the maximum value is 96; then the number of 1s in 12 groups of 3 6-bit taps is added in parallel to obtain the number of 1s in 12 7-bit taps.
9. The high-precision time interval measurement system based on FPGA according to claim 8, characterized in that: The method of encoding using the DSP unit is: Based on the branching method, the DSP unit is used to encode the encoding result of the LUT; Specifically: Configure the corresponding DSP unit to TWO24 mode, add the numbers of 1 in 12 7-bit taps in parallel, and get the numbers of 1 in 6 8-bit taps; then add the numbers of 1 in 6 8-bit taps in parallel, and get the numbers of 1 in 3 groups of 9-bit taps; Then configure the corresponding DSP unit to TWO12 mode, first add the number of 1s in a group of 9-bit taps in parallel to obtain the number of 1s in a 10-bit tap; then add the number of 1s in the 10-bit tap and the number of 1s in the other two groups of 9-bit taps to obtain the number of 1s in all taps.
10. The high-precision time interval measurement system based on FPGA according to claim 9, characterized in that: The encoding result of the DSP unit is further encoded: The number of 1s in all taps obtained based on complex sampling is used as the position code of the first rising edge of the start signal Start or the stop signal End in the system clock cycle, the position interval of the second rising edge of the system clock cycle is obtained by subtracting the number of 1s corresponding to the first pulse width set from the position code of the first rising edge, the number of 1s in all taps before the second rising edge is obtained by Popcount coding as the position code of the second rising edge, and the position codes of the two rising edges are added to obtain the final fine measurement result code; The first pulse width is 1 CARRY8 unit; the interval between the first rising edge and the second rising edge is 7 CARRY8 units.
Citation Information
Cited By
On-chip time sequence margin monitoring system and method and electronic equipment
CN122346421A
