The computers which use Stack based CPU Organization are based on a data structure called stack. Stack is a list of data words. It uses Last In First Out (LIFO) access method which is the most popular access method in most of the CPU. A register is used to store the address of the top most element of the stack which is known as Stack pointer (SP).
The main two operations that are performed on the operators of the stack are Push and Pop. These two operations are performed from one end only.
- Push –
This operation is results in inserting one operand at the top of the stack and it decrease the stack pointer register. The format of the PUSH instruction is:
It inserts the data word at specified address to the top of the stack. It can be implemented as:
//decrement SP by 1 SP <-- SP - 1 //store the content of specified memory address //into SP; i.e, at top of stack SP <-- (memory address)
- Pop –
This operation is results in deleting one operand from the top of the stack and it increase the stack pointer register. The format of the POP instruction is:
It deletes the data word at the top of the stack to the specified address. It can be implemented as:
//transfer the content of SP (i.e, at top most data) //into specified memory location (memory address) <-- SP //increment SP by 1 SP <-- SP + 1
Operation type instruction do not need address field in this CPU organization. This is because the operation is performed on the two operands that are on the top of the stack. For example:
This instruction contains the opcode only with no address field. It pops the two top data from the stack, subtracting the data, and pushing the result into the stack at the top.
PDP-11, Intel’s 8085 and HP 3000 are some of the examples of the stack organized computers.
The advantages of Stack based CPU organization –
- Efficient computation of complex arithmetic expressions.
- Execution of instructions is fast because operand data are stored in consecutive memory locations.
- Length of instruction is short as they do not have address field.
The disadvantages of Stack based CPU organization –
- The size of the program increases.
My Personal Notes arrow_drop_up
- Computer Organization | General Register based CPU Organization
- Single Accumulator based CPU organization
- Computer Organization | RAM vs ROM
- Computer Organization | Basic Computer Instructions
- Computer Organization | BUS Arbitration
- Computer Organization | MPU Communication
- Computer Organization | Subprogram and its characteristics
- Computer Organization | Booth's Algorithm
- Computer Organization | Cache Memory
- Computer Organization | Micro-Operation
- Computer Organization | Register Allocation
- Computer Organization | Amdahl's law and its proof
- Computer Organization | Different Instruction Cycles
- Computer Organization | Von Neumann architecture
- Computer Organization | Memory Banking
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.