So far, we’ve numbered a job each time we needed one. Let’s gather all the instructions we’ve added along the way.
The machine from the call and return post can run every instruction we’ve made. Its memory holds a program that computes 2 to the n-th power. It starts from 1 and doubles it n times; n is in slot 13, and the result is written to slot 15.
Press the play button to the right of CLK to give clocks automatically. Since n is 3, R1 grows to 2, 4, and 8, and the machine stops after writing 8 into slot 15.
We’ve numbered thirteen jobs, one at a time as we needed them. This agreement on the instructions a CPU understands, their numbers, and how to write them is called the instruction set architecture (ISA). There are four for moving data between registers and memory, four for computing with the ALU, and five for changing the flow.
Put the immediate into Rd.
LDI R0, 301100011
These thirteen instructions for moving data, computing, and controlling the flow are everything this CPU understands. But to put numbers into this machine, we still have to edit memory slots by hand. In the next post, let’s attach devices for exchanging numbers with people.
Memory slots 0–3 hold the machine code below. Running from slot 0 until it stops at HALT, what number ends up in slot 15? Use the instruction table in this post. Answer with a number.
Slot 0: 01100011 Slot 1: 00010000 Slot 2: 10011111 Slot 3: 11110000