Finished MIPS Simulator
-
- Member
- Posts: 46
- Joined: Wed Mar 05, 2008 4:41 pm
- Location: San Francisco, California, USA
- Contact:
Finished MIPS Simulator
Hello, all!
I have recently been doing some interesting development in my spare time. If you just want to see something real quick, check out http://code.google.com/p/mips-machine/. Run the program and click "Resume" a few times (remembering to provide input when the simulator is waiting).
So, that's just the baby stages of something really cool
I'm writing a MIPS simulator since I'm so bored in school. I figured it would be really easy to target a compiler at MIPS, so once I got it working I could experiment with targeting other platforms. I want to eventually target a managed operating system ("Nazario") at ARM and Intel.
I've had a bit of experience writing operating systems and compilers pretty thoroughly for fun. Right now, I haven't had as much time as I used to to work on this stuff since I've been volunteering most of my time as sort of a software architect for a ministry in East Texas.
What do you think?
-Josh Wyant
UPDATE 3/12/2012: I know most of you probably don't have Mercurial, and perhaps some of you don't even have Visual Studio. So, I uploaded a test build. You can find it here! Since I made this post, the simulator has become much cleaner and friendlier. When you start it, it's already loaded with a program in memory (which comes from page 21 of the book I mentioned on the project page), but you can also load the sample.asm file and run that. You can step through and edit the programs, also. Remember that if the CPU is in syscall 5, you can't do anything until you provide input in the console window.
Note This post represents the state of the project when I first started working on it. Go to the home page to see the latest updates and get the latest copy.
A subset of the instruction set is implemented so far. I really hope to get this working at a useful scale. It's coming along great so far!
Here's a screenshot:
I have recently been doing some interesting development in my spare time. If you just want to see something real quick, check out http://code.google.com/p/mips-machine/. Run the program and click "Resume" a few times (remembering to provide input when the simulator is waiting).
So, that's just the baby stages of something really cool
I'm writing a MIPS simulator since I'm so bored in school. I figured it would be really easy to target a compiler at MIPS, so once I got it working I could experiment with targeting other platforms. I want to eventually target a managed operating system ("Nazario") at ARM and Intel.
I've had a bit of experience writing operating systems and compilers pretty thoroughly for fun. Right now, I haven't had as much time as I used to to work on this stuff since I've been volunteering most of my time as sort of a software architect for a ministry in East Texas.
What do you think?
-Josh Wyant
UPDATE 3/12/2012: I know most of you probably don't have Mercurial, and perhaps some of you don't even have Visual Studio. So, I uploaded a test build. You can find it here! Since I made this post, the simulator has become much cleaner and friendlier. When you start it, it's already loaded with a program in memory (which comes from page 21 of the book I mentioned on the project page), but you can also load the sample.asm file and run that. You can step through and edit the programs, also. Remember that if the CPU is in syscall 5, you can't do anything until you provide input in the console window.
Note This post represents the state of the project when I first started working on it. Go to the home page to see the latest updates and get the latest copy.
A subset of the instruction set is implemented so far. I really hope to get this working at a useful scale. It's coming along great so far!
Here's a screenshot:
Last edited by Joshw on Fri May 11, 2012 8:28 am, edited 3 times in total.
-
- Member
- Posts: 46
- Joined: Wed Mar 05, 2008 4:41 pm
- Location: San Francisco, California, USA
- Contact:
Re: MIPS
I just wanted to say, I got the fibonacci.asm assembling and running great now and I pushed the code online!
But, I guess it doesn't look cool to you guys unless I actually get an OS running on top of it
But, I guess it doesn't look cool to you guys unless I actually get an OS running on top of it
-
- Member
- Posts: 46
- Joined: Wed Mar 05, 2008 4:41 pm
- Location: San Francisco, California, USA
- Contact:
Re: MIPS
In your case that might be your best bet. I used MonoDevelop a couple years ago and it took a little configuration to get running right, but it may have improved now. Of course, you could just download the sample binary and use the Mono runtime. Hope that helps I enjoy using C#.
-
- Member
- Posts: 46
- Joined: Wed Mar 05, 2008 4:41 pm
- Location: San Francisco, California, USA
- Contact:
I finished it!
I finished it!
Go to the home page and check it out. I'm presenting it tomorrow as my end of the year project.
It can run programs written in C. It has a basic graphics library, and I built the VM and assembler from scratch.
Please let me know what you think, and let me know if it doesn't work for you!
Do you guys think this could be useful for the community at all?
Thanks guys!
-Josh
Go to the home page and check it out. I'm presenting it tomorrow as my end of the year project.
It can run programs written in C. It has a basic graphics library, and I built the VM and assembler from scratch.
Please let me know what you think, and let me know if it doesn't work for you!
Do you guys think this could be useful for the community at all?
Thanks guys!
-Josh
Re: Finished MIPS Simulator
Pretty cool. But why did you choose C# over C or another compiled language? I mean C# is a nice language however it has its down sides. It is after all, a JITed language.
Pretty fun to tinker with, might consider writing an OS for it .
BTW: It works on OS X through mono with a couple of glitches here and there.
Pretty fun to tinker with, might consider writing an OS for it .
BTW: It works on OS X through mono with a couple of glitches here and there.
Get back to work!
Github
Github
-
- Member
- Posts: 595
- Joined: Mon Jul 05, 2010 4:15 pm
Re: Finished MIPS Simulator
For application development I would choose C# or perhaps Java. Managed code usually makes you create you programs more quickly and Visual Studio has a nice built in debugger. Managed code simply taking over more and more when it comes application development.ACcurrent wrote:Pretty cool. But why did you choose C# over C or another compiled language? I mean C# is a nice language however it has its down sides. It is after all, a JITed language.
Pretty fun to tinker with, might consider writing an OS for it .
BTW: It works on OS X through mono with a couple of glitches here and there.
Visual Studio also provides a nice interface to design GUIs.
I'm using Mercurial for my OS project and it works ok for me. Visual Studio Express is available for download for those who wants to develop C# applications.
Re: Finished MIPS Simulator
Very nice work but I have to agree ACcurrent and berkus. If it counts, I also vote for a C rewrite, that would be really cool. Shouldn't be so hard.
Another example: I got database error in syslog from an application that's been running without problems for months. There were about 2 screens of data (more than 100 lines), but none of these contained the destination address. The detailed log just said: "Unable to connect to", but no where. It's some kind of java joke I don't get, right?
I never coded in C#, neither have used, so I've nothing to say about. Maybe that world is free of this, as C# programmers are more accurate.
I used to be a java programmer for years, I hated it. I don't understand how can people think that a specific language can save you from designing the program. I use and admin java programs day-by-day, and 99% simply sucks. Mostly because they're "managed code, created quickly". They're brainf*cking slow and unresponsive. When I had to update a jvm under a java service, I had to modify configuration 16 times (in different types of files: perl, shell, xml...) to update the absolute path containing java version. It was really annoying because I've created a jre symlink prior to installation and configured for it. And there was all kinds of names: JAVAHOME, JAVA_HOME, javaHome, JavaHome, MYLITTLEAPP_JAVAHOME etc. Seriously?OSwhatever wrote:For application development I would choose C# or perhaps Java. Managed code usually makes you create you programs more quickly and Visual Studio has a nice built in debugger. Managed code simply taking over more and more when it comes application development.
Another example: I got database error in syslog from an application that's been running without problems for months. There were about 2 screens of data (more than 100 lines), but none of these contained the destination address. The detailed log just said: "Unable to connect to", but no where. It's some kind of java joke I don't get, right?
I never coded in C#, neither have used, so I've nothing to say about. Maybe that world is free of this, as C# programmers are more accurate.
-
- Member
- Posts: 595
- Joined: Mon Jul 05, 2010 4:15 pm
Re: Finished MIPS Simulator
You can fail regardless what type of programming language you choose to use. When it comes to Java, I found it quite fragmented and some applications are indeed slow. I found C# being easier to work with and speed it adequate for most applications. Many people use managed code applications without even knowing that it is managed code and there are more of them than you realize.turdus wrote:Very nice work but I have to agree ACcurrent and berkus. If it counts, I also vote for a C rewrite, that would be really cool. Shouldn't be so hard.I used to be a java programmer for years, I hated it. I don't understand how can people think that a specific language can save you from designing the program. I use and admin java programs day-by-day, and 99% simply sucks. Mostly because they're "managed code, created quickly". They're brainf*cking slow and unresponsive. When I had to update a jvm under a java service, I had to modify configuration 16 times (in different types of files: perl, shell, xml...) to update the absolute path containing java version. It was really annoying because I've created a jre symlink prior to installation and configured for it. And there was all kinds of names: JAVAHOME, JAVA_HOME, javaHome, JavaHome, MYLITTLEAPP_JAVAHOME etc. Seriously?OSwhatever wrote:For application development I would choose C# or perhaps Java. Managed code usually makes you create you programs more quickly and Visual Studio has a nice built in debugger. Managed code simply taking over more and more when it comes application development.
Another example: I got database error in syslog from an application that's been running without problems for months. There were about 2 screens of data (more than 100 lines), but none of these contained the destination address. The detailed log just said: "Unable to connect to", but no where. It's some kind of java joke I don't get, right?
I never coded in C#, neither have used, so I've nothing to say about. Maybe that world is free of this, as C# programmers are more accurate.
Well, regardless what we think here, more and more programs are being written in C# and Java on the expense of C++, that is simply how things are progressing. Since you never have tried C#, download Visual Studio and try it out.
- gravaera
- Member
- Posts: 737
- Joined: Tue Jun 02, 2009 4:35 pm
- Location: Supporting the cause: Use \tabs to indent code. NOT \x20 spaces.
Re: Finished MIPS Simulator
Yo:
I'm not sure the OP was really calling for a voteturdus wrote:Very nice work but I have to agree ACcurrent and berkus. If it counts, I also vote for a C rewrite, that would be really cool. Shouldn't be so hard.
17:56 < sortie> Paging is called paging because you need to draw it on pages in your notebook to succeed at it.
-
- Member
- Posts: 46
- Joined: Wed Mar 05, 2008 4:41 pm
- Location: San Francisco, California, USA
- Contact:
Re: Finished MIPS Simulator
Hey guys, I have to run and take an exam, but I just wanted to reply real quick before I went.
Re-writing in C is a slight possibility depending on time, but it's less likely.
By the way, I presented the virtual machine today after everyone presented their computer history slideshows, and it went very well! My professor is writing a recommendation for me for MIT.
See you guys later, gotta run!
- Josh
Edit:
The couple of glitches were probably a couple of UI glitches I opted not to fix right away before presenting it today Those should be fixed soon.
Thank you guys for the feedback!
Re-writing in C is a slight possibility depending on time, but it's less likely.
I chose C# mainly because of the rapid development speed, great stability, and extreme ease of debugging. C# is not like Java in that regards, IMO. This was more of a presentation/toy project, so I didn't need to spend much time writing it in a language like C. Honestly, we use C# where I work all the time, so it was easier just to use C#.turdus wrote:...
I never coded in C#, neither have used, so I've nothing to say about. Maybe that world is free of this, as C# programmers are more accurate.
By the way, I presented the virtual machine today after everyone presented their computer history slideshows, and it went very well! My professor is writing a recommendation for me for MIT.
See you guys later, gotta run!
- Josh
Edit:
When you ran it, especially under OS/X, where you able to get the C compiler to run? Did it work with an existing one, or did you modify the path in the code? I've had a little bit of trouble getting it to run on a different computer (when it was working before) on Windows, and I'm sure it had something funky to do with the PATH environment variable. I originally installed and used CodeSorcery Workbench (MIPS) to use the GCC binaries.ACcurrent wrote:BTW: It works on OS X through mono with a couple of glitches here and there.
The couple of glitches were probably a couple of UI glitches I opted not to fix right away before presenting it today Those should be fixed soon.
Thank you guys for the feedback!
Last edited by Joshw on Thu May 10, 2012 8:11 am, edited 1 time in total.
Re: Finished MIPS Simulator
No. The C compiler did not run. In order to do so I would have to use wine. I do not have a mips toolchain installed. However the assembler works. No the UI ain't pretty. But I did not expect it to look good cosidering you used system.windows.forms; Congratulations on your recommendation!
Get back to work!
Github
Github
-
- Member
- Posts: 46
- Joined: Wed Mar 05, 2008 4:41 pm
- Location: San Francisco, California, USA
- Contact:
Re: Finished MIPS Simulator
Yeah, I guess it's best to use an already installed toolchain for C. I've updated the code and I'll push the source soon. The target is specified in the App.config file, and the bin directory should be in PATH. The defaults will work (mips-sde-elf).
Here are two places to get a free MIPS bare-metal GCC toolchain:
http://developer.mips.com/tools/compile ... toolchain/ - Pre-built Linux binaries, and build instructions for other platforms
https://sourcery.mentor.com/sgpp/lite/m ... elease2099 - Pre-built windows binaries
Let me know if anyone is able to test this successfully
Also, if anyone would like to contribute this project, I am considering opening it up. I don't know that there are many MIPS/C# programmers there are here, but feel free to let me know if you want to help! I'm willing to move to GitHub and maybe even shoot for a C++ version.
My secret plan is to have a good basis and starting point for developing a compiler infrastructure (experimenting) sort of like LLVM but a little more flexible and tailored to my own dreams for a new platform, which is beyond the scope of this project
-Josh Wyant
Here are two places to get a free MIPS bare-metal GCC toolchain:
http://developer.mips.com/tools/compile ... toolchain/ - Pre-built Linux binaries, and build instructions for other platforms
https://sourcery.mentor.com/sgpp/lite/m ... elease2099 - Pre-built windows binaries
Let me know if anyone is able to test this successfully
Also, if anyone would like to contribute this project, I am considering opening it up. I don't know that there are many MIPS/C# programmers there are here, but feel free to let me know if you want to help! I'm willing to move to GitHub and maybe even shoot for a C++ version.
My secret plan is to have a good basis and starting point for developing a compiler infrastructure (experimenting) sort of like LLVM but a little more flexible and tailored to my own dreams for a new platform, which is beyond the scope of this project
-Josh Wyant
-
- Member
- Posts: 46
- Joined: Wed Mar 05, 2008 4:41 pm
- Location: San Francisco, California, USA
- Contact:
Re: Finished MIPS Simulator
It's bulky And you have to interface with std::streams. I want to be more flexible than that, for specific, proprietary projects in the future. Plus, I always enjoy building things from scratch, I don't know why... I'll probably play around with LLVM first anyway.berkus wrote:That sounds interesting. What's inflexible in LLVM in your opinion?Joshw wrote:sort of like LLVM but a little more flexible