cursor

Friday, 29 April 2016

ADDRESSING MODES

ADDRESSING MODES

The different ways in which the location of an Operand is specified in an instruction are addressing modes.
  

INSTRUCTION FORMAT 
  


Effective Address   =   Address of Operand
     Operand Value    =   Value at Effective Address


TYPES OF ADDRESSING MODES

There are various types of addressing modes -
 






DIRECT ADDRESSING

If the second part of instruction specifies the address of an Operand , then it is said that the instruction has a direct address or direct operand .



 Example 
                              Add    r  ,  2000
                             
                      *  value at E.A. (2000) is 5
                            
                         Therefore  r + 5  →  r


* Single Memory reference only.

USE :  used to implement variables. 
        
                                                               

INDIRECT ADDRESSING

If the second part of an instruction code specifies an address of memory in which the address of the operand is obtained , then it is called indirect addressing.                        





Effective Address   =   2000  =  [1000]
Operand Value        =   [ E.A.]   =  [[1000]]
                                  =   [2000]
                                  =   5
             

* It requires two memory references.

USE : used to implement pointer.






 

Thursday, 28 April 2016

INSTRUCTION CYCLE

INSTRUCTION CYCLE

PROGRAM  :  A program is set of instructions.

* instructions are generally executed by the computer in sequential manner.
This cycle for every instruction is known as the instruction cycle.

COMPOSITION  OF INSTRUCTION CYCLE

The cycle consists of the following steps -




  

 

INSTRUCTION FETCH

In this step instruction which has to be executed , is fetched through data bus.

Initially CPU (central processing unit) transfers the address of the next instruction (to be fetched from memory) from the program counter (pc) to the memory address register (MAR).
MAR sends it to the memory through the address bus.
  
Finally, instruction is fetched from memory through data bus.
 










DECODING

In this step fetched instruction is decoded (In Machine Language).








OPERAND FETCH

In this step Operand is fetched from the memory.

* Depending on the Effective Address (EA) , Operand may reside in CPU registers or in memory.

NOTE : FOR MORE INFORMATION PLEASE VISIT PREVIOUS POSTS.










EXECUTION

After Instruction and Operand fetching we have both the Opcode & Operand.

Once the instruction gets decoded the processor executes the instruction.

* Arithmetic and Logic Unit (ALU) inside CPU executes the instructions.


RESULTS

After all the processing result is stored back in the memory at appropriate places. 
 




 

Wednesday, 27 April 2016

REGISTERS

REGISTERS

Registers are group of flip-flops.

A single flip-flop can store one bit of information only.

* Registers are inside CPU.

 

TYPES OF REGISTERS

There are various types of registers -  


 


  

ACCUMULATOR  (Ac)

It is a 8 bit register.
It stores the Input or Output results.
 

         





PROGRAM COUNTER  (pc)

It is a 16 bit register.
It contains the address of the next instruction to be executed.
After an Instruction has been fetched, its contents are automatically incremented by 1 (pointing to the next instruction).

* Normally instructions are executed sequentially.





 

Increment of Program Counter by 1.



 




MEMORY ADDRESS REGISTER  (MAR)

It is a 16 bit register.
It holds the address of the next instruction to be fetched from the memory.

CPU (central processing unit) transfers the address of the next instruction from the program counter (pc) to the memory address register (MAR).

From MAR it is transmitted to the memory through the address bus



 
  


INSTRUCTION REGISTER  (IR)

Holds the current Instruction.
It holds instruction until it is decoded
 

MEMORY DATA REGISTER (MDR)

It holds data received from or sent to the memory.
It is connected to data bus.

* the flow of data from the CPU to the memory or from memory to the CPU is always through memory data register

  

   

                                     

 

INSTRUCTIONS

INSTRUCTIONS

An instruction is just a combination of the following two parts - 
1. opcode field.
2. Address field.




                              

 

OpCode Field

This field specifies how data has to be manipulated.

* Data items may reside in CPU registers or in the main memory

Address Field 

Address field specifies the data address (or operand address).

  

Example