Transistor level 6502 simulation |
Sunday, 26 September 2010 | |||
Take a processor. Cut the top off the packaging. Photograph the naked chip through a microscope. Digitise the result. From this create a simulation of the components and run some software. This is transistor level simulation. If you thought that our previous news item on building a programmable model of a Cray computer (Home Brew Cray) was slightly crazy, this next idea might make you decide to drop the "slightly". The idea is amazing but it is difficult to believe that it works.
The simulation in Javascript
What the guys at Visual6502 have done is to take a 6502 microprocessor, remove the top of the packaging using acid, take accurate and high resolution photos of the chip and then digitise the result.
Taking the photos
From the digitised image they created a vector model using polygons. Where the polygons overlap we have transistors and other components - about 20,000 of them for the 6502. The next step is the most amazing. From this geometrical model they have implemented a working simulation of the chip. The simulation is claimed to be 100% accurate and the proof is that it can run 6502 machine code. It is also claimed that this is a simple method. Instead of having to write a simulation with lots of complex code you only need some simple and fixed code to interpret the polygon model. It is also a fairly quick process - the team started on the 6502 in November 2009 and had a finished simulation at the end of December. Microphoto to polygon model
What is interesting is that after trying an automatic method of converting the bitmap into vector polygons the team gave up and manually digitised the images. The problems of noise and damage to the chip made it faster to input a clean image manually than spend time cleaning up the automatic conversion. What is amazing is that this method can take any chip and convert it into a working simulation almost at the physical hardware level without any knowledge of the inner workings of the chip - timing, cycle counts, machine code and so on - all from a sample of the chip. What have they done with the simulation? If you are using a browser that supports HTML5 then you can view the simulation in action. It has been implemented as a Javascript application drawing to a Canvas object. There is also a Python implementation but it's not online yet. You can download the Javascript from github. The slides from their SigGraph presenation are also worth looking at if you are interested in the process. It also illustrates another phase of the project - multichip simulations. By reverse engineering the TIA (Television Interface Adapter) chip in an Atari 2600 game system they were able to put it together with the 6502 and run real programs - Space Invaders to be exact! Space invaders
Is there a practical application for this technique? To be useful as a library of old hardware capable of running any ancient program it needs to be speeded up. In principle there is no reason why it can't be. Think of the vector model as a basic language for a general purpose emulator and now use parallel hardware and clever optimisation to speed things up. The team claims that with this method old hardware can be saved for posterity and of course this means old software has something to run on.
<ASIN:193183640X> <ASIN:0750618396> <ASIN:1403315175> <ASIN:0316491977> |
|||
Last Updated ( Sunday, 26 September 2010 ) |