Variable clock dividing circuit

Abstract: This variable clock dividing circuit is provided with n dividers (31-34) including the first divider (31) to divide the basic clock (10) by a predetermined dividing ratio and the n-th divider to branch and input the output from the (n-1)th divider and selectively outputs one of the clocks output from the dividers using a switching circuit (40). A divider is, on the input side, provided with a phase synchronization circuit (20) to synchronize the phase of the clock input to n dividers based on the basic clock (10). The phase synchronization circuit (20) comprises a buffer (21) to input the basic clock (10) with a delay to the first divider and a plurality of AND gates (22-24) each corresponding to the second to the n-th dividers and inputs the basic clock and the outputs from all the dividers up to the previous stages to the AND gates (31-34).

Description: BACKGROUNDS OF THE INVENTION FIELD OF THE INVENTION This invention relates to a variable clock dividing circuit capable of switching dividing clocks used in a microcomputer stably. DESCRIPTION OF THE PRIOR ART Many conventional microcomputers, in particular single-chip microcomputers provided with peripheral circuits have a built-in variable clock dividing circuit to switch the system clock frequency corresponding to the application. Since the system clock affects the operation of the entire system, the variable clock dividing circuit as the source of such clock is required to be highly reliable. A conventional variable clock dividing circuit comprises a plurality of dividers to divide the basic clock by different dividing ratios and a switching circuit to select and output one of the clocks output from those plurality of dividers according to the dividing ratio setting signal. In such a conventional variable clock dividing circuit, since the output from a divider is continuously sent to the next input terminal of the divider on the next stage, delay at devices constituting a divider delays the change point of the output clock from the divider; the higher the stage of the divider, the larger the delay from the basic clock becomes. For this reason, when switching from a certain divider clock to another divider clock, the cycle of the output clock immediately after switching changes by the delay of the divider, which might cause the frequency of the output clock to exceed the guaranteed operation frequency immediately after switching. This excess of the guaranteed operation frequency can be a cause of malfunction of the system. This drawback is particularly prominent when the clock with a large dividing ratio is switched to that with a small dividing ratio due to a large delay. EP-A-O 291 335 discloses a clock dividing circuit according to the precharacterizing part of claim 1. In this circuit, each setting signal for designating one of the outputs of the divider sections is inverted, and the corresponding inverted and not inverted signals are provided to the respective decoders. The decoded signals are then latched in corresponding latch circuits. Accordingly, the circuit of this document inherently has a large scale, since for each divider section there is provided a latch circuit. Additionally, this requires substantially long signal lines and makes the circuit complicated. Furthermore, in the circuit disclosed in the above mentioned document, the basic clock is provided without delay to the first divider section. This will lead to disturbances due to delay differences of the input of the single divider sections. SUMMARY OF THE INVENTION An object of the present invention is to provide a variable clock dividing circuit capable of supplying stable clocks with extremely little disturbance in frequency even at switching of clock dividing ratios. This object is achieved by a clock dividing circuit according to claim 1. The dependent claims are related to further advantageous aspects of the present invention. Other objects, characteristics and effects of the present invention will be clarified in the detailed description below. BRIEF DESCRIPTION OF THE DRAWINGS Fig. 1 is a block diagram to show the configuration of a variable clock dividing circuit according to a first embodiment of the present invention; Fig. 2 is a schematic diagram to show a specific example of a divider for the variable clock dividing circuit as shown in Fig. 1; Fig. 3 is a schematic diagram to show a specific example of a switching circuit for the variable clock dividing circuit as shown in Fig. 1; Fig. 4 is a timing chart to illustrate the operation of the variable clock dividing circuit as shown in Fig. 1; Fig. 5 is a timing chart to illustrate the operation when a phase synchronization circuit is not provided; and Fig. 6 is a schematic diagram to show a second embodiment of the phase synchronization circuit according to the present invention. DESCRIPTION OF THE PREFERRED EMBODIMENT Referring to Figs. 1 to 6, preferred embodiments of the present invention will be described. Fig. 1 shows the configuration of a variable clock dividing circuit according to an embodiment of the present invention. In Fig. 1, the variable clock dividing circuit according to this embodiment comprises dividers 31 to 34 which divide the frequency by two at the fall edge of the input clock, a phase synchronization circuit 20 which synchronizes the phase of the clock input to the dividers 31 to 34 based on the basic clock 10, a switching circuit 40 which selects and outputs one of the clocks from the dividers 31 to 34. The phase synchronization circuit 20 has a buffer 21 and AND gates 22 to 24. The numeral 10 indicates the basic clock supplied by an oscillator, 11 indicates the output clock provided from the switching circuit 40 to a microprocessor or others, 12 and 13 indicate dividing ratio setting signals used for selection of a clock from those having the different dividing ratios output from the divider 31 to 34. To the dividers 31 to 34, output signals from the buffer 21 in the phase synchronization circuit 20 and AND gates 22 to 24 are input respectively. To the phase synchronization circuit 20, the basic clock 10 and the output signals from the dividers 31 to 34 are input. The buffer 21 of the phase synchronization circuit 20 receives the basic signal 10, the AND gate 22 receives the basic clock 10 and the output signals from the divider 31, and the AND gate 23 receives the basic clock 10 and the output signals from the dividers 31 and 32. The AND gate 24 receives the basic clock 10 and the output signals from the dividers 31 to 33. Therefore, the first divider 31 gives a clock representing 1/2 of the basic clock 10, the second divider 32 generates a clock representing 1/4 of the basic clock 10, the third divider 33 provides a clock representing 1/8 of the basic clock 10, and the fourth divider 34 gives the clock representing 1/16 of the basic clock 10. To the switching circuit 40, the basic clock 10, output clocks from the dividers 31 to 34, and the dividing ratio setting signals 12 and 13 are input. The switching circuit 40 selects, according to a combination of two dividing ratio setting signals 12 and 13, one of the output signals from the dividers 31 to 34, and outputs it as the output clock 11. In addition, the clock switching at the switching circuit 40 is executed when the clock signals input from the dividers 31 to 34 are all at the low (L) level and the basic clock 10 rises to the high (H) level. The buffer 21 in the phase synchronization circuit 20 is provided to set a certain delay value to the basic clock 10 input to the divider 31. The delay value at the buffer 21 is set to be the same as the delay values given by the AND gates 22 to 24. Since the AND gates 22 to 24 AND the output clocks from the dividers 31 to 33 and the basic clock 10, the clock with synchronized phase is input to the dividers 32 and 33. Fig. 2 shows a specific configuration example of the dividers 31 to 34. The dividers 31 to 34 consists of JK type flip-flops 131 to 134 here. Fig. 3 shows a specific configuration example of the switching circuit 40. In Fig. 3, the output clocks from the dividers 31 to 34 are input to AND gates 101 to 104 and a NOR gate 105. The output from the NOR gate 105 and the basic clock 10 are input to an AND gate 106. The dividing ratio setting signals 12 and 13 are input to D type latch circuits 107 and 108 respectively and the output from the AND gate 106 is input to the clock terminals at the D type latch circuits 107 and 108. The outputs from the D type latch circuits 107 and 108 are input to four AND gates at a decoding circuit 109. The output from this decoding circuit 109 is input to the AND gates 101 to 104. The outputs from the AND gates 101 to 104 are input to an OR gate 110 and the output clock 11 is output from the OR gate 110. In the configuration of the switching circuit 40 as shown in Fig. 3, as described later, output clock 11 is switched by dividing ratio setting signals 12 and 13 when the basic clock 10 rises to the H level (output at the AND gate 106 becomes high) with all the clock signals input from the dividers 31 to 34 at the L level. In other words, when the output at the AND gate 106 goes to the H level, change in dividing ratio setting signals 12 and 13 is output to the decoding circuit 109 via the D type latch circuits 107 and 108 and the output from that decoding circuit 109 selects one of the AND gates 101 to 104. This causes one of the clocks output from the dividers 31 to 34 to be selected, which is output from the OR gate 110 as the output clock 11. Fig. 4 is a timing chart to illustrate the operation of the variable clock dividing circuit as shown in Figs. 1 to 3 above. This chart shows a case where the switching circuit 40 switches from the output from the divider 34 to the output from the divider 31, or switches the dividing ratio from 1/16 to 1/2 of the basic clock. Delays at the buffer 21 and the AND gates 22 to 24 cause the output clock signals of these devices (i.e. the clock signals input to the dividers 31 to 34) to delay from the basic clock 10 by the delay at the device. If the device structure is arranged so that the devices have the same driving capacity and the delays at the devices become equal, the waveform of the clock output from the dividers 31 to 34 becomes synchronized as shown in Fig. 5. Delay at the dividers 31 to 34 can be equalized by using the dividers having the same configuration (for example, a JK type flip-flop as shown in Fig. 2), and output signals from the dividers 31 to 34 have waveforms with the change point at the same location. At this point, if the dividing ratio setting signals 12 and 13 change as shown in Fig. 5, the output clock 11 from the switching circuit 40 is switched to the output clock from the divider 31, or the clock representing 1/2 of the basic clock, by the operation of the switching circuit 40 when all input clock signals from the dividers 31 to 34 are at the L level and the basic clock 10 rises to the H level. Supposing that the output signals from the dividers 31 and 34 have the same change point, the cycle ts1 immediately after switching of the output clock 11 by the switching circuit 40 can be made substantially the same as the cycle ts0 of the output signal from the divider 31, which assures stable switching of clocks. Switching of dividing ratio from 1/16 to 1/2 of the basic clock has been described here, but stable dividing clocks can be obtained for other switching of dividing ratios. Fig. 5 shows a timing chart of a case where the dividing ratio is switched from 1/16 to 1/2 of the basic clock when a phase synchronization circuit 20 of this embodiment is not provided. A conventional variable clock dividing circuit was not provided with a phase synchronization circuit as in this embodiment. In such a circuit, the output from a divider at a certain stage is continuously provided to the input terminal of the next stage divider, the change point of the output clock from a divider becomes later and later for dividers at higher stages. For this reason, as shown in Fig. 5, when switching the dividing ratio from 1/16 to 1/2 using the dividing ratio setting signals 12 and 13, the output signal 11 from the dividing circuit has temporarily a small L level width and tf1 becomes smaller than tf0 (where tf0 is the cycle of the output clock from the divider 31 and tf1 is the cycle of the output clock 11 from the dividing circuit immediately after switching). This results in excess of the guaranteed operation frequency by the output clock 11 of the dividing circuit, which may cause malfunction of the system. In contrast, the variable clock dividing circuit of this embodiment as described above, the cycle ts1 immediately after switching of the output clock 11 from the switching circuit 40 can be made substantially the same as the cycle ts0 of the output signal from the divider 31, which enables stable clock switching. This assures prevention of system malfunction due to excess of the guaranteed operation frequency by the output clock 11 of the dividing circuit. Next, referring to Fig. 6, a second embodiment of the phase synchronization circuit 20 is described. In Fig. 6, the configuration of the phase synchronization circuit 20 and dividers 31 to 34 only are shown, but this embodiment uses a switching circuit 40, with the same configuration as shown in Fig. 1. In this embodiment, the phase synchronization circuit 20 comprises AND gates 51 to 54 instead of the buffer 21 and the AND gates 22 to 24. The AND gates 51 to 54 have the same structure having four input gates respectively. VDD in the figure indicates a positive power supply. For the AND gate 51, the basic clock 10 is input to one of the input gates and the positive power VDD is input to the remaining three input gates. For the AND gate 52, the basic clock 10 is given to an input gate, the output clock from the divider 31 to another, and the positive power VDD to the remaining two input gates. For the AND gate 53, the basic clock 10 is input to an input gate, the output clock from the divider 31 to another, that from the divider 32 to still another, and the positive power VDD to the remaining input gate. For the AND gate 54, the basic clock 10 is input to an input gate, and the output clocks from the dividers 31 to 33 are respectively input to the remaining three input gates. The AND gates 51 to 54 provided with the same number of input gates can be made to have the same structure, which improves balance of driving capacity of the devices, resulting in more precise equalization of delay values at the devices. Thus, the clock signals input to the dividers 31 to 34 can be more precisely synchronized than in the embodiment as shown in Fig. 1. The variable clock dividing circuit is capable of stably supplying clocks with extremely little disturbance of frequency even at the time of switching of clock dividing ratio by synchronizing the output signals from the dividers. Particularly when many dividers are used, or the basic clock has a high frequency, use of this circuit may be quite effective. Obviously, many variations and modifications can be made to the embodiments described above. For example, the above embodiment has four dividers, but there may be any number of dividers provided that there are more than one.

