# Patent

## Title
Time-to-digital converter using time residue feedback and related method

## Abstract

A method and apparatus for measuring an elapsed time from a starting signal to an ending signal in a time-to-digital converter. Primarily, the invention calculates an amount of complete cycles from the starting signal to a starting edge of a next clock cycle or the next Nth clock cycle (N is a natural number great than one) after the clock cycle corresponding to the ending signal. The amount is multiplied by a cycle time of the coarse clock to obtain a coarse time value. A time residue is calculated from the ending signal to the starting edge. Finally, the time residue is subtracted from the coarse time value to obtain a required time.

## Background
BACKGROUND OF THE INVENTION
1. Technical Field
The invention relates to time measurement of time of flight (ToF), particularly to a method and apparatus for time-to-digital conversion using time residue feedback.
2. Related Art
A time-to-digital converter (TDC) is used for measuring a time difference and converting it into a digital format. The TDC's input end accepts two impulses, namely, a starting signal and an ending signal. A time difference between these two impulses is the time difference to be measured. A fundamental principle of TDC is to use a coarse (reference) clock and a counter. A cycle time of the coarse clock is known, and the counter counts an amount of elapsed cycles of the coarse clock during the time difference to be measured so as to know the magnitude of the time difference to be measured.
There are many types in framework of TDC. The most common types are two-stage, pipeline and cyclic. A two-stage type TDC, as shown in FIG. 1, uses two TDCs, i.e., a coarse TDC (CTDC) and a fine TDC (FTDC). A time amplifier (TA) is arranged between the two TDCs. The CTDC performs detection of time first. When an ending signal of the CTDC arrives, all D-type flip-flops will be triggered to output all signals at every node on a delay line of the CTDC and convert them into digital codes. And the outputs of the CTDC will generate a selecting signal to control a multiplex (MPX). Inputs of the MPX are separately connected to nodes on the delay line of the CTDC to be selected by the selecting signal. A time residue and the ending signal are sent to the TA to be temporally amplified. Finally, the amplified signals are converted into digital codes by the FTDC. However, resolution of such a two-stage framework is directly proportional to quantity of time residue detectors and TAs. To keep a certain resolution, the hardware structure must be huge. It is very disadvantageous to chip design.
The pipeline type is derived from the two-stage type. The pipeline type divides the conversion into much more stages. As shown in FIG. 2, there are n stages. Composition of every stage is identical to each other, which is composed of a TDC, a digital-to-time converter (DTC) and a TA. When the TDC of the first stage has output digital codes, a time residue is amplified by the TA and then detected by the TDC of the next stage. However, such a pipeline framework must perform conversion and measurement of time residue only after the ending signal. Thus it is not good enough in speed.
The cyclic type, as shown in FIG. 3, is based upon the pipeline type and adds a feedback path. As a result, the cyclic type still has the same drawback as the pipeline type. That is, its speed is not good enough.
In sum, a common point of the above TDCs is the measurement of the time to be measured. It uses an amount of complete cycles of the coarse clock within the time to be measured as a coarse time value, and the coarse time value is added to a time residue which is a residue of the incomplete cycle corresponding to the ending signal to obtain a required time value. Besides the abovementioned drawbacks, such an adding approach will be inaccurate and irremediable when the ending signal is not correctly detected in the corresponding cycle of the clock because time cannot goes back. Although some new developments may overcome this potential problem by digital correction, it still requires additional algorithms and circuits to judge and calculate. An additional circuit area is still required and a drawback still remains.
SUMMARY OF THE INVENTION
An object of the invention is to provide a method and apparatus of time-to-digital conversion, which can achieve the fastest speed of time-to-digital conversion, high resolution, wide input range and auto error correction under the smallest hardware requirement.
To accomplish the above object, the invention provides a method and apparatus for measuring an elapsed time from a starting signal to an ending signal in a time-to-digital converter. The invention calculates an amount of complete cycles from the starting signal to a starting edge of a next clock cycle or the next Nth clock cycle (N is a natural number great than one) after the clock cycle corresponding to the ending signal. The amount is multiplied by a cycle time of the coarse clock to obtain a coarse time value. A time residue is calculated from the ending signal to the starting edge. Finally, the time residue is subtracted from the coarse time value to obtain a required time.



