Technical Requirements
You can find the programs used in this chapter on GitHub at https://github.com/PacktPublishing/Practical-Computer-Architecture-with-Python-and-ARM/tree/main/Chapter04.
An ultra-primitive one-instruction computer
Our first one-instruction interpreter demonstrates both instruction decoding and execution, which are key to all simulators. This computer has a memory with nine locations, mem[0]
to mem[8]
, arranged as a list of integers. The contents of the memory are preset to mem = [4,6,1,2,7,8,4,4,5]
. The memory locations are 0 to 8 and are read left to right in the list; for example, memory location 0 contains a value of 4, location 1 contains a value of 6, and location 8 contains a value of 5.
The computer has an array of eight registers, r[0]
to r[7]
. These are specified in Python via the following:
r = [0,0,0,0,0,0,0,0] #. Define a list of 8...