Data processor having wait state control unit

Abstract: A data processor includes a wait state control unit for generating a ready signal for instructing the insertion of a wait state into a bus cycle being currently performed, which unit comprises a bus cycle judgement circuit for judging the bus cycle being currently performed to produce judged bus cycle information, a register for storing a plurality of wait cycle numbers, a wait cycle selector/decoder for selecting one of the wait cycle numbers and decoding the selected wait cycle number to produce a decoded wait cycle number to be inserted, a wait cycle presence/absence detector supplied with the selected wait cycle number for detecting whether or not a wait state is to be inserted into the bus cycle being currently performed to produce a detection signal when the wait state is detected to be inserted, and a ready signal generator coupled to the wait cycle selector/decoder and the wait cycle presence/absence detector for generating the ready signal in response to the detection signal from the wait cycle presence/absence detector irrespective of the absence of the decoded wait cycle number from the wait cycle selector/decoder and continuing to generate the ready signal until the wait state is inserted into the bus cycle being currently performed by a number designated by the decoded wait cycle number.

Description: The present invention relates to a data processor such as a microprocessor or a microcomputer and, more particularly, to a wait state control unit in a data processor for controlling the insertion of one or more wait states into a sequence of states for performing each bus cycle. A data processor constitutes an information processing system together with a memory unit and a plurality of peripheral I/O (Input/Output) units. When the data processor reads or writes data from or into the memory units and the peripheral I/O units, it performs a data read or a data write bus cycle in accordance with a sequence of states, the number of which is determined by a bus control unit of the data processor and consists of a few states in general. Each of the states corresponds to one cycle period of a system clock signal. As well known in the art, an information processing system does not always employ memory devices constituting the memory unit and the peripheral I/O units each having a high speed access time. One or more memory devices and/or one or more peripheral I/O units having a low speed access time may be employed. In such a case, necessary data may not be read or written from or into the memory device and the I/O unit within an access time determined by the bus cycle of the bus control unit. In order to overcome this shortcoming, a wait state control unit is provided in the data processor for controlling or prolonging the bus cycle of the data processor. This unit generates a ready signal in response to a bus cycle to be performed to inform the bus control unit of the unit currently accessed having the low speed access time.. As long as the ready signal is generated, the bus control unit inserts a wait state into the sequence of states for performing the bus cycle. The wait state control unit includes a bus cycle judgement circuit for judging the kind of bus cycles to be currently performed, a register for storing a plurality of wait cycle numbers to be inserted, a wait cycle selector and decoder for selecting one of the wait cycle numbers in response to the judged kind of the bus cycle and decoding the selected wait cycle number, and a ready signal generator for responding to the decoded bus cycle number to generate the ready signal until the wait state is inserted in the bus cycle by a number designated by the decoded wait cycle number. Recently, the data processor has been required to operate at a high speed. For this purpose, the frequency of the system clock signal is made high and the bus control unit performs each of the data read and data write bus cycles by two states. In this case, the bus control unit samples the ready signal from the wait state control unit at an intermediate time point during the second state to determine whether or not the wait state is to be inserted. This means that the wait state control unit must generate the ready signal within a time corresponding to one and a half clock cycle of the system clock signal. However, the wait state control unit according to the prior art performs the operation thereof in a sequential manner, as described above. In other words, the wait state control unit requires a relatively long operation time for generating the ready signal. For this reason, the enhancement in an operation speed of the data processor is restricted. In ELECTRONIC ENGINEERING, vol. 59, no. 675, March 1983, pages 103 - 105 a soft wait system is described wherein software selectable wait logic provides a mechanism for independently setting the number of wait states on peripheral cards and for synchronising bus transfers to a constant frequency clock. All bus write transfers occuring while a signal is set at system reset do not write to peripherals but to a wait RAM. One output bit of the RAM is used to provide a software selectable single wait cycle, which provides time (for the PAL) to decide whether to insert more wait states. WO 89/02128 discloses a microcomputer with external bus interface for providing communication with external peripheral devices such as memory and the like is provided with on-board chip select logic and programmable bus stretching capability. The chip select logic provides chip select signals to external devices when addresses fall within pre-selected ranges, eliminiating the "glue" logic normally required for this purpose. The programmable bus stretching feature inserts a pre-selected number of "wait states" into any external bus cycle for which it is programmed by stretching, or freezing, the central processing unit and external bus interface unit clocks. Other internal clocks, such as those which drive timers and/or serial interface baud rate generators are not frozen by the bus stretch. SUMMARY OF THE INVENTION Therefore, an object of the present invention is to provide a data processor having an improved wait state control circuit. Another object of the present invention is to provide a wait state control unit which does not present the constraint on the enhancement in operation speed of a data processor. The object is solved by a data processor according to claim 1. The subclaims show further advantageous features of the invention. A data processor according to the present invention includes a wait state control unit for generating a ready signal for instructing the insertion of a wait state into a bus cycle being currently performed, which unit comprises a bus cycle judgement circuit for judging a kind of the bus cycle being currently performed to produce judged bus cycle information, a register for storing a plurality of wait cycle numbers, a wait cycle selector/decoder for selecting one of the wait cycle numbers and decoding the selected wait cycle number to produce a decoded wait cycle number to be inserted, a wait cycle presence/absence detector supplied with the selected wait cycle number for detecting whether or not a wait state is to be inserted into the bus cycle being currently performed to produce a detection signal when the wait state is detected to be inserted, and a ready signal generator coupled to the wait cycle selector/decoder and the wait cycle presence/absence detector for generating the ready signal in response to the detection signal from the wait cycle presence/ absence detector irrespective of the absence of the decoded wait cycle number from the wait cycle selector/ decoder and continuing to generate the ready signal until the wait state is inserted into the bus cycle being currently performed by a number designated by the decoded wait cycle number. The present invention pays attention to a fact that the wait cycle selector/decoder requires a relatively long time to decode the selected wait cycle number. Therefore, the wait cycle presence/absence detector is provided to detect whether or not the wait state is required to be inserted into the current bus cycle. Since this detector detects only the necessity of the insertion of the wait state, the detecting operation thereof is completed for a very short time. Accordingly, the ready signal generator generates the ready signal before the intermediate time point of the second state of the current bus cycle, and the generated ready signal is sampled at that time point. One wait state is thereby inserted into the current bus cycle. In other words, one wait state is provided after the second state. Next sampling of the ready signal is carried out at an intermediate time point of this wait state. Before this sampling time point, the wait cycle selector/decoder completes the decoding operation to supply the decoded wait cycle number to the ready signal generator. When the decoded wait cycle number represents one, the generator withdraws the generation of the ready signal, so that a wait state is no more inserted. On the other hand, the decoded wait cycle number represents two or more, the ready signal is continued to be generated until the required number of the wait state is inserted. When the wait cycle presence/absence detector does not produce the detection signal, the ready signal is of course not generated. BRIEF DESCRIPTION OF THE DRAWINGS The above and other objects, advantages and features of the present invention will be more apparent from the following description taken in conjunction with the accompanying drawings, in which Fig. 1 is a block diagram representative of a data processor according to an embodiment of the present invention; Fig. 2 is a block diagram representative of a wait state control unit (WCU) shown in Fig. 1; Fig. 3 is an internal circuit diagram representative of a wait cycle selector/decoder and a wait cycle presence/ absence detector shown in Fig. 2; and Fig. 4 is a timing chart representative of an operation of WCU. DETAILED DESCRIPTION OF THE INVENTION Referring now to Fig. 1, a microprocessor 1 as a data processor according to an embodiment of the present invention is fabricated as a semiconductor integrated circuit device and has a set of address terminals 7 coupled to a system address bus 71, a set of data terminals 8 coupled to a system data bus 81 and a set of control/status terminals 9 coupled to a system control/status bus 91. Although not shown, a memory unit storing a program and data and a plurality of peripheral I/O units are coupled to the buses 71, 81 and 91. The microprocessor 1 further includes a central processing unit (CPU) 2, a direct memory access unit (DMAU) 4, a refresh control unit (REFU) 5, a bus control unit (BCU) 3, a wait state control unit (WCU) 6 and a clock generator (CLGU) 10. CPU 2 executes a program to perform a data processing operation required by each instruction. The request for fetching each instruction and for reading or writing data from or into the memory unit and the peripheral I/O units is transferred via a bus 21 from CPU 2 to BCU 3. DMAU 4 performs a data transfer operation between the memory unit and the peripheral I/O unit in place of CPU 2. The request for the DMA data transfer is supplied via a bus 41 to BCU 3. REFU 5 performs a refresh operation on a dynamic random access memory (DRAM) constituting one part of the memory unit. The request for the refresh operation is supplied to BCU 3 via a bus 51. CPU 2 writes or sets control and/or parameter data into DMAU 4, REFU 5 and WCU 6 via a bus 22. CLGU 10 generates a system clock signal CLK which is supplied to CPU 2, BCU 3, DMAU 4, REFU 5 and WCU 6. BCU 3 responds to the respective requests from CPU 2, DMAU 4 and REFU 5 and performs a bus cycle for those requests by driving internal address, data and control/status buses 32, 33 and 34 which are in turn coupled to the system buses 71, 81 and 91 via the corresponding sets of terminals 7, 8 and 9, respectively. In this embodiment, BCU 3 basically performs each of bus cycles in two states T1 and T2, each of which corresponds to one cycle period of the system clock CLK. Included in BCU 3 is a state signal generator (SSG) 31 for generating a first state signal T1 and a second state signal T2. The first state T1 is allocated to the generation of the address information and the control/status information and the second state T2 is allocated to the data output or data fetching state. In order to control or prolong a period of one bus cycle, WCU 6 responds to the address information supplied via a branch bus 61 from the bus 32 and status information supplied via a branch bus 62 from the bus 34 and generates a ready signal 63. The SSG 31 samples the level of the ready signal 63 at an intermediate point of the second state T2. When the sampled ready signal is at a high level, SSG generates a wait state signal TW after the second state T2. The wait state TW also corresponds to one cycle period of the system clock CLK. The wait state TW is inserted repeatedly so long as the ready signal is at the high level. The ready signal 63 is further supplied to CPU 2, DMAU 4 and REFU 5 to inform that the wait state TW is inserted into the bus cycle. Referring to Fig. 2, WCU 6 includes a bus cycle judgement circuit 601, a wait cycle number register 603, a wait cycle selector/decoder 605, a wait cycle presence/ absence detector 608 and a ready signal generator 610. The bus cycle judgement circuit 601 judges a bus cycle being currently performed in response to the information from the blanch buses 61 and 62. In this embodiment, the circuit 601 judges basically four kinds of bus cycles: the first bus cycle is a memory bus cycle for accessing the external memory unit; the second bus cycle is a I/O bus cycle for accessing the peripheral I/O units; the third bus cycle is a DMA bus cycle for a DMA data transfer; and the fourth bus cycle is a refresh bus cycle for a DRAM refresh operation. These four bus cycles can be judged by the status information via the bus 62. The circuit 601 includes a memory boundary register (WMB) 6011 storing boundary data for deviding a memory space into three blocks, i.e. a lower, a middle and an upper memory block. The boundary data can be rewritten by CPU 2 through an instruction. Accordingly, the memory bus cycle is further classified into three bus cycles: the first one is a lower memory bus cycle for accessing the lower memory block; the second one is a middle memory bus cycle for accessing the middle memory block; and the third one is an upper memory bus cycle for accessing the upper memory block. The memory block to be accessed can be detected in response to the address information from the bus 61. As a result, six kinds of bus cycles are judged by the judgement circuit. The judged data 602 generated by the circuit 601 is supplied to the wait cycle selector/decoder 605 which is further supplied with data 604 representative of wait cycle numbers from a wait cycle number register 603. This register 603 includes a plurality of storage regions 603-1 to 603-6 (six in this embodiment). Each of the storage regions 603-1 to 603-6 stores data representative of a wait cycle number to be inserted into the bus cycle, which data is set and rewritten by CPU 2 through instructions. The storage regions 603-1 to 603-6 correspond to the above-mentioned six bus cycles, respectively, and thus store wait cycle number data IOW for the I/O bus cycle, UMW for the upper memory bus cycle, MMW for the middle memory bus cycle, LMW for the lower memory bus cycle, DMAW for the DMA bus cycle and RFW for the refresh bus cycle. Each of these wait cycle number data IOW to RFW consists of 2 bits in this embodiment and thus can set the number of wait states to be inserted from 0 to 3. The wait cycle selector/decoder 605 selects one of the number data 604 in response to the information 602 from the bus cycle judgement circuit 601 and then decodes the selected wait cycle number data to produce the decoded wait state number 606. The selected wait cycle number is further supplied as data 607 to a wait cycle presence/ absence detector 608. This detector 608 detects whether or not the selected wait cycle number data 607 is zero, i.e., whether or not a wait state is required to be inserted into the current bus cycle. This detection output is derived as a signal 609 which takes a high level when the selected wait cycle number data 607 is not zero. Turning to Fig. 3, the wait cycle selector/detector 605 includes six transfer gates TG1 to TG6 supplied with wait cycle number data IOW to RFW, respectively. Each of the transfer gates TG1 to TG6 is made open when the associated one of selection signals S1 to S6 takes an active level. These selection signals S1 to S6 are supplied with the bus cycle judgement circuit 601 as the judged data 602. For example, when the judgement circuit judges that the current bus cycle is the I/O bus cycle, only the selection signal S1 takes the active level to open the transfer gate TG1. The wait cycle number data IOW for the I/O bus cycle is thereby selected. The wait cycle number data thus selected is supplied to a decoder circuit 6051 and then decoded to the number of wait states 606 to be inserted into the bus cycle. The selected wait cycle number data is further supplied to an OR gate 6081 as the wait cycle presence/absence detector 608. Accordingly, so long as the selected wait cycle number data is not zero, the detection signal 609 takes the high level. Only when the wait cycle number to be inserted is zero, the signal 609 takes the low level. Turning back to Fig. 2, the decoded wait state number 606 and the detection signal 609 are supplied to a ready signal generator 610. This generator 610 includes a counter 611 counting a pulse signal 615, a comparator 613 comparing the decoded wait state number 606 with the content 612 of the counter 611 to produce a comparison output signal 614 which takes the low level when the wait state number 606 is coincident with the counting number 612, and a ready signal controller 616. This controller 616 responds to T1 and T2 state signals, the detection signal 609 and the comparison output signal 614 and controls the level of the ready signal 63 as well as the generation of the count pulse signal 615. Next, an operation will be described below with reference to Figs. 1 to 3 and further to Fig. 4. Assume that BCU 3 initiates the lower memory bus cycle. At the beginning of T1 state, therefore, the address and status information is changed, so that the bus cycle judgement circuit 601 changes the selection signal S4 to the active level. The wait cycle number data LMW for the lower memory bus cycle is thereby selected and supplied to the OR gate 6081. In this description, the wait cycle number data LMW is zero to represent that a wait state is required to be inserted in the lower memory bus cycle. Accordingly, the detection signal 609 from the wait cycle presence/absence detector 608 takes the valid low level during the T1 state. The ready signal generator 610 thus holds the ready signal at the low level. The selected wait cycle number data LMW is further supplied to the decoder circuit 6051. While the decoder circuit 6051 decodes the wait cycle number data LWW, it requires a relatively long time for decoding the wait cycle number data, so that the decoded wait state number 606 appears at a later part of T2 state, as shown in Fig. 4. On the other hand, SSG (state signal generator) 31 samples the level of the ready signal 63 in synchronism with the raising edge of the clock signal CLK during T2 state. Since the ready signal 63 is at the low level, a wait state TW is not generated. Since the wait cycle number data LMW is zero, a problem occurs. Next bus cycle, an I/O bus cycle in the present description, is thus initiated. The bus cycle judgement circuit 601 changes the selection signal S1 to the active level. The wait cycle number data IOW is thereby selected and supplied to the wait cycle presence/absence detector 608, the OR gate 6081. This data IOW represents wait cycle number of 2, so that the detection signal 609 is changed to the high level during T1 state. In response thereto the ready signal controller 616 changes the ready signal 63 to the high level at the beginning of T2 state and further generates the count pulse 615. The counter 611, which is reset to zero each time one bus cycle is initiated, thereby increments the contents thereof. At this time, the decoded wait state number 606 is not yet produced by the decoder 6051, as mentioned above. In synchronism with the leading edge of the clock CLK during T2 state, SSG 31 samples the high level ready signal 63 and thus produces the wait state TW after T2 state. The decoded wait state number 606 is produced and supplied to the comparator 613 during T2 state. Since the number 606 is not equal to the counter content 612, the comparator 613 produces the high level output 614. The ready signal controller 616 then responds to the signal 614 in place of the detection signal 609. Since the signal 614 is at the high level, the ready signal 63 is held at the high level during the first wait state TW and the count pulse 615 is generated again at the beginning of wait state TW. Since the counter 611 further increments the content thereof by one, the comparison output signal 614 is changed to the low level. On the other hand, SSG 31 samples the high level ready signal 63 at the leading edge of the clock CLK during first wait state TW, so that a second wait state TW is further inserted after the first wait state. Since the comparison signal 614 is at the low level, the ready signal 63 is changed to the low level at the beginning of the second wait state TW. SSG 31 samples the low level ready signal 63 at the leading edge of the clock CLK during the second wait state TW, so that another wait state is no more inserted. A next bus cycle is initiated. In the above description, when the number represented by the wait cycle number data is 1, the signal 614 is held at the low level, so that the second wait state TW is omitted. In case of the wait state number representing 3, the high level signal 614 is held at the high level until the second wait state TW starts, so that a third wait state TW is further inserted. Thus, by the provision of the wait cycle presence/ absence detector 608, the control for insertion of a wait state can be carried out even when the BCU 3 basically performs each bus cycle in two states T1 and T2. The number of kinds of bus cycle judged by the judgement circuit can be increased and the wait state number represented by the data IOW to RFW can be also increased.

