Antimetastable state circuit

Abstract: An antimetastable state circuit which detects when a data edge (12) is so close to a clock edge (11) that it would result in a metastable state in a time measurement circuit (16, 17) is provided. When a potential metastable state is detected, the antimetastable circuit delays the data edge with respect to the clock edge by a known amount (27) so as to avoid the metastable state. The delayed edge is used to start the time measurement circuit, and the next clock edge is used to stop the time measurement circuit. When the known delay (27) has been added, it is subtracted from the measured time, to produce an accurate measurement of the elapsed time between the rise of the data edge (12) and the rise of the clock edge (11).

Description: Background of the Invention This invention relates in general to time measurement circuits, and more particularly to circuits for measuring elapsed time between two asynchronous electric pulses. The manufacture and use of electronic circuits requires that parameters such as switching speeds and gate delay times are measured accurately. Commonly, time measurement circuits produce an output that is proportional to the amount of time that passes between two events. Usually, each of these events are marked by a transition from a logic low state to a logic high state or vice-versa. Most often it is this transition, or pulse edge, which is used to trigger the time measurement circuit. The term "pulse edge" as used hereinafter is intended to encompass any transition between a logic low state to a logic high state, or vice-versa. Most logic devices recognize either a rising or falling edge of a waveform and rarely require both a rising and falling edge. Depending on the type of logic devices used, the term pulse edge can be taken to mean a rising edge, a falling edge, or a combination of the two. UK Patent No. GB-B-1389894 describes apparatus for the measurement of short time intervals in semiconductor circuits, such as a D-type bistable circuit. US Patent No. 3,675,127 discloses a gated-clock time interval measurement system including error elimination. US Patent No. 4,613,951 discloses apparatus for measuring the time interval between two signals by successively delaying one of the signals until the signals are synchronised. A simple way of measuring time between two asynchronous pulse edges, or data edges, is to provide a clock, and count the number of clock edges which occur between the data edges. This simple method results in a crude time measurement which is limited in accuracy to the speed of the clock used. Since typical clock periods are in the order of 1 nanosecond, this method clearly cannot work for picosecond measurement accuracy. To improve accuracy, elapsed time between each data edge, and the next clock edge must be measured. This can be done by providing a ramp circuit which has an output signal which increases linearly with time. One of the data edges is used to start the ramp circuit, while a subsequent clock edge is used to stop the ramp circuit. One such ramp circuit must be used for each of the two data edges. The ramp circuit has an analog output which is proportional to the elapsed time between the data edge, and the next clock edge. This analog data can be converted to digital data, and added to the count of clock pulses described hereinbefore. It should be noted that ramp circuits will often take several hundred or thousands of times longer to make a measurement than the actual event took. For example, if the elapsed time between the data edge and the next clock edge were 0.5 nanoseconds, a typical ramp circuit may take 500 nanoseconds to measure the elapsed time. Also, physical size of the ramp circuit is a function of the length of time which must be measured. Therefore, it is useful to minimize the time which must be measured by the ramp circuit. In order to select the next clock edge which occurs after the data edge, a D-type flip flop is used having the data edge coupled to a data (D) input, and the clock edge coupled to a clock input. Using this arrangement, once the data edge appears on the D input, the output (Q) of the D flip flop will switch after the next clock edge comes to the clock input. Thus the Q output of the D flip flop will go high when the first clock edge after the data edge occurs. The output of the D flip flop is then coupled to the ramp circuit and is used to stop the ramp circuit. While this basic circuit works well in theory, practical problems occur when the clock edge and data edge occur too close together. When the clock edge and data edge are so close together as to violate setup or hold time of the flip flop, the output of the flip flop will be uncertain. This uncertain output is also called a metastable state. The metastable output may or may not trigger the ramp circuit to stop. Also, propagation delay of the D-type flip flop is unknown in a metastable state, so accurate time measurement is impossible. The metastable state will eventually drift to either a logic high or logic low state, but this may take several clock periods to occur. Circuits have been devised to reduce the occurrence of a metastable state. Commonly, a series of three or four D flip flops are used in place of the single D flip flop described above. By using three flip flops, the probability that the metastable state would reach a logic high or logic low within a clock period was greatly improved. A significant probability remained that the metastable state will be transferred through the series of flip flops, however, and eventually reach the time measurement circuit. This is increasingly probable when short clock periods were used. To compensate for the possibility of a metastable state, several thousand measurements were usually taken, and averaged to improve accuracy. Although this method allowed the erroneous data caused by the metastable state to be averaged out, it obviously took much longer than a single measurement. Multiple measurements could actually take several milliseconds or even seconds to get an accurate measurement of an event which took only a few picoseconds. This additional time is unacceptable when many thousands or millions of measurements must be taken, as is the case for testing semiconductor integrated circuits. Also, some transient events cannot be repeated, and thus repeated measurements cannot be taken. In these cases, errors caused by the metastable state make accurate time measurement impossible. Accordingly, it is an object of the present invention to provide a method of measuring time and a time measurement circuit with improved accuracy. Another object of the present invention is to provide a circuit means and method for measuring elapsed time in the order of a few picoseconds. Summary of the Invention In accordance with a first aspect of the present invention there is provided a method for measuring time between two asynchronous pulse edges comprising the steps of: providing a time measurement circuit coupled to first and second edges; the method being characterized by the steps of testing the first edge with respect to the second edge to determine if the edges would cause a metastable state in the time measurement circuit; and delaying the first edge by a predetermined amount if a metastable state would exist. In accordance with a second aspect of the invention there is provided a time measurement circuit characterised by: a means for detecting a metastable window coupled to first and second pulse edges; a means for programmably delaying the first pulse edge with respect to the second pulse edge which is controlled by the means for detecting a metastable window; and a ramp circuit having a start input coupled to the means for programmably delaying the first pulse and a stop input coupled to the second pulse edge. Thus, the antimetastable state circuit in accordance with the invention detects when a data edge would be so close to a next clock edge that it would result in a metastable state, and delays the data edge with respect to the clock by a known amount so as to avoid the metastable state. The delayed edge is used to start a time measurement circuit, and the next clock edge is used to stop the time measurement circuit. By changing the position of the data edge with respect to the clock edge the time which must be measured by a ramp circuit is minimized. When the known delay has been added, it is subtracted from the measured time, to produce an accurate measurement of the elapsed time between the data edge and the clock edge. Thus, an advantage of the present invention is that it provides a circuit means and method for measuring elapsed time so accurately that multiple measurements are not necessary. A further advantage of the present invention is that is provides a time measurement system which removes errors caused by propagation delay change of flip flops operating in a metastable state. Brief Description of the Drawings FIG. 1 shows a timing diagram illustrating problems involved in time measurement; FIG. 2 illustrates a portion of a prior art timing circuit; FIG. 3 shows a timing diagram illustrating waveforms present in the circuit of FIG. 2; FIG. 4 illustrates a schematic of an antimetastable circuit of the present invention; and FIGS 5-8 illustrate timing diagrams for various conditions which occur in the antimetastable circuit of FIG. 4. Detailed Description of the Drawings FIG. 1 illustrates a basic timing diagram which illustrates the difficulty in measuring elapsed time between a first data edge 12 and a second data edge 13. The present invention will be described in reference to positive edge triggered electronics. The terms "edge" and "pulse edge" are intended to encompass any change in logic state, including rising or falling edges. Positive edge triggered electronics change state on a rising edge of a clock. Other types of flip flops and counters are known and are equally applicable to the present invention. A task often arises in electronic circuits, particularly in semiconductor testing equipment, which requires measurement of elapsed time between two pulse edges. As shown in FIG. 1, data edge 12 begins at T1 and data edge 13 begins at T3. Clock 11 produces a rising edge on a regular cycle which typically has a period of about one to ten nanoseconds. The antimetastable circuit will be described with reference to a one nanosecond clock, although it should be understood that any clock period is applicable. T1 and T3, as illustrated in FIG. 1, occur asynchronously with clock edge 11. That is to say, T1 and T3 do not always coincide with a rising clock edge, although coincidence is possible. A crude approximation of time between T1 and T3 can be made by counting clock edges 11 between T1 and T3. This approximation would result in a measurement accuracy of plus or minus one clock period. To obtain a more accurate measurement of elapsed time it is necessary to measure the difference in time between T1 and a next clock edge which occurs at T2, as well as T3 and the next rising clock edge at T4. Thus, the problem of accurately measuring elapsed time between asynchronous edges at T1 and T3 boils down to a problem of measuring elapsed time between a first interval T1 to T2 and elapsed time between a second interval T3 to T4. The time between T2 and T4 can be easily measured by counting clock edges. The methods and apparatus for measuring the first and second interval are identical, and so will be described in reference to the first interval only. It should be understood, however, that the circuitry shown in FIG. 2 and FIG. 4 would be duplicated to measure the second interval. The interval measurement can be done using a ramp circuit 17 as shown in FIG. 2. Ramp circuit 17 outputs an analog output which is a function of elapsed time between a start signal received on start input 18 and a stop signal received on stop input 19. This analog output can be converted to a digital output which can be added and subtracted from other measurements. For the waveform shown in FIG. 1, one ramp circuit 17 must be provided to measure the time elapsed between T1 and T2, and another ramp circuit provided to measure the time elapsed between T3 and T4. In order to measure the elapsed time between T1 and T2 shown in FIG. 1, data line 12 should be coupled directly to start input 18 while stop input 19 must be coupled to the next clock edge which occurs after data appears on data line 12. Flip flop 16 serves to select the next clock edge at T2. Flip flop 16 is a D-type flip flop which transfers data which is on a data (D) input to an output (Q) when a rising edge of a clock signal is present on a clock input. The D flip flop also has a differential output ( Q ) which has the opposite logic value from the Q output. Data edge 12 is coupled to the D input of flip flop 16 and to start input 18, clock 11 is coupled to the clock input of flip flop 16, and the Q output of flip flop 16 is coupled to stop input 19. In this arrangement, data edge 12 starts ramp circuit 17. When the next clock edge 11 appears at the clock input of flip flop 16 the Q output goes high. The logic high output shuts off ramp circuit 17 and the analog output from ramp circuit 17 represents elapsed time between T1 and T2 shown in FIG. 1. A propagation delay of flip flop 16 is added to the elapsed time between T1 and T2, but so long as this propagation delay is constant, it can be compensated for. As illustrated in FIG. 3, when data input on data line 12 and a clock edge 11 coincide, the Q output of flip flop 16 can go into an indeterminate or metastable state. Data edge 12 and clock edge 11 do not have to be exactly coincident as any data edge 12 during metastable window 21 which surrounds a clock edge may result in a metastable state. Metastable window 21 results because every flip flop has setup and hold time conditions which, if violated, result in a metastable output. The metastable output, illustrated by the Q waveform in FIG. 3, will vary between a logic low and a logic high indeterminately and may eventually settle into a logic state. There is no guarantee, however, that a logic state will be reached within a single clock period, nor any guarantee that the eventual logic state will be a correct one. Also, since the propagation delay of flip flop 16 is indeterminate in the metastable state, it cannot be compensated for even when a correct logic state is reached. FIG. 4 illustrates an antimetastable circuit of the present invention. Ramp circuit 17 and flip flop 16 are analogous to the elements shown in FIG. 2. The circuit shown to the left of flip flop 16 serves to precondition data edge 12 so that a metastable condition on flip flop 16 is impossible. Start input 18 is coupled to an output 34 of multiplexer 28. A signal on control input 33 of multiplexer 28 selects between inputs 31 and 32 and places the selected input on output 34. Input 31 is coupled to data edge 12 by a "short" data path. This short data path has a programmable delay 26 which preferably delays data edge 12 by 3.25 clock periods. Data input 32 is coupled to what is called a "long" data path and incorporates an additional delay 27 which is preferably about one-half clock period. Delay 27 should be at least as long as metastable window 21 shown in FIG. 3, and is preferably the same length as delay 29, described later. Data input 31 is selected when a logic low is present on control input 33 and data input 32 is selected when a logic high is present on control input 33. For ease of description, any propagation delay through multiplexer 28 has been lumped into delay 26 as well as any delay associated with transmission lines or coupling between components. Because delay 26 is programmable, it can be easily calibrated to take into account the additional delays. As described, multiplexer 28 serves to select from either a 3.25 nanosecond delay or a 3.75 nanosecond delay when a one nanosecond clock period is used. Thus, a data input edge 12 will appear at ramp start input 18 and at the D input of flip flop 16 either 3.25 nanoseconds or 3.75 nanoseconds after appearing at the D input of flip flop 22. As will be seen, the selectable delay is used to position data edge 12 so that a metastable condition cannot result at flip flop 16. Flip flops 22-24 and delay 29 serve to test the relationship between data edge 12 and clock edge 11 and output a signal to multiplexer 28 to correct data edge 12 when a metastable condition would exist at flip flop 16. Clock 11 is coupled to the clock input of each of flip flops 22-24, as well as flip flop 16. The D input of flip flop 22 is coupled directly to data edge 12 while the D input of flip flop 23 is coupled to data edge 12 through delay 29. Delay 29 is conveniently selected to be one-half clock period although it is only necessary that delay 29 be longer than metastable window 21 for the flip flop, shown in FIG. 3. With a 1 nanosecond clock, delay 29 will be 0.5 nanoseconds. Typically, a 0.5 nanosecond delay adds about a 200% guard band around metastable window 21. When a data edge appears at the D input of flip flop 22, it will appear at the D input of flip flop 23 0.5 nanoseconds later. The Q output of the flip flop 22 is coupled to the Q output of flip flop 23 and to the D input of flip flop 24. The coupling between the Q output of flip flop 22 and the Q output of flip flop 23 is commonly called a "hardwire or" and results in the D input of flip flop 24 being at the highest logic level of either the Q output flip flop 22 or the Q output of flip flop 23. The Q output of flip flop 24 is coupled to a reset input 36 of flip flop 24. When reset input 36 receives a logic high, the clock input of flip flop 24 is disabled and the Q output of flip flop 24 goes to a logic high. By coupling the Q output to its own reset 36, a positive feedback loop is created whereby a metastable signal on the Q output will tend to turn on reset 36 thus disabling the clock input of flip flop 24 and forcing the Q output to a logic high from the metastable state. Once reset input 36 is latched to a logic high state, any edges which occur at the D input of flip flop 24 will not affect the outputs. This is important in that the D input of flip flop 24 will remain in a logic low state for at most one clock period, so the output of flip flop 24 must be latched to guarantee a stable output even when the D input of flip flop 24 changes. The Q output of flip flop 24 is also coupled to control input 33 of multiplexer 28. Once the positive feedback loop has latched the Q output of flip flop 24 into a logic high, circuit operation will need to be restored by providing a logic signal to a set input (not shown) of flip flop 24. The set input may also be needed to initialize flip flop 24 when the antimetastable circuit is first turned on. Flip flop 24 should be of a type which has a set input which overrides reset input 36. One such flip flop is part number MC10E131 manufactured by Motorola Inc. The operation of the antimetastable circuit shown in FIG. 4 is most easily understood by looking at the waveforms shown in FIGs. 5-8 which illustrate the antimetastable circuit function with various relationships between data edge 12 and clock edge 11. FIG. 5 illustrates a condition where data edge 12 occurs more than one-half clock period before metastable window 21A. The waveform labeled D23 illustrates the waveform seen at the D input of flip flop 23, and so is delayed by 0.5 clock period by delay 29 shown in FIG. 4. Hash mark 37 on data edge 12 waveform illustrates the time at which data edge 12 would arrive at the D input of clock 16 when the short data path is used while hash mark 38 indicates the time it would arrive when the long data path is used. If data edge 12 arrives within metastable window 21B, flip flop 16 can enter a metastable state. It is this condition which is to be avoided by the antimetastable circuit. In the case illustrated in FIG. 5, where both data edge 12 and delayed edge D23 arrive before metastable window 21A, the Q output of flip flop 22 will be forced to a logic low while the Q output of flip flop 23 will be forced to a logic high. Thus the D input of flip flop 24 will be at a logic high and the Q output of flip flop 24 will be forced to a logic low. In this case the short data path is selected. As shown in FIG. 5, it is indeed the short data path which should be selected to avoid metastable window 21B. FIG. 6 illustrates waveforms when data edge 12 comes before metastable window 21A but delayed edge D23 comes during metastable window 21A. This condition results in the Q output of flip flop 22 being at a logic low while the Q output of flip flop 23 would enter a metastable state. Thus the D input of flip flop 24 sees a metastable state. It should be noted that by looking at hash marks 37 and 38 that in this condition it doesn't matter whether a short data path or a long data path is chosen as neither path will result in a metastable condition on flip flop 16. It is important, however, that one or the other of the data paths be chosen in order to avoid time measurement error. Referring to FIG. 4, a subsequent clock edge will force the metastable state on the D input of flip flop 24 to be transferred to the Q output of flip flop 24. As described hereinbefore, the positive feedback loop will tend to force the Q output to a logic high. Often, this will occur before the next clock edge, and thus a logic high will appear on control input 33. Even if this does not occur, the next clock edge will force the Q output to a logic low because by this time the D input of flip flop 24 has stabilized at a logic high. If this happens the short data path will be chosen. In either case, the data path will be chosen well before the data arrives at multiplexer 28 thus protecting the integrity of the data which is presented at flip flop 16. FIG. 7 illustrates a relationship between data edge 12 and clock edge 11 which must result in the long data path being chosen. Here, data edge 12 comes before metastable window 21, while delayed edge D23 falls after the window. This results in the Q output of flip flop 22 as well as the Q output of flip flop 23 being forced to a logic low. Thus, the Q output of flip flop 24 goes high forcing multiplexer 28 to select the long data path. As can be seen in FIG. 7 when this relationship exists between data edge 12 and clock edge 11, indeed a long data path 38 should be chosen. The positive feedback loop formed by coupling the Q output of flip flop 24 to reset 36 serves to hold the Q output at a logic high until flip flop 24 is reinitialized. Without the positive feedback loop shown in FIG. 4, the Q output of flip flop 24 would change to a logic low, before data edge 12 arrived at multiplexor 28. FIG. 8 illustrates a condition similar to that shown in FIG. 6 but in this case the metastable state on the D input of flip flop 24 is caused by flip flop 22. The antimetastable circuit functions similarly to ensure that multiplexer 28 selects a data path well before it is needed although it doesn't matter which data path is selected. It should be noted that although flip flops 22-24 may enter a metastable state, their propagation delays are not added to either the data edge or the clock edge, and thus to not effect the accuracy of the time measurement circuit. Only flip flop 16 is in the data path, and since it cannot enter a metastable state, no measurement error will occur. It should be noted that the circuit shown in FIG. 4 serves to place data pulse 12 in a range of 0.25 to 0.75 clock periods from the next clock edge 11. Thus, ramp circuit 17 will never be required to measure a time which is outside of this range. The size of this range is the same as delay 29 and delay 27. Flip flops 22 and 23, together with delay 29, serve to detect a window which is as wide as delay 29. If additional flip flops and delays are used which are coupled and function analogously to flip flops 22 and 23 and delay 29, additional windows can be detected. In this manner, data edge 12 can be placed in smaller and smaller ranges with respect to the next clock edge 11, greatly reducing the time which ramp circuit 17 is required to measure. By now it should be appreciated that a circuit and method for measuring elapsed time between two asynchronous edges is provided. By testing the relationship between the two edges, a metastable state can be avoided before the edges are used in a time measurement circuit. In this manner, greater accuracy can be achieved by the measurement circuit, and it becomes possible to accurately measure events with only a few picosecond duration. It is believed that accuracy of plus or minus five picoseconds can be achieved in a single measurement using a one nanosecond clock period. By eliminating the need for multiple measurements, time required for measuring events is greatly reduced, resulting in a time measurement system which can be efficiently used for integrated circuit testing.

