The present application claims a priority based on Japanese Patent Application No. 2009-073918 filed on Mar. 25, 2009, the contents of which are incorporated herein by reference.
1. Technical Field
The present invention relates to clock switching circuits, integrated circuit devices and electronic apparatuses.
2. Related Art
Generally, an integrated circuit device such as a microcomputer switches among a plurality of clocks with different frequencies and uses them as system clocks (internal clocks). For example, an integrated circuit device may be provided with a crystal oscillator to obtain a highly accurate frequency, a ceramic oscillator for operating the microcomputer at high frequencies, and the like, wherein appropriate ones of the clocks generated by these oscillators are selected and supplied to the core circuit (a CPU or the like) of the microcomputer. Accordingly, an integrated circuit device such as a microcomputer has the task of switching a plurality of clocks with one another.
For example, when clocks are switched, glitches (undesired pulses) may be generated in output clocks depending on phase relation among the clocks to be switched. If a clock having a glitch is inputted in the core circuit, the core circuit may possibly malfunction. Therefore, clocks need to be switched without generating a glitch. Also there may be certain situations where clocks with various frequencies may be used as system clocks, or multiple clocks of three or more may be switched and used. For this reason, it is necessary to provide a capability of switching clocks at certain frequency ratios with one another and also a capability of switching three or more clocks with one another.
In this connection, Japanese Laid-open Patent Application 09-098161 describes a method of switching clocks of two systems and preventing a glitch and a phase skip from being generated when switching the clocks.
In accordance with some embodiments of the invention, it is possible to provide clock switching circuits, integrated circuit devices and electronic apparatuses, which are capable of switching a plurality of clocks with one another.
An embodiment of the invention pertains to a clock switching circuit having: a selector that selects one of a plurality of clocks based on a select signal and outputs the clock selected as a selected clock; a mask circuit that masks the selected clock based on a mask signal and outputs the selected clock masked as an output clock; and a mask signal generation circuit that generates the mask signal and the select signal, wherein the mask signal generation circuit switches a signal level of the select signal after causing the mask signal to be active, and causes the mask signal to be inactive on condition that a change is detected in the signal level of the selected clock after the signal level of the select signal has been switched.
According to an aspect of the embodiment of the invention, the mask signal generation circuit switches the signal level of a select signal after making a mask signal active, the selector selects one of a plurality of clocks based on the select signal and outputs the same as a selected clock, the mask signal generation circuit makes the mask signal inactive on condition that a change is detected in the signal level of the selected clock after the signal level of the select signal has been switched, and the mask circuit masks the selected clock based on a mask signal and outputs the same as an output clock.
In this manner, according to one aspect of the embodiment of the invention, the signal level of a select signal is switched after a mask signal has been made active. By this, during the period in which the selected clock is masked based on the mask signal, the clock can be switched based on the select signal. Also, according to another aspect of the embodiment of the invention, the mask signal is made inactive on condition that a change is detected in the signal level of the selected clock after the signal level of the select signal has been switched. Therefore, the selected clock can be masked until a change is detected in the signal level of the selected clock after the signal level of the select signal has been switched. For example, even when a glitch at H level is generated in the selected clock at the time of clock switching, the glitch can be masked by causing the mask signal to be inactive upon detecting a falling edge of the glitch. In this manner, according to the present embodiment, a plurality of clocks can be switched without generating a glitch in output clocks.
In accordance with an embodiment of the invention, the mask signal generation circuit may make the mask signal active through sampling a clock switching signal based on the output clock or a delay clock of the output clock.
According to the embodiment of the invention described above, the mask signal can be made active through sampling a clock switching signal based on the output clock or a delay clock of the output clock. Accordingly, even when one of the plural clocks has been selected prior to clock switching, the mask signal can be made active. Also, as described above, by causing the mask signal to be inactive upon detecting a change in the signal level of the selected clock after the signal level of the select signal has been switched, the mask signal can be made inactive even when any one of the plural clocks is selected after clock switching. In this manner, the mask signal can be generated when switching between any clocks among a plurality of clocks. With this, even when three or more clocks, as a plurality of clocks, are switched, the clocks can be switched without generating a glitch.
In accordance with another embodiment of the invention, the mask signal generation circuit may output the select signal based on a delay signal of a signal that is generated through sampling the clock switching signal based on the output clock or a delay clock of the output clock.
With this, the timing to switch the signal level of the select signal can be delayed with respect to the timing at which the mask signal is made active. Accordingly, during the period in which the selected clock is masked, the clock can be switched.
In accordance with still another embodiment of the invention, the mask signal generation circuit may include a first flip-flop circuit that samples the clock switching signal based on the output clock or a delay clock of the output clock and outputs a first output signal, a second flip-flop circuit that samples the first output signal based on the selected clock and outputs a second output signal, and an exclusive OR circuit that obtains an exclusive OR of the first output signal and the second output signal and outputs the mask signal, wherein the selector receives the select signal based on the first output signal and selects one of a first clock and a second clock among the plurality of clocks.
According to the embodiment of the invention described above, by the inclusion of the first flip-flop circuit, the mask signal can be made active through sampling the clock switching signal based on an output clock or a delay clock of the output clock. Also, as the second flip-flop circuit samples the first output signal based on the selected clock, the mask signal can be made inactive on condition that a change in the signal level of the selected clock is detected. Accordingly, a clock switching circuit that switches between a first clock and a second clock without generating a glitch.
Further, in accordance with yet another embodiment of the invention, the mask signal generation circuit may include a delay circuit that receives the first output signal from the first flip-flop circuit and outputs the select signal.
With this, it is possible to delay the first output signal that is a signal generated through sampling a clock switching signal based on an output clock or a delay clock of the output clock, and to output a select signal based on the delayed first output signal.
In accordance with another embodiment of the invention, the mask signal generation circuit may include a first flip-flop circuit that samples the clock switching signal based on the output clock or a delay clock of the output clock and outputs a first output signal, a second flip-flop circuit that samples the first output signal based on the selected clock and outputs a second output signal, a first exclusive OR circuit that obtains an exclusive OR of the first output signal and the second output signal and outputs a first mask signal, a third flip-flop circuit that samples the clock switching signal based on the output clock or a delay clock of the output clock and outputs a third output signal, a fourth flip-flop circuit that samples the third output signal based on the selected clock and outputs a fourth output signal, a second exclusive OR circuit that obtains an exclusive OR of the third output signal and the fourth output signal and outputs a second mask signal, and a mask signal output circuit that outputs the mask signal based on the first mask signal and the second mask signal, wherein the selector may receive the select signal based on the first output signal and the third output signal and may select any one of a first clock through a fourth clock among the plurality of clocks.
According to an aspect of the embodiment of the invention described above, by the inclusion of the first and third flip-flop circuits, the mask signal can be made active through sampling the clock switching signal based on the output clock or a delay clock of the output clock. According to another aspect of the embodiment of the invention, the second and fourth flip-flop circuits sample the first and third output signals based on the selected clock, and the mask signal can be made inactive on condition that a change is detected in the signal level of the selected clock. In this manner, it is possible to realize a clock switching circuit that switches among the first through fourth clocks without generating a glitch.
Also, in accordance with another embodiment of the invention, the mask signal generation circuit may include a delay circuit that outputs the select signal upon receiving the first output signal from the first flip-flop circuit and the third output signal from the third flip-flop circuit.
With this, it is possible to delay the first and third output signals that are signals generated through sampling a clock switching signal based on an output clock or a delay signal of the output clock, and to output a select signal based on the delayed first and third output signals.
Furthermore, another embodiment of the invention pertains to an integrated circuit device including one of the clock switching circuits described above.
Moreover, still another embodiment of the invention pertains to an electronic apparatus including the integrated circuit device described above.
Preferred embodiments of the invention are described in detail below. It is noted that the embodiments described below should not unduly limit the content of the invention recited in the scope of the claimed invention, and all of the compositions to be described in the embodiments may not necessarily be indispensable as means for solution provided by the invention.
Referring to
Specifically, the FF1 latches (retains) the CK1 at a rising of the CK2, and outputs an output signal Q1. The FF2 latches the output signal Q1 from the FF1 at a rising edge of the CK2, and outputs an output signal Q2. The ENC sets an enable signal at H level when the Q1 is at L level and the Q2 is at H level. The FF3 latches a clock switching signal CKSW from a CPU (central processing unit) or the like at a rising edge of the CK2, and outputs an output signal Q3. The FF4 latches the Q3 at a falling edge of the CK2 when the EN is at H level, and outputs an output signal Q4. The SL selects the CK1 when the Q4 is at L level, and selects the CK2 when the Q4 is at H level, and outputs the selected clock as an output clock CKQ.
However, the clock switching circuit according to the comparison example samples the clock CK1 with the clock CK2. For this reason, the clock CK2 must have a frequency higher than that of the clock CK1, and the clock CK2 and the clock CK1 need to be in a frequency ratio of 2 or higher. Furthermore, although it is possible to switch among two clocks, it is difficult to cope with switching among three or more clocks.
The selector 10 receives first-n-th clocks CKA1-CKAn (a plurality of clocks where n is a natural number of 2 or more) and a select signal SA (a clock selection signal) from the mask signal generation circuit 30, and outputs a selected clock SQA. More specifically, the selector 10 selects one of the clocks CKA1-CKAn based on the select signal SA, and outputs the selected clock as a selected clock SQA, For example, upon receiving the SA with a single bit or multiple bits, the selector 10 selects and outputs one of the clocks corresponding to the value of the SA. A clock generated by a clock generation circuit is inputted in the selector 10. For example, a clock generated by an oscillation circuit that uses a solid oscillator such as a crystal vibrator, a ceramic oscillator and the like, a clock generated by a built-in oscillation circuit such as a ring oscillator, a clock generated by a PLL (phase-locked loop) or the like may be inputted in the selector 10.
The mask circuit 20 receives a selection clock SQA, and outputs an output clock CKQA. More specifically, the mask circuit 20 masks the selection clock SQA based on a mask signal MQA from the mask signal generation circuit 30, and outputs the selection clock SQA after having been masked as an output clock CKQA. In other words, during the period in which the MQA is inactive (a first logical level in a broad sense), the mask circuit 20 outputs the SQA (or a clock obtained by inverting or delaying the SQA) as the CKQA. Also, in the period in which the MQA is active (a second logical level in a broad sense), the mask circuit 20 outputs the CKQA that is fixed at L level or H level thereby masking the MQA.
Upon receiving a clock switching signal CKSA, the output clock CKQA from the mask circuit 20 and the selected clock SQA from the selector 10, the mask signal generation circuit 30 outputs a mask signal MQA and a select signal SA. Specifically, when the signal level of the clock switching signal CKSA is changed, the mask signal generation circuit 30 causes the mask signal MQA to be active based on the output clock CKQA. Then, the mask signal generation circuit 30 switches the signal level of the select signal SA during the period in which the mask signal MQA is active, and causes the mask signal MQA to be inactive based on the selection clock SQA. For example, the mask signal generation circuit 30 samples the CKSA at a rising edge or a falling edge of the CKQA (or a delay clock of the CKQA), and causes the MQA to be active when there is a change in the signal level of the signal generated through sampling. Then the mask signal generation circuit 30 outputs the SA based on a delay signal of the signal generated through sampling the CKSA, thereby switching the signal level of the SA. After the SQA has been switched based on the SA, and upon detecting a rising edge or a falling edge (a change in the signal level) of the SQA, the mask signal generation circuit 30 causes the MQA to be inactive. It is noted that the clock switching signal CKSA can be supplied from a CPU inside the microcomputer (an integrated circuit device), or from a setting register at which register values can be set from an external host controller.
As indicated at B1 of
The example described with reference to
In the example in
In an integrated circuit device that switches among plural clocks and uses them, a glitch that may be generated in a clock at the time of switching clocks would cause a malfunction of a circuit to which the clock is supplied. Therefore it is necessary to switch among multiple clocks without generating a glitch.
In this respect, in accordance with the present embodiment, the mask signal generation circuit 30 makes the mask signal MQA active and then switches the signal level of the select signal SA, the selector 10 selects one of the clocks CKA1-CKAn based on the select signal SA to switch the selected clock SQA, the mask signal generation circuit 30 causes the mask signal MQA to be inactive on condition that a change is detected in the signal level of the selected clock SQA after the selected clock SQA has been switched, and the mask circuit 20 masks the selected clock SQA based on the mask signal MQA and outputs the output clock CKQA.
According to the present embodiment, the signal level of the select signal SA is changed after the mask signal MQA has been made active. With this, during the period in which the output clock CKQA is masked, one of the clocks CKA1-CKAn is selected, whereby the selected clock SQA can be switched. Also, in accordance with the present embodiment, the mask signal MQA is made inactive on condition that a change is detected in the signal level of the selected clock SQA after the selected clock SQA has been switched. With this, a fractional clock pulse that may be generated at the time of switching the selected clock SQA can be masked. This makes it possible to switch among plural clocks without generating a glitch.
The above feature is more concretely described with reference to
With the clock switching circuit of the comparison example described above, one of the clocks to be switched is used to sample the other clock, such that it is difficult to switch among three or more clocks. Also in the comparison example, the frequency of a clock to be used for sampling needs to be two times or greater the frequency of a clock to be sampled, which poses a limitation to the frequency ratio of clocks to be switched.
In contrast, in accordance with the present embodiment, the mask signal generation circuit 30 may sample the clock switching signal CKSA based on the output clock CKQA or a delay clock of the output clock CKQA, thereby causing the mask signal MQA to be active.
In accordance with the present embodiment, the mask signal generation circuit 30 can generate a mask signal MQA and a select signal SA based on a selected clock SQA and an output clock CKQA. With this, the MQA and the SA can be generated without sampling one of the clocks to be switched with the other clock. In this manner, switching among desired clocks of three or more clocks can be realized without a restriction to the frequency ratio of clocks to be switched.
Furthermore, in accordance with the present embodiment, by sampling the clock switching signal CKSA based on the output clock CKQA or a delay clock of the output clock CKQA, the mask signal MQA can be made active after an edge of the output clock CKQA or the delay clock of the output clock CKQA has been outputted (after a change in the signal level). With this, at the time of switching the SQA, the clock can be switched without forming the clock pulse of the clock CKA1 prior to the switching into a fractional clock pulse. For example, as described with reference to
Furthermore, in accordance with the present embodiment, the mask signal generation circuit 30 may output the select signal SA based on a signal that is obtained by delaying a signal generated through sampling the clock switching signal CKSA based on the output clock CKQA or a delay clock of the output clock CKQA.
With this, the signal level of the select signal SA can be switched after the mask signal MQA has been made active. Specifically, as described above, the mask signal MQA is made active through sampling the clock switching signal CKSA based on the output clock CKQA or a delay clock of the output clock CKQA. Therefore, by outputting the SA based on a signal that is obtained by delaying a signal generated through sampling the CKSA based on the CKQA or a delay clock of the CKQA, the SA can be switched at a timing later than the timing at which the MQA is made active. In this manner, the clock can be switched during a masking period.
The selector SLB selects either of the CKB1 and CKB2 based on a select signal SB from the delay circuit DB, and outputs a selected clock SQB. For example, the SLB selects the CKB1 when the SB is at L level, and selects the CKB2 when the SB is at H level. For example, the SLB may be composed of transfer gates with CMOS transistors, whereby one of the clocks may be selected by turning on one of the transfer gates corresponding to a clock to be selected. Alternatively, the SLB may be comprised of clock inverters, whereby one of the clocks may be selected by setting one of the clocked inverters corresponding to a clock to be selected to be in an output enable state.
The flip-flop circuit FFB1 latches (samples) a clock switching signal CKSB2 at a falling edge of the output clock CKQB, and outputs a first output signal QB1. The flip-flop circuit FFB2 latches (samples) the QB1 at a falling edge of a selected clock SQB, and outputs a second output signal QB2. The delay circuit DB delays the QB1, and outputs the delayed QB1 as the SB. For example, the DB may be comprised of a logic circuit such as a circuit of an even number of serially connected inverters, or may be comprised of an RC delay circuit with which a delay time is set by a RC circuit. The exclusive OR circuit EXB obtains an exclusive OR of the QB1 and QB2, and outputs a mask signal MQB. Specifically, the EXB causes the MQB to be H level, when the QB1 is at L level and the QB2 is at H level, or when the QB1 is at H level and the QB2 is at L level.
The inverter INB inverts the logic level of the mask signal MQB, and outputs a signal MQNB. In other words, the INB outputs the MQNB at H level when the MQB is at L level, and outputs the MQNB at L level when the MQB is at H level. The AND circuit ANB obtains a logical product of the selected clock SQB and the signal MQNB, and outputs an output clock CKQB. Specifically, the ANB outputs the CKQB at L level when the MQNB is at L level thereby masking the SQB, and outputs the SQB as the CKQB when the MQNB is at H level.
In accordance with the present embodiment, as the FFB1 latches the CKSB at a falling edge of the CKQB and outputs the QB1, the clock switching signal CKSB can be sampled based on the output clock CKQB. Also, in accordance with the present embodiment, the EXB causes the MQB to be active when the signal level of the QB1 changes, and the DB delays the change in the signal level of the QB1 thereby changing the signal level of the SB. By this, the signal level of the select signal SB can be switched after the mask signal MQB has been made active. In accordance with the present embodiment, as the FFB2 latches the QB1 at a falling edge of the SQB, a change in the signal level of the selected clock SQB can be detected. Then, as the EXB makes the MQB inactive when the signal level of the QB2 changes, the mask signal MQB can be made inactive on condition that a change in the signal level of the selected clock SQB is detected. In accordance with the present embodiment, as the DB delays a change in the signal level of the QB1 to change the signal level of the SB, the select signal SB can be outputted based on the signal that is obtained by delaying the signal QB1 generated through sampling the clock switching signal CKSB based on the output clock CKQB. In this manner, in accordance with the present embodiment, the first and second clocks CKB1 and CKB2 can be switched without generating a glitch.
The selector SLC selects one of the CKC1 CKC4 based on select signals SC1 and SC2 from the delay circuit DC, and outputs a selected clock SQC. Specifically, the SLC includes selectors SLC1 through SLC3. The SLC1 selects one of the CKC1 and the CKC2 based on the SC1, and outputs a clock SQC1. The SLC2 selects one of the CKC3 and CKC4 based on the SC1, and outputs a clock SQC2. The SLC3 selects one of the SQC1 and the SQC2, and outputs a selected clock SQC. For example, the SLC selects CKC1, CKC2, CKC3 and CKC4 according to (SC1, SC2) being (0, 0), (1, 0), (0, 1) and (1, 1), respectively, where 0 is L level and 1 is H level.
The flip-flop circuit FFC1 latches a clock switching signal CKSC [0] of clock switching signals CKSC [1:0] at a falling edge of the output clock CKQC, and outputs a first output signal QC1. The flip-flop circuit FFC2 latches the QC1 at a falling edge of the selected clock SQC, and outputs a second output signal QC2. The flip-flop circuit FFC3 latches the clock switching signal CKSC [1] of the clock switching signals CKSC [1:0] at a falling edge of the output clock CKQC, and outputs a third output signal QC3. The flip-flop circuit FFC4 latches the QC3 at a falling edge of the selected clock SQC, and outputs a fourth output signal QC4. The delay circuit DC delays the output signals QC1 and QC3, and outputs select signals SC1 and SC2. More specifically, the DC includes first and second delay circuits DC1 and DC2. The DC1 delays the QC1, and outputs the delayed QC1 as the SC1, and the DC2 delays the QC3, and outputs the delayed QC3 as the SC2. The exclusive OR circuit EXC1 obtains an exclusive OR of the QC1 and QC2, and outputs a first mask signal MQC1. The exclusive OR circuit EXC2 obtains an exclusive OR of the QC3 and the QC4, and outputs a second mask signal MQC2. The mask signal output circuit NRC (an inversion OR circuit, a NOR circuit) obtains an inverted OR of the MQC1 and the MQC2, and outputs a mask signal MQC. In other words, the NRC outputs the MQC at H level in the case where the MQC1 and the MQC2 are at L level, and outputs the MQC at L level in other cases.
The AND circuit ANC obtains a logical product of the selected clock SQC and the mask signal MQC, and outputs the output clock CKQC. Specifically, the ANC outputs the CKQC at L level when the MQC is at L level thereby masking the SQC, and outputs the SQC as the CKQC when the MQC is at H level.
As indicated at E1 in
In accordance with the embodiment described above, switching between desired ones of the first through fourth clocks CKC1-CKC4 can be performed without generating a glitch. It is noted that the second detailed composition example has been described with reference to a composition example for switching among the first through fourth clocks CKC1-CKC4, as a plurality of clocks. However, in accordance with the invention, first through third clocks as a plurality of clocks may be switched. For example, in the second detailed composition example shown in
The microcomputer 400 shown in
The crystal oscillation circuit 410 generates a clock, using oscillation of a crystal vibrator XT. The CR oscillation circuit 420 is formed from, for example, a ring oscillator that is fed back with a CR circuit, and generates a clock with a frequency set by the capacitance value and the resistance value of the CR circuit. The ceramic oscillation circuit 430 generates a clock, using oscillation of a ceramic oscillator CM. The clock switching circuit 440 selects one of the clocks from the oscillator circuits, and supplies a selected one of the clocks to the CPU 450. The CPU 450 executes a variety of operation processings using the clocks from the clock switching circuit 440. Register values for controlling the microcomputer 400 are written to the control register 460 by the CPU 450, Register values for controlling clock switching are written to the control register 460, and the resister values are supplied as clock switching signals to the clock switching circuit 440.
The integrated circuit device 200 may be, for example, a microcomputer, and may control the electro optical panel 210, and execute a variety of operation processings necessary for operation of an electronic apparatus. The electro optical panel 210 is provided for displaying various images, and may be realized with, for example, an LCD (liquid crystal display) or the like. The operation section 220 allows the user to input a variety of information, and may be realized with a variety of buttons, a keyboard and the like. The storage section 230 stores a variety of data, and may be realized with a RAM, a ROM and the like. The communication section 240 performs processings for communication with an external device, and may be realized with an ASIC for wireless or wired communication.
As the electronic apparatuses realized by the present embodiment, a variety of apparatuses, such as, clocks, remote controllers, portable information terminals, cellular phones, a variety of home appliances and the like can be enumerated.
It is noted that, although some embodiments of the invention have been described in detail above, those skilled in the art would readily appreciate that many modifications are possible without departing in substance from the novel matter and effects of the invention. Accordingly, such modifications are deemed to be included within the scope of the invention. For example, throughout the specification and the drawings, any terms (active, inactive, microcomputer and the like) described at least once with other different terms (first logical level, second logical level, integrated circuit device and the like) that encompass broader meaning or are synonymous can be replaced with these different terms in any sections of the specification and the drawings. Also, the structures and operations of the mask signal generation circuit, the mask circuit, the clock switching circuit, the integrated circuit device, the electronic apparatus and the like are not limited to those described in the present embodiments, and many modifications can be made.
Number | Date | Country | Kind |
---|---|---|---|
2009-073918 | Mar 2009 | JP | national |