Industrial Training




Stack Architecture

These machines are Zero address machines and their operands are taken from top of the stack implicitly. The ALU of such machine directly references a stack which can be implemented in main memory or registers or both. These machine contains instructions like PUSH and POP to load a value, on stack and store a value in the memory respectively. Please note that PUSH, POP are not zero address instructions but contain one address.



The main advantages of such an architecture are:

  • very short instructions
  • since stacks are normally made within CPU in such an architecture machine, the operands are close to the ALU, thus fast execution of instructions.
  • excellent support for subroutines.


While, the main disadvantages of this architecture are:

  • not very general in nature, in comparison to other architectures.
  • difficult to program for applications like text and string processing.


One example of such a machine is Burroughs B6700. However, these machines are not very common today because of the general nature of machines desired. The stack machines uses Polish notations for evaluation of arithmetic expression. Polish notation was introduced by a Polish logician Jan Lukasiewicz. The main theme of this notation is that an arithmetic expression AxB can be expressed as:



either     xAB      (Prefix notation)

or           ABx     (Suffix or reverse polish notation)



In stacks we use suffix or reverse polish notation for evaluating expression. The rule here is to push all the variable values on the top of stack and do the operation with the top elements of stack as an operand is encountered. The priority of operand is kept in mind for generation of reverse polish notation. For example, an expression AxB+CxD/E will be represented in reverse polish notation as:



AB x CD x E/+

Thus, the execution program for evaluation of F = AxB+CxD/E will be:

PUSH A /Transfer the value of A on to the top of stack/
PUSH B /Transfer the value of B on to the top of stack/
MULT /Multiply. It will remove value of A and B from the stack and multiply A x B/
PUSH C /Transfer C on the top of stack/
PUSH D /Transfer D on the top of stack/
MULT Remove values of C & D from the stack and multiply C x D/
PUSH E /Transfer E on the top of stack/
DIVM /C x D/E /
ADD /Add the top two values on the stack/
POP F /Transfer the results back to memory location F/


Sample program for evaluating AxB+CxD/E using zero address Instructions

Please note that PUSH and POP are not zero-address instructions.

The execution of the above program using stack is represented diagrammatically in



Stack Architecture-1

Hi I am Pluto.