MIPS — архитектура и система команд

MIPS (англ. Microprocessor without Interlocked Pipeline Stages) — микропроцессор, разработанный компанией MIPS Computer Systems в соответствии с концепцией проектирования процессоров RISC.

Тип

−31− формат (в битах) −0−

R

код (6)

rs (5)

rt (5)

rd (5)

сдвиг (5)

функция (6)

I

код (6)

rs (5)

rt (5)

непосредственное значение (16)

J

код (6)

адрес (26)

MIPS-1_1.jpg

   1 ## Program to assemble the instruction ori  $8,$9,0x004A
   2 ##
   3 
   4         or    $25,$0,$0        # clear $25
   5         ori   $11,$0,0xD       # opcode
   6         ori   $12,$0,0x9       # operand $s
   7         ori   $13,$0,0x8       # dest. $d
   8         ori   $14,$0,0x004A    # immediate operand
   9         
  10         sll   $11,$11,26       # shift opcode into position
  11         or    $25,$25,$11      # or it into the instruction
  12         
  13         sll   $12,$12,21       # shift operand $s into position
  14         or    $25,$25,$12      # or it into the instruction
  15         
  16         sll   $13,$13,16       # shift dest $d into position
  17         or    $25,$25,$13      # or it into the instruction
  18         
  19         or    $25,$25,$14      # or const into the instruction
  20         
  21         ori   $8,$9,0x004A     # The actual assembler
  22                                # should create the same machine
  23                                # instruction as we now have in $25
  24 
  25 ## end of file

   1 ## handMadeNeg.asm
   2 ## 
   3 ## Program to demonstrate two's complement negative
   4 ##
   5 ## The program adds +146 to -82, leaving the result in $10
   6 
   7         ori      $7, $0, 146        # put +146 into $7
   8         ori      $8, $0,  82        # put 82 into $8
   9         nor      $8, $8,  $0        # reflect
  10         ori      $9, $0,   1        # 
  11         addu     $8, $8,  $9        # add 1: $8 = -82
  12         addu    $10, $7,  $8        # (+146) + (-82)
  13 
  14 ## End of file