Claims: A clock dividing circuit comprising: a pluralit N of divider sections (31, 32, 33, 34) having each the same dividing ratio and generating each an output signal, said plurality of divider sections (31, 32, 33, 34) including a leading divider section (31) and a last divider section (34); a plurality N of synchronizing means (21, 22, 23, 24); the output of each divider section (31, 32, 33), except the last, being connected to the successive divider section (32, 33, 34) via the corresponding synchronizing means (22, 23, 24), such as to successively divide a basic clock signal, said synchronizing means (22, 23, 24) receiving a basic clock and all the output signals generated by the preceding divider sections (31, 32, 33); and a switching circuit (40) receiving all the output signals generated by the divider sections (31, 32, 33, 34), the basic clock and one or more setting signals for selecting one of the output signals generated by the divider sections (31, 32, 33, 34), said switching circuit (40) comprising a latch circuit (107, 108) for each setting signal receiving the corresponding setting signal and a signal derived from the output signals generated by the divider sections (31, 32, 33, 34), and a decoder (109) for decoding the signal to be selected; characterized in that, the output signals generated by said divider sections (31, 32, 33, 34) are all synchronized to the falling edges of the basic clock; and said latch circuits (107, 108) and said decoder (109) are such that the clock switching at the switching circuit (40) is executed only when the signals output by the divider sections (31, 32, 33, 34) are all at low level and the basic clock rises to high level. A clock dividing circuit according to claim 1, which further comprises: a detector circuit (105, 106) connected to the divider sections (31, 32, 33, 34) for generating said signal derived from the output signals generated by the divider sections (31, 32, 33, 34), when detecting that all frequency divided signals are of low level and said basic clock raises to high level, said detector circuit (105, 106) being connected to said latch circuit (107, 108) so that the latch circuit (107, 108) supplies the output of the latch circuit to said decoder (109) in response to the output of said detector circuit (105, 106). A clock dividing circuit according to claim 2, wherein said detector circuit (105, 106) is supplied with said basic clock and detects correspondence of the phases in response to said basic clock. A dividing circuit according to any of claims 1 to 3, wherein said synchronizing means (21, 22, 23, 24) are provided with an AND-gate. A clock dividing circuit according to claim 4, wherein each of the AND-gates has the same number of input terminals, those input terminals not receiving the basic clock or an output of a divider section (31, 32, 33, 34) are connected with a common positive power. A clock dividing circuit according to claim 5, wherein the number of input terminals of each said AND-gates is designed to be equal to the number of divider sections (31, 32, 33, 34). A clock dividing circuit according to claim 1, wherein the synchronizing means connected with the first divider section (31, 32, 33, 34) comprises a buffer (21) to output said basic clock with delay to the first one of said divider sections (31, 32, 33, 34). A clock dividing circuit according to claim 7, wherein said buffer (21) is designed to have the same signal delay as the remaining synchronizing means (22, 23, 24).

Inventors: SONOBE SATORU, SONOBE, SATORU
Applicants: NIPPON ELECTRIC CO, NEC CORPORATION
Application year: 1992
Main classification: G06F1
IPC codes: G06F1