My own :)
Not so long ago, I found a link on usenet talking about a CPU made with relays (look at http://www.cs.pdx.edu/~harry/Relay/index.html).
I found the principle very cool, and now I want to do my own !
However, relays are very costy parts. They are heavy and juice hungry. So, why relays ? Because it's neat ! you can see your cpu working !
Well, you're hearing it too…
So, as the relays cost money, I'll try to make is so it requires the less relays possible.
Of course, I'll have a working machine *in simulation* even before buying the hardware.
Doing a cpu isn't a task you're doing as fast as writing an hello world. You don't take your soldering iron and tell “now, which gate do I solder ?”
The first task is making the requirements. The requirement, as in every evolutary software, moves along with the customer's needs. So, this page will contain the most up to date specifications.
Here is a list of what I want Mycpu to be able to:
I don't need a beast. I think a 8bits cpu is more than enough. Also, I feel that the Risc architecture is a must, because multiple-cycles cisc instruction are going to need more logic gates. Also, cisc instruction are very long. It's not very suited to my cpu.
Looking at relays specifications, I see that the commutation time of a relay is more or less 5ms. That mean, a cycle will end when every relay has commuted. So, a cycle time is the sum of commutation times of all relays in a straight line. I'll calculate it exactly when the simulated implementation is done, but I don't believe I'll be able to make it work at more than 1 cycle by second.
Yeah, you heard it. 1 Hertz.
It might look trivial (it looked so for me) but designed an efficient binary executable format is not easy !
you have to make it simple so the instruction decoding unit is very simple and doesn't cost too much gates. Actually, I designed it using OpenOffice.org's Calc. One of the tricky part was the Tests :
There is a value in register W you want to test for different aspects : =0, !=0, <0, ⇐0, >=0, >0.
Thus, there are 3 input bits from the instruction opcode. The test unit only need two bits of information from W : the bit sign (bit 0) and the sum of all bits (to test zeroesness).
I found out which convention for the opcode use the less gates.
more information in assembler.pdf
Ever heard about the graph theory ? It says you can explain a week of procrastination by a well choosend graph :)
More seriously, this is the graph of the data flow. Of course it's not definitive, but it gives an idea of what each part of the cpu is doing.
A later version will include more information on the arrows, because they don't tell *which* information is given. for instance, you may not guess that the arrow from instruction unit to Program code means “Instruction Address”. Another time maybe.
The first thing that needs to be tested is the instruction set constitency, as well as the practibility (can the cpu resolve problem and impress chicks ?)
I'm not going to write my programs in binary in 2006. I'll make a lex/yacc based assembler, quick and dirty.
This virtual machine will emulate the cpu behaviour. Not its internals. So, it'll will receive a binary program as input and tell the result. Eventually, I'll be able to debug the programs and make some estimations about the time needed to run a program.
And i'll know if 256 instruction words are enough to calculate pi or e.
formule pour le calcul de pi : ça va être sportif !
Going a step forward, I'll make independant parts of a program that simulates the in and outs of the cpu. It's time to find a conceptual defect in my graph…
I'm probably going to use one of well known electronic drawer that makes a connection matrix. I'll make a program to simulate the relays, and I'll test each unit separatly, then together… And i'll know if it really works !
I found a cool little java app :
http://www.tetzl.de/java_logic_simulator.html#demo
It's not very “serious” but it's more than enough to draw the initial schematics
I'll take my soldering iron and put all that pieces together…