r/AppliedScienceChannel • u/p2p_editor • Jul 17 '14
Build a small CPU out of raw logic gates
I dislike the post about building a C compiler out of transistors, because good god, that just sounds painful. Horrible to design. Tedious to build. Ridiculous to debug.
However, building a small CPU out of logic gates would make a fabulous introduction to how computers really work for a lot of people who still see them as magic. Nothing fancy. Maybe just a four-bit machine with a teeny tiny instruction set and a bank of ROM made out of DIP switches or something.
94
Upvotes
4
u/-Big_Test_Icicles- Jul 31 '14
http://www.reddit.com/r/EngineeringStudents/comments/256cuj/what_do_you_guys_think_of_my_really_small/
1
u/dev-disk Jul 17 '14
The hard part is wiring everything together, you'd need at least a 2-layer board, and you'd have to jumper things unless you went 4-layer. Hand wiring a CPU together is too much work.
It could be pretty complex if you used add/subtract chips and an SRAM.
1
u/hwgasdfasdf Aug 27 '14
Bleh, if you want to know how a CPU works, go read a computer architecture book and then build one yourself (preferably in a HDL / simulation environment - the wiring would get a bit tedious in discrete logic gates). Having done it multiple times (both general purpose cpus and custom controllers) in VHDL for both FPGA and ASIC implementation, all of the interesting bit of this is in actually doing it, not watching someone else do it. I don't think you'd get any more out of watching Ben do it than you would reading a good textbook. Most of the learning comes from simulating it and figuring out why it doesn't do what you expected it to, and all the satisfaction comes from actually getting silicon back 6 months later with a functioning controller that matches the simulation!
2
u/Senor_Wilson Jul 17 '14 edited Jul 17 '14
Agree. Compiling is a fun software project, not a hardware project, but a small CPU with an very tiny instruction set would be neat. Then making a mini-language that works on a simple instruction set would be relatively easy.
2
u/skurk Jul 17 '14 edited Jul 17 '14
I would love to see this as well, as it's on my bucket list of things to do when I get enough spare time (a.k.a. never)
Doesn't have to be too complicated, even a one-bit (XOR+AND) CPU would be interesting.
2
u/tired_afraid Jul 17 '14
This is my favorite idea here, even though I did upvote half the things listed, as I want to see them done eventually.
2
u/phlogistonical Oct 05 '14
Too much work, not very original and of limited educational value unless one explains every intricate detail of the design (which is of interest to a very limited audience).
1
u/jdiez17 Jul 19 '14
This would be a great project. Most of the simple computers I've seen on YouTube are actually just a full n-bit adder. It would be awesome to see you build a programmable computer (with a couple of opcodes at most) from logic gates.