Lecture 1.2.3 (Instruction Types, Addressing Modes)
Lecture 1.2.3 (Instruction Types, Addressing Modes)
ASSISTANT PROFESSOR
BE-CSE
INSTRUCTION TYPES
Advantages
1. Faster Execution: Registers are faster to access than memory.
2. Reduced Memory Bottleneck: Fewer memory accesses reduce overall processing
time.
3. Compact Instruction Encoding: Register operations typically use shorter
instruction formats.
Disadvantages
These instructions require interaction with the memory unit, making them slower
than register reference instructions due to the additional time required for memory
access.
Instruction Format: Typically include a memory address or a mechanism
to compute one (e.g., direct, indirect addressing).
Primary Operations:
oReading data from memory.
oWriting data to memory.
oPerforming operations where one or more operands are in memory.
Opcode=000 through 110
In Memory-reference instruction, 12 bits of memory is used to specify an address
and one bit to specify the addressing mode 'I'.
Advantages
1. Flexibility: Allow operations involving large datasets that cannot fit in registers.
2. Support Complex Operations: Useful for working with arrays, structures, and
dynamic data.
Disadvantages
Instruction Format
1. Implied Mode: In this mode the operands are specified implicitly in the definition
of the instruction. For example, the instruction "complement accumulator" is an
implied- mode instruction because the operand in the accumulator register is
implied in the definition of the instruction. In fact, all register reference
instructions that use an accumulator are implied-mode instructions.
4. Register Indirect Mode: In the register indirect mode, the instruction available to
us defines that particular register in the CPU whose contents provides the
operand’s address in the memory. In simpler words, any selected register would
include the address of an operand instead of the operand itself.
The reference to a register is equivalent to specifying any memory address. The pros of
using this type of instruction are that an instruction’s address field would make use of
fewer bits to select a register than would be require when someone wants to directly
specify a memory address.
5. Autoincrement or Autodecrement Mode: The Autodecrement or
Autoincrement mode is very similar to the register indirect mode. The only
exception is that the register is decremented or incremented before or after its
value is used to access memory. When the address stored in the register defines a
data table in memory, it is very crucial to decrement or increment the register
after accessing the table every time. It can be obtained using the decrement
or increment instruction.
6. Direct Address Mode: In the direct address mode, the address part of the
instruction is equal to the effective address. The operand would reside in memory,
and the address here is given directly by the instruction’s address field. The
address field would specify the actual branch address in a branch-type instruction.
7. Indirect Address Mode: In an indirect address mode, the address field of an
available instruction gives that address in which the effective address gets stored
in memory. The control fetches the instruction available in the memory and then
uses its address part in order to (again) access memory to read its effective
address.
The CPU register used in the computation may be the program counter, an
index register, or a base register. In either case we have a different addressing mode
which is used for a different application.
9. Relative Address Mode: In relative addressing mode, the Effective Address (EA)
of the operand is calculated by adding the content of the CPU register to the address
part of the instruction word. Essentially, the effective address is the sum of the
displacement (the immediate value specified in the instruction) and the value of the
register. The address part of the given instruction is typically a signed number, which
can be either negative or positive. The resultant effective address is relative to the
address of the next instruction.
EA = Displacement + CPU Register
Here's a symbolic representation of relative addressing mode: X(PC)
The effective address for it can be calculated as follows: EA = X + (PC)
Because the operand addresses in this mode are found relative to the program
counter, it's referred to as the relative address mode.
Numerical Example for Addressing Mode
References
Reference Books:
J.P. Hayes, “Computer Architecture and Organization”, Third Edition.
Mano, M., “Computer System Architecture”, Third Edition, Prentice Hall.
Stallings, W., “Computer Organization and Architecture”, Eighth Edition,
Pearson Education.
Text Books:
Carpinelli J.D,” Computer systems organization &Architecture”, Fourth
Edition, Addison Wesley.
Patterson and Hennessy, “Computer Architecture”, Fifth Edition Morgaon
Kauffman.
Reference Website
https://www.studytonight.com/computer-architecture/addressingmodes-instruc
tioncycle
http://www.eie.polyu.edu.hk/~enyhchan/addrmode.pdf
Video References
https://www.youtube.com/watch?v=ol_g3Lt66xA
https://www.youtube.com/watch?v=_CH4cm5PhK8