Sunday, 3 May 2015

Instruction Format



Instruction Format

All instructions are 32 bits long. There are four types of instruction format.
  • Arithmetic instruction format
  • Conditional Branch  and Immediate format
  • Unconditional Jump format
  • Input and Output instruction format

Arithmetic instruction format


2 bits      6 bits           4 bits       4 bits      4 bits      12 bits
00
 OPCODE
S-reg
S-reg
D-reg      000

The first two bits are always 00, indicating that the instruction is an Arithmetic or Register transfer type of instruction. S-reg is the source register. D-reg is the destination register. The last 12 bits are always 0, as they are not used.

Conditional Branch and Immediate format


2 bits      6 bits           4 bits       4 bits       16 bits
01
OPCODE
B-reg
D-reg
Address

The first two bits are always 01, indicating that the instruction is a Conditional Branch and Immediate type of instruction. B-reg is the base register. D-reg is the destination register. The last 16 bits may be an address or an immediate data.
  • When the last 16 bits contain data, the D-reg is always 0000.
  • The Address may at times be treated as data, which is direct addressing.
  • An indirect Address is calculated as :

  Effective Address = Content (B-reg) + Address

  • Conditional Branch checks for B and D reg to cause a branch, to a specified Address, or not


Unconditional Jump format 


2 bits      6 bits                           24 bits
10
OPCODE
                 Address

The first two bits are always 10, indicating that the instruction is an Unconditional Jump type of instruction, with a jump to the specified Address.

 

 

 

Input and Output instruction format




2 bits      6 bits            4 bits      4 bit               16 bits
11
OPCODE
Reg 1
Reg 2
       Address

The first two bits are always 11, indicating that the instruction is an Input and Output type of instruction.
  • The instruction may read the content of Address/Reg 2 into Reg 1.
  • The instruction may write the content of Reg 1 into a specified Address/Reg 2.  


Registers 


There are 16 registers; each of 32 bit long.
  • Reg-0 (0000) being the Accumulator.
  • Reg-1(0001) being the Zero register, which contains the value 0.
  • All other registers are general purpose register.

Buffers


  • Input buffer – containing data read by the program
  • Output buffer – containing data produced by the program
  • Temp buffer – area in memory to store/retrieve the data temporarily.

No comments: