HIGH SPEED STACK CIRCUIT FOR A DATA REGISTER IN A MICROCOMPUTER

Abstract: In a microcomputer a random access memory (12) and a central processor unit (11) are mounted on a single chip and are connected therebetween by a bus line (BUS). Sit lines (BL, BL ) of the memory are extended to internal registers of the central processor unit, and a connecting portion (10) which can read and write is provided therebetween. When data bits from an internal register are saved, one word line of the memory is selected and all bits of the data are transferred simultaneously to a memory cell group connected to the word line.

Description: This invention relates to a high speed stack circuit for a register in a one-chip microcomputer. A microcomputer comprising a CPU (central processor unit), a ROM (read only memory), a RAM (random access memory), etc., on a single chip transfers data in each portion by using common bus lines. When an operation is performed by transferring data from the RAM to internal registers of the CPU, the process is carried out in accordance with an instruction previously stored in the ROM. Such program can be latched as a routine formed usually by many instructions. In such a process, when a main routine is carried out in a set sequence, if an IRQ (interrupt request) is caused by an external source when the routine reaches a certain step, the process of the main routine must be discontinued at that step and the IRQ routine processed with priority. In this case, since the IRQ routine also utilises many registers, a stacking process is required. That is, the content of the registers, in the state of execution of a certain main routine, is saved to a region of the RAM instructed by a stack pointer, and subsequently, upon completion of the processing of the IRQ routine, processing of the main routine is resumed from an instruction following the certain instruction, and hence the saved content is restored in the previously-used registers. If, as in the conventional stack system, an internal BUS is used, one cycle is required for each register transfer (it is assumed that the number of bits of the register is the same as the number of lines of the bus). This leads to a disadvantage in that the larger the number of registers, the more time is required for stacking. A similar situation occurs when it is returned from the IRQ routine by a return interrupt instruction (RTI). To improve this situation, a system has been proposed in which registers exclusively used for the stack are procided internally in the CPU. In this system, since a data stack for the RAM is not necessary, high speed can be realised (stacking can be accomplished by one cycle). However, the registers exclusively used for the stack are dedicated hardware, and so cannot be used for storing and reading arbitrary data such as in a RAM, and accordingly cannot be used for another purpose. In particular, nesting is restricted by the capacity of the dedicated registers, and consequently for multistage nesting, multi-stage dedicated stack registers must be provided. This means that a large register capacity is required and, furthermore, since these registers are not always used, much of the capacity is wasted. Hochintegrierte Digitalschaltungen und Mikroprozessoren, H. Bernstein, Pflaum Verlag, Munchen 1978, p 239, pp 339-343 describes a microprocessor comprising a CPU with a plurality of internal registers, a RAM, a data bus line provided between the CPU and RAM and a connecting part between the RAM and the internal registers of the CPU. IBM Technical Disclosure Bulletin Vol 24 no. 7B, December 1981, New York, pp 3896-3897, A. Blum, details a processor chip which has multiple sets of general purpose registers in embedded arrays on the chip. These eliminate lengthy transfer operations of the general purpose registers contents to and from the main storage areas in multi-programming task swiching. An object of the present invention is to provide parallel processing of the stack. The apparatus according to the invention is set out in claim 1. Hence, when the data from the internal registers are stacked, one word line of the memory is selected and each bit of the data is transferred at the same time to a memory cell group connected to the word line through the extended bit line of the memory. Embodiments of the invention will now be described, by way of example, with reference to the accompanying drawings, in which Figs.1A, 1B and 1C are diagrams for explaining the operation of a conventional one-chip microcomputer; Figs.2A and 2B are schematic diagrams showing features of a microcomputer according to the present invention; Fig. 3 is a block diagram showing details of the diagrams of Figs. 2A and 2B; Fig. 4 is a block diagram of one embodiment of the present invention; Fig. 5 is a block diagram showing a CPU of Fig. 3 in detail; Fig. 6 is a schematic diagram showing in detail a connecting portion between internal registers of a CPU and a RAM of Fig. 4; Fig.7 is a flow chart for explaining the operation of stacking the register data; and Fig. 8 is a block diagram of another embodiment of the present invention. A microcomputer, which comprises a CPU (central processor unit), a ROM (read only memory), a RAM (random access memory), etc., mounted on a single chip, transfers the data in each portion by utilising a common bus line BUS, as shown in Fig. 1A. That is, when an operation is carried out by transferring data from a RAM 2 to internal registers R₁, R₂, ... of a CPU 1, the procedure is carried out by issuing an instruction previously stored in a ROM 3. For example, if the registers R₁, R₂ in the CPU 1 are defined as accumulators A, B, and an additional operation A + B is carried out in an arithmetic logic unit (ALU) 4 in the CPU, the program thereof will be substantially expressed as follows. M₁ → A MOV M₂ → B MOV A + B → A ADD The first step shows that the data in the RAM address M₁ is moved (MOV) to the accumulator A; the second step similarly shows that the data in the RAM address M₂ is moved to the accumulator B; and the third step shows that the contents of the accumulators A and B are added (ADD) and the result of the addition is written in the accumulator A. Such a program can be latched as a routine, formed usually by many instructions. Now, as shown in Fig. 1B, when a main routine is carried out with a set sequence ...., h, i, j, k, ..., if an IRQ (interrupt request) is received from an external source when the sequence reaches the step i, the processing of the main routine must be discontinued at that step and the IRQ routine processed with priority. In this case, since the IRQ routine also utilises the registers R₁, R₂ ..., the stacking process is required as shown in the example of Fig. 1C. Namely, the content of the registers R₁, R₂, ..., in the state of executing the main routine up to the instruction i is saved to a region of the RAM instructed by a stack pointer, and upon completion of the processing of the IRQ routine, the processing of the main routine is resumed from the instruction following the instruction i, and the saved content can be returned to the registers R₁ R₂, .... In the conventional stacking system, as already mentioned, the internal BUS is used for saving the content of the registers R₁, R₂ ..., and a certain time of one cycle is required for each register transfer (it is assumed that the number of bit positions in the register is the same as the number of lines of the bus). This brings a drawback in that the larger the number of registers, the greater is the time required for the stacking. Fig. 1C shows the stacking process of n internal registers R₁ - R n along a time axis t, and stacking of all register data is completed from the time at which an IRQ occurs at an nth cycle. A similar procedure occurs when it is returned from the IRQ routine by a return interrupt RTI. In the present invention, parallel processing of the stack from the internal registers of the CPU to the RAM is performed by using bit lines extended from the RAM which provide a special route which is different from the common bus lines. Figs. 2A and 2B are schematic diagrams of details of the present invention. Fig. 2A shows a relevant portion of a CPU 11 and a RAM 12, and Fig. 2B shows the construction of a memory cell in the CPU 11. In the drawing, BL and BL are a pair of bit lines, MC is, in this embodiment a static type memory cell, R₀, R₁, ... are internal registers in the CPU 11, 14 is an arithmetic logic unit (ALU), and WL is a word line. The memory cell MC is formed as a flip-flop type, in which inverters I₁ and I₂ are cross-connected. The cell is connected via transfer gates Q₁ and Q₂ to the bit lines BL and BL , respectively. As shown in Fig. 2A, each bit position of the internal registers R₀, R₁ ... in the CPU 11 is directly connected (in detail, via a gate not shown in the drawing) to each pair of bit lines of the data RAM 12. Fig. 3 is a diagram showing details of Fig. 2A. In this embodiment, a one-chip microcomputer is formed as an 8-bit type, and an eight-bit data bus (BUS) is connected between the RAM 12 and the CPU 11. The RAM 12 is divided into eight regions D₀ - D₇. Assuming that there are 128 pairs of hit lines BL, BL , then there are 16 pairs of bit lines in each region. The 16 pairs of bit lines are connected, via a selection gate (not shown) and a decoder 15, to a data bus (BUS), and since the eight regions D₀ - D₇ are each formed as one bit, accordingly eight bits are formed in the former portion. In each region, a plurality of word lines WL run horizontally to a row decoder 16, these are crossed by a purality of bit lines in the vertical direction, and a memory cell MC is arranged at each cross point. Assuming that, in the present embodiment, one bit is provided for each pair of bit lines, then the sixteen 8-bit internal registers can be provided in the PCU 11. R₀, R₁ ..., R₁₅ denote these 16 registers in the CPU 11 or each bit thereof, and b₇, b₆, ... in the CPU 11 indicate an eighth bit, a seventh bit, ... of each register. B₁ indicates an internal bus in the CPU 11, eight of which buses are provided in this example. A connecting portion of the RAM 12 and a common bus BUS are the same as usually used but, in the present invention, in each pair of bit lines in the RAM, the ends opposite to the connecting portion are extended and connected via gates G to each bit position of the internal registers in the CPU 11. Therefore, the CPU 11 and the RAM 12 are adjacent to each other on the chip, as shown in Fig. 3. Normal data transmission between the CPU 11 and the RAM 12 is carried out by using the bus line BUS. Gates and decoders controlled by the output of the decoder exist between the BUS and each data bit region of the RAM 12, and only selected 8-bit line pairs are connected to the eight-bit bus BUS, whereas the save and recapture of the data of the internal registers R₀, R₁, ..., R₁₅ are carried out directly via the extended portion EBL of the bit lines without going via the common bus BUS. For example, the data bits b₇, b₆, ... in the register R₀ are stored, via the extended portion EBL of the bit lines, in the regions D₇, D₆, ... of the RAM 12. This is the same for the other registers R₁, R₂, ..., and, therefore, all of the bits of the regions D₇ - D₀ of registers R₀ - R₁₅ are saved to the RAM 12 simultaneously. The stacked position is a memory cell group connected to a word line selected by a stack pointer. By this process, the data can be stacked in a small number of cycles regardless of the number of internal registers in the CPU 11, and is advantageous in that nesting can be made deep, in accordance with the number of the word lines of the RAM 12. Fig. 4 is a schematic block diagram showing one embodiment of the present invention. In Fig. 4 the same items as in Fig. 3 are shown by the same reference numerals and symbols. A decoder (DEC) 16 selects a word line of the RAM 12, the input of the DEC being supplied from an address bus during a normal operation. However, during an interruption (IRQ) and a return interrupt instruction (RTI), the input for the DEC 16 is switched to the address from a hardware stack pointer (HSP) 18. A multiplexer (MPX) 19 is used for this purpose, and is controlled by the output of a CPU controller (CPU CTL) 20. An interrupt controlling portion (INTR CTL) 21 causes the CPU CTL 20 to operate when the interrupt IRQ is sensed. As usual, a timer 22, etc., is provided as a peripheral circuit. Fig. 5 is a detailed diagram of the CPU, wherein TIM - TPS are internal registers. Among these, AS0 - AS6 are accumulator stacks, IX and IY are index registers, and temporary-use registers are shown by the prefix T. H, L and M denote High, Low, and Medium registers, respectively. In addition to these internal registers, there are a program counter IP, a software stack pointer SSP and an increment/decrement circuit INC/DEC, and these units determine the position of an address to be interrupted. ADD is an adder for address calculation, ALU is an operator in the internal register, and PSW is a program status word. Fig. 6 is a detailed diagram of a connecting portion 10 between the internal register in the CPU 11 and the RAM 12, wherein inverters I₃, I₄ form one bit of the internal register. A gate Q₃ for write, and a gate S₁ for read, exist between this internal register and the internal bus of the CPU 11. The gate Q₃ is a transistor which turns ON when a write signal W is made high (H) at the time of a normal operation. On the other hand, the gate S₁ is an inverter type switch which turns ON when a read signal r is made H at the time of a normal operation. The signals W and r are fed out from a CPU frame 25. However, as the internal BUS in the CPU 11 is used in common by the registers R₀ - R₁₅, any register can be selcted by a transfer gate Q₄, ... Therefore, the decode signal for this process is also formed in the CPU frame 25. The diagram to this point shows a function which exists in a conventional one-chip microcomputer. However, in this embodiment, a connecting portion 10 formed by gates Q₅ - Q₈ and a switch S₂ are added thereto, so that the internal register in the CPU 11 can be directly connected to the RAM 12. That is, the write command from the RAM 12 to the internal register in the CPU 11 (recapture of saved data) is carried out so that the inverter S₂ is turned ON by the write signal W, and an electric potential from one bit line BL is applied to a bit of the register, or more precisely, in this embodiment, to the input of the inverter I₃. At this time, in the RAM 12 the word line WL selected at the time of the interruption is again selected, and a potential difference H, L is supplied to the pair of bit lines BL, BL according to the information from a memory cell connected to the word line. Therefore, by adding the potential of the bit line BL to the bit from the register via the inverter switch S₂, the bit flip-flop is set or reset, so that the recapture of the saved data is carried out. Conversely, when the data is transferred (saved) from the internal register in the CPU 11 to the RAM 12, the gates Q₅ and Q₆ are turned ON by a signal R, and the switches Q₇ and Q₈ are driven by the complementary output of the bits I₃ and I₄ of the register. For example, the output of I₃ is H and the output of I₄ is L, the transistor Q₈ turns ON and the transistor Q₇ turns OFF. Then, the bit line BL becomes L, BL become H, and, in the cell MC in Fig. 2B, the output of the inverter I₂ becomes H and the output of I₁ becomes L. Thus, the content of the registers I₃, I₄ is saved to the RAM 12. As already mentioned, the position to be saved is selected by the word line WL. The signals R and W at the time of the save are also formed in the CPU 11, and the word line to be selected is determined by the stack pointer. The inverter S₂ has the function of a sense amplifier and the switches Q₇ and Q₈ have the function of a write amplifier. It is not necessary to cause a special speeding up of the direct transmission between the RAM 12 and the internal register in the CPU 11, because a time margin, usually about 3 cycles, exists from the time of the interruption to the time when the stack is completed. For example, consider the execution of an instruction A as shown in a block 71 of Fig. 7 and then the execution of the next instruction B as shown in a block 72. If the interruption occurs while the instruction B is being executed as shown in a block 73 of Fig. 7, it is necessary to then latch H and L in the address to be interrupted and, subsequently, to latch the OP code of the next instruction as shown in the block 73. This requires about three cycles, and the save may be carried out during this time. Next, the instructions of the interruption routine are executed as shown in a block 74. After that, the saved data is latched to the registers in the CPU as shown in a block 75, and an instruction C is effected as shown in a block 76. Fig. 8 shows another embodiment of the present invention. The basic idea of that embodiment is similar to that shown in Fig. 3. The difference between those embodiments is that in Fig. 8 four decoders 30a - 30d are provided for 16 bit lines, and the decoded outputs of the decoders 30a - 30d are supplied, via four pairs of gates Ga - Gd, to four internal registers R₁ - R₄. The decoders are controlled by the hardware stack pointer shown in Fig. 3. The embodiment shown in Fig. 8 is effective when the number of internal registers in the CPU 11 is small, and the region of the RAM 12 can be effectively used. As mentioned above, in the present invention the data in the internal registers in the CPU can be saved to the RAM by using the bit lines, so that the advantage of transferring to the interruption routine in a small number of cycles and of returning from the routine can be obtained. Furthermore, a residual region of the RAM can be used for the stack, and nesting can therefore be arbitrarily carried out without taking into consideration the capacity of the register for stacking.

