The present application is based on Japanese patent application No. 2014-159642 filed on Aug. 5, 2014.
The present disclosure relates to a time measuring circuit, which realizes time measurement at high resolution.
It is conventional to measure time by using a ring oscillator, in which plural delay elements for delaying a pulse signal are connected in a ring form, and encoding the number of stages of the delay elements, through which the pulse signal passes in a period of measurement (refer to U.S. Pat. No. 5,818,797 corresponding to JP H10-54887 A, for example).
According to the conventional device, a variation in a measured time value increases as a period of measurement increases. This variation is considered to arise, because the delay time of individual delay element forming the ring oscillator varies with a variation of a power supply voltage, thermal noise and the like and this variation of the delay time accumulates in proportion to the number of the delay elements, through which the pulse signal passed.
In an application for detecting precisely a variation in a frequency, which has a sufficiently long period longer than milliseconds (ms) relative to the delay time of nanoseconds (ns) of the delay element, the error in the measured time value increases to be large relative to the variation in the frequency to be measured. This variation thus makes it impossible to attain the time measurement precisely.
In an actual experiment, a period of a signal, which is set to a predetermined frequency (oscillation period), was measured 2,000 times. This measurement was performed 2,000 times for each frequency, while changing the predetermined frequency. The measurement exhibited the following results. That is, as shown in
The present disclosure addresses this problem and has an object to provide a time measuring circuit, which reduces a variation even in a case that a period to be measured is long.
According to one aspect, a time measuring circuit comprises a delay line, a first encoding part, a second encoding part, a count part and a fraction calculation part. The delay line has plural delay elements connected in series for delaying a pulse signal. The first encoding part performs an encoding operation, at every reference timing determined by a reference clock, in accordance with a number of stages of the delay elements, which the pulse signal passes through during a period from a preset start timing to the reference timing. The second encoding part performs an encoding operation with respect to a measurement start timing and a measurement end timing of a measurement period determined by a measurement signal inputted asynchronously from a reference signal, at every reference timing determined by the reference clock, in accordance with the number of stages of the delay elements, which the pulse signal passes through during the period from the preset start timing to the measurement start timing and from the preset start timing to the measurement end timing. The count part counts a number of periods of the reference clock included in the measurement period. The fraction calculation part calculates based on encoding results of the first encoding part and the second encoding part a start fraction and an end fraction. The start fraction indicates a time difference from the measurement start timing to the reference timing appearing first after the measurement start timing, and the end fraction indicates a time difference from the measurement end timing to the reference timing appearing first after the measurement end timing. The fraction calculation part further calculates from the start fraction and the end fraction a fraction data indicating a difference between the measurement period and a period, which is a product of the period of the reference timing and a count value of the count part, thereby to output a count data and the fraction data as a measurement value of length of the measurement period. Preferably, the count data is outputted by correcting the count value by correcting part so that the count data corresponds to the count value.
The above and other objects, features and advantages of a time measuring circuit according to the present disclosure will become more apparent from the following detailed description made with reference to the accompanying drawings. In the drawings:
Embodiments of a time measuring circuit will be described below with reference to the drawings.
[Configuration]
As shown in
[Ring Oscillator]
The ring oscillator 2 uses an odd number of inverter circuits (fifteen inverter circuits, for example) as delay elements. The inverter circuits are connected in series and in a ring form by connecting an output of a last stage of the delay elements to an input of a first stage of the delay elements. The inverter circuit of the first stage is formed of a NAND gate having two inputs and the inverter circuit of the other stages are formed of inverter gates. One of two input terminals of the NAND gate, which is not used to form the ring form, is connected to an input terminal for externally inputting a start pulse signal SP. In the following description, a pulse output of the ring oscillator 2 is indicated as P[14:0]. However, a pulse output of each inverter circuit is indicated as P[i] (P=0 to 14) collectively. The pulse output of the inverter circuit of the first stage is indicated as P[0]. The pulse outputs of the inverter circuits of the second and subsequent stages are indicated as P[1] to P[14] in the order of serial connection, respectively.
According to the ring oscillator 2 configured as described above, when the start pulse signal SP is at a low level, the pulse output P[0] of the inverter circuit of the first stage is always at a high level irrespective of a signal level of the pulse output P[14] of the inverter circuit of the last stage. As a result, all the pulse outputs P[0] to P[14] stop changing and remain unchanged. In this stop state, the pulse output PM is at the high level. Assuming that a timing of a change of the start pulse signal SP from the low level to the high level is a start timing, the pulse output P[0] of the inverter circuit of the first stage inverts from the high level to the low level when the high level of the start pulse signal SP is held following the start timing. In the following stages, the pulse output of each inverter circuit inverts while being delayed at each inverter circuit stage and the pulse output P[14] changes to the low level. Thus, each time the pulse output P[0] of the inverter circuit of the first stage changes to the high level, an inverted edge of the signal level continues to circulate. The inverted edge changes from the low level to the high level or from the high level to the low level. Assuming that one inverted edge is a top edge with respect to any one of the pulse outputs P[i], a pulse signal is outputted at every two circulations of the inverted edge, that is, at every period of delay times of thirty stages of the inverter circuits.
[Counter Circuit]
The counter circuit 3 includes a counter of 9 bits, which operates with the pulse output P[14] of the ring oscillator 2 as a count clock. The counter circuit 3 counts up at a timing when the pulse output P[14] changes from the low level to the high level. As a result, a count value of the counter circuit 3 increments by one each time the pulse signal passes through 30 stages of the inverter circuits. When the counter circuit 3 further counts up under a state that the count value has reached its maximum value, the count value returns to 0 and the counter circuit 3 continues to count up. The output of the counter circuit 3 is indicated as RCNT[8:0].
[First Encoding Part]
The first encoding part 4 includes latch circuits 41, 42, 43, an encoder 44, a selector 45 and a delay circuit 46. Although the first encoding part 4 is conventional (for example, refer to JP-A-H07-183800), its operation is summarized as follows.
The latch circuit 41 latches the pulse output P[14:0] of the ring oscillator 2 at a timing of a rising edge of a measurement clock RCLK, which is inputted externally to be measured. The latch circuit 42 similarly latches an output RCNT[8:0] of the counter circuit 3 at a timing of the rising edge of the measurement clock RCLK. The latch circuit 43 latches the output RCNT [8:0] of the counter circuit 3 at a delayed timing, which is delayed one-half period of the measurement clock RCLK by the delay circuit 46.
The encoder 44 specifies a position, at which the input and the output of the inverter circuit in the ring oscillator 2 are at the same signal level, from the results latched by the latch circuit 41. The encoder 44 encodes the specified position of the inverter circuit into binary numbers indicating decimal numbers 0 to 30 in accordance with the specified position of the inverter circuit and the same signal level (high level or low level). An output of the encoder 44 is indicated as ENC[4:0].
The selector 45 selects an output of the latch circuit 42 when the output of the encoder 44 is ENC[4]=1 and selects an output of the latch circuit 43 when the output of the encoder 44 is ENC[4]=0 in accordance with a most significant bit (highest-digit bit) ENC[4] in the output of the encoder 44. The output, which the selector 45 selects, is indicated as CNT[8:0] below. Either one of the outputs latched at different timings is used selectively so that the count value, which is latched while it is still in an unstable state, is not supplied to subsequent processing.
The first encoding part 4 supplies a first measurement output DR[13:0] to the fraction processing part 6 at every timing of the rising edge of the measurement clock RCLK. The first measurement output is a data of a total of 14 bits, which is formed of the output ENC[4:0] of the encoder 44 as least significant bits (lower digits) and the output CNT[8:0] of the selector 45 as most significant bits (higher digits).
[Second Encoding Part]
The second encoding part 5 is configured similarly to the first encoding part 4 described above and hence description of its details will not be made. It is noted however that the second encoding part 5 is inputted with a reference clock SCLK in place of the measurement clock RCLK. Further, in place of the first measurement output DR[13:0], a second measurement output DK[13:0] is supplied to the fraction processing part 6 at every timing of a rising edge of the reference clock SCLK.
The reference clock SCLK is a clock, which is generated as the reference clock from an output of a crystal oscillator, for example, and is highly stable. The reference clock SCLK is set to have a period (for example, 100 ns), which is as long as about tens of times to hundreds of times of the delay time of each inverter circuit forming the ring oscillator 2. The reference clock SCLK and the counter circuit 3 are set to have a period and an output bit width, respectively, so that a time corresponding to a maximum value, which can be indicated by the first measurement output DR[13:0] and the second measurement output DK[13:0], becomes twice or more as long as the period of the reference clock SCLK. The reference clock SCLK is set to have a period, which is far shorter (for example, 1/100 or less) than the measurement clock RCLK. The first measurement output DR[13:0] and the second measurement output DK[13:0] are indicated simply as DR and DK below, respectively. Other symbols indicating plural bits are also indicated in a simplified manner.
[Fraction Processing Part]
The fraction processing part 6 includes, as shown in
<Processing Timing Generation Part>
The processing timing generation part 61 includes, as shown in
In the processing timing generation part 61 configured as described above, as shown in
That is, each time the RCLK timing is detected, the processing timing signal HIT generated by the processing timing generation part 61 changes to the high level at the SCLK timing, which is immediately following the RCLK timing, and changes to the low level further at the next SCLK timing. Thus, the high level is maintained only for one period of the reference clock SCLK. This period of the SCLK clock is referred to as a processing period below. Since the measurement clock RCLK and the reference clock SCLK are not synchronized, the output S2 of the latch circuit 612 cannot change its level at the first SCLK timing and changes its level to the high level at the next SCLK timing in a case that the period from the RCLK timing to the first SCLK timing is short. In this case, the processing timing signal HIT remains at the high level for a period from the second SCLK timing to the third SCLK timing after detection of the RCLK timing. In the following description, cases that the processing timing signal HIT becomes high at the first SCLK timing and the second SCLK timing after detection of the RCLK timing are referred to as a normal detection state and a delayed detection state, respectively.
<RCLK Period Counting Part>
Referring back to
<Border Fraction Calculation Part>
The border fraction calculation part 63 includes, as shown in
The fraction calculation value SUB indicates the number of stages of the inverter circuits which the pulse signal passed through in the ring oscillator 2 during a period from the RCLK timing to the SCLK timing, which is immediately following the RCLK timing. In the normal detection state, SUB=DK−DR as shown in
Here, the first measurement output DR and the second measurement output DK indicates RDL free-run (values indicated by outputs P, RCNT of the ring oscillator 2 and the counter circuit 3), which are latched at timings of the rising edges of the measurement clock RCLK and the reference clock SCLK. The RDL free-run repeats values from 0 to an upper limit value as shown in
Since the period of the RDL free-run is set to be two times or more as large as that of the reference clock SCLK, each relation of DK, DR and DKB relative to the RDL free-run is summarized in three patterns in any states of normal detection and delayed detection. That is, it may be determined to be the normal detection state in cases of DKB<DR<DK (solid line), DR<DK<DKB (dotted line) and DK<DKB<DR (one-dot chain line) as shown in
Since the RCLK period count part 65 starts and ends its counting operation in correspondence to the processing timing signal HIT, the starting and ending of the counting is delayed by one clock. To indicate this, the first correction value PM1 is set to PM1=0 (count value need not be corrected) in the normal detection state and set to PM1=1 (count value need be corrected) in the delayed detection state.
The binary correction part 633 corrects the fraction calculation value SUB calculated by the fraction calculation execution part 632 to a value represented in a binary code. The values SUB_U of left-most significant 9 bits of the first measurement output DR and the second measurement output DL (specifically, fraction calculation values SUB), which are based on the outputs of the counter circuit 3, are counted up by one each time the value indicated by right-most least significant 4 bits reaches 30. For this reason, the corrected fraction calculation value SUB is outputted as SUB-SUB_U×2 by subtracting from the fraction calculation value SUB a value, which is twice as large as a value indicated by the left-most significant 9 bits.
<SCLK Period Calculation Part>
Referring back to
<Fraction Correction Value Calculation Part>
The fraction correction value calculation part 64 includes, as shown in
The RCLK period fraction calculation value RCH indicates a remaining time, which remains to be less than the SCLK period as a result of subtracting time of integer times of the period of the reference clock SCLK (referred to as a SCLK period) from one period (measurement period) of the measurement clock RCLK. The RCLK period fraction calculation value RCH indicates the number of stages of the inverter circuits, which the pulse signal passed through, in the ring oscillator 2. As shown in
The RCLK period fraction calculation value RCH is calculated by subtracting SUB from SUB_B in a case of SUB_B≥SUB (refer to
The number of periods of the reference clock SCLK included in the measurement period is equal to a count value of the RCLK period count part 65 in a case of SUB_B≥SUB (refer to
<Count Value Correction Part>
The count value correction part 66 includes, as shown in
The first correction value PM1 indicates whether the detection stage of the processing timing signal HIT at the RCLK timing is the normal detection state (PM1=0) or the delayed detection state (PM1=1). There are four correction patterns depending on a combination of the first correction value PM1_B at the start timing of the measurement period and the first correction value PM1 at the end timing of the measurement period. That is, when both of the start timing and the end timing are of the normal detection states (PM1_B=0 and PM1=0), counting of the count value CT starts from the SCLK timing, which is immediately after the start timing, and ends at the SCLK timing, which is immediately before the end timing, as shown in
As described above with reference to the fraction correction value calculation part 64, the count value CT need not be corrected when the second correction value PM2 is PM=0 and need be decremented by one when the second correction value PM2 is PM2=1. That is, the correction calculation part 662 performs a total of eight patterns, which are combinations of the four patterns of the first correction values PM1, PM1_B and the two patterns of the second correction value PM2 (refer to
<Output Part>
Referring back to
All of the latch circuits 671 to 673 latch respective input values at the SCLK timing when the processing timing signal HIT is at the high level. It is noted that the latch circuit 671 inputs the SCLK period calculation value SCW generated by the SCLK period calculation part 62, the latch circuit 672 inputs the fraction correction value RCH generated by the fraction correction value calculation part 64, and the latch circuit 673 inputs the RCLK period count value RCC generated by the count value correction part 66.
<Operation of Fraction Processing Part>
As shown in
[Advantage]
According to the time measuring circuit 1 described above in detail, the measurement value of the RCLK period is expressed by using the RCLK period count value RCC generated by the reference clock SCLK having an accurate period and the RCLK period fraction calculation value RCH generated from the output of the ring oscillator 2. Thus influence of variations included in the output of the ring oscillator 2 is limited to be within a period, which is shorter than the SCLK period. Since the accumulation of such variations is minimized, the time can be measured accurately.
According to the time measurement circuit 1, various uncertainties caused by asynchronization between the measurement clock RCLK and the reference clock SCLK are broken down into patterns and the count value RCC is corrected depending on the patterns. As a result, the time can be measured accurately.
The time measuring circuit described above is not limited to the embodiment described above but may be modified differently.
(1) In the embodiment described above, the ring oscillator and the counter circuit are used. Alternatively, a linear delay line, which is formed of simply connecting delay elements in series, may be used.
(2) In the embodiment described above, the ring oscillator is formed of an odd number of inverter circuits and, since the output of the ring oscillator is not a power of 2 (that is, 2n), the output is corrected to a binary number at the latter stage. Alternatively, the ring oscillator may be formed to generate an output of a power of 2 and correction to the binary number may be eliminated.
(3) The function performed by one structural element in the embodiment described above may be shared by plural structural elements and the functions shared by plural structural elements may be performed by one structural element. At least a part of configuration of the embodiment described above may be replaced with a conventional configuration, which has the same function. A part of configuration of the embodiment described above may be eliminated. At least a part of configuration of the embodiment described above may be added to a structure of other embodiment or replaced. All embodiments covered by a technical idea defined by words described in patent claims belong to the present disclosure.
(4) The time measuring circuit and its time measuring method may be realized by not only the time measuring circuit itself described above but also by other forms such as a system including the time measuring circuit as one element thereof.
Number | Date | Country | Kind |
---|---|---|---|
2014-159642 | Aug 2014 | JP | national |
Number | Name | Date | Kind |
---|---|---|---|
4772843 | Asaka | Sep 1988 | A |
5128624 | Hoshino | Jul 1992 | A |
5684760 | Hunter | Nov 1997 | A |
5818797 | Watanabe et al. | Oct 1998 | A |
5963510 | Kudo | Oct 1999 | A |
6944099 | Preuss | Sep 2005 | B1 |
7516032 | Singh | Apr 2009 | B2 |
7755530 | Terazawa | Jul 2010 | B2 |
8228763 | Henzler | Jul 2012 | B2 |
9667262 | Yamauchi | May 2017 | B2 |
20050259239 | Lin | Nov 2005 | A1 |
20100277158 | Lee | Nov 2010 | A1 |
20110133973 | Yamamoto | Jun 2011 | A1 |
20120075137 | Tanizawa | Mar 2012 | A1 |
20130018631 | Chou | Jan 2013 | A1 |
20160041529 | Yamauchi | Feb 2016 | A1 |
Number | Date | Country |
---|---|---|
0122984 | Oct 1984 | EP |
Number | Date | Country | |
---|---|---|---|
20160041529 A1 | Feb 2016 | US |