2010-06-17

Back to hardware

When I was very little I was used to copy a lot of circuits from electronics magazines my father bought, and also from his own diagrams. To me they meant nothing at all, but I found them beautiful and I sensed that there was a meaning in all those symbols. Growing, strangely my interests shifted more towards software, even after I studied those symbols and assigned their proper meanings. At some point in time, I can't remember exactly where, I thought it would have been cool to be able to create a computer; I focused this idea when I studied more deeply digital electronics, but indeed I never planned to realize it for real.

Now it is almost time to get back the idea... It is renewed as something a little bit different: since to create the hardware for real is pragmatically hard (maybe FPGA could do, but...), what if I create a software simulation? The simulation "models" the digital components that "are" the microprocessor, properly interconnected.

Excited by this approach, that seemed possible and not so hard, I've created a new task for Rosetta Code, Four bit adder. The C "model" seemed to me to work greatly, I thought "It can be done", but the task is just a very short step towards the final aim, proved to be not so well written, and the code showed some limits this morning, when I've taken a look at how I could implement a latch using basicall the very same "ideas" already used in the four bit adder.

A little bit demoralized, I began searching the net for similar stuffs... And of course I've found very interesting things, and more "realistic" and done by people more gifted for hardware — I used SPICE once upon a time, but indeed never ever gone into hardware projecting for real, universitary laboratory apart, where however we did not too much complex circuits, in fact we have not done any ambitious project at all; and I know of the existance of languages like VHDL and Verilog, but never used them (I started to take a look at them since today).

I am swinging between two position. In one position, I want just a "simulator" realized in a known language like C (even though OO languages in this case could make things easier). In the other position, I am taking into account the hypothesis of using VHDL for real... and this second position started to exist when I've installed FreeHDL, which has a VHDL to C++ "translator"!!

So even my idea of writing the simulator in code is not so new... Well, the original part could be that I would like to realize an emulator for the processor, using as core the finished simulation. In practice, I would like to run something like myemul ROM where ROM is a file that provides the ROM, and myemul does not realize the emulation as Bochs or QEMU (which have performance needs), but realizes it at a low-level, through logic gates emulation...

Ok, too much for now. I've installed FreeHDL, gEDA, GtkWave and also ngspice. I think I have everything I can have for free (and mostly free, too). But I still does not know VHDL and Verilog, and I have not the slightest idea from where to begin. Luckly, the net is full of informations and experiments, like The Harp Project.

Note: discussing several arguments on Rosetta Code about the task (and a replacement for its description, since the current does not satisfy me) I've discovered that there could be a certain interest in having Brainfuck code running in gate-logic; maybe it would be not a bad idea to start projecting the processor so that it can "host" BF easily.

1 comment:

  1. pro memoria: MMIX! (Not at the gates PoV, but interesting anyway... and better than I can do, likely)

    ReplyDelete