How to convert MIPS instructions to machine code?

user3754212

I'm stuck at converting the below MIPS instruction to machine code

  sb $t3, 40($s2)
  beq $s0, $s1, Lab1
  j Lab1

  jr $s0

So far, I have

101000  10010       01011       101000
000100  10000       10001       0x00400000

How do I go from here? Since 0x00400000 is address not value, I don't think I translate it into binary. And so on... I can't really find an example to go on from here.

user3754212

Ah I think I'm getting a better idea now by looking at MIPS: Calculating BEQ into Hexadecimal Machine Code and Lưu's answer.

  beq $s0, $s1, Lab1
=>000100 10000 10001 0x00400000
=>0001 0010 0001 0001 (0x004000040 + 1 away instruction)
=>0001 0010 0001 0001 0000 0000 0000 0101
=12110001
  j Lab1
=>0000 1000 0001 0000 0000 0000 0000 0000
=08100000
  jr $s0
=>0000 0000 0000 0000 0000 0000 0000 1000
=02000008

So this is what I got. If any error please let me know.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

How to convert MIPS instructions to machine code?

From Dev

MIPS to Machine Code Conversion

From Dev

How to generate the machine code of Thumb instructions?

From Dev

MIPS .data Segment to Machine Code

From Dev

How does this virtual machine convert instructions to hexadecimal values?

From Dev

MIPS: Calculating BEQ into Hexadecimal Machine Code

From Dev

MIPS: Calculating BEQ into Hexadecimal Machine Code

From Dev

I don't understand these assembly code and machine code differences if assembly code instructions are equivalent of machine code instructions

From Dev

How does Spark do bytecode to machine code instructions run time conversion?

From Dev

MIPS - How to find the address value of branch and jump instructions

From Dev

MIPS - How to find the address value of branch and jump instructions

From Dev

MIPS Branch Instructions

From Dev

How to convert machine code to readable assembly (IDA free)

From Dev

Generate MIPS architecture assembly code on a X86 machine

From Dev

MIPS translator in C++, how to convert to hex

From Dev

Binary Patching - modifing existing instructions and keeping machine code alignment

From Dev

generate abstract machine code from simple programming instructions

From Dev

Converting binary/hexadecimal to MIPS instructions

From Dev

Branch instructions and Jump instruction in Mips

From Dev

MIPS jump and branch instructions range

From Dev

MIPS instructions to set a register to 1

From Dev

Converting binary/hexadecimal to MIPS instructions

From Dev

How to convert a DFA to a Turing machine?

From Dev

How to convert a CFG to a Turing Machine

From Dev

How to save program counter address without using J-Type instructions in MIPS architecture

From Dev

How many machine instructions can single memory address store?

From Dev

How to tell if a Linux machine supports AVX/AVX2 instructions?

From Dev

How to use code on React instructions homepage

From Dev

How do I convert stored hexa number array to decimal with MIPS?

Related Related

  1. 1

    How to convert MIPS instructions to machine code?

  2. 2

    MIPS to Machine Code Conversion

  3. 3

    How to generate the machine code of Thumb instructions?

  4. 4

    MIPS .data Segment to Machine Code

  5. 5

    How does this virtual machine convert instructions to hexadecimal values?

  6. 6

    MIPS: Calculating BEQ into Hexadecimal Machine Code

  7. 7

    MIPS: Calculating BEQ into Hexadecimal Machine Code

  8. 8

    I don't understand these assembly code and machine code differences if assembly code instructions are equivalent of machine code instructions

  9. 9

    How does Spark do bytecode to machine code instructions run time conversion?

  10. 10

    MIPS - How to find the address value of branch and jump instructions

  11. 11

    MIPS - How to find the address value of branch and jump instructions

  12. 12

    MIPS Branch Instructions

  13. 13

    How to convert machine code to readable assembly (IDA free)

  14. 14

    Generate MIPS architecture assembly code on a X86 machine

  15. 15

    MIPS translator in C++, how to convert to hex

  16. 16

    Binary Patching - modifing existing instructions and keeping machine code alignment

  17. 17

    generate abstract machine code from simple programming instructions

  18. 18

    Converting binary/hexadecimal to MIPS instructions

  19. 19

    Branch instructions and Jump instruction in Mips

  20. 20

    MIPS jump and branch instructions range

  21. 21

    MIPS instructions to set a register to 1

  22. 22

    Converting binary/hexadecimal to MIPS instructions

  23. 23

    How to convert a DFA to a Turing machine?

  24. 24

    How to convert a CFG to a Turing Machine

  25. 25

    How to save program counter address without using J-Type instructions in MIPS architecture

  26. 26

    How many machine instructions can single memory address store?

  27. 27

    How to tell if a Linux machine supports AVX/AVX2 instructions?

  28. 28

    How to use code on React instructions homepage

  29. 29

    How do I convert stored hexa number array to decimal with MIPS?

HotTag

Archive