4 ms·
I made a processor <edit> I emulated it </edit> in c++ in college. Started off with an abstract logic gate that had two inputs and an output, created an event q
by BarkingOven 13y ago
I made a processor <edit> I emulated it </edit> in c++ in college. Started off with an abstract logic gate that had two inputs and an output, created an event queue to propagate outputs to inputs, created a couple of different buses, tristate and open drain I believe, and then created methods to link inputs and outputs as well some concrete logic gate classes to each other and also to the various bus end points.
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.
- amenghra 13y agoThis sounds like a really great way to get started without having to invest (time, money or both) in unfamiliar tools.