I don't know how CPUs work so I simulated one in code (2019)
1–10 of 49 posts
Re: I don't know how CPUs work so I simulated one in code (2019)
#2Re: I don't know how CPUs work so I simulated one in code (2019)
#3I don't know how CPUs work so I simulated one in code - https://news.ycombinator.com/item?id=19969321 - May 2019 (172 comments)
Re: I don't know how CPUs work so I simulated one in code (2019)
#4As the AND gate 4 gates up the chain switches the NOT gate 4 gates down the chain starts to send different and unstable signals which may or may not be interpreted as a 1 or 0 in the downstream gate.
That's the reason computers have a clock, to make sure all transistors in a given stage of a CPU reach a steady state before moving on to the next instruction.
This is why it's probably a good idea to work with a HDL instead of just trying to wing it.
Re: I don't know how CPUs work so I simulated one in code (2019)
#5Re: I don't know how CPUs work so I simulated one in code (2019)
#6If, for fun, I wanted to train an ML model on a ton of CPU instructions (which each predicted state/label being the state of the registers), does anyone have any clue how to gather that kind of data?
Re: I don't know how CPUs work so I simulated one in code (2019)
#7Re: I don't know how CPUs work so I simulated one in code (2019)
#8So, what this project misses, which is quite hard to capture if you think of gates being just on off switches, is the fact that signals are not instantaneous, and everything runs in parallel. As the AND gate 4 gates up the chain switches the NOT gate 4 gates down the chain starts to send different and unstable signals which may or may not be interpreted as a 1 or 0 in the downstream gate. That's the reason computers…
Another game Turing Complete ( https://store.steampowered.com/app/1444480/Turing_Complete/ , https://news.ycombinator.com/item?id=38925307 ) lets you build a CPU from basic gates and a much larger (and customizable) instruction set. It also has the concept of gate delays, thopugh it doesn't visually show the unstable output as Silicon Zeroes does.
Re: I don't know how CPUs work so I simulated one in code (2019)
#9So, what this project misses, which is quite hard to capture if you think of gates being just on off switches, is the fact that signals are not instantaneous, and everything runs in parallel. As the AND gate 4 gates up the chain switches the NOT gate 4 gates down the chain starts to send different and unstable signals which may or may not be interpreted as a 1 or 0 in the downstream gate. That's the reason computers…
Re: I don't know how CPUs work so I simulated one in code (2019)
#10From memory it showed instruction decode, execution, cache and memory.
Unfortunately I've never been able to find it, because all the google results are about running DOS games and/or DOSBox.