Write a MIPS simulator using SPIM
kostas0z0000
Posts: 2
I am trying to solve the problem below:
Write a simulator for a subset of the MIPS instruction set
using MIPS instructions and the SPIM simulator. Your
simulator should execute hand-assembled programs that are located in the data
segment of the SPIM simulator and should use
$v0 and $v1 for input and output.
Other portions of the data segment can be used for storing the memory contents
and register values of your virtual machine. Your implementation can use any of
the MIPS instructions, but your simulator need only support a smaller subset of
the instruction set, as add, addi, mul div, lw, sw, and, ori, nor, sll, j, beq, bne, jal.
I would like to give me an example to understand how to read data segment, recognise the function (add), move the real data in the registers that i'll use and how to store them back in data segment!
Thanks in advance!!!
Write a simulator for a subset of the MIPS instruction set
using MIPS instructions and the SPIM simulator. Your
simulator should execute hand-assembled programs that are located in the data
segment of the SPIM simulator and should use
$v0 and $v1 for input and output.
Other portions of the data segment can be used for storing the memory contents
and register values of your virtual machine. Your implementation can use any of
the MIPS instructions, but your simulator need only support a smaller subset of
the instruction set, as add, addi, mul div, lw, sw, and, ori, nor, sll, j, beq, bne, jal.
I would like to give me an example to understand how to read data segment, recognise the function (add), move the real data in the registers that i'll use and how to store them back in data segment!
Thanks in advance!!!
Comments
Parallax has nothing to do with MIPS processors or the SPIM simulator.
Parallax does manufacture a Propeller microcontroller that has as it's native language, something called SPIN...but this is nothing like SPIM.
Sorry, I think you need to go back to Google and Wikipedia and do a little more research!
Good luck on your assignment!!
C.W.
By the way, kostas0z0000, I forgot to welcome you to the forum. Welcome, hope you can stay around and learn about Parallax products!
I use the PIC32 occasionally, which has a MIPS core, and have played with the SPIM simulator. I spent about half a day, a few months ago, working out how to write an assembler program for the PIC32. My test program might be of interest:
It runs OK under the Microchip PIC32 simulator, and on an actual PIC32 chip with the ICD 3 debugger. I can't remember if it works with SPIM, though.
It can't be done.
There, I said it, now someone can go ahead and prove me wrong.
C.W.
Probably more interesting to write a SPIN interpreter on a MIPS.
It seems like every time something comes up and someone says it isn't possible on the prop, someone goes and makes it work.
I was just doing my part and planting that seed.
C.W.
Actually it does not. There is my ZiCog 8080/Z80 emulator and there is Pulmol's Z80 emulator. I was looking forward to a 6502 emulator and I made a stab at the 6809 which proved to be too much for me.
Then there is ZOG which is not so much an emulator as there never was such a thing as the ZPU chip.
Great time to be a computer/electronic hobbyist.
see:
http://alvie.com/zpuino/
HAHAHAHAHAHAHA
Welcome aboard!
BTW, we have a couple of different propeller simulators on the PC and Linux that run spin just fine. All you need is Linux on MIPS.
Yes, it is nice. As I remember code is about the same size as SPIN code and maybe a little faster. Did you finish the little-endian implementation?
Sorry for the misunderstanding! By the way is not exactly my homework assignment, my teacher just proposed some exercises and I found it interesting.
However i will give up, I can't find something to start with!