Thursday, June 9, 2011

3.4 Representing Instructions in the Computer

  • In MIPS assembly language, registers $s0 to $s7 map onto registers 16 to 23, and registers $t0 to $t7 map onto registers 8 to15
  • ie. add $t0, $s1, $s2 : | 0 | 17 | 18 | 8 | 0 | 32 |
  • Each of the segments of an instruction is called a field
  • The first and last fields ( 0 & 32 ) tell the MIPS computer that this instruction performs addition
  • Fields in binary: | 000000 | 10001 | 10010 | 01000 | 00000 | 100000 |
  • MIPS fields: | op | rs | rt | rd | shamt | funct |
  • op: opcode, basic operation of instruction
  • rs: first register source operand
  • rt: second register source operand
  • rd: register destination operand, get the results of the operation
  • shamt: Shift amount
  • funct: Function. Selects specific variant of the operation in op field.
  • Instruction format : R-type (register) or I-type for data transfer instruction
  • I-type: | op | rs | rt | address |
  • address field is 16 bits

No comments:

Post a Comment