Chapter 3 -- Instruction Sets: Addressing Modes and Formats (Part B)
__________________________________________________________________
Addressing Modes
- Simplest form of addressing
- Operand is part of instruction
- Operand = address field
- Example: Add 5 to contents of accumulator
Advantage
|
Disadvantage
|
No memory reference other than the instruction fetch is required to
obtain the operand, thus saving one memory or cache cycle in the instruction
cycle.
|
The size of the number is restricted to the size of the address
field, in most instruction sets, is small compared with the word length.
|
- Address field contains address of operand
- Effective address (EA) = address field (A)
- Example: ADD A
- Limited address space
- Single memory reference to access data
- Memory cell pointed to by address field contains the address of (pointer to) the operand
- EA = (A)
Advantage
|
Disadvantage
|
For a word length of N and address space of 2N is now available
|
Instruction execution requires two memory references to fetch the
operand
|
- Similar to direct addressing
- Operand is held in register named in address field
- EA = R
Advantage
|
Disadvantage
|
- - Only a small address field is needed in the
instruction.
- - No time consuming memory references are
required.
|
- The address space is very limited.
|
- Register Indirect Addressing
- Analogous in indirect addressing
- EA = (R)
- Operand is in memory cell pointed to by contents of register R
- Uses one less memory reference than indirect addressing
- Combines the capabilities of direct addressing and register indirect addressing
- EA = A + (R)
- Operand is implicitly on top of stack
- A stack is a reserved block of locations
- Example: ADD
____________________________________________________
Instruction Formats
- Instruction format defines the layout of bits in an instruction in terms of its basic fields.
- An instruction format must include opcode, implicitly or explicitly with 0 or more operands which is being referenced using the addressing modes.
- The important design issues:-
1) Instruction Length
- If affects and affected by Memory size.
- Programmers would want to design shorter programs. This requires instructions with more opcodes, more operands and more addressing modes. All this requires more memory space.
2) Memory organization
- How the addresses and data are organized in the memory. Usually it will be organized in terms of bytes.
- Data are stored in multiples like 8 bits, 16 bits, 32 bits.
3) Bus structure
- Instruction length should be equal to the memory transfer length which is based on the bus structure. Otherwise instruction might be broken down and lead to data loss.
4) CPU complexity and speed
- Length of the instruction should be designed in a way that the processor can fetch and execute without any delay.
___________________________________________________
Allocation of bits
1) Number of addressing modes
- Different addressing modes requires different number of bits.
- Some addressing modes can be incorporated into the opcode implicitly/hidden.
- Some might need extra bits to determine which type of addressing mode is required.
2) Number of operands
- When more operand is included into an instruction, it results in the instruction getting longer. This means that more bits is required.
3) Register versus memory
- If more registers are used, number of bits required is lesser. This is because registers has limited range compared to memory.
4) Number of register sets
- Most machines have 1 set of general purpose registers which contain 32 or more registers. It can be used to store data and address.
- Some architectures have more than 1 set of general purpose register.
5) Address range
- Different addressing modes require different addressing bits.
6) Address granularity
- When addressing the memory, they are being reference by bytes or words. Byte addressing is more convenient for the programmer because characters are represented in bytes but this kind of fixed sized memory requires more address bits.
________________________________
.THE END.
Done by -- Fatin Adira bt Isa :)
1121116023
_____________________________________________________
|