项目作者: dannyqiu

项目描述 :
A MIPS Assembly Interpreter written for the browser
高级语言: JavaScript
项目地址: git://github.com/dannyqiu/mips-interpreter.git
创建时间: 2016-03-16T14:51:25Z
项目社区:https://github.com/dannyqiu/mips-interpreter

开源协议:

下载


MIPS Interpreter

A MIPS32 Assembly Interpreter written in Javascript for the browser. It allows for inspection of registers and memory, step by step code execution, and fast debugging using breakpoints and register initial values.

The interpreter follows the MIPS specifications of a delay slot and register syntactic sugar.

Supported Instructions

The interpreter supports the following instructions:

  1. - NOP: do nothing
  2. - ADDIU: add a register to an immediate
  3. - ADDU: add two registers
  4. - AND: bitwise AND two registers
  5. - ANDI: bitwise AND a register with an immediate
  6. - BEQ: branch if two registers are equal
  7. - BGEZ: branch if a register is greater than or equal to zero
  8. - BGTZ: branch if a register is greater than zero
  9. - BLEZ: branch if a register is less than or equal to zero
  10. - BLTZ: branch if a register is less than zero
  11. - BNE: branch if two registers are not equal
  12. - J: jump to a symbol or hard-coded address
  13. - JAL: jump to a symbol or a hard-coded address, saving PC+8 in $r31
  14. - JALR: jump to a register, saving PC+8 to $r31
  15. - JR: jump to a register
  16. - LB: load a signed byte from memory
  17. - LBU: load an unsigned byte from memory
  18. - LW: load a word from memory
  19. - SB: store a byte to memory
  20. - SW: store a word to memory
  21. - LUI: set a register to an immediate, shifted left by 16 bits
  22. - MOVN: move one register to another if a third register is non-zero
  23. - MOVZ: move one register to another if a third register is zero
  24. - NOR: bitwise OR two registers, then negate the result
  25. - OR: bitwise OR two registers
  26. - ORI: bitwise OR a register with an immediate
  27. - SLL: shift left logical by a constant amount
  28. - SLLV: shift left logical by a variable amount, specified by a register
  29. - SLT: set a register to 1 or 0 depending on if another register is signed less than yet another one
  30. - SLTI: set a register to 1 or 0 depending on if another register is signed less than a signed immediate
  31. - SLTIU: set a register to 1 or 0 depending on if another register is unsigned less than a signed immediate
  32. - SLTU: set a register to 1 or 0 depending on if another register is unsigned less than yet another one
  33. - SRA: shift right arithmetic by a constant amount
  34. - SRAV: shift right arithmetic by a variable amount, specified by a register
  35. - SRL: shift right logical by a constant amount
  36. - SRLV: shift right logical by a variable amount, specified by a register
  37. - SUBU: subtract a register from another register
  38. - XOR: bitwise XOR two registers
  39. - XORI: bitwise XOR a register with an immediate

Unsupported

The following are not supported:

  • Directives, such as .text or .word

Notes

  • The version in the v1 folder only supports basic instructions (no jumps/branches or memory), but can work if the program does not need any complex execution