Claims: A data processor including a wait state control unit for generating a ready signal (63) for instructing an insertion of a wait state into a bus cycle being currently performed, said wait state control unit comprising: first means (601) for judging a kind of said bus cycle being currently performed to produce judged bus cycle information; storage means (603) for storing a plurality of wait state data each representative of a number of wait states to be inserted into a bus cycle; second means (TG1 - TG6) responsive to said judged bus cycle information for selecting one of said plurality of wait state data stored in said storage means to produce a selected wait state data; and third means (6051) responsive to said selected wait state data for producing a number of wait states to be inserted; characterized by further comprising: fourth means (608) for detecting said selected wait state data to produce a detection signal (609) when the number of wait states to be inserted represented by said selected wait state data is not zero; and fifth means (610) for generating said ready signal in response to said detection signal irrespective of absence of the number of wait states to be inserted from said third means and for continuing to generate said ready signal so that said wait state is inserted into said bus cycle being currently performed by a number designated by said number of wait states from said third means. A data processor as claimed in claim I, wherein said fifth means (610) comprises: ready signal control means (616) responsive to said detection signal for generating said ready signal, said ready signal control means further generating count pulses for each wait state inserted in a current bus cycle; counter means (611) responsive to said count pulses for generating a count output, said counter means beginning a bus cycle; and comparator means (613) responsive to said number of wait states to be inserted from said third means and to said count output from said counter means for generating a comparison output to said ready signal control means indicating that no more wait states are to be inserted into said current bus cycle. A data processor as claimed in claim 1 or 2, wherein said fourth means (608) comprises an OR-gate (6081) responding to wait state data selected by said second means (TG1 - TG6).

Inventors: YOSHIMATSU NORIFUMI, YOSHIMATSU, NORIFUMI
Applicants: NIPPON ELECTRIC CO, NEC CORPORATION
Application year: 1990
Main classification: G06F13
IPC codes: G06F13, G06F12