STACK FOR A DATA PROCESSOR

Abstract: A stack (30) is provided in a pipelined data processor having a plurality of control registers including a fetch control register and an execution control register associated with respective stages of the processor. The stack comprises a memory stack (303), an address register (304), and a counter-register (302) interposed between the memory stack and the control registers of the data processor. In order to speed up operation of the stack, the counterregister (302) is always made to store the latest entry into the memory stack (303), that is the top of the stack, such that the latest entry into the stack (303) is immediately available to the control registers of the data processor thereby eliminating a memory access to the stack (303).

Description: STACK FOR A DATA PROCESSOR Technical Field This invention relates to a stack for a data processor for storing a return address to a main program whenever a subroutine or loop is executed. The inven¬ tion is concerned in particular with a stack for a data processor having a plurality of stages through which each microinstruction passes, said plurality of stages including a fetch stage, an interpret stage, and an execute stage. Such a processor is known, and is termed a pipelined processor and hereinafter will be referred to as a data processor of the kind specified. Background Art In existing digital computer systems, stacks have been utilized for storing information in an auto¬ mated, orderly manner to aid in reducing the time re¬ quired to perform some of the various operations of a digital computer, for example the execution of a sub¬ routine wherein the stack stores the return address to the main program. For example, U.S. Patent No. 3,396,371 discloses a stack or push-down memory com¬ prising a combination of a delay line and registers/ counters through which data is continuously circulated. The first memory position forms an instruction counter which holds the address of the instruction currently being executed. A branch or a jump instruction causes the address portion of the instruction to be stored in the first memory position, the return point of the main program (i.e., the current value in the instruction counter plus one) being pushed-down. A return instruc¬ tion executed by the subroutine causes the return address of the main program to be pushed-up to the first memory position. A disadvantage of the above described stack when envisaged for use with a data processor of the kind specified is that the memory access time of the stack is relatively long as compared with the very fast operation of a pipelined data processor. Disclosure of the Invention It is an object of the present invention to provide a stack for a data processor of the kind speci¬ fied having memory access operations which are fast as compared with the prior art described above. The present invention provides a data proces¬ sor of the kind specified characterized by a plurality of control registers including a fetch control register and an execution control register, each of said plural¬ ity of control registers associated with a correspond¬ ing one of the plurality of stages of the data processor, said plurality of control registers being connected in a fashion for receiving a control store address such that said control store address follows an associated micro¬ instruction through each of the plurality of stages of the data processor, and a stack comprising means for storing a plurality of information units, counter means controlled by a plurality of input control signals for address generation, operatively connected to said means for storing for addressing said means for storing, and register means operatively connected to said means for storing, operatively connected to said execution control register, and operatively connected to said fetch control register, for storing the latest infor¬ mation unit inputted to said means for storing, thereby making the latest information unit immediately avail¬ able to said fetch control register. In a memory access operation, for example when executing a return instruction from a subroutine, said register means, which stores the latest information unit inputted to the stack, makes the information unit therein immediately available to said fetch control register, thereby saving the time required to access said means for storing a plurality of information units. - J_ _ Brief Description of the Drawings A preferred embodiment of the invention will now be described with reference to the accompanying drawings, wherein: Fig. 1 is a block diagram of a data processor of the kind specified which incorporates a stack accord¬ ing to the invention; Fig. 2 is a block diagram of the stack; Fig. 3 is a sample microinstruction main pro- gram and associated subroutines; and Fig. 4A-D shows the contents of the stack at various points in the execution of the sample micro¬ instructions of Fig. 3. Best Mode for Carrying Out the Present Invention Fig. 1 shows, in simplified block form, a pro¬ cessor 10 of the kind specified which has incorporated therein a stack according to the present invention. The processor 10 has a so-called pipeline architecture and includes a FETCH stage, an INTERPRET stage and an EXECUTE stage. The FETCH stage includes a control store 12 that stores a plurality of microinstructions used by the processor during the execution of a computer pro¬ gram. The INTERPRET stage includes an instruction register (IR) 14 and suitable decoding circuitry (not shown since decoders are well known by those skilled in the art and not necessary for an understanding of the invention) for interpreting and decoding each micro¬ instruction provided by the FETCH stage. The EXECUTE stage includes an arithmetic and logic unit (ALU) 16, a register storage unit (RSU) 20, an execution register (ER) 22, and other circuitry for performing any arith¬ metic or logic operations necessary to execute each microinstruction interpreted by the INTERPRET stage. The register storage unit 20 contains a plurality of registers which interfaces with the various execute units of the processor 10, such as ALU 16. A control register (CRF) 18 is associated with the FETCH stage. The control register 18 holds a control store address and provides that control store address to the control store 12 in order to access each microinstruction to be executed by the processor 10 or to access data to be transferred to RSU 20. The processor 10 as described thus far is conventional. In order to diagnose operational errors in the processor 10, additional diagnostic circuitry is provided. The additional diagnostic circuitry, discussed only to the extent necessary for an understanding of the present invention, includes an INTERPRET control register (CRI) 26, and an EXECUTE control register (CRX) 28. The control registers CRI 26 and CRX 28 are connected for receiving, in a sequential fashion, each control store address from the control register CRF 18 such that each control store address follows its associated micro¬ instruction through each of the stages in the processor 10. Accordingly, the control register CRI 26 stores the control store address of the microinstruction passing through the INTERPRET stage of the processor 10, and the control register CRX 28 stores the same control store address when that microinstruction reaches the EXECUTE stage. The present invention finds use in a micro¬ programmed general purpose computer for providing a return address whenever a subroutine or loop is executed. Still referring to Fig. 1, the -inclusion of a jump return stack (JRS) 30 in the processor 10 is shown. The input of the JRS 30 is operatively connected to the control register CRX 28 via connection 32, an adder 40 forming part of the connection 32, and the output of the JRS 30 being coupled to MUXs 11, 36 via connection 34. When a jump is to be executed, the JRS 30 receives the address of the jump instruction from CRX 28 via connection 32 incremented by one by adder 40 yielding a return address. The return address is stored in JRS 30 until a return instruction is executed, whereupon the return address is transmitted to the CRF 18 via connec¬ tion 34 and multiplexer 11. It is recognized by those skilled in the art, that there may exist in processor 10, the multiplexer (MUX) 11 and the plurality of inputs to MUX 11 from various parts of the processor 10 for loading CRF 18, such as from a bootstrap or loader section, and these are not discussed further herein. A multiplexer (MUX) 36.permits the JRS 30 to transfer data into RSU 20 via register 38. The JRS 30 can store base addresses of tables stored in CS 12. These addresses can be loaded into CRF 18 without popping the JRS 30, thereby allowing the data transfer into RSU 20. This operation will be described further hereinunder. Fig. 2 shows a block diagram of JRS 30. A 2/1 MUX 301 receives data from the CRX 28 via the input line denoted DATA IN, or from the output of a register file 303 ( D 0ϋT )« The output of MUX 301 is transmitted to a counter/ register 302 which can hold, increment, or load the inputted data in response to the applicable control signals. The output of connecter/register 302 is oper¬ atively connected to MUXs 11, 36 for inputting data into the fetch control register 18, or the RSU 20, respec¬ tively. The output of the counter/register 302 is also operatively connected to register file 303 (D TN ) • The register file 303, which forms the memory stack, is a storage device for storing a plurality of information units, a unit comprising a computer word, a number of bytes or bits constituting a single data quantity, etc. In the preferred embodiment, the register file 303 is a 16 x 16-bit RAM for storing sixteen bit addresses of control store 12. The register file 303 is accessed by address counter 304. The operation of the JRS 30 will now be des- cribed with the aid of Figs. 3 and 4. The computer execution of a macro-program instruction invokes the operation' of a series of microinstructions referred to as a main program. For purposes of illustration, the microinstructions being invoked reside at a starting location (LOC) of 100 in control store 12. INST1, INST2, INST3, are representative microinstructions and are executed in a normal fashion by processor 10. (Note the microinstructions of Fig. 3 are denoted INSTX for simplicity without including the details of operation code, operands, etc.). At location 103 a jump to sub¬ routine 1 (SUBRTNl) is executed bringing the action of the JRS 30 into play. The execution of a jump instruc¬ tion causes a transfer out of CRX 28, and initiates a PUSH control signal which starts a push operation. The push operation causes MUX 301 to select the DATA IN in¬ put, which has a value of 104, the address of the jump instruction (LOC 103) presently stored in CRX 28 plus one, the addition being performed by adder 40, and which is loaded into counter/register 302. Address counter 304 supplies two addresses to register file 303, a write address 2 . and a read address h- . Initially _,. is set to zero and A R is set to minus one. A_ is always equal to A., minus one. The push operation proceeds by writing the contents of the counter/register 302 into the loca¬ tion of the register file 303- specified by the write address counter A-_. In the example, the quantity 104 is written into location 0. The return address of the jump, the quantity 104, is also retained in counter/ register 302. Finally, the address counter is increment¬ ed such that A„ equals 1 and A_ equals 0. Fig. 4A shows the initial contents of the counter/register 302, the register file 303, and the address counter 304. Fig. 4B shows the contents of the JRS 30 after the first push operation is completed. Likewise, if a jump instruction is executed within SUBRTNl before returning to the main program, the address of the jump instruction within the subroutine is written into the location of the register file 30 " 3 specified by A„ of address counter 304 and the address O PI is retained in counter/register 302. In this manner, the latest entry into register file 303 is also con¬ tained in counter/register 302. When the jump instruc¬ tion of SUBRTNl is completed, the contents of JRS 30 will be as shown in Fig. 4C. When a subroutine executes a return instruction a POP control signal is generated which initiates the pop operation. Since the counter/register 302 contains the entry address into SUBRTNl, the return to SUBRTNl from SUBRTN2 can begin immediately without having to make a memory access to the register file 303. The return address is outputted immediately to CRF 18 or RSU 20 allowing entry back to the correct point in SUBRTNl. While the return is being executed, register file 303 is read utilizing A -EX of address counter 304, which loads counter/register 302 with the contents of the now latest entry in the register file 303. Finally the pop opera¬ tion causes the address counter 304 to decrement by one. The contents of the JRS 30 after the pop operation is as shown in Fig. 4D. In a similar fashion, the return instruction of SUBRTNl causes the return to the main program at the proper entry point. The push and pop operation as described above always causes the counter/ register 302 to contain the latest entry into the regis- ter file 303. The latest entry into the register file 303 is sometimes referred to as the top of stack (TOS). Reading the counter/register 302 effectively reads the TOS (i.e., the next address to be used for a return instruction), thereby speeding up the pop operation since no memory access is required for the return. The memory access for loading the counter/register 302 overlaps other computer operations. In order to load RSU 20 with data stored in a table arrangement in CS 12, the base address of the table is initially loaded into counter/register 302. This address is then loaded into control register CRF 18 via MUX 11 and the first CS 12 read initiated. The counter/register 302, which initially contains the base address of the table, is incremented during the CS 12 read by the INCREMENT control signal without a pop operation of the JRS 30. The contents of the counter/ register 302, which now contains the next address of data within the table, is again loaded into control register CRF 18 such that the next data quantity of the table may be read from CS 12. The RSU 20 load operation repeats under processor 10 control until the entire data table is read from CS 12. The address counter 304 generates an OVERFLOW signal when a push operation is attempted and the regis¬ ter file 303 is full. Likewise, the address counter 304 generates an UNDERFLOW signal when a pop operation is attempted and the JRS 30 is empty. While there has been shown what is considered to be the preferred embodiment of the invention, it will be manifest that many changes and modifications can be made therein without departing from the essential spirit and scope of the invention. It is intended, therefore, in the annexed claims, to cover all such changes and modifications which fall within the true scope of the invention. OM