BRIEF DESCRIPTION OF THE DRAWINGS
FIG. 1 is a block diagram of a conventional two-stage type time-to-digital converter;
FIG. 2 is a block diagram of a conventional pipeline type time-to-digital converter;
FIG. 3 is a block diagram of a conventional cyclic type time-to-digital converter;
FIG. 4 is a block diagram of framework of the time-to-digital conversion apparatus of the invention;
FIG. 5 is a block diagram of a preferred embodiment of the time-to-digital conversion apparatus of the invention;
FIG. 6 is a timing diagram of the invention; and
FIG. 7 is a flowchart of the method of the invention.



DETAILED DESCRIPTION OF THE INVENTION
Please refer to FIG. 4. The time-to digital conversion apparatus of the invention includes a controllable switch 1, a time residue generator 2, a time amplifier (TA) 3 and a time-to-digital converter (TDC) 4. As shown, the controllable switch 1 can be controlled to selectively conduct an input signal with an external signal source to be measured or the feedback path of the output end of the TA 3. The time residue generator 2 is electrically connected with the TA 3 in series to form serial path and the serial path is parallel to the TDC 4.
Please refer to FIG. 5, which is a block diagram of a preferred embodiment of the time-to-digital conversion apparatus of the invention. As shown, the controllable switch 1 has a normally closed end, a normally open end and a common end. The normally closed end is used for connecting a signal source which is capable of sending out a starting signal and an ending signal. The time residue generator 2 has a first input end and a first output end. The first input end is electrically connected to the common end of the controllable switch 1 and a coarse clock. The time amplifier 3 has a second input end and a second output end. The second input end electrically connects the first output end. The second output end electrically connects the normally open end. The TDC 4 may be a cyclic Vernier type and has a third input end, a third output end and a fourth output end. The third input end electrically connects the common end. The third output end electrically connects the first input end. The fourth output end is used for electrically connecting an output register 5. The TDC outputs the coarse clock.
Please refer to FIG. 6 together. The input signal time Tin is a time difference between the starting signal Tstart and the ending signal Tstop. The coarse clock is synchronously activated with the starting signal. The TDC 4 calculates an amount of elapsed complete cycles of the coarse clock between the starting signal and the ending signal. In detailed, the TDC 4 calculates an amount of elapsed complete cycles of the coarse clock from the starting signal to a starting edge of a next cycle or a next Nth cycle (N is a natural number great than one) after the clock cycle corresponding to the ending signal. In a positive edge triggering system, the starting edge is a rising edge. A coarse time value can be obtained by multiplying the amount by a cycle time of the coarse clock Tcoarse and the coarse time value will be converted into a digital signal. The amount of the elapsed complete cycles includes the incomplete cycle corresponding to the ending signal. For example, the first cycle of the coarse clock is activated by the starting signal, if the ending signal occurs within the eighth cycle, then the eighth cycle is still included in the amount even though it is incomplete.
The time residue generator 2 is activated by triggering of the ending signal for calculating a time residue from the ending signal to the same starting edge of the coarse clock as the abovementioned one. Because both the coarse time value and the time residue are calculated to the same ending cycle or ending time (i.e., the same ending point), a required time can be obtained by subtracting the time residue from the coarse time value. Also, the TDC 4 and the time residue generator 2 are parallel in operation. Their mathematic relationship can be expressed as follows:

Tin=Tstop−Tstart  (1)

Tin=Tcoarse−Tresidue=NcTc−Tresidue  (2)

where Nc is the amount of cycles of the coarse clock in the coarse time, Tc is the cycle time of the coarse clock, and Tresidue is the time residue. Once the starting edge which should be detected at the next cycle of the coarse clock corresponding to the ending signal (i.e., the starting edge is detected in incorrect following cycle period), this can be remedied at some following cycle. Suppose the ending signal is detected after Ne complete cycles after the cycle it should be detected, formula (2) can be rewritten as:

Tin=NcTc−Tresidue=(Nc+Ne)Tc−(NeTc+Tresidue)

In other words, a correct required time can also be obtained by subtracting the delayed time (NeTc). This is one of features of the invention, no additional circuit or operation is required to make error correction.
FIG. 7 shows a flowchart of the method of the invention. The invention provides a method for time-to-digital conversion for measuring an elapsed time from a starting signal to an ending signal and converting to a digital signal. In step S1, a coarse clock is generated. In step S2, calculate an amount of complete cycles from the starting signal to a starting edge of a next clock cycle or a next Nth clock cycle after a clock cycle corresponding to the ending signal. The complete cycles include the incomplete cycle corresponding to the ending signal. In step S3, the amount is multiplied by a cycle time of the coarse clock to obtain a coarse time value. In step S4, a time residue is calculated from the ending signal to the starting edge in step S2. In step S5, the time residue is subtracted from the coarse time value to obtain a required time. Step S2 and step S4 are parallel, end at the same time and switch to a next feedback path when ending (no additional circuit is required to judge the circuit switching).

