Lec-6 Addressing Modes
Lec-6 Addressing Modes
Stack Organization
A stack is a data storage structure in which the most recent thing deposited is the most recent item retrieved.
It is based on the LIFO concept (Last-in-first-out). The stack is a collection of memory locations containing a
register that stores the top-of-element address in digital computers.
Stack's operations are:
Push: Adds an item to the top of the stack
Pop: Removes one item from the stack's top
The Last In First Out (LIFO) list is another name for stack. It is the CPU's most crucial feature. It saves information so
that the last element saved is retrieved first. A memory space with an address register is called a stack. This register,
known as the Stack Pointer, affects the stack's address (SP). The address of the element at the top of the stack is
continuously influenced by the stack pointer.
Implementation of Stack
The stack can be implemented using two ways:
Register Stack
Memory Stack
Register Stack
A stack of memory words or registers may be placed on top of each other. Consider a 64-word register stack like the
one shown in the diagram. A binary number, which is the address of the element at the top of the stack, is stored in the
stack pointer register.
Memory Stack
A stack may be implemented in a computer's random access memory (RAM). A stack is implemented in the CPU by
allocating a chunk of memory to a stack operation and utilizing a processor register as a stack pointer. The stack pointer
is a CPU register that specifies the stack's initial memory address.
Advantages of Stack Organization
Complex arithmetic statements may be rapidly calculated
Instruction execution is rapid because operand data is stored in consecutive memory areas
The instructions are minimal since they don't contain an address field
Disadvantages of Stack Organization
The size of the program increases when we use a stack
It's in memory, and memory is slower in several ways than CPU registers. It generally has a lesser bandwidth
and a longer latency. Memory accesses are more difficult to accelerate.
Addressing Mode
Addressing modes in computer architecture plays a vital role in enabling efficient and flexible
memory access and operand manipulation. Addressing modes define the rules and mechanisms
by which the processor calculates the effective memory address or operand location for data
operations. By understanding the different addressing modes available, programmers and system
designers can optimize memory utilization and enhance overall performance.
Addressing modes in computer architecture refer to the techniques and rules used by processors
to calculate the effective memory address or operand location for data operations. They define
how instructions specify the source or destination of data within the system’s memory or
registers. Addressing modes play a crucial role in determining the efficiency and flexibility of
memory access and operand manipulation.
Each addressing mode has its own set of rules and mechanisms, allowing programmers to
optimize memory utilization and enhance overall system performance. Common addressing
modes include immediate addressing, register addressing, direct addressing, indirect addressing,
indexed addressing, base+offset addressing, and stack addressing, among others.
Example:
There are two types of addressing modes for 8086 instructions:
1) Addressing modes for data
2) Addressing modes for branch