Claims: A microcomputer having a central processing unit (11) and a random access memory (12); a plurality of internal registers (R₀, R₁, ...) in the central processing unit; a data bus line (BUS), provided between the random access memory and the central processing unit, for transferring data therebetween; and a connection portion (10), provided between the random access memory and said internal registers, for transferring a plurality of data therebetween characterised in that the microcomputer is provided on a single chip; in that the connection portion is provided between the specially extended bit lines (BL, BL ) of the memory cells of the random access memory (12) and the respective bit positions of said registers thus bypassing the column decoder (15); and in that the number of memory cells in each word line of the random access memory (12) is at least equal to the overall number of bits in said internal registers allowing the simultaneous transfer of data between all said internal registers and the memeory cells connected to a selected word line of the random access memory without using the data bus line (BUS). A microcomputer according to claim 1, characterized in that the connecting portion (10) comprises a pair of a write gate (Q₃) and a read gate (S₁) for every bit line (BL, BL ) of the memory (12), one end of the pair being connected to the bit line of the memory, another end of the pair being connected to each of the internal registers having the same number of the bit lines, and the write gate and the read gate being controlled by a write signal (W) and a read signal (r), respectively. A microcomputer according to claim 1, characterised in that the connecting portion (10) comprises a decoder (30a-30d) for n bit lines of the memory, the decoder having inputs connected to the n bit lines of the memory; a respective pair of gates (Ga-Gd) comprising a write gate and a read gate for each output of each decoder, one end of the pair being connected to the output of the decoder, and the other end of the pair being connected to each of the internal registers (R₁-R₄) having one-n'th the number of the bit lines, the write gate and the read gate being controlled by a write signal (W) and a read signal (R), respectively. A microcomputer according to claim 2 or claim 3, characterised in that each pair of gates comprising a write gate and a read gate comprises a first transistor (Q₅) and a second transistor (Q₇) connected in series between a first bit line (BL) and ground, a third transistor (Q₆) and a fourth transistor (Q₈) connected in series between a second bit line ( BL ) and ground, an inverter (S₂) connected between the first bit line (BL) and one terminal of the internal register in the CPU; in that gates of the second and fourth transistors are connected to one terminal and an opposite terminal of the internal register in the CPU (11); in that when data is transferred from the RAM (12) to the CPU, the inverter is turned on so as to apply the potential of the first bit line (BL) to the register; and in that when data is saved from the CPU to the RAM, the first and third transistors are turned on and complemental outputs of the registers are supplied to the gates of the second and fourth transistors.

Inventors: YAMADA, KENJI
Applicants: FUJITSU LIMITED
Application year: 1986
Main classification: G06F9
IPC codes: G06F15, G06F9, G06F7, G06F12