1

There is a code block like MIPS, I want to convert this code to stack machine code. I've hesitated about its correctness. I m not sure about how to move value from "a" to "r1". Is it true? Thank you.

  • lw r1,a
  • lw r2,b
  • add r3,r1,r2
  • sw r3,c

    Stack machine code

    • lvalue r3
    • push a
    • push b
    • +
    • :=
kacikalin
  • 11
  • 2
  • in mips the registers you can use are t and s and not r. Are you using mips 32? You trying to add those items in a stack and then reload them to memory and perform the operations? Or you want to recursive take some operands and when operation character is pushed in the stack you want to perform the operation?Be more specific please – Korpel Oct 14 '15 at 14:59
  • Thanks for response. Actually I don't use MIPS and I want to learn stack machine code. So we can forget MIPS code and we can try convert below code block to stack machine code. r1=a; r2=b; r3=r1+r2; c=r3; – kacikalin Oct 15 '15 at 14:24

0 Answers0