Abstract:
A clock switching circuit responsive to at least one clock select signal switches to a selected one of a plurality of clock signals while minimizing transients generated during the switching. The circuit includes at least one flip-flop receiving a corresponding one of the at least one clock select signal; a plurality of flip-flops individually receiving an output of a corresponding one of the at least one flip-flop, and an inverted version of a corresponding one of the clock signals; a plurality of AND gates individually receiving the output of a corresponding one of the at least one flip-flop, the output of a corresponding one of the plurality of flip-flops, and a corresponding one of the plurality of clock signals; and an OR gate receiving the outputs of the AND gates so that the selected one of the plurality of clock signals is provided at an output of the OR gate, and fed back to an inverted clock input of the at least one flip-flop. Timing of the clock switching circuit is such that a first clock signal is provided to the circuit until a first falling edge of the first clock signal occurs following an indication to change clock signals, and a second clock signal is provided to the circuit after a first falling edge of the second clock signal occurs following the first falling edge of the first clock signal following the indication to change clock signals.

Description:
BACKGROUND OF THE INVENTION 
     This invention relates in general to systems employing multiple clock signals and in particular, to a method and circuit for selectably switching between a plurality of clock signals available in a system to provide a selected clock signal to a circuit in the system while minimizing the occurrence of transients such as glitches during the switching process. 
     A circuit for selectably switching between multiple clock signals has a number of practical applications. For example, where multiple memory devices operate at different speeds in a computer system, a circuit for selectably switching between multiple clock signals is useful in conjunction with a memory controller for controlling the reading and writing of data from and to the multiple memory devices. As another example, where a power saving circuit detects an idle condition or a power down request in a system, a circuit for selectably switching between multiple clock signals is useful in conjunction with the power saving circuit for switching from a normal operation mode clock signal to a slower, idle mode or power saving clock signal as the system clock signal. 
     FIG. 1a illustrates a conventional multiplexer 10 (&#34;MUX&#34;) which may perform such selectable switching function, and FIG. 1b illustrates timing diagrams relating to the operation of the MUX 10. The MUX 10 receives at its inputs, first and second clock signals, CLK1&#39; and CLK2&#39;, and passes, as determined by the state of a select signal CLK --  SEL&#39; received at its select input, one or the other input clock signal, CLK1&#39; or CLK2&#39;, as a current clock signal, CUR --  CLK&#39;, at its output. For example, when the state of the select signal CLK --  SEL&#39; is HIGH, the MUX 10 passes the first clock signal CLK1&#39; to its output as the current clock signal, CUR --  CLK&#39;, and when the state of the select signal CLK --  SEL&#39; is LOW, the MUX 10 passes the second clock signal CLK2&#39; to its output as the current clock signal, CUR --  CLK&#39;. 
     One problem with using the MUX 10 for selectably switching between multiple clock signals, is that objectionable transients in the form of glitches, for example, may occur during the switching process. Referring to FIG. 1b, with the timing conditions depicted therein, an effective time period, teff, occurs as the result of the select signal CLK --  SEL&#39; changing state at time t2. This effective time period, teff, is significantly less than a time period, tclk1, for the first clock signal CLK1&#39; being passed prior to time t2, and significantly less than a time period, tclk2, for the second clock signal CLK2&#39; being passed after time t2. Consequently, the very short effective time period, teff, occurring at the time of switching the clock signals, CLK1&#39; to CLK2&#39; at time t2, causes a corresponding high frequency glitch to occur at that time, which may adversely affect the proper operation of the system. 
     OBJECTS AND SUMMARY OF THE INVENTION 
     Accordingly, one object of the present invention is a method of changing clock signals being provided to a circuit, which minimizes transients such as glitches resulting from the change. 
     Another object is a cost effective circuit for changing a clock signal being provided to another circuit, from a first clock signal to a second clock signal of different frequency, which minimizes transients such as glitches resulting from the change. 
     These and additional objects are accomplished by the various aspects of the present invention, wherein briefly stated, one aspect is a method of changing clock signals being provided to a circuit (e.g., 118-1, 118-2 or 118-k in FIG. 3) comprising the steps of: providing a first clock signal (e.g., CLK1 in FIGS. 3 and 6) until a first falling edge (e,g., at time t1 in FIG. 6) of the first clock signal occurs following an indication (e.g., change in state of CLK --  SEL in FIGS. 3 and 6) to change clock signals; and providing a second clock signal (e.g., CLK2 in FIGS. 3 and 6) after a first falling edge (e.g., at time t2 in FIG. 6) of the second clock signal occurs following the first falling edge of the first clock signal following the indication to change clock signals. 
     Another aspect of the invention is a method of changing clock signals from an old clock signal (e.g., CLK1 in FIG. 6) being provided to a circuit (e.g., 118-1, 118-2 or 118-k in FIG. 3), to a new clock signal (e.g., CLK2 in FIG. 6), the method comprising the steps of: generating a turn off signal (e.g., CLK --  SL-bar in FIG. 6) such that the turn off signal goes from an active logic state to an inactive logic state upon a first falling edge of the old clock signal following an indication on at least one clock select signal (e.g., change in state of CLK --  SEL in FIG. 6) to change clock signals to the new clock signal; generating a turn on signal (e.g., CLK --  S2 in FIG. 6) such that the turn on signal goes from an inactive logic state to an active logic state upon a first falling edge of the new clock signal following the turn off signal going to an inactive logic state; logically ANDing the old clock signal and the turn off signal to generate a first output clock signal; logically ANDing the new clock signal and the turn on signal to generate a second output clock signal; and logically ORing the first and second output clock signals to generate a current clock signal (e.g., CUR --  CLK in FIG. 6) changing from the old clock signal to the new clock signal, and providing the current clock signal changing from old clock signal to the new clock signal, to the circuit. 
     Another aspect of the present invention is a clock switching circuit for providing a current clock signal switching from a first clock signal to a second clock signal in response to an indication to change clock signals while minimizing glitches generated during the switching. Included in the clock switching circuit are a first means for providing as the current clock signal, the first clock signal until a first falling edge of the first clock signal occurs following the indication to change clock signals; and a second means for providing as the current clock signal, the second clock signal after a first falling edge of the second clock signal occurs following the first falling edge of the first clock signal following the indication to change clock signals. 
     Still another aspect of the present invention is a clock switching circuit (e.g., 116 in FIG. 3) responsive to at least one clock select signal (e.g., CLK --  SEL in FIG. 3) for switching between a plurality of clock signals (e.g., CLK1 and CLK2 in FIG. 3) while minimizing glitches generated during the switching. Included in the clock switching circuit are at least one flip-flop (e.g., 127 in FIG. 4) individually having a data input connected to a corresponding one of the at least one clock select signal; a plurality of flip-flops (e.g., 128-1 and 128-2 in FIG. 4) individually having a data input connected to an output of a corresponding one of the at least one flip-flop, and an inverted clock input connected to a corresponding one of the plurality of clock signals; a plurality of AND gates (e.g., 130-1 and 130-2 in FIG. 4) individually having a first input connected to the output of a corresponding one of the at least one flip-flop, a second input connected to the output of a corresponding one of the plurality of flip-flops, and a third input connected to a corresponding one of the plurality of clock signals; and an OR gate (e.g., 132 in FIG. 4) having a plurality of inputs respectively connected to the outputs of the plurality of AND gates, and an output providing the switched clock signal (e.g., CUR --  CLK in FIG. 4), which is thereupon fed back to an inverted clock input of individual ones of the at least one flip-flop. 
     Still another aspect of the present invention is a computer system (e.g., 100 in FIG. 2) having a system bus (e.g., 104 in FIG. 2), a microprocessor (e.g., 102 in FIG. 2), and a controller circuit (e.g., 108 in FIG. 2). Included in the controller circuit is a means (e.g., 114 in FIG. 3) for generating at least one clock select signal (e.g., CLK --  SEL in FIG. 3), and a clock switching circuit (e.g., 116 in FIG. 3) responsive to the at least one clock select signal for switching between a plurality of clock signals (e.g., CLK1 and CLK2 in FIG. 3) while minimizing glitches generated during the switching. Included in the clock switching circuit are at least one flip-flop (e.g., 127 in FIG. 4) individually having a data input connected to a corresponding one of the at least one clock select signal; a plurality of flip-flops (e.g., 128-1 and 128-2 in FIG. 4) individually having a data input connected to an output of a corresponding one of the at least one flip-flop, and an inverted clock input connected to a corresponding one of the plurality of clock signals; a plurality of AND gates (e.g., 130-1 and 130-2 in FIG. 4) individually having a first input connected to the output of a corresponding one of the at least one flip-flop, a second input connected to the output of a corresponding one of the plurality of flip-flops, and a third input connected to a corresponding one of the plurality of clock signals; and an OR gate (e.g., 132 in FIG. 4) having a plurality of inputs respectively connected to the outputs of the plurality of AND gates, and an output providing the switched clock signal (e.g., CUR --  CLK in FIG. 4), which is thereupon fed back to an inverted clock input of individual ones of the at least one flip-flop. 
     Additional objects, features and advantages of the various aspects of the present invention will become apparent from the following description of its preferred embodiments, which description should be taken in conjunction with the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIGS. 1a and 1b respectively illustrate, as examples, a prior art circuit for selectably switching between two clock signals, and timing diagrams related to the operation of the prior art circuit; 
     FIG. 2 illustrates, as an example, a computer system utilizing aspects of the present invention; 
     FIG. 3 illustrates, as an example, a memory controller included in the computer system of FIG. 2, utilizing aspects of the present invention; 
     FIG. 4 illustrates, as an example, a two clock signal, clock switching circuit included in the memory controller of FIG. 3, utilizing aspects of the present invention; 
     FIG. 5 illustrates, as an example, a multiclock signal, clock switching circuit utilizing aspects of the present invention; and 
     FIG. 6 illustrates, as an example, timing diagrams for the two clock signal switching circuit of FIG. 4. 
    
    
     DETAILED DESCRIPTION OF THE PREFERRED EMBODIMENT 
     FIG. 2 illustrates, as an example, a computer system 100 including a central processing unit (&#34;CPU&#34;) 102, a system bus 104, an input/output device (&#34;I/O&#34;) 106, a memory controller 108, and a number of memory devices, 110-1 to 110-n. The CPU 102 communicates in a conventional fashion with the I/O 106 and the memory controller 108 via the system bus 104, and in turn, the memory controller 108 communicates with the memory devices, 110-1 to 110-n. The CPU 102 may be any one of a number of commercially available microprocessors, such as those marketed by Intel Corp. and Motorola Corp., and the memory devices, 110-1 to 110-n, individually may be any one of a number of commercially available memory devices of different types, sizes, and speeds. 
     FIG. 3 illustrates, as an example, a block diagram of the memory controller 108. Included in the memory controller 108 are a clock signal generator circuit 112, an address decode circuit 114, a clock switching circuit 116, and a plurality of memory device controller circuits, 118-1 to 118-n. The clock signal generator circuit 112 receives a clock signal input CLK --  INP from the system bus 104, and generates therefrom, a plurality of clock signals, e.g., CLK1 and CLK2, having different frequencies. In one embodiment, the clock signal generator circuit 112 includes a buffer 120 which receives the clock signal input CLK --  INP and generates therefrom, the clock signal CLK1 having the same frequency as the clock signal input CLK --  INP, and a clock doubler circuit 122 which receives the clock signal input CLK --  INP and generates therefrom, the clock signal CLK2 having twice the frequency as the clock signal input CLK --  INP. 
     The address decode circuit 114 generates a clock select signal, CLK --  SEL, by decoding, for example, a system memory address, A[0:31], which is indicative of one of the memory devices, 110-1 to 110-n, since each of the memory devices, 110-1 to 110-n, is allocated its own addressable memory space in system memory. Accordingly, when the address decode circuit 114 receives a system memory address, A[0:31], which is in the addressable memory space of one of the memory devices, 110-1 to 110-n, requiring a clock speed corresponding to the clock signal CLK1, it generates a clock select signal, CLK --  SEL, having a first logic state such as LOW, and when the address decode circuit 114 receives a system memory address, A[0:31], which is in the addressable memory space of one of the memory devices, 110-1 to 110-n, requiring a clock speed corresponding to the clock signal CLK2, it generates a clock select signal, CLK --  SEL, having a second logic state such as HIGH. When more than two clock signals are required and available for selection in the system, the address decode circuit 114 and the clock switching circuit 116 may be modified to respectively generate and receive more than one clock select signal, as will be subsequently described, for example, in reference to FIG. 5. 
     The plurality of memory device controller circuits, 118-1 to 118-n, are generally of conventional design, operation, and construction, depending primarily upon the type of memory device each is controlling. For example, memory device controller 118-1 may be a controller generating appropriate control signals for DRAMs, memory device controller 118-2 may be a controller generating appropriate control signals for SRAMs, and memory device controller 118-n may be a controller for generating appropriate control signals for flash EEPROMs. Other memory device controllers may be dedicated to controlling other types of memories. Each type of memory has its own control signal protocol. For example, a DRAM device controller would provide to a DRAM, a DRAM memory address along with the appropriate row and column address strobes, RAS-bar and CAS-bar, and enable signals, WE-bar and OE-bar, to read or write data from or to the DRAM, wherein the timing of such signals would be affected by the frequency of the clock signal CUR --  CLK being provided to the DRAM controller by the clock switching circuit 116. 
     FIG. 4 illustrates, as an example, a preferred embodiment of the clock switching circuit 116. Included in the clock switching circuit 116 are first, second, and third D-Q flip-flops, 127, 128-1, and 128-2, respectively, first and second AND gates, 130-1 and 130-2, and an OR gate 132. The clock select signal CLK --  SEL is connected to a D-input of the first flip-flop 127. A Q-output of the first flip-flop 127 is connected to a D-input of the third flip-flop 128-2, and a Q-bar-output of the first flip-flop 127 is connected to a D-input of the second flip-flop 128-1. An inverted version of the first clock signal CLK1 is connected to a clock input of the second flip-flop 128-1, and an inverted version of the second clock signal CLK2 is connected to a clock input of the third flip-flop 128-2. The first AND gate 130-1 receives the signal CLK --  SL-bar generated at the Q-bar output of the first flip-flop 127 at a first input, the signal CLK --  S1 generated at the Q-output of the second flip-flop 128-1 at a second input, and the first clock signal CLK1 at a third input. In a similar fashion, the second AND gate 130-2 receives the signal CLK --  SL generated at the Q-output of the first flip-flop 127 at a first input, the signal CLK --  S2 generated at the Q-output of the second flip-flop 128-2 at a second input, and the second clock signal CLK2 at a third input. The OR gate 132 receives as inputs, the signals AND --  1 and AND --  2 respectively generated at outputs of the AND gates 130-1 and 130-2, and generates at its output, the current clock signal CUR --  CLK. An inverted version of the current clock signal CUR --  CLK is then fed back to a clock input of the first flip-flop 127. 
     FIG. 5 illustrates, as an example, a multiclock signal, clock switching circuit 116&#39;. The clock signal switching circuit 116&#39; is similar in construction and operation to the clock switching circuit 116, with the primary exception that instead of receiving only one clock select signal, CLK --  SEL, as the clock switching circuit 116 does from the address decode circuit 114, the clock switching circuit 116&#39; receives a plurality of clock select signals, CLK --  SEL --  1 to CLK --  SEL --  k, equal to the number of selectable clock signals in the system, from an address decode circuit 114&#39; (shown in a dotted block to indicate that it is not part of the clock switching circuit 116&#39;). 
     The address decode circuit 114&#39; decodes a received system memory address A[0:31] to activate an appropriate one of the clock select lines, CLK --  SEL --  1 to CLK --  SEL --  k, wherein each clock select line is associated with one of the available clock signals in the system. For example, when the address decode circuit 114&#39; receives a system memory address, A[0:31], which is in the addressable memory space of one of the memory devices, 110-1 to 110-n, requiring a clock speed corresponding to the clock signal CLK1, it raises the clock select signal CLK --  SEL --  1 HIGH while keeping the other clock select signals, CLK --  SEL --  2 to CLK --  SEL --  k, LOW; when the address decode circuit 114&#39; receives a system memory address, A[0:31], which is in the addressable memory space of one of the memory devices, 110-1 to 110-n, requiring a clock speed corresponding to the clock signal CLK2, it raises the clock select signal CLK --  SEL --  2 HIGH while keeping the other clock select signals, CLK --  SEL --  1 and CLK --  SEL --  3 to CLK --  SEL --  k, LOW; and so forth, so that when the address decode circuit 114&#39; receives a system memory address, A[0:31], which is in the addressable memory space of one of the memory devices 110-1 to 110-n, requiring a clock speed corresponding to the clock signal CLKk, it raises the clock select signal CLK --  SEL --  k HIGH while keeping the other clock select signals, CLK --  SEL --  1 to CLK --  SEL --  (k-l), LOW. 
     Alternatively, the address decoder 114&#39; may be replaced by a select bit decoder (not shown), which decodes a plurality of clock select bits provided, for example, from the CPU 102. In this case, two clock select bits may be provided to decode up to four clock select lines, three clock select bits may be provided to decode up to eight clock select lines, and so forth. For example, where two clock select bits are employed to decode four clock select lines, the bit value combination [0,0] may be decoded to raise the clock select line CLK --  SEL --  1 HIGH while all other clock select lines are LOW, the bit value combination [0,1] may be decoded to raise the clock select line CLK --  SEL --  2 HIGH while all other clock select lines are LOW, the bit value combination [1,0] may be decoded to raise the clock select line CLK --  SEL --  3 HIGH while all other clock select lines are LOW, and the bit value combination [1,1] may be decoded to raise the clock select line CLK --  SEL --  4 HIGH while all other clock select lines are LOW. 
     Included in the clock switching circuit 116&#39; are a first plurality of D-Q flip-flops, 127-1&#39; to 127-k&#39;, a second plurality of D-Q flip-flops, 128-1&#39; to 128-k&#39;, a plurality of AND gates, 130-1&#39; to 130-k&#39;, and a single OR gate 132&#39;. As shown in FIG. 5, each of the first plurality of flip-flops, 127-1&#39; to 127-k&#39;, has a D-input connected to the decoder 114&#39; to receive a corresponding one of the clock select signals, CLK --  SEL --  1 to CLK --  SEL --  k, and has a Q-output connected to a D-input of a corresponding one of the second plurality of flip-flops, 128-1&#39; to 128-k&#39;. Each of the second plurality of flip-flops, 128-1&#39; to 128-k&#39;, has a clock input receiving an inverted version of a corresponding one of the clock signals, CLK --  1 to CLK-k. Each of the AND gates, 130-1&#39; to 130-k&#39;, receives as a first input, the signal generated at the Q-output of a corresponding one of the first plurality of flip-flops, 127-1&#39; to 127-k&#39;, as a second input, the signal generated at the Q-output of a corresponding one of the second plurality of flip-flops, 128-1&#39; to 128-k&#39;, and as a third input, a corresponding one of the clock signals, CLK --  l to CLK --  k. The OR gate 132&#39; receives as inputs, the respective outputs of the AND gates, 130-1&#39; to 130-k&#39;, and generates at an output of the OR gate 132&#39;, the current clock signal CURR --  CLK. An inverted version of the current clock signal CURR --  CLK is then fed back to the clock inputs of each of the first plurality of flip-flops, 127-1&#39; to 127-k&#39;. 
     FIG. 6 illustrates, as an example, timing diagrams related to the operation of the clock switching circuit 116 of FIG. 4. In the example, the first clock signal CLK1 is twice the frequency of the second clock signal CLK2, and ninety degrees out of phase. Prior to time t0, the clock select signal CLK --  SEL is LOW so that the Q-output of the flip-flop 127 generates a signal CLK --  SL which is LOW and the Q-bar-output of the flip-flop 127 generates a signal CLK --  SL-bar which is HIGH. Consequently, the flip-flop 128-1 generates at its Q-output, a signal CLK --  S1 that is HIGH, and the flip-flop 128-2 generates at its Q-output, a signal CLK --  S2 that is LOW. Accordingly, the output AND --  1 of the first AND gate 130-1 is the first clock signal CLK1, the output AND --  2 of the second AND gate 130-2 is LOW, and the output of the OR gate 132 is the first clock signal CLK1. 
     At time t0, the clock select signal CLK --  SEL goes from a LOW state to a HIGH state. Accordingly, upon a first falling edge of the current clock signal CUR --  CLK, at time t1, the signal CLK --  SL at the Q-output of the first flip-flop 127 goes HIGH, and the signal CLK --  SL-bar at the Q-bar-output of the first flip-flop 127 goes LOW. Thence, upon a first falling edge of the and second clock signal CLK2, at time t2, the signal CLK --  S2 generated at the Q-output of the third flip-flop 128-2 goes HIGH. As a result, prior to time t1, the output AND --  1 of the first AND gate 130-1 is the first clock signal CLK1, and after time t1, the output AND --  1 of the first AND gate 130-1 goes to LOW since its first input, CLK --  SL-bar goes to LOW at that time. Similarly, prior to time t1, the output AND --  2 of the second AND gate 130-2 is LOW, and after time t2, the output of the second AND gate 130-2 is the second clock signal, since both its first and second inputs, CLK --  SL and CLK --  S2, are HIGH at that time. Accordingly, prior to time t1, the output of the OR gate 132 is the first clock signal CLK1, after time t2, the output of the 0R gate 132 is the second clock signal CLK2, and between times t1 and t2, the output of the OR gate 132 is LOW. The transition period t1 to t2, wherein the output of the OR gate 132 is neither the first clock signal CLK1 or the second clock signal CLK2, serves to eliminate glitches that may occur during this period in the switching process. 
     Continuing with the example, at time t4, the clock select signal CLK --  SEL switches back to the LOW state from the HIGH state. Accordingly, upon a first falling edge of the current clock signal CUR --  CLK, at time t5, the signal CLK --  SL at the Q-output of the first flip-flop 127 goes LOW, and the signal CLK --  SL-bar at the Q-bar-output of the first flip-flop 127 goes HIGH. Thence, upon a first falling edge of the first clock signal CLK1, at time t6, the signal CLK --  S1 at the Q-output of the second flip-flop 128-1 goes HIGH. As a result, prior to time t5, the output AND --  2 of the second AND gate 130-2 is the second clock signal CLK2, and after time t5, the output AND --  2 of the second AND gate 130-2 goes to LOW since its first input, CLK --  SL goes to LOW at that time. Similarly, prior to time t6, the output AND --  1 of the first AND gate 130-1 is LOW, and after time t6, the output of the first AND gate 130-1 is the first clock signal, since both its first and second inputs, CLK --  SL-bar and CLK --  S1, are HIGH at that time. Accordingly, prior to time t5, the output of the OR gate 132 is the second clock signal CLK2, after time t6, the output of the OR gate 132 is the first clock signal CLK1, and between times t5 and t6, the output of the OR gate 132 is LOW. The transition period t5 to t6, wherein the output of the OR gate 132 is neither the first clock signal CLK1 or the second clock signal CLK2, serves to eliminate glitches that may occur during this period in the switching process. 
     Although the various aspects of the present invention have been described with respect to a preferred embodiment, it will be understood that the invention is entitled to full protection within the full scope of the appended claims.