Pre-study- Instruction sets, Addressing Modes Flashcards
An ISA is defined as the design of a computer from the ___________ Perspective.
Programmer’s
ISA include 3 types of MIPS instructions
Arithmetic/ Logic Instructions
Data Transfer Instructions
Branch and Jump Instructions
ISA instruction - Arithmetic/ Logic Instructions
These Instructions perform various Arithmetic & Logical operations on one or more operands.
ISA instruction - Data Transfer Instructions
These instructions are responsible for the transfer of instructions from memory to the processor registers and vice versa.
ISA instruction - Branch and Jump Instructions
These instructions are responsible for breaking the sequential flow of instructions and jumping to instructions at various other locations, this is necessary for the implementation of functions and conditional statements.
The ISA defines the maximum length of each type of ________.
Since the MIPS is a 32 bit ISA, each instruction must be accommodated within 32 bits.
instruction
The ISA defines the Instruction Format of each type of instruction.
The Instruction Format determines how the entire instruction is encoded within 32 bits
There are 3 types of Instruction Formats in the MIPS ISA:
R-Instruction Format
I-Instruction Format
J-Instruction Format
Binary _____ is false / OFF
Zero ( 0 )
Binary ____ is true / ON
One ( 1 )
8 bits equals _____ byte
One
Binary is a _____ number system: counting done by a computer.
mathematics
Addressing modes in computer architecture techniques are used to accommodate the following provisions:
It provides programming versatility to the user by including pointers to the memory, indexing of data, counters for loop control, and program relocation.
It reduces the number of bits in the addressing field of the instruction.
It also provides flexibility to the assembly language programmer in writing more efficient programs concerning the number of instructions and execution time.
The _______ _______ refers to how the operand of an instruction is specified. It specifies a rule for interpreting/modifying the address field of the instruction before referencing the operand.
Addressing mode
The control unit is designed to go through an instruction cycle divided into three major phases:
______ the instruction from memory:
Program Counter (PC) is one of the registers present in the system that keeps track of the program’s instructions stored in the memory. It holds the address of the next instruction to be executed and is incremented every time an instruction is fetched from memory.
_______ the instruction:
It determines the operation to be performed: the operands’ location and the instruction’s addressing mode. Further, the computer executes the instruction and returns to step 1 (fetching the instruction from memory) to fetch the next instruction in the sequence.
______ the instruction:
The addressing mode of the instruction is specified with a unique binary code that designates both the operation and the mode of the instruction. Instructions can be defined with a variety of addressing modes. Combining two or more addressing modes in one instruction is also possible.
Fetch
Decode
Execute
type of addressing mode:
_______ / ______ _____ _____
The operands are implicitly specified in the instruction’s definition.
Consider the example, the instruction “complement accumulator” is an implied-mode instruction as the operand in the accumulator register is implied in the instruction definition. All register reference the instructions that use an accumulator are implied-mode instructions. Zero-address instructions in a stack-organized computer are also implied-mode instructions because the operands are implied to be on top of the stack.
Implied/ Implicit Addressing Mode
type of addressing mode:
_________ ____________ _______
The operand is defined in the instruction itself. This mode instruction has an operand field instead of an address field. The operand field contains the actual operand used with the specified operation in the instruction. The immediate-mode instructions help initialize registers to a constant value.
Instruction Opcode | Operand
ADD 8 will increment the value stored in the accumulator by 8.
Immediate Addressing Mode
type of addressing mode:
_______ ________ ____________ _______
The operands that reside within the CPU are stored in the registers. The specific register is selected from a register field in the instruction. No reference to the memory is required to fetch the operand. The only difference between the Direct addressing mode and the register direct addressing mode is that the instruction address field refers to a CPU register instead of the main memory.
Instruction Register: Opcode | R --------> | Operand
Advantage: This mode provides faster memory access to the operands.
Disadvantage: It has limited address space, and using multiple registers can help boost the performance, but it complicates the instructions.
Register Direct Addressing Mode
type of addressing mode:
________ _________ ________ ______
The instruction defines a register in the CPU that stores the effective address of the operand in memory. Only one reference to the memory is required to fetch the operand. The specified register contains the address of the operand instead of the operand. The only difference between the Indirect addressing mode and the register indirect addressing mode is that the instruction address field refers to a CPU register.
[ ] [ ] [ Opcode | R ] ---> [ EA ] ---- [ ] [ ] |-> [ Operand] [ ] [ ] Reg Set Memory
For example: ADD R1, R2: Here, the content of R2 is added to R1. R1 R2 represents registers.
Advantage: The instruction address field uses fewer bits to select a register than required to specify a memory address directly.
Register Indirect Addressing Mode
type of addressing mode:
_____-_____ ________ ______
This mode is a special Register Indirect Addressing Mode case. The register is incremented/decremented after or before its value is utilized.
EA = content of the register.
The content of the register is increment automatically by step size ‘d’ after accessing the operand, where the step size ‘d’ depends on the size of the accessed operand. Only one reference memory is required to fetch the operand.
Auto-Increment Addressing Mode
type of addressing mode:
_____-______ _________ ______
This mode is also a special Register Indirect Addressing Mode case.
EA = content of the register - step size.
The content of the register is decremented by step size ‘d’ after accessing the operand, where the step size ‘d’ depends on the size of the accessed operand. Only one reference memory is required to fetch the operand.
Auto-Decrement Addressing Mode
type of addressing mode:
______ ______ _______
The effective address of the operand resides in the address field of the instruction.
The operand resides in the memory, and the address field of the instruction gives its address. Only one reference to the memory is required to fetch the operand, and no additional calculations need to be done to find the effective address of the operand. It is also known as absolute addressing mode.
For example, ADD X will increment the value stored in the accumulator by the value stored at X’s memory.
Direct Addressing Mode
type of addressing mode:
______ _______ _______
The address field of the instruction gives the address of the memory location that contains the effective address of the operand. Two references to the memory are required to fetch the operand: The control fetches the instruction from memory and uses its address part to reaccess the memory that stores the effective address. This addressing mode slows down the execution as it requires multiple memory lookups to find the operand.
instruction [ I ][ Opcode ][ Operand ]
[ I ] is the mode bit
Indirect Addressing Mode
type of addressing mode:
______ _____ ______
The indexed register content is added to the instruction’s address part to obtain the effective address of the operand.
EA = A + (R)
Here, the address field holds two values, A: Base value R: displacement value.
Displacement Addressing Mode
type of addressing mode:
______ ______ ______
This mode is another version of the displacement address mode. The program counter’s content is added to the instruction’s address part to obtain the effective address.
EA = A + (PC)
Here, EA: Effective address, PC: program counter.
The instruction’s address part is usually a signed number that can be positive or negative. After the instruction’s address is fetched, the value of the program counter increases immediately, irrespective of whether the fetched instruction has been executed or not. PC: It contains the address of the next instruction to be executed.
Relative Addressing Mode
type of addressing mode:
_____ ______ ______
The index register’s content is added to the instruction’s address to obtain the effective address.
EA = content of index register + Instruction address part
Indexed Addressing Mode
type of addressing mode:
_____ _____ _____ ______
This mode is another version of the displacement address mode. To obtain the effective address, the base register’s content is added to the instruction’s address.
EA = A + (R)
A: Displacement, R: Pointer to the base address.
Base Register Addressing Mode
type of addressing mode:
______ ______ ______
The operand resides at the top of the stack. Consider an example, ADD: This instruction will POP two items from the stack, add them, and at last, will PUSH the result to memory references of Addressing Modes.
It helps in reducing the number of bits in the instruction’s addressing field.
It facilitates pointers, indexing of data, and counters for loop controls.
Stack Addressing Mode
_______ Addressing Mode: It initialize the register to a constant value.
Immediate
______ Addressing Modes and _____ ______ Addressing Mode: It helps access static data and implement variables.
Direct
Register Direct
______ Addressing Modes and ______ ______ Addressing Mode: It helps implement pointers and pass arrays as parameters.
Indirect
Register Indirect
_______ Addressing Mode: It helps in program relocation at runtime. And in changing the sequence of instructions during execution.
Relative
______ Register Addressing Mode: It helps in writing relocatable code and handling recursive procedures.
Base
_____ Addressing Mode: It helps in the array and record implementation.
Index
_____-______ Addressing Mode and Auto-Decrement Addressing Mode: It helps implements loops and stacks.
Auto-Increment
Advantages of addressing modes
They improve performance by efficiently utilizing the CPU cache and reducing the memory read latency
Addressing Modes are used for implementing complex data structures in memory as they provide mechanisms such as indexing
Program sizes can be reduced drastically as the code can be compacted which allows faster execution of instructions
Addressing modes give you the flexibility to use different ways of specifying the address of operands in your instructions
Disadvantages of Addressing Modes
Complexity: Particularly for inexperienced programmers, some addressing modes might be challenging to comprehend and use. Due to its intricacy, code may include errors or be inefficient
Limited Flexibility: Some addressing modes may limit the kind of operand operations that can be carried out. For instance, Immediate Mode restricts dynamic calculations to preset values only
Increased Memory Access: Because Direct and Indirect modes need more memory accesses to retrieve operands, program performance may be slowed down
Register Dependency: The availability of registers is very important for register modes. This can cause conflicts and inefficient resource utilization in systems with a finite number of registers
Code Size: Certain addressing modes could provide longer and more complicated instructions, increasing the code size
What are addressing modes in computer architecture?
The operation field of instruction in a computer specifies the operation to be performed. The Addressing mode refers to how the operand of an instruction is specified.
It specifies a rule for interpreting/modifying the address field of the instruction before referencing the operand.
Why addressing mode is used?
The Addressing mode refers to how the operand of an instruction is specified. We can specify how an operand’s effective address is represented in any particular instruction by using the addressing modes.
There is only one memory reference needed and no additional computation.
What are the 5 addressing modes?
The addressing mode include Register Mode, which places the operand in a register, Immediate Mode, which places a constant value in the instruction, Direct Mode, which places the operand address in the instruction, Indirect Mode, which places the address in a register, and Indexed Mode, which determines the address using the base register and offset.
What are addressing modes and its types?
Computer architecture’s addressing modes control how a processor accesses information in memory while carrying out an instruction. The five main types are Indexed Mode, Register Mode, Immediate Mode, Direct Mode, and Indirect Mode.