0% found this document useful (0 votes)
21 views3 pages

Lec-6 Addressing Modes

The document discusses stack organization and addressing modes in computer architecture. It explains the stack's LIFO structure, operations (push and pop), and implementation methods (register and memory stacks), along with their advantages and disadvantages. Additionally, it details various addressing modes used by processors, particularly in the 8086 microprocessor, highlighting their significance in memory access and operand manipulation.

Uploaded by

rewej10831
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views3 pages

Lec-6 Addressing Modes

The document discusses stack organization and addressing modes in computer architecture. It explains the stack's LIFO structure, operations (push and pop), and implementation methods (register and memory stacks), along with their advantages and disadvantages. Additionally, it details various addressing modes used by processors, particularly in the 8086 microprocessor, highlighting their significance in memory access and operand manipulation.

Uploaded by

rewej10831
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Stack Organization and 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

Starting address of memory segment.

• Effective address or Offset: An offset is determined by adding any combination of three


address elements: displacement, base and index.
• Displacement: It is an 8 bit or 16 bit immediate value given in the instruction.
• Base: Contents of base register, BX or BP.
• Index: Content of index register SI or DI.
The 8086 microprocessor uses a variety of addressing modes depending on how an
operand is specified.
Addressing modes used by 8086 microprocessor are discussed below:
Implied mode: The operand is mentioned in the instruction itself in inferred addressing. Data is
a component of instructions in this mode and might be 8 bits or 16 bits long. Insinuated
addressing is used in the construction of zero address instructions.
Example: CLC (used to reset Carry flag to 0)
Immediate addressing mode (symbol #): Data is present in the instruction’s address field in
this manner. Like a single format for address instructions.
Example: MOV AL, 35H (move the data 35H into AL register)
• Register mode: The operand is put in either an 8 bit or 16 bit general purpose register
when using register addressing. The instruction’s designated register for the data is
present.
• Here one register reference is required to access the data.
Example: MOV AX,CX (move the contents of CX register to AX register)
• Register Indirect mode: According to the instruction, the operand’s offset is put in any
one of the registers BX, BP, SI, or DI in this addressing. The base register or an index
register that the instruction specifies is where the data’s actual address is located.
Here two register references are required to access the data.
Using the register indirect addressing modes, the 8086 CPUs enable indirect memory access via
a register.
Example: MOV AX, [BX](move the contents of memory location s
addressed by the register BX to the register AX)
Direct addressing/ Absolute addressing Mode (symbol [ ]): The operand’s offset is given in
the instruction as an 8 bit or 16 bit displacement element. In this addressing mode the 16 bit
effective address of the data is the part of the instruction.
Here only one memory reference operation is required to access the data.
Example: ADD AL,[0301] //add the contents of offset address 0301 to AL
• Indirect addressing Mode (symbol @ or () ): In this mode address field of instruction
contains the address of effective address. Here two references are required.
1st reference to get effective address.
2nd reference to access the data.
Based on the availability of Effective address, Indirect mode is of two kind:
1. Register Indirect: In this method, the register holds the effective address, while the
address field of an instruction maintains the name of the relevant register. In this case,
one memory reference and one register reference are needed to access the data.
2. Memory Indirect: In this mode, the instruction’s address field will always preserve the
associated memory address even while the effective address is in the memory. Here,
accessing the data requires two memory references.
• Indexed addressing mode: The content of an index register SI or DI and an 8 bit or 16
bit displacement are added to determine the operand’s offset.
Example:MOV AX, [SI +05]
• Based Indexed Addressing: The content of a base register (BX or BP) and an index
register (SI or DI) are added to determine the operand’s offset.
Example: ADD AX, [BX+SI]
Based on Transfer of control, addressing modes are:
• PC relative addressing mode: PC relative addressing mode is used to implement intra
segment transfer of control, In this mode effective address is obtained by adding
displacement to PC.
• Base register addressing mode: Base register addressing mode is used to implement
inter segment transfer of control.In this mode effective address is obtained by adding base
register value to address field value.
Advantages of Addressing Modes
1. The provision of programming tools like Pointers, counters for loop controllers, data
indexing, and program relocation.
2. To decrease the number of bits in the instruction’s addressing field.

You might also like