Showing posts with label Architecture. Show all posts
Showing posts with label Architecture. Show all posts

Short Note On Addressing Mode




Addressing Mode :Each operation field of an instruction specifies the operation to be performed. The operand field specifies the data (or operand) on which the operations must be executed. These data are stored in the registers or memory locations. So which executing an instructions, the processor needs the specific data from their storage locations.
                                 The way, the data is specified or the way the operands are chosen by the processor during program execution gives the addressing mode of the instruction.
The different addressing modes are the following below –

Implied Mode : In this mode the operands are specified ‘implicitly’ in the definition of the instruction i.e the operands are implied in the definition . Operands need not be specified explicitly.

Example :
Complement Accumulator : This instruction is an implied instruction because the operand in the accumulator register is implied in the definition of the instruction. The operand need not be specified explicitly.

Uses : All register reference instructions using an accumulator and zero address instruction in a stack-organized computer are implied-mode instructions.

Immediate Addressing Mode : In this mode the operand is itself specified in the instruction operand field. Here the operand value is a constant.

Example :
LOADI 99 or LOADI immediate 99





This means the 99 are to be loaded in the Accumulator as has been shown in the figure. In this mode the instruction has an operand field rather than an address field.

Uses : Immediate Addressing Mode instruction are useful for initializing registers to a constant value.

Register Mode or Register Direct Mode : In this mode the operands reside in registers that reside within the CPU i.e the operands reside directly in the CPU registers.

Example :

ADD B or ADD register direct B



Here B is a cpu register and the content of which is 10 i.e this content reside directly with in the cpu register B. Hence, this content must get added to the content of the accumulator.

Register Indirect Mode : In this mode the instruction specifies a register in the cpu whose contents give the address of the operand in memory i.e the content of the cpu register is the address of the operand’s location in the memory.

 Example :
ADD B or ADD register indirect B



Here the content of the cpu register B is the memory location that contains the operand 99. So the register B contains the address of the operand (99) is to be added to the Accumulator content.

Uses : Register Indirect addressing modes are convenient to use as the execution time needed is much less.

Direct Addressing Mode : In this mode, the effective address of the operand is equal to the address part of the instruction i.e the address part of the instruction indicates the memory location containing the operand.

Example :
LOAD X



In this the memory location X contains the operand 60 to be loaded in the accumulator.

Indirect Addressing Mode : In this mode the address field of the instruction gives the address where the effective is stored in memory i.e the address part of the instruction indicates the memory location whose content is the address of the memory location containing.

Example :
LOAD W



The memory location W contains X, which is the memory location whose content is the actual operand 60. This operand is to be ultimately in the accumulator.

Relative Addressing Mode : In such modes the content of the cpu register is added to the address part of the instruction to obtain the actual address of the operand. The address part of the instruction which is usually a signed number an addition to the cpu register content, gives the effective address whose position in memory is relative to the address of the next instruction.

Uses : Relative addressing Mode is often used with branch type instruction.
                Relative addressing mode may be of the following three types  given below –

    a)    PC Relative Addressing Mode : In this mode the content of the program counter is added to the address part of the instruction to obtain the address of the operand.

    b)    Indexed Addressing Mode : In this mode the content of the index register is added to the address part of the instruction to obtain the actual address of the operand.  

Uses : The index register can be used to access consecutive operands. This can be done by increment the register contents.

     c)     Base Register Addressing Mode :  In this mode the content of the base register is added to the address part of the instruction to obtain the actual address of the operand.

Uses : Such modes are used in computers to facilitate the relocation of program in memory.

Stack Addressing Mode : Here the address of the operand is specified by the stack pointer (SP). The length of instruction is the shortly as it does not include any address of the memory location or mention any register. After each stack operation the contents of sp are automatically incremented or decremented . PUSH and POP are the two commonly used instructions of this type.

Example :
PUSH  A à To PUSH the content of accumulator to the top of stack (TOS).

Uses : Useful hen PUSH and POP instructions are used in a program by the programmer.

                  When interrupt occurs the contents of important registers are saved into the stack. For this stack addressing is used.



Difference Between Hardware Control Unit and Micro Operation Control Unit




Hardware Control Unit V/S Micro Operation Control Unit:

Hardware Control Unit
Micro Operation Control Unit
1 . Hardware Implemented.
1 . Software Implemented (Micro Instruction).
2 . Non – Programmable.
2 . Programmable.
3. Faster
3 . Slower.
4 . Not Flexible.
4 . Flexible.
5 . Implementation is Complex.
5 . Simple and Easy to Implement.

Advantage and Disadvantage and Uses of Zero Address Instructions



Advantage :-
Do not Contained any explicit address. So, instructions are simple.

Disadvantage :-
(i) To evaluate arithmetic expression in a stack computer.
It is necessary to convert the expression into Reverse POLISH Notation (RPN).

Uses :-
In all stack type computers.

Advantage and Disadvantage and Uses of One Address Instructions



Advantage :-
(i) Match L number of bets is required to Specify the single operand address.
(ii) Less complicated decoding is needed.

Disadvantage :-
(i) Number of instructions needed to evaluate an arithmetic expression is much more compared to two and three address instructions.
(ii)More execution time needed compare to two and three address instructions.
(iii) Limited range of functions each instruction can perform.

Uses :-
In INTEL 8085 machines.

