Phase-locked loop circuit and method
BACKGROUND OF THE INVENTION 
     1. Field of the Invention 
     The present invention relates generally to phase-locked loop circuits and more particularly to a phase-locked loop circuit having a wide dynamic input range suitable for reducing clock skew. 
     2. Background Art 
     In some applications it is necessary to produce a clock having a fixed phase relationship to a reference clock. For example, in fault-tolerant microprocessor systems, two or more microprocessors operate in parallel, each performing the same operation on a clock-by-clock basis (lock-step). One of the microprocessors (the master) interfaces directly with the system, driving all receiving signals. The second microprocessor (the shadow), receives the outputs of the master and checks the outputs each cycle. In this manner, any fault in the master can be detected. 
     In order to achieve lock-step operation, the skew (phase difference) between the microprocessor clocks, must be minimized and tightly controlled. This tight control must be maintained in the presence of loading requirements that vary among application systems. 
     It is possible to generate an internal microprocessor clock which is phase locked to an external clock using a conventional phase-locked loop. However, such conventional phase-locked loops are not generally capable of controlling clock skew to one nanosecond (10 -9  seconds) or below for microprocessor clock frequencies which can range from 5 MHZ to 50 MHz and above. 
     The present invention is capable of reducing clock skew to less than one nanosecond over a wide range of frequencies. The disclosed phase-locked loop circuit can be readily implemented in integrated circuit form so that it can be incorporated into the clock circuitry of a microprocessor chip and other large systems having high level noise. These and other advantages of the present invention will become apparent to those of ordinary skill in the art upon a reading of the following Detailed Description of the Invention together with the drawings. 
     SUMMARY OF THE INVENTION 
     A phase-locked loop circuit for producing an output signal which is phase locked with respect to an input signal and a method of producing an output signal which is phase locked to an input signal are disclosed. The circuit and method are useful, for example, in reducing and controlling skew between an external and an internal microprocessor clock, where the frequency of the external clock may vary over a wide range. 
     The circuit includes phase detector means for producing a detector output signal in response to a phase difference between the input and output signals. Also included is a controlled signal generating means, for generating the output signal, which includes coarse adjust means and fine adjust means. The coarse adjust means selects the frequency of the output signal from a group of discrete operating frequencies in response to the frequency of the input signal. The fine adjust means is for continuously adjusting the frequency and phase of the output signal in response to the detector output. 
     The fine adjust means is preferably a voltage controlled oscillator which is responsive to the phase detector output signal. In one embodiment, the coarse adjust means selects the frequency of the output signal by dividing the voltage controlled oscillator output signal by a variable value N, where N is an integer which can vary from 1 through M, with M being an upper limit. The value of N is a function of the frequency of the input signal. 
     In a second embodiment, the voltage controlled oscillator is a ring oscillator having a plurality of delay stages which can be added to or deleted from the ring oscillator so that the center frequency of the oscillator may be changed. The coarse adjust means functions to either add or delete the delay stages, based upon the frequency of the input signal. 
    
    
     BRIEF, DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a block diagram of a first embodiment phase-locked loop circuit in accordance with the present invention. 
     FIG. 2 is a graph showing the frequency versus control voltage V c  characteristics of the voltage controlled oscillator 14 (FIG. 1) of the first embodiment phase-locked loop circuit. 
     FIG. 3 is a graph showing the relationship between the frequency divider value N and the ratio of the phase-locked loop circuit input frequency and output frequency. 
     FIG. 4A is a block diagram of the control logic section 18 (FIG. 1) of the first embodiment circuit. 
     FIG. 4B is a flow chart depicting the operation of the control logic section 18 (FIG. 1) during the phase-locked loop initialization period when the coarse adjust of the loop takes place. 
     FIG. 5 is a block diagram of an alternative phase-locked loop circuit. 
     FIG. 6 is a more detailed diagram of the voltage controlled oscillator and the associated control logic of the FIG. 5 embodiment. 
    
    
     DETAILED DESCRIPTION OF THE INVENTION 
     Referring now to the drawings, FIG. 1 shows a block diagram of a first embodiment of the present invention. The principal components of the phase-locked loop (PLL) circuit include a phase detector 10, followed by a low pass filter 12. The output of filter 12 is an input to a voltage controlled oscillator (VCO) 14 and the output of VCO 14 is fed back to one of the phase detector 10 inputs by way of a programmable frequency divider 16. Divider 16 is controlled by control logic 18. 
     The external (input) clock EC is connected to one input of phase detector 10. The remaining input of detector 10 receives an internal clock IC which is produced by the PLL circuit. Clock IC has a fixed phase relationship with the external clock EC. The objective of the FIG. 1 circuit is to limit the skew between the external and internal clocks to a well controlled minimum value over a wide range of external clock EC frequencies. 
     The output V d  of the phase detector 10 is a function of the phase difference between the two clocks, as follows (the following equation and the other equations disclosed herein are only linear approximations of a phase-locked loop): 
     
         V.sub.d =K.sub.d (φ.sub.x -φ.sub.o)                (1) 
    
     where 
     V d  is the output of the phase detector; 
     K d  is the gain of the phase detector 10; 
     φ x  is the phase of the external clock EC; and 
     φ o  is the phase of the internal clock IC. 
     The output of the low pass filter 12 is a voltage V c  and is as follows: 
     
         V.sub.c =F(s) V.sub.d                                      (2) 
    
     where 
     V c  is the output of the filter; 
     V d  is the input to the filter; and 
     F(s) is the transfer function of the filter. 
     The output CL I  of the voltage controlled oscillator (VCO) 14 has a frequency f i  and phase φ i  which depend upon the magnitude of control voltage V c . The phase of output CL I  may be expressed as follows: 
     
         φ.sub.i =K.sub.c V.sub.c /s                            (3) 
    
     where 
     φ i  is the phase of output CL I  ; 
     K c  is the gain of the VCO; and 
     s is the Laplace transform variable. 
     The output CL I  of VCO 14 is connected to the input of the programmable frequency divider 16 which divides the frequency (and phase) of CL I  by a variable integer N. The value of variable N is preferably a power of two and is determined by the control logic 18, as will be explained. The output of divider 16 is the internal clock IC which forms the output of the PLL circuit. 
     The phase relationship between the VCO output CL I  and the internal clock IC is a follows: 
     
         φ.sub.o =φ.sub.i / N                               (4) 
    
     where 
     φ o  is the phase of internal clock IC; 
     φ i  is the phase of VCO output CL I  ; and 
     N is a Variable integer. 
     Combining equations (1)-(4), it can be seen that the ratio of the phase of the internal clock IC and external clock EC is as follows: ##EQU1## 
     At steady state (s=0) it can be seen from equation (5) that φ o  will be equal to φ x . 
     The value of N is a function of the frequency f x  of the external clock EC. N is determined by the control logic 18 each time the control logic receives the Reset signal (Reset becomes active). This typically occurs at power-up. 
     The control logic 18 receives the external clock EC and the VCO output CL I . When Reset becomes active, control logic 18 causes an Enable signal on line 20 to go active. This causes the phase detector 10 output to go to an inoperative high output impedance state. This further causes a transistor 22 to become conductive, thereby coupling a reference voltage V REF  to the input of VCO 14 in lieu of the phase detector output. 
     Voltage V REF  is selected to fall within the midrange of the control voltage V c . The control logic 18 computes the ratio of the frequency f i  of output CL I  to the unknown frequency f x  of the external clock EC and produces an appropriate value of N. In the present embodiment, N may be any power of 2 ranging from 1 through 64. 
     Once the value of N has been determined, the value is used to select an appropriate output of divider 16 (divide by 1, 2, 4, etc.). The control logic 18 then causes the Enable signal to go low thereby turning off transistor 22 so that V REF  is no longer coupled to the VCO input. Also, phase detector 10 is enabled so that the detector can function. 
     FIG. 2 shows the transfer characteristics of VCO 14 in combination with divider 16 for various values of N. The horizontal axis of the FIG. 2 graph represents the magnitude of the VCO 14 input control voltage V c  and the vertical axis represents the frequency f o  of the internal clock IC (the output of divider 16). By way of example, frequency f o  can range from a maximum value of 50 MHz to a minimum value of less than 1 MHz. 
     If the input frequency f x  of the external clock EC is in the upper range, the control logic 18 will select a value of N equal to 1. For lower input frequencies, the value of N will be higher. 
     FIG. 3 is a graph illustrating an exemplary algorithm for selecting the value of N. The value is based upon the ratio of the frequency f i  of the VCO output CL I  produced by VCO 14, when the control voltage V c  is forced to V REF , to the frequency f x  of the external clock EC. Both the vertical and horizontal axes are logarithmic scale. The vertical axis represents the various values of N and the horizontal axis represents the ratio of the VCO frequency f i  to the external clock EC frequency f x . 
     Assume that VCO 14 is constructed to produce an output CL I  having a frequency f i  of 35 MHz when V c  is forced to V REF . Further assume that the external clock EC has a frequency f x  of 40 MHz. According to the exemplary algorithm plot 22 of FIG. 3, control logic 18 will produce N=1 when the ratio of f i  to f x  is 0.88 (35/40). As a further example, if the input frequency f x  is 9 MHz, the ratio is 3.89 (35/9). In that event, plot 22 indicates that the control logic 18 will produce N=4. 
     Returning to FIG. 2, curve 24 represents the VCO 14/divider 16 transfer characteristics when N=1. Curves 26, 28 and 30 represent the transfer characteristics when N=2, 4, and 8, respectively. Curves for higher values of N are not depicted. 
     FIG. 4A is a simplified block diagram of the control logic 18 and FIG. 4B is a flow chart illustrating the operation of the control logic during the phase-locked loop reset period. The control logic includes a state machine 82 which receives the Reset signal and the external clock EC. State machine 82 produces the Enable signal and a clear signal which are synchronized with the external clock EC. 
     The control logic further includes a frequency divider 84 which divides the frequency of the external clock EC by thirty-two. Divider 84 is cleared by the state machine 82. The output of divider 84 is used to enable an AND gate 86. Gate 86 also receives the output of CL I  of the VCO 14 (FIG. 1). 
     The output of gate 86 is used to clock a counter 88. Counter 88 is also cleared by state machine 82. Counter 88 has eleven output stages which, as will be described, represent the ratio of the frequency f i  of the VCO output CL I  and the frequency f x  of the external clock EC during the coarse adjust period. 
     The FIG. 4B flow chart depicts the operation of state machine 82 and the associated logic. As represented by element 92, a determination is initially made as to whether the Reset signal is active. If the Reset signal is active, the PLL will be initialized for the purpose of computing the value of N. This will occur, for example, each time the microprocessor is reset in the event the subject circuit is being used in a microprocessor. The PLL reset sequence is of shorter duration than the microprocessor reset sequence since the microprocessor reset sequence requires a functioning internal clock IC. 
     Assuming that the PLL reset is active, divider 84 and counter 88 are cleared by the state machine, as represented by block 94. In addition, the state machine will produce the Enable signal which will cause voltage V REF  to be connected to VCO 14 in lieu of the control voltage V c . Thus, the output of VCO 14 will be forced to a midfrequency value (35 MHz). 
     Divider 84 produces a counting window having a duration of thirty-two external clock EC cycles. AND gate 86 is enabled during the window period so that several cycles of the VCO output CL I  can be averaged by counter 88. This is depicted by block 96 of the FIG. 4B flow chart. The output of counter 88, therefore, represents the ratio of the frequency f i  of output CL I  to the external clock frequency f x . The weight given to the eleven counter 88 outputs reflects the fact that the averaging period is thirty-two external clock EC cycles. 
     The counter 88 outputs are coupled to a decision decoder 90 which produces the appropriate value of N in accordance with the FIG. 3 diagram. As indicated by block 98, the state machine waits one external clock EC cycle to enable the decision decoder 90 to produce the appropriate value of N. 
     The above-described process continues until the PLL initialization has ended and the value of N computed. Once the reset signal goes inactive, (element 92 of FIG. 4B), the Enable signal goes inactive thereby disconnecting the reference voltage V REF  from the VCO 14 input and permitting the control voltage V c  to control the oscillator. In addition, the phase detector 10 becomes operative so that the phase-locked loop can proceed to function, with the divider 16 output set to correspond to the computed value of N. 
     Having described the construction of the first embodiment PLL circuit, operation of the circuit will now be given. Initially, the value of N is selected based upon the frequency f x  of the external clock EC. This can be considered a coarse adjust where the internal clock IC frequency is selected from one of a group of discrete operating frequencies. Once the coarse adjust is completed (Reset inactive), VCO 14 proceeds to function thereby carrying out a fine adjust. The VCO responds to the phase detector 10 and the frequency and phase of the internal clock IC are adjusted continuously so that the clock skew is reduced. 
     Assume that the input frequency f x  of the external clock EC is 9 MHz. As previously noted, during initialization, the control logic 18 will generate a value of N=4. Accordingly, divider 16 will divide the VCO output CL I  frequency f i  by 4. The output frequency f o  of the divider 16 will, therefore, be at approximately 8.8 MHz (35 MHz/4), as represented by point 28(a) of the FIG. 2 plot 28. 
     At the end of the initialization, the coarse adjust is completed (N is fixed) and the fine adjust commences. Phase detector 10 is enabled and V REF  is disconnected. By operation of negative feedback, the control voltage V c  will begin to increase until the frequency f o  of the divider 16 output, the internal clock IC, is the same frequency as the external clock EC frequency f x , namely, 9 MHz. This is represented by point 28(b) of the FIG. 2 plot 28. At this time, VCO 14 is controlled such that the phase φ x  of the external clock EC theoretically matches the phase φ o  of the internal clock. 
     There will be some phase difference between the two clocks, due primarily to the presence of noise in the system. However, the first embodiment PLL circuit is much more immune to noise than a conventional PLL, as explained below. 
     Assume that a conventional PLL circuit is used. VCO 14 would have to have a very wide dynamic range in order to accommodate the wide range of input frequencies f x  of the external clock EC. Plot 32 of FIG. 2 shows the transfer characteristics of such a VCO. The slope of the plot, which is the gain K c  of the VCO, must be very steep (high) in comparison to the plots 24, 26, 28 and 30 of the subject invention. Small variations in the control voltage V c  will result in much larger changes in the VCO output frequency. Thus, the high gain VCO is much more susceptible to noise. 
     The sensitivity of a conventional PLL circuit to noise can be illustrated by the following equation: 
     
         dtα[T.sup.2 K.sub.CA ]dV.sub.c                       (6) 
    
     where 
     T is the period of the external clock signal EC; 
     K CA  is the gain of a conventional VCO; 
     dV c  represents step function noise on 
     control voltage V c  ; and 
     dT represents the change in signal period (clock skew) due to noise dV c . 
     The following equation represents the sensitivity of the first embodiment PLL to noise: ##EQU2## where N is the variable value used by frequency divider 16; 
     K c  is the gain of the VCO 14; 
     T is the period of the external clock EC; 
     dV c  represents step function noise on control voltage V c  ; and 
     dT represents the change in internal clock 
     IC period T (clock skew) due to noise dV c . 
     In comparing equations (6) and (7), it can be seen that the smaller value of VCO gain of the present invention, K C , in comparison to gain K CA  of the conventional PLL, substantially reduces sensitivity to noise. Further, the value of N of equation (7) increases linearly with the period T of the external clock EC. Thus, the magnitude of the clock skew, dT, is linearly dependent on T, whereas the magnitude of the clock skew of the conventional PLL circuit represented by equation (6) is dependent on T 2 . 
     As previously noted, the control logic 18 generates the value of N in accordance with the exemplary algorithm plot 22 of FIG. 3. Other algorithms for selecting N could be used. It is important that each curve overlap the adjacent curve. For example, f MAX  /4 for curve 28 should be selected to exceed f MIN  /2 for curve 26. 
     FIG. 5 is an alternative embodiment PLL circuit which can also be used for reducing clock skew. An external clock EC is provided on line 34 and an internal clock IC is produced by the PLL circuit on line 36, with the skew between the two clocks being maintained at a small, controlled value. 
     The PLL circuit includes a phase detector 38 which receives the external clock EC and the internal clock IC. Detector 38 detects the difference in phase between the two clocks and generates digital control signals UP, on line 40, and DN, on line 42, depending upon the polarity of the relative phase difference. If clock IC lags behind clock EC, output UP is active. Similarly, if clock EC lags behind IC, output DN is active. 
     The control signals UP and DN are coupled to a voltage control block 44 which generates a control voltage V c  on line 46. Control voltage V c  varies, according to signals UP and DN, such that the voltage reflects the phase difference between clocks EC and IC. 
     Control voltage V c  is fed into a VCO/Control Logic block 48, as is the external clock EC and the internal clock IC. In addition, a Reset signal is coupled to block 48. As will be described in greater detail, the VCO of block 48 produces an output signal having a frequency and phase which varies with the control voltage Vc, external clock EC and internal clock IC. Generally, the frequency of the VCO is initially adjusted based upon the frequency of the external clock EC. This is a coarse adjust wherein one of a plurality of VCO frequency operating bands is selected. Once the initial coarse frequency setting has been made, the final frequency and phase of the VCO output are controlled by control voltage Vc in a continuous manner. This is the fine adjust. 
     The VCO output on line 50 is buffered by circuit 51 which is capable of driving a large number of clock inputs (not depicted). These clock inputs may be, for example, various internal clock inputs of a microprocessor. 
     The details of the construction of VCO/Control Logic 48 are shown in FIG. 6. The VCO includes a ring oscillator and associated control logic. The ring oscillator has an input in the form of an inverter 52 which receives the output of the VCO on line 50. 
     The output of inverter 52 is coupled to the first stage of a plurality of identical ring oscillator delay stages 58, 1 through n. Each delay stage 58 includes two inverters I 1  and I 2  connected in series. The output of the first inverter I 1  is connected to a capacitor C 1  by way of an MOS transistor T 1 . Similarly, the output of inverter I 2  is connected to a capacitor C 2  by way of a MOS transistor T 2 . 
     The gates of transistors T 1  and T 2  are also connected in common to line 46 which receives the control voltage V c . Accordingly, the delay provided by each delay stage 1 through n is a function of the control voltage magnitude Vc. 
     The output of each delay stage 58 is connected to a selector circuit 60 which includes a multiplexer (not depicted) for coupling a selected one of the delay stage 58 outputs back to the input of inverter 52. Since there are always an odd number of inverters, the feedback will be positive, thereby providing the desired oscillation. The frequency of the ring oscillator can be varied in discrete steps by adding or deleting delay stages in the feedback loop. The maximum frequency is achieved by feeding back the output of the first delay stage and the minimum frequency is achieved by feeding back the output of the last delay stage n. 
     The number of selected delay stages 58 is determined by the control logic, as will be described. The external clock EC on line 34 is fed to the input of a first counter 62. The internal clock IC from buffer 51 is fed to the input of a second counter 64. The outputs of counters 62 and 64 are fed to respective inputs of a digital comparator 66. The outputs of the two counters are compared after a predetermined time period. Output signal U/D of the comparator indicates the relative magnitude of the frequency of clocks EC and IC. 
     Signal U/D controls the state of an up/down counter 68 which is either incremented or decremented by a clock produced by a state machine 70, depending upon the level of signal U/D. The selector circuit 60 includes decode logic (not depicted) which decodes the output of counter 68 and selects a particular delay stage 58 output to be fed back to the oscillator input on line 50. 
     The state machine 70 is similar in function to the state machine 82 of the first embodiment circuit. Machine 70 receives the PLL Reset signal and the external clock EC. The machine then produces various signals, including the Enable signal on line 72, the clock for up/down counter 68, signals for clearing counters 62 and 64 and signals for controlling the counting window for counters 62 and 64. 
     Initially, the state machine determines whether the Reset signal is active. If active, the Enable signal is produced on line 72. The Enable signal causes transistor 74 to be conductive thereby coupling the voltage reference V REF  to the control input of the VCO on line 46. Preferably, V REF  is selected to fall within the midrange of the control voltage V c . In addition, the Enable signal also disables the voltage control block 44 (FIG. 4) so that the output of the block becomes disabled (a high impedance). Accordingly, V REF  is applied to VCO 48 in lieu of the control voltage V c . 
     The state machine 70 clears counters 62 and 64 and permits the counters to be clocked by the external clock EC and the internal clock IC, respectively. The duration of the counting period is also controlled by the state machine, as previously noted. 
     After a predetermined time period, the contents of counters 62 and 64 are compared by comparator 66. Assuming that the external clock EC frequency is greater than the frequency of the internal clock IC, the count in counter 62 will exceed that of counter 64. Accordingly, the comparator output U/D will cause counter 68 to be in a decrement mode. Machine 70 will then produce one clock pulse and counter 68 will be decremented by one count. This will cause the selector circuit 60 to remove a delay stage so that the VCO frequency will increase by one discrete step as will the frequency of the internal clock IC. 
     The above-described process continues until an appropriate number of delay stages are selected. At this point, the VCO frequency (the internal clock IC frequency), roughly matches the frequency of the external clock EC. This initialization step is equivalent to a coarse adjust of the VCO. 
     After the initial coarse adjust period is completed, the Reset signal becomes inactive followed by the Enable signal. This causes the reference voltage V REF  to be disconnected and the voltage control block 44 to be enabled. At this time, voltage V c  will change magnitude, either increasing or decreasing the gate voltage of transistors T 1  and T 2  of the delay stages. An increase in control voltage will cause the transistors to become more conductive thereby increasing the effective load capacitance. Thus, the frequency of the VCO will decrease. Conversely, a decrease in control voltage V c  will cause the transistors to become less conductive, thereby reducing the effective load capacitance and increasing the frequency of the VCO output. 
     The value of V c  changes until the frequency and phase of the internal clock IC match that of the external clock EC. During this fine adjust period, the frequency and phase of clock IC will be continuously varied to match that of external clock EC. Thus, the skew between clocks EC and IC is reduced to a minimum value and closely controlled. 
     VCO 48 has a very wide dynamic range which can accommodate a wide range of external clock EC frequencies. In most applications, however, the first embodiment PLL circuit (FIG. 1) is preferred because immunity to noise present on the control voltage V c  has been found to be higher in practice. 
     Thus, two embodiments of a phase-locked loop circuit suitable for reducing clock skew have been disclosed. Although these embodiments have been described in some detail, it is to be understood that various changes can be made by those skilled in the art without departing from the spirit and scope of the invention as defined by the appended claims.