Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts all other
Embodiment shall fall within the protection scope of the present invention.
The embodiment of the present invention provides a kind of FPGA time-delay mechanism 10, as shown in Figure 1, the FPGA time-delay mechanism 10 includes delay
Adjust module 11 and measurement module 12, wherein
Delay adjustment module 11 according to delay time for delaying or the first signal in advance.
Measurement module 12 is connect with delay adjustment module 11, and measurement module 12 is for determining specified time interval.
Wherein, the is divided into after adjustment in moment, with second signal where the first signal after corresponding to adjustment between specified time
Time interval between the initial time in the period of one signal, second signal are periodic signal.
It should be noted that after adjustment the moment where the first signal compared to the moment where the first signal, may delay or
In advance, it delays or corresponding delay time may be different in advance.For example, in a period of time, there are moment 1,2,3,4,5,6,
7,8,9, second signal S is respectively present at moment 1, moment 5 and moment 91、S2And S3.If there are the first signal P at the moment 61,
The time interval between the first signal and the second signal is 1 at this time, and user needs the time between the first signal and the second signal
Between be divided into 3, if delaying the first signal, the moment where the first signal is 8 after adjustment, delay time 2;If the first letter in advance
Number, then the moment where the first signal is 4 after adjusting, and delay time 2, is delayed or corresponding delay time is identical in advance.If
At the moment 7, there are the first signal P1, the time interval between the first signal and the second signal is 2 at this time, and user needs the first signal
Time interval between second signal is 3, if delaying the first signal, the moment where the first signal is 8 after adjustment, when delay
Between be 1;If the first signal in advance, the moment where the first signal is 4 after adjustment, and delay time 3 is delayed or corresponding in advance
Delay time is different.
It delays or in advance after the first signal, then specified time interval is determined by measurement module, obtains in delay adjustment module
To after specified time interval, specified time interval is uploaded to terminal, in order to be monitored to signal adjusted.
The application provides a kind of FPGA time-delay mechanism, the delay time of multiple signals can be controlled in FPGA, and measure
Specified time interval between signal after delay since the precision of FPGA control delay time is higher, and will not produce signal
Raw interference, signal quality will not change, can accurately be measured when carrying out specified time interval measurement in this way
Value, compared with using cable, improves the precision of delay time, and improve the precision of the time interval of measurement;Due to logical
A FPGA delay adjustment module is crossed, the delay of all signals can be controlled, therefore, can only increase by one in existing apparatus
Delay adjustment module reduces hardware complexity, reduces costs simultaneously compared with high-precision delay chip.
In order to make the time interval after adjusting where the first signal between moment and second signal meet being taken for user
Between be spaced, in an implementation of the embodiment of the present invention, need to be determined according to initial interval and required time interval
Therefore delay time on the basis of implementation as shown in Figure 1, can also realize implementation as shown in Figure 2.Its
In, the FPGA time-delay mechanism further include:
Module 13 is obtained, for obtaining moment where the first signal and the second letter before time cycle of second signal, adjustment
Correspond to the initial interval between the initial time for adjusting the period of preceding first signal in number.
For example, as shown in figure 3, second signal is periodic signal, period T, in moment S1、S2And S3There is the second letter
Number, in moment P1There are the first signals, i.e. P1To adjust the moment where preceding first signal, adjustment preceding the is corresponded in second signal
The initial time in the period of one signal is S2, initial interval S2With P1Between time interval, i.e. T2。
Computing module 14, computing module 14 are connect with module 13 is obtained, and computing module 14 also connects with delay adjustment module 11
It connects, computing module 14 is based on according to the time cycle at required time interval, the second signal and the initial interval
Calculate delay time.
It should be noted that delay time can be required time when required time interval is greater than initial interval
The absolute value at interval and the difference of initial interval;Alternatively, delay time is spaced the time required to may be and initial time
The absolute value of the difference at interval adds the period of at least one second signal;Alternatively, delay time may be at least one
The difference in the period of binary signal and above-mentioned absolute value.
When required time interval is less than initial interval, delay time can be required time interval and initial time
The absolute value of the difference at interval is as delay time, by the first signal advance time-delay time;Alternatively, delay time may be institute
Take time interval and initial interval difference absolute value add at least one second signal period;Alternatively, when delay
Between or at least one second signal period and above-mentioned absolute value difference.
When determining delay time according to initial interval and required time interval, since second signal is period letter
Number, therefore increase on the basis of required time interval and the absolute value for the difference for obtaining initial interval acquired in module
The period of second signal, or be spaced the time required to the period of second signal is subtracted and obtain initial time acquired in module
The absolute value of the difference at interval, the value that operation obtains can be used as delay time, thus there is the value of multiple delay times,
It can be according to one of method that user demand or actual needs select the above-mentioned computation delay time come the computation delay time.
Signal adjusted is monitored for the ease of terminal, in an implementation of the embodiment of the present invention, is needed
Measure moment where the first signal and the initial time in second signal corresponding to the period of the first signal after adjustment after adjusting
Between specified time interval therefore on the basis of implementation as shown in Figure 2, can also realize reality as shown in Figure 4
Existing mode.Wherein, measurement module 12 includes:
First judgment module 121, first judgment module 121 are connect with delay adjustment module 11, and first judgment module 121 is used
In judging that the first signal delays delay time or advance time-delay time.
First computing module 123, the first computing module 123 are connect with first judgment module 121, the first computing module 122
For when the first signal delays delay time, the adduction of computation delay time and initial interval;First computing module 122
It is also used in the first signal advance time-delay time, calculates the difference of first time interval and delay time.Wherein, at the first time
Between be divided into adjust preceding first signal where correspond in moment and second signal adjust after the first signal period initial time
Between time interval.
Second judgment module 123, the second judgment module 123 are connect with the first computing module 122, the second judgment module 123
For judging whether adduction is greater than the time cycle of second signal;Second judgment module 123 is also used to judge whether difference is greater than
The time cycle of second signal.
Second computing module 124, the second computing module 124 are connect with the second judgment module 123, the second computing module 124
For in time cycle of the adduction greater than second signal, adduction to be subtracted at least one time cycle, obtain being less than week time
The first result of phase;Second computing module 124 be also used to difference be greater than second signal time cycle when, by difference subtract to
A few time cycle, obtain the second result less than the time cycle.
Specified module 125, specified module 125 are connect with the second judgment module 123, and module 125 is specified also to calculate with second
Module 124 connects, and specifies module 125 to be used for when adduction is greater than the time cycle of second signal, it is specified for specifying the first result
Time interval;Specified module 125 is also used to specify adduction between specified time when adduction is less than the time cycle of second signal
Every;Specified module 125 is also used to specify the second result between specified time when difference is greater than the time cycle of second signal
Every;Specified module 125 is also used to when difference is less than the time cycle of second signal, and specifying difference is specified time interval.
For example, being distinguished at the time of where each second signal as shown in figure 3, second signal is the periodic signal for being T the period
For S1、S2And S3, it is P at the time of where the first signal1, initial interval T2, T2+ T=T1, after adjustment where the first signal
Moment is P1' when the first signal delay or in advance when, the calculation method at specified time interval is as follows:
A, the first signal delays △ t1, △ t1< T and △ t1+T2<T
The adduction of delay time and initial interval is △ t1+T2, because of △ t1+T2< T, so being divided between specified time
△t1+T2。
B, the first signal delays △ t2, △ t2< T and △ t2+T2>T
The adduction of delay time and initial interval is △ t2+T2, because of △ t2+T2> T, so being divided between specified time
△t2+T2-T。
C, the first signal shifts to an earlier date △ t3, △ t3< T and △ t3<T2
Due to P1' and P1In the same period in second signal, therefore, first time interval T2, due to T2-△t3
< T, so being divided into T between specified time2-△t3。
D, the first signal shifts to an earlier date △ t4, △ t4< T and △ t4>T2
Due to P1' locating time cycle and P1The period of locating second signal is adjacent, and therefore, first time interval is
T1-△t4, due to T1-△t4< T, so being divided into T between specified time1-△t4。
As shown in figure 5, P1" and P1Between time interval be less than T, and P1" and P1' between time interval be n T, n
For positive integer.
E, the first signal delays △ t5, △ t5>T
The adduction of delay time and initial interval is △ t5+T2, because of △ t5+T2> T, so being divided between specified time
△T1, △ T1Calculation method can be using calculation method used by above-mentioned A or B, this will not be repeated here.
F, the first signal shifts to an earlier date △ t6, △ t6>T
△ T is divided between specified time2, △ T2Calculation method can be using calculation method used by above-mentioned C or D, herein
It does not repeat them here.
The application is by the calculation method at specified time interval according to delaying or in advance and delay time and second signal
Size relation between period is classified, and different classes of calculation method is different, so that between measurement module calculating specified time
Every when, can by the first signal after all adjustment may where at the time of the case where, fully according to think specified calculation method into
Row calculates, and improves the accuracy for calculating specified time interval.
In order to make the time interval required time interval of the first signal and second signal place moment, implement in the present invention
In one implementation of example, need to adjust the first signal.Wherein, corresponding in a time cycle of second signal to exist at least
Two the first signals, delay adjustment module 11 delay at least two first signals or the advance time-delay time as a whole.
For example, as shown in fig. 6, the moment where second signal is respectively S1、S2And S3, in S2And S3Between time interval
In, in moment P1With moment P2It is respectively present first signal, as a whole by two the first signals, while delaying △ t7Or
△ t in advance simultaneously8, adjust the moment where latter two first signal between time interval it is constant.
At this point, be standard by the moment where first signal in two the first signals, the corresponding computation delay time and
Specified time interval.When two the first signals are integrally delayed, the calculation method at specified time interval can using above-mentioned A, B or
Calculation method used by E;When two the first signals integrally in advance when, the calculation method at specified time interval with can use it is upper
State calculation method used by C, D or F.
In this application, at least two first signals are delayed using a delay adjustment module as a whole or is prolonged in advance
When the time, due to the setting delay adjustment module in FPGA, the precision that FPGA controls delay time is higher, and will not produce to signal
Raw interference, signal quality will not change, can accurately be measured when carrying out specified time interval measurement in this way
Value, which improves the precision of delay time, and improve the precision of the time interval of measurement;Due to being adjusted by a delay
Mould preparation block can control the delay of all signals, therefore, can only increase a delay in existing apparatus and adjust module, drop
Low hardware complexity, reduces costs simultaneously.
In order to calculate time interval, in an implementation of the embodiment of the present invention, when needing to be arranged for each signal
Between label therefore on the basis of implementation as shown in Figure 2, can also realize implementation as shown in Figure 7.Wherein,
FPGA time-delay mechanism 10 further include:
Time tag creation module 15 is connect with measurement module 12, and time tag creation module 15 is for marking adjustment preceding the
At the time of where one signal and second signal.
It should be noted that comprising the carry chain that construct by adder in time tag creation module 15, the first signal with
Second signal is digital signal by analog-signal transitions, realizes the number of temporal information after time tag creation module 15
Word conversion.At the time of time tag creation module 15 marks the rising edge place of the first signal and the second signal, and with week time
Phase creation time label corresponds to the period of the first signal in moment where the time cycle is greater than the first signal and second signal
Initial time between time interval.After a time cycle, continue the starting timing from the time cycle, for letter
Moment creation time label where number.For example, using 0,1,2,3,4,5,6,7,8,9 as one time cycle creation time mark
Label, in first time cycle, the time tag at moment where second signal is 1,5,9, and first time cycle terminates, after
The continuous starting timing from second time cycle, in second time cycle, the time tag at moment is where second signal
3、7。
The application uses time tag creation module, at the time of marking the first signal and the second signal place, the first signal
By analog-signal transitions it is the digital signal characterized by temporal information with second signal, then the first signal is controlled by FPGA and is prolonged
When.It is in this way after the number conversion of temporal information to the realization of the delay function of signal, FPGA control delay is to signal
Time-to-digital converter function does not have any influence, in this way to the performance of entire time-to-digital converter system just without any influence.
In addition, after by time tag creation module, that is, after analog-signal transitions are digital signal, it can be into one
Step carries out the processing of the first signal and the second signal.
The application provides a kind of FPGA time-delay method, as shown in figure 8, the FPGA time-delay method includes:
Step 201 is delayed or the first signal in advance according to delay time.
Step 202 determines specified time interval.
Wherein, the is divided into after adjustment in moment, with second signal where the first signal after corresponding to adjustment between specified time
Time interval between the initial time in the period of one signal, second signal are periodic signal.
In the implementation of the application, on the basis of implementation as shown in Figure 8, be also implemented as
Implementation shown in Fig. 9.Wherein, it is delayed according to delay time or in advance before the first signal executing step 101, it can be with
Execute step:
The moment where the first signal is corresponding with second signal before step 203, the time cycle for obtaining second signal, adjustment
Initial interval between the initial time in period for adjusting preceding first signal.
Step 204, according to required time interval, the time cycle of second signal and initial interval computation delay when
Between.
In the implementation of the application, on the basis of implementation as shown in Figure 9, be also implemented as
Implementation shown in Fig. 10.Wherein, step 202 determines specified time interval, can also be implemented as step 2021 to step
Rapid 2025:
Step 2021 judges that the first signal delays delay time or advance time-delay time.
Step 2022, when the first signal delays delay time, the adduction of computation delay time and initial interval;Or
Person calculates the difference of first time interval and delay time in the first signal advance time-delay time.
Wherein, first time interval is to correspond to after adjusting the in moment and second signal where adjusting preceding first signal
Time interval between the initial time in the period of one signal.
Step 2023 judges whether adduction is greater than the time cycle of second signal;Alternatively, judging whether difference is greater than second
The time cycle of signal.
Step 2024, adduction be greater than second signal time cycle when, adduction is subtracted at least one time cycle, is obtained
To the first result for being less than the time cycle;Alternatively, difference is subtracted at least one when difference is greater than the time cycle of second signal
A time cycle obtains the second result less than the time cycle.
Step 2025, adduction be greater than second signal time cycle when, specify the first result be specified time interval;Or
Person, when adduction is less than the time cycle of second signal, specifying adduction is specified time interval;Alternatively, being greater than second in difference
When the time cycle of signal, specifying the second result is specified time interval;Alternatively, being less than the time cycle of second signal in difference
When, specifying difference is specified time interval.
In the implementation of the application, on the basis of implementation as shown in Figure 8, be also implemented as
Implementation shown in Figure 11, the FPGA time-delay method include:
Step 205, second signal a time cycle in correspond to there are at least two first signals, by least two the
One signal is delayed as a whole or the advance time-delay time.
In the implementation of the application, on the basis of implementation as shown in Figure 9, be also implemented as
Implementation shown in Figure 12.Wherein, the first signal institute before executing step 203 and obtaining the time cycle of second signal, adjustment
In the step of the initial interval corresponded between the initial time for adjusting the period of preceding first signal in moment and second signal
Before rapid, step 206 can also be performed:
At the time of before step 206, label adjust where the first signal and the second signal.
The application provides a kind of FPGA time-delay method, the delay time of multiple signals can be controlled in FPGA, and measure
Specified time interval between signal after delay since the precision of FPGA control delay time is higher, and will not produce signal
Raw interference, signal quality will not change, can accurately be measured when carrying out specified time interval measurement in this way
Value, compared with using cable, improves the precision of delay time, and improve the precision of the time interval of measurement;Due to logical
A FPGA delay adjustment module is crossed, the delay of all signals can be controlled, therefore, can only increase by one in existing apparatus
Delay adjustment module reduces hardware complexity, reduces costs simultaneously compared with high-precision delay chip.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for method reality
For applying example, since it is substantially similar to Installation practice, so describing fairly simple, related place is referring to Installation practice
Part explanation.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with
Relevant hardware is instructed to complete by computer program, the program can be stored in computer-readable storage medium
In, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, the storage medium can be magnetic
Dish, CD, read-only memory (Read-Only Memory, ROM) or random access memory (Random Access
Memory, RAM) etc..
The above, the only specific embodiment of the application, but the protection scope of the application is not limited thereto, it is any
Change or replacement within the technical scope of the present application should all be covered within the scope of protection of this application.Therefore, this Shen
Protection scope please should be subject to the scope of protection of the claims.