Emulating Linux MIPS in Perl – Part 1: ELF loader
schplog.schmorp.de
schplog.schmorp.de
As a perl user, I'm also highly biased as it's nice to see a perl article on HN once in a while :)
MIPS is certainly one of the simplest instruction sets. A while ago I decided to write one too, for fun, after having done ones for a few other CPUs (Z80, 6502, 8086), and MIPS was by far the simplest, almost to the point of being boring. Getting the branch delay slots right (see http://www.pagetable.com/?p=313 for some details) was the hardest part.
An interesting idea: instead of fixing a number of branch delay slots (or none), what about splitting branches? That is - you have a branch_commit instruction, and anything between the branch and the branch_commit is treated as (a) branch delay slot(s), with the processor either filling in pipeline bubbles or stalling the branch as necessary. If you want to get fancy about it you can start doing matched branch / commit pairs (like nesting brackets), or potentially even start dealing with general matching.
Although the decreased instruction density may kill the benefits.
> You want to do X, and you think Y is the best way of doing so. Instead of asking about X, you ask about Y.
If we allow "ask" to include asking oneself, then this seems like a great example :)
How you get Perl on MIPS is by compiling on a MIPS machine, or in an emulated chroot environment (QEMU on x86, say). Now Perl can maybe supply that environment.
Emulating a whole processor to run a shell script on Windows.... Seriously??
Strikes me that someone didn't research the options correctly or just wants an excuse to play...
Complaining about hackers being hackers on a site called Hacker News... Seriously??