The final project in the Codecademy CS104 course was to build a Python program that simulates some of the functionalities of a CPU. I wrote a program that simulates a simplified version of pipelining in a CPU taking instructions in assembly language.
I have a very basic understanding of the topic. To keep the simulation simple it has no branching and does not do the write-back.
The machine instructions are in a list. They input the length, width and height of a box then calculate the box’s Volume and Surface Area.
I used a small cache of 4 registers and simulated them with a dictionary. Data was “moved to memory” when the cache was full.
The code can be found here at GitHub.