CPU-S is the first project I have re-written from my old website for this new one.
The original version was created on a whim after having a module on my course at Loughborough University in my first year. When going over basic CPU internals and architectures our lecturer, Dr. Daniel Reidenbach, came up with a simplified, idealised CPU and accompanying system to help illustrate his points over the course of the module.
Part of the module had us writing assembly, using the hypothetical instruction set he defined, to do various functions and show people how you can go from doping silicon to make transistors all the way to writing a do-while loop. The made up system, CPU-S, meant we didn’t get stuck with the details of modern hardware with all the optimisations that go on there, or spend time learning a multitude of registers and instructions when only a few were needed to serve a point.
I thought it would be a fun side project to spend an evening hacking away with PHP and CodePress (a now-defunct in-browser code editor) to create some software where I could put my data and made up assembly, run it, and get real results as if the CPU-S system existed. The original version actually, kind of, worked. I anded up adding a few extra instructions to make it a bit more interesting to program for and wrote a walkthrough as some students in the module didn’t really grasp the low-level programming and I thought it might help to show how to do some common tasks.
The original version was well recieved. Other students in my year on the module played with it and it was generally viewed as a bit of good fun. For a while a link was included in the lecture notes I believe.
It’s now 2013, 5 years since I initially wrote it. I now work at the company I worked at during my industrial placement year from Loughborough, and the company still hires students from Loughborough University. This year, while talking to them, I remembered the old CPU-simulator and asked if they’d seen it and to my surprise they had! Later that night I checked the site out to see how it had held up over the years but unfortunately it hadn’t fared well.
My CSS was broken, the code editors didn’t work in many browsers and had serious bugs when they did work. Generally it was a visual shambles with a back end full of 5 year old bugs.
I had a free Saturday coming up so I figured a full re-write was in order. Using a newer code editor from CodeMirror, adding in the ability to pass input and mark breakpoints and generally make things nicer.
You can go and play with it now, there’s a slightly updated walkthrough, some new and refreshed examples and information. It was a bit of a rush to get it all coded before Sunday rolled around so there’s currently (as of this blog post) no decent comments and there are a couple of visual bugs I have spotted when using breakpoints. I also haven’t published the source but I will when I get more time.
On the whole I’m happy with it and it seems fit enough that it should last another 5 years, so let me know if you have any feature requests.