Background of the Invention
1. Field of the Invention
The present invention relates to electrical circuits and, in particular, to a circuit that utilizes an asynchronous clock select input to control selection between two synchronous clock sources while eliminating spurious glitches on the clock output.
2. Discussion of the Prior Art
The clock supplied to a microprocessor must not exceed the maximum frequency requirement inherent in the microprocessor design. For a system where multiple frequency operation is desirable, it becomes necessary to provide a means for selecting the operating frequency. It is also desirable to be able to switch clock speed quickly without stopping the clock and, certainly, without "glitching" the clock, since this would be detrimental to the operation of the microprocessor.
Conventional clock select systems require stopping the clock altogether, selecting the new frequency, and then starting the clock up again at the new frequency. A system of this type is disclosed in U.S. Pat. No. 4,229,699, titled Multiple Clock Selection System, issued to Frissel on Oct. 21, 1980.
The system described by Frissel is adequate in applications where configuration time is not critical. However, in some applications, it is necessary to change speed "on the fly" to meet the requirements of the application. In both cases, it is essential that the selection process be glitch free, i.e. the transition from one clock frequency to another must be implemented in a manner such that small skews or spikes that could be interpreted as clock signals are avoided.
Summary of the Invention
A clock select circuit in accordance with the present invention allows CPU operation at either the crystal frequency (1/T) or at one-half the crystal frequency (1/2T), where T equals one period of the crystal clock. Frequency selection is performed under CPU control. Circuitry is provided to insure that the clock speed can be changed "on the fly" without glitches. The glitch free clock select insures that no half-speed T state on the clock generated by the select circuit to drive the CPU is less than what a full speed half T state would be. By gating the right phases of the half speed clock and of the full speed clock to control the clocking of a flip-flop, the point at which the clock selection multiplexer is switched can be controlled. When speeding up the clock, the speed change occurs on the falling edge of the full speed clock provided that the half speed clock is low. When slowing down the clock, the speed change occurs on the rising edge of the half speed clock. The circuitry provided works at frequencies up to and exceeding 20 MHz.
A better understanding of the features and advantages of the present invention will be obtained by reference to the following detailed description of the invention and accompanying drawings which set forth an illustrative embodiment in which the principles of the invention are utilized.
Brief Description of the Drawings
FIG. 1 is a circuit diagram illustrating a glitch free clock select circuit in accordance with the present invention.
FIG. 2 is a timing diagram illustrating a change in speed selection from low speed to high speed mode of operation for the glitch free clock circuit shown in FIG. 1.
FIG. 3 is a timing diagram illustrating a speed selection change from high speed to low speed mode of operation for the glitch free clock select circuit shown in FIG. 1.
Detailed Description of the Invention
Referring to FIG. 1, a glitch free clock select circuit in accordance with the present invention includes a conventional synchronous divider comprising D-flip-flop 10 and its associated delays, for generating a divide-by-two frequency source DV2 in conjunction with a full speed clock source DV1 based on a crystal clock CLK. A two-to-one multiplexer 12 is then utilized for asynchronously selecting between the two synchronous frequency sources DV1 and DV2. Signals SSELI and SSELI' control the steering of the multiplexer 12 such that either input DV1 or input DV2 is selected to form system output CPU.sub.-- CLOCK. The remaining logic shown in FIG. 1 controls when the SSELI and SSELI' signals change with respect to the DV1 and DV2 inputs to insure that the clock selection changes are glitch free and that the maximum frequency supplied is not exceeded in output CPU.sub.-- CLOCK . Another function of the remaining logic is to allow frequency selection to be made totally asynchronously to the input clock.
The key to understanding the operation of the clock selection logic lies in the circuitry required for generation of the SCK signal. As shown in FIG. 1, the SCK signal clocks a D type flip-flop 14 the outputs of which, i.e., SSELI and SSELI', control the final clock selection at the multiplexer 12, as described above. The SCK signal is generated from logic combinations of the DV1 and DV2 clock sources and is dependent upon the current mode of operation.
The role of the SCK signal and how it is generated is best described in conjunction with the FIGS. 2 and 3 timing diagrams. When the RST' signal is low, the selection of half-speed clock DV2 is accomplished. As seen in the FIG. 2 timing diagram, the CPU.sub.-- CLOCK output signal is running in the slowest speed DV2 mode at the start of the simulation. The SPEED.sub.-- SELECT input is toggled at time point 15,000 in the simulation, as shown in FIG. 2. SSELI is high, which results when SPEED.sub.-- SELECT is high. The SCK signal at this time can be logically described as SCK=NOT (DV1 or DV2).
The above-described logic combination insures that if SPEED.sub.-- SELECT goes low, it will result in a frequency change at a point in time when both the DV1 and DV2 clock sources are low. With this constraint, the speed change may shorten the low time of the CPU.sub.-- CLOCK output at the slow speed, which is of no consequence, since the maximum frequency rate is not exceeded. When SCK goes high, after SPEED.sub.-- SELECT goes low, the selection of multiplexer 12 is changed and, also, the selection of the generation logic for SCK is changed as well through secondary multiplexor 16. The selection results in the next high time of the CPU.sub.-- CLOCK output being at the maximum frequency with no glitches in the transition.
With the CPU.sub.-- CLOCK output at full speed (i.e. with SPEED.sub.-- SELECT low), the logic equation for SCK is changed to simply SCK=DV2. With this constraint, a frequency change to slow down (i.e., SPEED.sub.-- SELECT going high) is only allowed to occur on a rising edge of DV2. Since DV2 and DV1 are synchronized, DV1 will be going high along with DV2. Therefore, after SPEED.sub.-- SELECT goes high, the next rising edge of DV2 results in both SCK and SSELI going high to switch the rate of the CPU.sub.-- CLOCK output to the slower rate of DV2. As with the speeding up operation, the selection is glitch free and the maximum frequency supplied is not exceeded.
The resulting CPU.sub.-- CLOCK output can be used to drive a processor the maximum frequency rate of which is that of either DV1 or CLK. The processor speed can then be altered by toggling the SPEED.sub.-- SELECT signal asynchronously with no detrimental impact on processor operation.
It should be understood that the invention is not intended to be limited by the specifics of the abovedescribed embodiment, but rather defined by the accompanying claims.