1. Field of the Invention
The present invention relates to the field of computers and computer processors, and more particularly to a method and means for a more efficient use of a stack within a stack computer processor.
2. Description of the Background Art
Stack machines offer processor complexity that is much lower than that of Complex Instruction Set Computers CISCs, and overall system complexity that is lower than that of either Reduced Instruction Set Computers RISCs or CISC machines. They do this without requiring complicated compilers or cache control hardware for good performance. They also attain competitive raw performance, and superior performance for a given price in most programming environments. Previously, the stacks were kept mostly in program memory; newer stack machines maintain separate memory chips or even an area of on-chip memory for the stacks. These stack machines provide extremely fast subroutine calling capability and superior performance for interrupt handling and task switching.
However, there is no hardware detection of stack overflow or underflow conditions. Stack overflow occurs when there are not a sufficient number of registers available and results continue to be pushed onto the stack, causing the bottom registers to be overwritten. Stack underflow occurs when all registers have been emptied, and continued popping of a stack produces unintentional or incorrect results. Some other stack processors use stack pointers and memory management such that an error condition is flagged when a stack pointer goes out of range of memory allocated for the stack. U.S. Pat. No. 6,367,005, issued to Zahir, et al., discloses a register stack engine, which saves to memory sufficient registers of a register stack to provide more available registers in the event of stack overflow. The register stack engine also delays the microprocessor until the engine can restore an appropriate number of registers in the event of stack underflow.
U.S. patent application Ser. No. 11/503,372 addresses the problem of stack overflow and underflow by replacing a conventional stack by an array of registers which function in a circular, repeating pattern. This circular, repeating pattern is accomplished through utilization of an associated bi-directional shift register which contains a plurality of one bit shift registers electrically interconnected in an alternating pattern. This configuration prevents reading from outside of the stack, and prevents reading an unintended empty register value. While the above-described method did effect the improvement of enabling a circular stack to prevent the overflow and underflow, that method was less than ideal if more than one bit is set to a ‘1’ because of single event upset, where the bits of the shift registers are corrupted by the radiation. If more than one of the bits of the shift registers is set to ‘1’, the successive operations will receive corrupted data or may not able to perform the required operations and can enter an unknown state. The above method also fails to operate if all the bits of the bidirectional shift register is set to ‘0’ and enters an unknown state. Thus, there is a need for a robust system that is operational in case of single event upset and yet able to eliminate overflow and underflow within a stack.
The present invention provides a method and apparatus for eliminating the stack overflow and underflow in a dual stack computer while remaining fully operational in case of single event upset caused by radiation. More importantly, the present invention provides a method and apparatus for eliminating stack overflow and underflow by replacing a conventional stack with a circular stack array which is coupled to a plurality of multiplexers to function in a circular repeating pattern. This circular repeating pattern is accomplished through utilization of a plurality of multiplexers which, on receiving control signals from the decode logic, shifts the data up or down in the data stack registers and return stack registers. This configuration prevents reading from outside of the stack, and prevents reading an unintended empty register value.
Each multiplexer in the data stack and return stack provides input to one stack register of the circular stack array, while accepting inputs from a proceeding and a succeeding stack register of the circular array. The multiplexer shifts the data by providing data of the preceding or succeeding stack register as the input to the stack register. On receiving the active pop signal, multiplexer provides input of the succeeding stack register as the input to the stack register thus shifting data up in the data stack and the data of the top stack register is written to the bottom stack register in the circular array to avoid underflow. On the other hand, if an active push signal is received, multiplexer provides input of the preceding stack register as the input to the stack register, thus shifting data down in the data stack and the return stack and the data of the bottom stack register is written over to avoid overflow.
The present invention also provides a method and apparatus for the stack to remain operational in the event of single event upset by using one hot logic multiplexers. The one hot logic multiplexer only performs an operation if only one of the push or pop control signals is active. Thus, in case of single event upset, where the logic state of the control signals can be corrupted such that at a given time both the push or pop control signals are active, the multiplexers will not shift the data either upward or downward in the data stack and the return stack and prevents the processor system from entering into an unknown state.
a and 6b are a method of operation in a circular data stack registers on receiving push and pull control signals; and,
a and 7b are a method of operation in a circular return stack registers on receiving push and pull control signals.
This embodiment also includes of logic circuitry which includes a plurality of multiplexers 205a through 205h that provide data to the 18-bit data stack registers S1 through S8145C based on the control signals control signals to the multiplexers and stack registers will be explained in detail in
This embodiment also includes logic circuitry, which includes a plurality of multiplexers 305a through 305h that provide data to the 18-bit return stack registers R1 through R8 based on the control signals control signals to the multiplexers and stack registers are explained in detail in
The multiplexer 205a providing data 215a to the 18-bit data stack registers S1 is coupled with the output 210s of the 18-bit S register 145B and output 210b of the successive-bit data stack registers S2. Multiplexer 205a provides the 18-bit data stack registers S1 either data output 210s of the 18-bit S register or output 210b of the successive 18-bit data stack registers S2 as input 215a depending on if the push control signal 415 or the pop control signal 410 is active. If an active push control signal 415 is received, the multiplexer 205a provides data 210s from the 18-bit S register 145B as the input 215a to the 18-bit data stack register S1. If an active pop control signal 410 is received, the multiplexer 205a provides data 210b from the successive 18-bit stack register S2 as the input 215a to the 18-bit data stack registers S1. In one embodiment, multiplexers 205a through 205h and multiplexers 305a through 305h are all implemented using one hot logic methodology, wherein only one of the control inputs can be active at any given point. No data operations are performed if both push 415 and pop 410 control signals are active or inactive at the same time.
a illustrates one embodiment of a method of shifting data to avoid overflow when decode logic section 150 detects a push instruction to be performed on the data stack 140. The decode logic section 150 sends an active push control signal 415 to the multiplexers 205a through 205h. A ten cell deep push down stack is formed by the 18-bit T register 145A, 18-bit S register 145B and 18-bit data stack registers S1 through S8. The new data to be pushed is written to the 18-bit T register 145A, the data from the 18-bit T register 145A is written to 18-bit S register 145B and the data of the 18-bit S register 145B is shifted down to the 18-bit data stack register S1 and the data from the 18-bit data stack registers S2 through S8145C is shifted down to the 18-bit data stack registers S2 through S8145C on receiving the active push control signal 415. The data that was previously present in the data stack registers will be shifted down in the following fashion T→S→S1→S2→S3→S4→S5→S6→S7→S8 and the data in the S8 register are lost as shown in
b illustrates one embodiment of a method of shifting data to avoid underflow when decode logic section 150 detects a pop instruction to be performed on the data stack 140. The decode logic section 150 provides an active pop signal 410 to the multiplexers 205a through 205h. A ten cell deep pop up stack is formed by the registers T 145A, S 145B, and S1 through S8, and on receiving an active pop signal 140, the data from the 18-bit data stack registers S1 through S8 will be shifted up and the data from S1 register will be copied to the S8 register. The data will be shifted up in the following fashion S8→S7→S6→S5→S4→S3→S2→S1→S→T and data in S1 register is copied to S8 register as shown in
a illustrates one embodiment of a method of shifting data to avoid overflow when decode logic section 150 detects a push instruction to be performed on the return stack. The decode logic section 150 provides an active push signal to the multiplexers 305a through 305h. A ten cell deep push down stack is formed by the registers R 125A, and R1 through R8 and on receiving an active control input push signal, the new data will be written to the top register, in this case 18-bit R register 125A and the data stored in 18-bit return stack registers R1 through R8 will be shifted down to the 18-bit return stack registers R2 through R8. The data that was previously present in the stack registers will be shifted down in the following fashion R→R1→R2→R3→R4→R5→R6→R7→R8 and the data in the R8 register is lost as shown in
b illustrates one embodiment of a method of shifting data to avoid underflow when decode logic section 150 detects a pop instruction to be performed on the return stack 120. The decode logic section 150 provides an active pop control signal 410 to the multiplexers 305a through 305h. A ten cell deep pop up stack is formed by the registers R, and R1 through R8 and on receiving an active pop signal 410 then the data from the registers will be shifted up and the data from R1 register 2109 will be copied to the R8 register 21016. The data will be shifted up in the following fashion R8→R7→R6→R5→R4→R3→R2→R1→R and data in R1 is copied to R8 stack register as shown in
It will be apparent to those familiar with the art that in yet an alternate embodiment, the hardware portion that is the smallest repeated element of array 16 on chip 14 may have a form that is different from a dual-stack computer with RAM and ROM memory, without departing from the spirit and scope of the invention. This invention is described with reference to the Figures, in which like numbers represent the same or similar elements. While this invention is described in terms of modes for achieving this invention's objectives, it will be appreciated by those skilled in the art that variations may be accomplished in view of these teachings without deviating from the spirit or scope of the presently claimed invention.
The embodiments and variations of the invention described herein, and/or shown in the drawings, are presented by way of example only and are not limiting as to the scope of the invention. Unless otherwise specifically stated, individual aspects and components of the invention may be omitted or modified for a variety of applications while remaining within the spirit and scope of the claimed invention, since it is intended that the present invention is adaptable to many variations.
The inventive computers 100, stacks 120, 130, and 145A-C and method of
As discussed previously herein, the applicability of the present invention is such that the sharing of information and resources between the computers in an array is greatly enhanced, both in speed a versatility. Also, communications between a computer array and other devices is enhanced according to the described method and means.
Since computers 100, stacks 120, 130, and 145A-C and method of