Ask HN: did you ever implement a toy processor?
Did you ever implement a toy processor? Was it from scratch or were you given pieces to complete? Do you think it was worth the effort and did it help you become a better coder?
I'm asking this because I feel there isn't any easy way to write/debug and run fpga projects. I would like to change this, and I'm wondering if others feel the same?
9 comments
[ 3.3 ms ] story [ 31.5 ms ] threadDid you like the tools you used to test your vhdl? Did you run the code on a fpga and did you find it easy to do?
Do you wish you could demo your processor to anyone using a javascript simulator?
The event queue even handled propagation delay.
I made it so that if a tristate bus was held to both high and low at the same time, then an exception would be thrown that told you you "let the blue smoke out" and ended the program.
Binary instructions were read from a static string buffer which were then interpreted by the logic to implement the functions of the cpu and alu.
In the end, I discovered that the cpu logic block that we had been told to emulate was missing a one clock cycle delay buffer and should not have functioned properly if anyone else implemented it accurately.
Wish I still had the code for that, it was super fun to make.
While this was not a toy processor per say (it was a part of a bigger project), I consider it toy-like because of the simple instruction set. Writing and debugging was not a major pain point in this case. Generally speaking though, I have been fairly satisfied with logic design tools for ASICs, though not as much for FPGAs.
I later discovered CAD tools built specifically for designing processors. Google ASIP [1] for more if interested.
Regarding this making me a better coder, well no, since I was already a good coder. :-) OK, I learned machine code at the age of 15 years, and so already had good insights into how stuff works inside when I learned C and C++.
[1] http://en.wikipedia.org/wiki/Application-specific_instructio...
Check out TECS/NAND2Tetris to get started with VHDL and processor architecture: http://www.nand2tetris.org/ If you want a more academic approach, try Hennessey and Patterson's Computer Architecture: A Quantitative Approach.