Computer Instructions: Locations of Data

The CPU may store data in various places:

  1. Accumulator architecture: the accumulator register AC always implicitely participates in an operation. For instance, ADD R1 adds the contents of R1 to AC, LOD X copy the contents of X to AC, etc.
  2. Stack architecture: operands and data is found inside the stack, which is a LIFO data stucture stored in main memory. This architecture features a great number of calls to the POP and PUSH instructions to extract and put data inside the stack and use that data for calculations. For instance, POP R1 pops a number from the top of the stack and pastes it into R1, ADD R1 pops a number from the top of the stack and adds it to R1, etc.
  3. General-purpose register architecture (GPR): data is located in various general-purpose registers, so we are not limited to only an accumulator or a stack. This is the most common type of architecture, and can further be classified as:
    1. Memory-Memory architecture: all the operands are memory variables, e.g., X, VAR, etc.
    2. Register-register architecture: all the operands must be stored inside registers, e.g., R1, AC, etc.
    3. Register-Memory architecture: some operands are memory variables, while others are registers.