We have seen at least the seeds of how simple logical1 circuits can be used to describe some of the basic operations of a computer. We return now to our CPU2 simulator, PIPPIN3, to watch the higher-level components (like memory4, a MNX, a decoder and an ALU - with its arithmetic operations) in action as they execute a program5. |
1pp. 160, 238–241, 311 2pp. 7, 257 3pp. 210–213, 215, 227–228, 260 4pp. 255, 262 5pp. 210, 216
|
- Enter the following PIPPIN program into PIPPIN, beginning at memory location 0. You may remember that this is the PIPPIN equivalent of our example equation:
W = X * (2 + Y).
LOD #2
ADD Y
MUL X
STO W
- Set the values of memory locations X and Y to 4 and 5, respectively.
- Run the program, by clicking on the "PLAY" button.
- Reset the program, and reset the value of memory location W back to zero.
- Now, use the "STEP" button to execute one PIPPIN instruction at a time. Watch carefully to see how the program counter is used to retrieve an instruction from memory, how the instruction is decoded to detect which operation is to be performed. This is the fetch-execute cycle in action.
- Reset the simulator now, and perform steps 1-5 again, this time using the PIPPIN codes for equation:
X = (3 * Y) + (2/W)
LOD #3
MUL Y
STO T1
LOD #2
DIV W
ADD T1
STO X
In this case, set the values of the memory locations for variables Y and W to 5 and 1, respectively.
- On a separate sheet of paper, describe how a single instruction gets executed by our machine in terms of the components of the simulator. That is, describe the order in which components are used, and the flow of information that occurs in the processing of one instruction.
|
|