Claims: CLAIMS : 1. A data processor of the kind specified (10) characterized by a plurality of control registers (18, 26, 28) including a fetch control register (18) and an execution control register (28), each of said plurality of control registers (18, 26, 28) associated with a corresponding one of the plurality of stages of the data processor, said plurality of control registers (18, 26, 28) being connected in a fashion for receiving a control store address such that said control store address follows an associated microinstruction through each of the plurality- of stages of the data processor, and a stack (30) comprising means for storing (303) a plurality of information units, counter means (304), controlled by a plurality of input control signals (PUSH, POP) for address generation, operatively connec¬ ted to said means for storing (303) for addressing said means for storing (303), and register means (301, 302) operatively connected to said means for storing (303), operatively connected to said execution control regis- ter (28), and operatively connected to said fetch control register (18), for storing the latest infor¬ mation unit inputted to said means for storing (303), thereby making the latest information unit immediately available to said fetch control register (18). 2. A data processor according to claim 1, characterized in that said means for storing (303) com¬ prises a RAM operated on a last in-first out basis for storing a plurality of information units. 3. A data processor according to claim 1, characterized in that said register means (301, 302) comprises a multiplexer (301) having a first and second input, said first input being operatively connected to an output of said means for storing (303) and said second 3. ( concluded ) input being operatively connected to said execution control register (28), and a counter/register (302), operatively connected to said multiplexer (301) for re¬ ceiving said latest information unit, and operatively connected to said means (303) for transmitting said latest information unit to be stored in said means (303), and further operatively connected to said fetch control register (18) for restoring said latest information units to the fetch control register. 4. A data processor according to claim 1, characterized in that said counter means (304) comprises a first counter, operatively connected to said means for storing (303) and controlled by a plurality of input control signals, for addressing said means for storing (303) when a read of said means for storing (303) is commanded by one of said plurality of input control signals, and a second counter, operatively connected to said means for storing (303) and controlled by said plurality of input control signals, for addres¬ sing said means for storing (303) when a write into said means for storing is commanded by one of said plurality of input control signals. 5. A data processor according to claim 3 characterized in that said counter/register is further responsive to a control signal (INCREMENT) wherein said information unit is stored. 6. A data processor according to claim 1 characterized in that the plurality of stages of the data processor includes an execute stage having a plurality of execute registers (22), wherein said register means (302) is operatively connected to said plurality of execute registers (22). -iTϋB-S OIV--PI - 11 - 7. A data processor according to any pre¬ ceding claim, characterized in that said operative connection between said register means (301, 302) and said execution control register (28) includes an adder (40).

Inventors: ARMSTRONG ROLFE D
Applicants: NCR CO, NCR CORP
Application year: 1981
Main classification: G06F9
IPC codes: G06F9