Advantage and Disadvantage and Uses of Two Address instructions



Advantage :- 
(i)Less execution time compare to one-address instructions.
(ii) Number of instructions needed to evaluate a arithmetic expression is much less compared to are address instructions.

Disadvantage :-
(i) It result in comparatively longer programs, then three-address instructions, when evaluating arithmetic expression.
(ii) Comparatively more execution time then three address instruction.

Uses :-
Two address instructions are used in all commercial computer.

Advantage and Disadvantage and Uses of Three Address instructions



Advantage :-
(i) It results in short programs when evaluating arithmetic expressions.
(ii) Less execution time.

Disadvantage :-
(i) Too many bits are required for binary-coded instructions to specify three addresses
(ii)More complex decoding and processing circuits are needed.

Uses :-
Cyber 170 is a Commercial Computer using three-address instructions.

Explain Three, Two, One and Zero Address Instruction with Examples ?




Three, Two, One and Zero Address Instruction :-

(a) Three Address instructions :- In these type of instructions, all operand addresses are explicitly defined. Here the instructions format has three different  address fields specifying or memory or processor register operand.

Example :- ADD R1,C,B ---> R1 <---M[C] +M[B] i,e the operands at memory addresses C and B are added and the resultant sum is stored at or third processor register R1.

Advantage :-
(i) It results in short programs when evaluating arithmetic expressions.
(ii) Less execution time.

Disadvantage :-
(i) Too many bits are required for binary-coded instructions to specify three addresses
(ii)More complex decoding and processing circuits are needed.

Uses :-
Cyber 170 is a Commercial Computer using three-address instructions.

(b) Two Address instructions :- Here the instruction format has two different address fields, each specifying either a memory or a processor register operand.

Example :- ADD X,Y --->AC<---M[X]+M[Y]
                  Here X,Y - explicit Operands
                                        OR
                  M[X] <---M[X]+M[Y]
                                         OR
                  M[Y]<---M[X]+M[Y]

Advantage :- 
(i)Less execution time compare to one-address instructions.
(ii) Number of instructions needed to evaluate a arithmetic expression is much less compared to are address instructions.

Disadvantage :-
(i) It result in comparatively longer programs, then three-address instructions, when evaluating arithmetic expression.
(ii) Comparatively more execution time then three address instruction.

Uses :-
Two address instructions are used in all commercial computer.

(c) One Address Instructions :- Such instruction format has a single explicit address field and uses an implied accumulator (AC) register for all data manipulation.

Example :- ADD X --->AC <---AC+M[X]

i.e The operand  at memory location X is added to the accumulator content and the result is stored in the accumulator it self. So there are only see explicit operand address field (i.e,x) and two implicit operand addresses.

Advantage :-
(i) Match L number of bets is required to Specify the single operand address.
(ii) Less complicated decoding is needed.

Disadvantage :-
(i) Number of instructions needed to evaluate an arithmetic expression is much more compared to two and three address instructions.
(ii)More execution time needed compare to two and three address instructions.
(iii) Limited range of functions each instruction can perform.

Uses :-
In INTEL 8085 machines.

(d) Zero Address Instructions :-
Such instructions do not contain any explicit addresses (except for PUSH and pop instructions). As the operand are stored in a pushdown stack (the operand required must be there in the to P Positions in the stack hence no addresses are required.

Example :- ADD--->TOS <--- X+Y
Here the top two operands X and Y in the stack are removed from the stack and added. The result is then  again placed at the top of the stack (TOS).

Advantage :-
Do not Contained any explicit address. So, instructions are simple.

Disadvantage :-
(i) To evaluate arithmetic expression in a stack computer.
It is necessary to convert the expression into Reverse POLISH Notation (RPN).

Uses :-
In all stack type computers.

What is the Implicit and Explicit Operand Addresses ?




Implicit and Explicit Operand Addresses :-

Operand addresses may be implicit (i .e implicit) or explicit (i.e not implied).
Generally operations performed with an accumulator register hasimplicit operand addresses i.e all operations that have reference to the accumulator register hare implicit operands as well as implicit operand address.

Example :- MOV B – The content of register B is to be moved in the accumulator.

 All operations that do not have references to the accumulator register, generally have explicit operands as well as explicit operand addresses.

Example :-  MUL X.C.B—To multiply the constants of registers B and C and to store the result in the register X.

What is an opcode and what is an operand ?




Opcode and Operand :-

'opcode' means 'operation code' , i . e the specific operation to be carried out by instruction. The operation field of an instruction is called the opcode. Operands are the set of data to be used to carry out the operations. Operand fields contains the addresses  of storage locations of the arguments to be used in the operations.

Draw or explation a basic instruction format




Draw or Explanation a Basic Instruction Format :- Instruction format means how or basic instruction look like. Each instruction has three point. The ‘opcode’ point, the ‘addressing mode’ part and the operands or the ‘address’ (That is operands address) point.

 The operation field is called the ‘op code’ or  ‘operation code’. The operand/address field contain either the  operands them selves or the address of storage location of the data arguments (i.e addresses of operands) in main memory. Or in the processor depending on the various addressing modes (I) as specified in or particular instruction.

    So a basic computer instruction format will be like –


Format for an instruction can have an opcode,  an addressing mode but a set of operand’s or operand addresses (1,2, ----------- n).


Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