Patent Publication Number: US-5530906-A

Title: Control circuit responses to a wait request from an address decoder for controlling clock signal supply to a CPU to operate with slow peripheral

Description:
This is a continuation application of application Ser. No. 08/138,568 filed on Oct. 18, 1993 now abandoned, which is a continuation application of application Ser. No. 07/500,816 filed on Mar. 28, 1990 now abandoned. 
    
    
     BACKGROUND OF THE INVENTION 
     The present invention relates to a single-chip microcomputer for controlling peripheral circuits such as memories or dual port memories. 
     Japanese Patent Application Kokai No. 61-141,064 discloses that when a single-chip microcomputer of relatively high process speed accesses a peripheral circuit such as a read only memory (ROM) or random access memory (RAM), or a dual port memory, a wait time setting control circuit is added to the single-chip microcomputer to divide the frequency of a clock signal outputted from the microcomputer for permitting access with a clock signal of lower frequency. The wait time setting control circuit and address decoder must be made from a general purpose large scale integrated circuit, resulting in the increased mounting area. 
     SUMMARY OF THE INVENTION 
     Accordingly, it is an object of the invention to provide a single-chip microcomputer, which is equipped with peripheral circuits having different process times depending on the process contents and peripheral circuits having constant process times, with the minimum external circuit and thus the minimum mounting area. 
     According to the invention there is provided a single-chip microcomputer for outputting an address signal and a control signal to a peripheral circuit, exchanging data with the peripheral circuit, and receiving a wait request signal from the peripheral circuit, the microcomputer having a central processing unit, which includes a setting control circuit responsive to the wait request signal to output a control signal during a predetermined period; and an extension circuit responsive to the control signal to close its gate for blocking a clock signal from passing to the central processing unit. 
     Other objects, features, and advantages of the invention will be apparent from the following description when taken in conjunction with the accompanying drawings. 
    
    
     BRIEF DESCRIPTION OF THE DRAWINGS 
     FIG. 1 is a schematic diagram of part of a single-chip microcomputer according to an embodiment of the invention; 
     FIG. 2 is a block diagram of a system including the single-chip microcomputer of FIG. 1 and external circuits; 
     FIG. 3 is a timing chart showing the operation of the single-chip microcomputer of FIG. 1; 
     FIG. 4 is a schematic diagram of part of a single-chip microcomputer according to another embodiment of the invention; 
     FIG. 5 is a timing chart showing the operation of the single-chip microcomputer of FIG. 4; 
     FIG. 6 is a schematic diagram of part of a single-chip microcomputer according to still another embodiment of the invention; 
     FIG. 7 is a block diagram of a system including the single-chip microcomputer of FIG. 6 and external circuits; 
     FIG. 8 is a timing chart showing the operation of the single-chip microcomputer of FIG. 6; 
     FIG. 9 is a schematic diagram of part of a single-chip microcomputer according to yet another embodiment of the invention; and 
     FIG. 10 is a block diagram of a system including the single-chip microcomputer of FIG. 9 and external circuits. 
    
    
     DESCRIPTION OF THE PREFERRED EMBODIMENT 
     In FIG. 1, the single-chip microcomputer 5 includes a wait time setting control circuit 1 which outputs a control signal P for a predetermined time in response to a wait request signal. The wait request signal is inputted to a wait input terminal RDYIN/WAITIN. In response to the controlsignal P, an extension circuit 3 closes the gate to block a clock signal CLOCK from passing to a central processing unit (CPU). The clock signal CLOCK is inputted to the extension circuit 3, which consists of a 2-input AND gate 4, and the counter clock input terminal CNTCLK of the setting control circuit 1. The setting control circuit 1 consists of a 1-bit down counter 2. The wait request signal is inputted to the signal input terminal CNTENB of the 1-bit down counter 2. The output terminal CNTOUT ofthe 1-bit down counter 2 is connected to the input of the AND gate 4. The AND gate supplies a clock signal CPUCLK to the CPU. 
     In FIG. 2, a peripheral circuit 7 operates at a constant process time regardless of the process contents and is used satisfactorily when the single-chip microcomputer 5 is put in the wait condition for one clock cycle. The microcomputer 5 outputs an address value on an address bus which is connected to an address decoder 6. The output DECOUT of the address decoder 6 is inputted to the enable signal input terminal CE of the peripheral circuit 7 and the wait input terminal RDYIN/WAITIN of the microcomputer 5. A data bus connects the microcomputer 5 and the peripheral circuit 7. A control bus connects the microcomputer 5 to the peripheral circuit 7. 
     The operation will be described with reference to FIG. 3, wherein individual signals (a)-(e) represent CLOCK, address bus, DECOUT, CNTOUT, and CPUCLK, respectively. In order to select the peripheral circuit 7, themicrocomputer 5 outputs at a time A an address value (b) which is allotted to the peripheral circuit 7. In response to the address value, the addressdecoder 6 outputs a low level signal &#34;L&#34; at the output terminal DECOUT (c) at the time A. The signal &#34;L&#34; is inputted to the input terminal CE of the peripheral circuit 7 to enable it. The signal &#34;L&#34; is also inputted to the input terminal RDYIN/WAITIN and thus CNTENB  of the 1-bit down counter 2. Upon detection of the signal &#34;L&#34;, the 1-bit down counter 2 down counts theclock signal from the microcomputer 5. The output signal at the output terminal CNTOUT (d) falls from &#34;H&#34; to &#34;L&#34; at a trailing edge B of the clock signal (a) and rises again to &#34;H&#34; at the next trailing edge C after one clock cycle. Then, the microcomputer 5 outputs at a time D another address value (b) for selecting another peripheral circuit. At the same time, the signal at the decoder output terminal DECOUT (c) becomes &#34;H&#34;. The clock signal CLOCK (a) and the counter output signal CNTOUT (d) are ANDed to produce a CPU clock signal CPUCLK (e). 
     By synchronizing the address bus output, the data bus input/output, read/write control bus output with the period &#34;L&#34; of the CPU clock signal CPUCLK (e), the single-chip microcomputer 5 is able to use the peripheral circuit 7 which operates at lower speed than that of the original clock signal CLOCK. 
     In FIG. 4, the original clock signal CLOCK is inputted to the AND gate 4 ofan extension circuit 3 and the setting control circuit 1. The countdown value is inputted to the input terminal CNTCLK of a 3-bit down counter 8. The signal RDYIN/WAITIN is inputted to the input terminal CNTENB of the 3-bit down counter 8. The output signal CNTOUT of the 3-bit down counter is inputted to the 2-input AND gate 4, which outputs a clock signal CPUCLKto the CPU. The single-chip microcomputer 5 further includes a setting register 9 for setting with software the countdown value for the 3-bit down counter 8. In other words, it is possible to change the setting of a countdown value for the down counter 8. 
     This single-chip microcomputer 5 is useful for the same system as that of FIG. 2, wherein the peripheral circuit 7 operates at a constant process time regardless of the process contents and is used satisfactorily when the microcomputer 5 is put in the wait state for a multiple of the clock cycles up to 8 cycles (=2 3 ). The microcomputer 5 outputs an address value on the address bus to the address decoder 6. The output signal DECOUT is inputted to the input terminal CE of the peripheral circuit 7 and the wait input terminal RDYIN/WAITIN of the microcomputer 5. A data bus connects the microcomputer 5 and the peripheral circuit 7. A control bus connects the microcomputer 5 to the peripheral circuit 7. 
     The operation will be described with reference to FIG. 5. It is assumed that the downcount value of a setting register 9 is set by software at 3 or &#34;011&#34;. In order to select the peripheral circuit 7, the microcomputer 5outputs at a time A an address value (b) to which the peripheral circuit 7 is allotted. In response to the address value, the address decoder 6 outputs at the output terminal DECOUT (c) at the time A a low-level signal &#34;L&#34; to the input terminal CE of the peripheral circuit 7 to enable it. Thesignal &#34;L&#34; is also inputted to the input terminal CNTENB of the 3-bit down counter 8. Upon detecting that the counter enable signal CNTENB becomes &#34;L&#34;, the 3-bit down counter 8 down counts the clock signal CLOCK inputted to the input terminal CNTCLK from the microcomputer 5. The output signal CNTOUT (d) of the 3-bit down counter 8 falls from &#34;H&#34; to &#34;L&#34; at a time B and rises again to &#34;H&#34; at a time C after 3 cycles of the original clock inthis case. Then, the microcomputer 5 outputs another address value (b) at atime D for another peripheral circuit. At the same time, the decoder outputDECOUT (c) rises to &#34;H&#34;. The CPU clock signal CPUCLK (e) is the logical product of the clock signal CLOCK (a) and the counter output signal CNTOUT(d). 
     Thus, by synchronizing the address bus output, the data bus input/output, the control bus read/write output with the period &#34;L&#34; of the CPU clock signal CPUCLK, the single-chip microcomputer 5 is able to use the peripheral circuit 7 which operates at lower speed than that of the original clock. In addition, by writing with software another value, such as 4 or &#34;100&#34;, in the setting register 9 to change the downcount value, itis possible to set the wait time of the microcomputer 5 according to the process speed of the peripheral circuit 7. 
     In FIG. 6, the original clock signal CLOCK is inputted to the output terminal CLOCKOUT, the 2-input AND gate 4, and the input terminal CNTCLK of a 3-bit down counter 8 in the setting control circuit 1. The input signal RDYIN/WAITIN is inputted to a switch SW 10 which is incorporated inthe single-chip microcomputer 5. An output terminal SWOUT0 of the switch 10is connected to the input terminal CNTENB of the 3-bit down counter 8. The output terminal CNTOUT of the 3-bit down counter 8 is connected to the output terminal SWOUT1 of the switch 10 and the input of the AND gate 4. The output signal of the AND gate 4 is inputted to the CPU as a CPU clock signal CPUCLK. The microcomputer 5 also has a setting register 11 for setting with software a countdown value of the 3-bit down counter 8 and anoutput of the switch 10. 
     This microcomputer 5 is also useful for the peripheral circuit 7 in the system of FIG. 2 when it is put in the wait condition for a multiple of clock cycles up to 8 cycles (=2 3 ). In FIG. 2, the single-chip microcomputer 5 outputs an address value on the address bus to the addressdecoder 6. The output signal DECOUT of the address decoder 6 is inputted tothe input terminal CE of the peripheral circuit 7 and the input terminal RDYIN/WAITIN of the microcomputer 5. 
     In operation, it is assumed that the downcourt value of the down counter 8 and the output value of the switch 10 are set with software at 3 and 0, respectively, or &#34;0110&#34; as shown in FIG. 6. This setting makes the circuitidentical with that of FIG. 4 and, therefore, the description of its operation will be omitted. 
     Next, by using software, the contents of the setting register 11 are set at &#34;XXX1&#34; wherein X is either 0  or 1. Since the bit 0 has a value of 1, the input signal RDYIN/WAITIN of the microcomputer 5 is inputted directly to the 2-input AND gate 4. Where the CPUCLK is made &#34;L&#34; during the entire period in which the address decoder 6 outputs an address value, the switch10 is turned to the SWOUT1 with software to thereby supply the input signalRDYIN/WAITIN directly to the extension circuit 3. 
     In FIG. 7, the process speed of a peripheral circuit 7 varies with its processing contents. Where the single-chip microcomputer 5 uses this peripheral circuit 7, the microcomputer 5 must wait until the peripheral circuit 7 completes its process. The microcomputer 5 outputs an address value on the address bus to the address decoder 6. The output terminal DECOUT is connected to the input terminal CE of the peripheral circuit 7 and the input terminal WCENB of the setting control circuit 1. The peripheral circuit 7 outputs at the output terminal BUSY a busy signal H, which is inputted to the input terminal BUSYIN of the setting control circuit 1. The clock signal is inputted to the input terminal WCCLK of thesetting control circuit 1 from the output terminal CLOCKOUT of the microcomputer 5. The output terminal WCOUT of the setting control circuit 1 is connected to the input terminal RDYIN/WAITIN of the microcomputer 5. A data bus connects the microcomputer 5 and the peripheral circuit 7. A control bus connects the microcomputer 5 to the peripheral circuit 7. 
     The operation of the system of FIG. 7 will be described with reference to FIG. 8. In order to select the peripheral circuit 7, the microcomputer 5 outputs at a time A on the address bus (b) an address value to which the peripheral circuit 7 is allotted. In response to the address value, the address decoder 6 outputs at the time A at the output terminal DECOUT (c) a low-level signal &#34;L&#34;, which is inputted to the input terminal CE of the peripheral circuit to enable it. The signal &#34;L&#34; from the decoder output DECOUT is also inputted to the input terminal WCENB of the setting controlcircuit 1. The peripheral circuit 7 outputs a high-level signal &#34;H&#34; at the output terminal BUSY (d) at a trailing edge B of the clock signal (a). Upon detecting that the busy signal (BUSY) is at &#34;H&#34;, the setting control circuit 1 outputs a low-level signal &#34;L&#34; at the output terminal WCOUT (e) at the time B. 
     Then, the peripheral circuit 7 completes its process, and the BUSY signal (d) changes from &#34;H&#34; to &#34;L&#34; at a time E, the output signal WCOUT (e) of the setting control circuit 1 becomes &#34;H&#34; at a trailing edge C of the nextclock pulse (a). Then, the microcomputer 5 outputs another address value (b) at a time D to select another peripheral circuit. At the same time, the decoder output DECOUT (c) becomes &#34;H&#34;. The clock signal CLOCK (a) and the output signal WCOUT (e) are ANDed in the microcomputer 5 using the circuitry of FIG. 6 to produce a CPU clock signal CPUCLK (f). That is, theperiod of a bus cycle is extended while the input RDYIN/WAITIN to the microcomputer 5 is at &#34;L&#34;. 
     In FIG. 9, the setting control circuits 1 of FIGS. 1 and 4 are provided in parallel at 12 and 13 respectively. The clock signal CLOCK is inputted to a 4-input AND gate 14 of an extension circuit 3 and the respective settingcontrol circuits 12 and 13. The setting control circuit 12 consists of a 1-bit down counter 2 in which the countdown value is fixed at &#34;1&#34;. The setting control circuit 13 consists of a 3-bit down counter 8 in which different countdown values are set by software with the setting register 9. More specifically, the clock signal CLOCK is inputted to the input terminal CNTCLK 1 of the 1-bit down counter 2, the input terminal CNTCLK 2of the 3-bit down counter 8, and the 4-input AND gate 14. Wait signals RDYIN1/WAITIN1 and RDYIN2/WAITIN2 are inputted to the input terminal CNTENB1 of the 1-bit down counter 2 and the input terminal CNTENB2 of the 3-bit down counter 8 respectively. Another wait signal RDYIN3/WAITIN3 is inputted to the 4-input AND gate 14. By setting the contents of the setting register 9 with software, it is possible to set eight (2 3  =8)different countdown values of the 3-bit down counter 8. The output signal of the AND gate 14 is inputted to the CPU as a CPU clock signal CPUCLK. That is, the setting register 9, the setting circuits 12 and 13, and inputterminals RDYIN1/WAITIN1, RDYIN2/WAITIN2, RDYIN3/WAITIN3 are arranged so asto process three inputs to thereby enable the microcomputer to use peripheral circuits of various process speed. 
     For example, the microcomputer 5 is able to use three peripheral circuits 18, 19, and 20 as shown in FIG. 10, wherein the peripheral circuits 18 and19 have different process times which are constant regardless of the process contents, and the peripheral circuit 20 has different process times depending on its process contents. The microcomputer 5 outputs address values on the address bus to the address decoders 15, 16, and 17. The respective output signals DECOUT1, DECOUT2, and DECOUT3 from the address decoders 15-17 are inputted to the input terminals CE1, CE2, and CE3 of the peripheral circuits 18-20. The two output signals DECOUT1 and DECOUT2 are also inputted to the input terminal RDYIN1/WAITIN1 and RDYIN2/WAITIN2 of the microcomputer 5. The output signal DECOUT3 of the address decoder 17 is also inputted to the input terminal WCENB of the setting control circuit 1. The busy signal BUSY indicating that the peripheral circuit 20 is in process is inputted to the setting control circuit 1, and a clock signal is inputted to the input terminal WCCLK fromthe output terminal CLOCKOUT of the microcomputer 5. The output signal WCOUT of the setting control circuit 1 is inputted to the input terminal RDYIN3/WAITIN3 of the microcomputer 5. A data bus connects the microcomputer 5 and the peripheral circuits 18, 19, and 20. A control bus connects the microcomputer 5 to the peripheral circuits 18, 19, and 20. 
     In operation, when the microcomputer 5 outputs on the address bus an address value to which the peripheral circuit 18 is allotted, only the address decoder 15 outputs a low-level signal &#34;L&#34; to the input terminal CE1 of the peripheral circuit 18 and the input terminal RDYIN1/WAITIN1 of the microcomputer 5 to enable the 1-bit down counter 2 within the microcomputer 5. The circuit and operation under this enable condition areidentical with those of FIGS. 1 and 3 and, therefore, their detailed description will be omitted. 
     When the microcomputer 5 outputs on the address bus an address value to which the peripheral circuit 19 is allotted, only the address decoder 16 outputs a low-level signal &#34;L&#34; to the input terminal CE2 of the peripheralcircuit 19 and the input terminal RDYIN2/WAITIN2 of the microcomputer 5 to enable the 3-bit down counter 8. The circuit and operation under this enable condition are identical with those of FIGS. 4 and 5 and, therefore,their detailed description will be omitted. 
     When the microcomputer 5 outputs on the address bus an address value to which the peripheral circuit 20 is allotted, only the address decoder 17 outputs a low-level signal &#34;L&#34; to the input terminal CE3 of the peripheralcircuit 20 and the input terminal WCENB of the setting control circuit 1. The circuit and operation under this condition are identical with those ofFIGS. 6 and 8 and, therefore, their detailed description will be omitted. 
     That is, when the microcomputer 5 uses the peripheral circuits 18 and 19 having a constant process time regardless of the process contents and the peripheral circuit 20 having different process times depending on its process contents, it is possible to minimize the external add-on circuit to thereby minimize not only the mounting area on a board but also the wait time of the microcomputer according to the individual peripheral circuits. 
     As has been described above, according to an embodiment of the invention, the single-chip microcomputer, which has a central processing unit, a waitinput terminal, a clock signal input terminal, an address output terminal, a data i/o terminal, and a control output terminal, is provided with a wait time setting control circuit which outputs a control signal for extending the bus cycle to a wait time predetermined by software or hardware when the signal inputted to the wait input terminal is found at apredetermined level at a certain time within one bus cycle and a bus cycle time extension circuit which receives an output signal of the setting control circuit and the original clock signal and outputs a CPU clock signal of a prolonged bus cycle, whereby the external wait time setting control circuit is eliminated, resulting in the small mounting area. 
     According to another embodiment of the invention, the single-chip microcomputer, which has a central process unit, a wait input terminal, a clock signal input terminal, a clock signal output terminal, an address output terminal, a data i/o terminal, and a control signal output terminal, is provided with a wait input switch which receives a wait signal and switches between two outputs; a wait setting control circuit which outputs a control signal for extending the bus cycle to a wait time predetermined by software or hardware when the signal inputted to the input terminal is found at a predetermined signal level at a certain time within one bus cycle; a bus cycle extension circuit which receives an output signal of the wait setting control circuit, an output signal of thewait input switch, and the clock signal and outputs a CPU clock signal of aprolonged bus cycle; and a setting register for setting a wait time of the wait setting control circuit where the wait time is set by software, whereby the external circuit is minimized when the single-chip microcomputer uses either a peripheral circuit which has a process time varying with its process contents or a peripheral circuit which has a constant process time regardless of its process contents, resulting in thesmall mounting area. 
     The wait time required to use the peripheral circuit is also minimized. That is, the wait input switch switches its outputs to select the best setting control circuit for the peripheral circuit to be used. As a result, it is sufficient to use a minimum external circuit, resulting in the small mounting area. In addition, it is possible to use the peripheralcircuit with the shortest wait time. 
     According to still another embodiment of the invention, the single-chip microcomputer, which has a central processing unit, a plurality of wait input terminals, a clock signal input terminal, a clock signal output terminal, an address output terminal, a data i/o terminal, and a control signal output terminal, is provided with at least one setting control circuit which outputs a control signal for extending the bus cycle to a wait time predetermined by software or hardware when one of the wait signals inputted to the wait input terminals is found at a predetermined level at a certain time within one bus cycle and a bus cycle extension circuit which receives one of the wait input signals, all the output signals of the setting control circuit, and the clock signal to extend theduration of a bus cycle, whereby the external circuit is minimized where the single-chip microcomputer uses a plurality of peripheral circuits having different process times depending on the process contents and peripheral circuits having constant process times regardless of the process contents, resulting in the small mounting area. 
     Since the setting control circuit is incorporated in the single-chip microcomputer, once a low-level signal &#34;L&#34; is inputted to the input terminal RDYIN/WAITIN, it is not necessary to detect the value of the above signal (it is not necessary for the signal to be &#34;L&#34;) until the setting control circuit or counter (delay circuit) is overflown (wait is completed), whereby the counter of the single-chip microcomputer is able to control the CPU wait time. This indicates small signal changes outside the chip, thus reducing the possibility of noise generation.