Memory Stack Organization

1. From where does the data item are getting stored in the stack?

By using the memory write operation, the data item from the data register gets inserted into the top of the stack.

2. What does Program Counter do?

It points to the address of the next instruction which is going to execute in the program.

3. In memory stack organization, does the stack pointer grow only by decreasing the memory address?

No, It totally depends upon the organization of the stack whether the stack pointer grows by decreasing or increasing the memory address.


Memory Stack Organization in Computer Architecture

A stack is a storage device in which the information or item stored last is retrieved first. Basically, a computer system follows a memory stack organization, and here we will look at how it works.

A portion of memory is assigned to a stack operation to implement the stack in the CPU. Here the processor register is used as a Stack Pointer (SP). The above figure shows the portion of computer memory divided into three segments: Program Instructions, Data, and Stack.

  • Program Counter (PC): It is a register that points to the address of the next instruction that is going to be executed in the program.
  • Address Register (AR): This register points at the collection of data and is used during the execute phase to read an operand.
  • Stack Pointer (SP): It points at the top of the stack and is used to push or pop the data items in or from the stack.

As we can see in the figure, these three registers are connected to a common address bus and either one of them can provide an address for memory.

Stack Pointer is first going to point at the address 3001, and then the stack will grow with the decreasing addresses. It means that the first item is going to be stored at address 3001, the second item at address 3000, and the items can keep getting stored in the stack until it reaches the last address 2000 where the last item will be held.

Here the data which is getting inserted into the Stack is obtained from the Data Register and the data retrieved from the Stack is also read by the Data Register.

Now, let’s see the working of PUSH and POP operations in Memory Stack Organization.

Similar Reads

PUSH

This operation is used to insert a new data item into the top of the Stack. The new item can be inserted as follows:-...

POP

This operation is used to delete a data item from the top of the Stack. Data item can be deleted as follows:-...

FAQs on Memory Stack Organization

1. From where does the data item are getting stored in the stack?...