Claims: A method for measuring time between two asynchronous pulse edges (11, 12) comprising the steps of: providing a time measurement circuit (17) coupled to first and second edges; the method being characterized by the steps of testing the first edge with respect to the second edge to determine if the edges would cause a metastable state in the time measurement circuit; and delaying the first edge by a predetermined amount if a metastable state would exist. The method of claim 1 further comprising the steps of: delaying the first edge by a first amount (26) when a metastable condition does not exist and by a second amount (26 and 27) when a metastable condition would exist. A method of measuring elapsed time between a data edge (12) and a clock edge (11) comprising the steps of: providing a time measurement circuit (17); the method being characterised by the steps of: generating first and second delayed edges from the data edge (12), wherein the first and second delayed edges are separated by a predetermined length of time (29) such that at least one of the delayed edges is not coincident with the clock edge (11); determining which of the delayed edges is not coincident with the clock edge (11); and coupling the delayed edge which is not coincident with the clock edge to the time measurement circuit (17). A circuit for measuring time difference between a data signal (12) and a clock signal (11) the circuit being characterised by: a first flip flop (22) having a data input coupled directly to the data signal (12); a first delay line (29) having a predetermined time delay coupled to the data signal (12); a second flip flop (23) having a data input coupled to the first delay line (29), wherein a Q output of the first flip flop (22) is coupled to a Q output of the second flip flop (23); a third flip flop (24) having a data input coupled to the Q output of the second flip flop (23) and the Q output of the first flip flop (22), wherein the first, second, and third flip flops (22, 23, 24) have clock inputs coupled to the clock signal (11); a multiplexer (28) having two data inputs (31, 32), an output (34), and a control input (33) for selecting between the two data inputs (31, 32), wherein the control input (33) is coupled to a Q output of the third flip flop (24); a second delay line (26) coupling the data signal to one of the multiplexer data inputs (31); a third delay line (27 and 26) coupling the data signal to another (32) of the multiplexer data inputs, wherein the third delay line (27 and 26) is longer than the second delay line (26); and a time measurement circuit (16, 17) coupled to the output of the multiplexer (28) and the clock signal (11). The circuit of claim 4 wherein the third flip flop (24) has a reset input (31) which disables the clock and data inputs and forces the Q output to a logic high state, and the Q output is coupled to the reset input. The circuit of claim 4 or 5 wherein the flip flops are D-type flip flops. The circuit of claim 4, 5 or 6, wherein the third delay line is longer than the second delay (26) line by the predetermined time delay (27). A time measurement circuit characterised by: a means (22, 29, 23, 24) for detecting a metastable window coupled to first and second pulse edges (12, 11); a means (26, 27, 28) for programmably delaying the first pulse edge with respect to the second pulse edge which is controlled by the means (24) for detecting a metastable window; and a ramp circuit (17) having a start input (18) coupled to the means for programmably delaying the first pulse (28) and a stop input (19) coupled to the second pulse edge (11).

Inventors: COLLIS CHARLES, SWAPP MAVIN, COLLIS, CHARLES, SWAPP, MAVIN
Applicants: MOTOROLA INC, MOTOROLA, INC.
Application year: 1990
Main classification: G04F10
IPC codes: G04F10