## Claims

1. A time-to-digital conversion apparatus comprising:
a controllable switch, having a normally closed end, a normally open end and a common end, wherein the normally closed end is used for connecting a signal source which is capable of sending out a starting signal and an ending signal;
a time residue generator, having a first input end and a first output end, and the first input end electrically connecting the common end of the controllable switch and a coarse clock;
a time amplifier, having a second input end and a second output end, the second input end electrically connecting the first output end, and the second output end electrically connecting the normally open end; and
a time-to-digital converter (TDC), having a third input end, a third output end and a fourth output end, the third input end electrically connecting the common end, the third output end electrically connecting the first input end, the fourth output end being used for electrically connecting an output register, the TDC outputting the coarse clock, calculating an amount of complete cycles from the starting signal to a starting edge of a next cycle after a clock cycle corresponding to the ending signal, and multiplying the amount by a cycle time of the coarse clock to obtain a coarse time value;
wherein the time residue generator is activated by triggering of the ending signal for calculating a time residue from the ending signal to the starting edge, a required time is obtained by subtracting the time residue from the coarse time value, and the TDC and the time residue generator are parallel in operation.

2. The time-to-digital conversion apparatus of claim 1, wherein the TDC is a cyclic Vernier type.

3. The time-to-digital conversion apparatus of claim 1, wherein the starting edge is a rising edge.

4. A time-to-digital conversion apparatus comprising:
a controllable switch, having a normally closed end, a normally open end and a common end, wherein the normally closed end is used for connecting a signal source which is capable of sending out a starting signal and an ending signal;
a time residue generator, having a first input end and a second output end, and the first input end electrically connecting the common end of the controllable switch and a coarse clock;
a time amplifier, having a second input end and a second output end, the second input end electrically connecting the first output end, and the second output end electrically connecting the normally open end; and
a time-to-digital converter (TDC), having a third input end, a third output end and a fourth output end, the third input end electrically connecting the common end, the third output end electrically connecting the first input end, the fourth output end being used for electrically connecting an output register, the TDC outputting the coarse clock, calculating an amount of complete cycles from the starting signal to a starting edge of a next Nth cycle (N is a natural number great than one) after a clock cycle corresponding to the ending signal, and multiplying the amount by a cycle time of the coarse clock to obtain a coarse time value;
wherein the time residue generator is activated by triggering of the ending signal for calculating a time residue from the ending signal to the starting edge, a required time is obtained by subtracting the time residue from the coarse time value, and the TDC and the time residue generator are parallel in operation.

5. The time-to-digital conversion apparatus of claim 4, wherein the TDC is a cyclic Vernier type.

6. The time-to-digital conversion apparatus of claim 4, wherein the starting edge is a rising edge.

7. A method for time-to-digital conversion for measuring an elapsed time from a starting signal to an ending signal and converting to a digital signal, comprising:
a) generating a coarse clock;
b) calculating an amount of complete cycles from the starting signal to a starting edge of a next clock cycle after a clock cycle corresponding to the ending signal;
c) multiplying the amount by a cycle time of the coarse clock to obtain a coarse time value;
d) calculating a time residue from the ending signal to the starting edge in step b); and
e) subtracting the time residue from the coarse time value to obtain a required time.

8. The method of claim 7, wherein the steps b) and d) are parallel.

9. The method of claim 8, wherein the steps b) and d) end at the same time and switch to a next feedback path when ending.

10. The method of claim 7, wherein the starting edge is a rising edge.

11. A method for time-to-digital conversion for measuring an elapsed time from a starting signal to an ending signal and converting to a digital signal, comprising:
a) generating a coarse clock;
b) calculating an amount of complete cycles from the starting signal to a starting edge of a next Nth clock cycle (N is a natural number great than one) after a clock cycle corresponding to the ending signal;
c) multiplying the amount by a cycle time of the coarse clock to obtain a coarse time value;
d) calculating a time residue from the ending signal to the starting edge in step b); and
e) subtracting the time residue from the coarse time value to obtain a required time.

12. The method of claim 11, wherein the steps b) and d) are parallel.

13. The method of claim 12, wherein the steps b) and d) end at the same time and switch to a next feedback path when ending.

14. The method of claim 11, wherein the starting edge is a rising edge.