Labs

Lab 6.4: Symbols and Bits

PIPPIN Help

Print
References

We asked you in the previous lab to confirm to your own satisfaction that the PIPPIN1 code produced by the Rosetta program did in fact correspond to - or simulated the effects of - the original equation. This is tough to do by hand, but there's a better way. We can use our CPU2 simulator, "PIPPIN", to actually run the program, and then observe the effects of the program on the simulator's memory.

1pp. 210–213, 215, 227–228, 260
2pp. 7, 257

Clearly, we anticipated that these two programs, our translator and our machine simulator, would be related. It is no accident that Rosetta produces as its output PIPPIN instruction codes, which can then serve as input to the simulator. Neither is it an accident that the Rosetta program has a button in its control panel which saves the resultant PIPPIN code for loading into the CPU Simulator (the button is named SAVE FOR CP SIMULATION - NOTE This will only work if your browser allows saving from applets).

  1. Enter and set our standard equation, W = X * (2 + Y), into the Rosetta program, set it to perform "Code Generation", and hit the "Play" button.

  2. Now, click on "SAVE FOR CP SIMULATION," and switch to this lab, so you can use the PIPPIN simulator. Open the file you just created in PIPPIN, or type in the values from Rosetta if your browser can't save and load from Java files.

  3. Make sure that the simulator is operating in Symbolic mode.

  4. Notice, too, how the memory locations associated with variable W, X, and Y are uninitialized. In order for our statement to accomplish anything that we would notice (beside, say, setting W to zero, which it already is!), we should set the locations corresponding to X and Y to reasonable values, so that we can see if the code actually works. Click on the memory cell for variable X, and set it (by typing into it) to 4. Similarly, set Y's memory cell to contain 5.

  5. If all goes well, when you click the "Play" button on the simulator, it should (after some pretty serious work) leave the value 28 (the result of evaluating 4 * (5 + 2)) in the location W. Click "Play" now to watch this occur.

  6. Click "Reset" to clear the simulator, and reset the value of memory location W to zero (resetting the simulator does not clear the memory cells for our variables).

  7. Repeat steps 1-6 for our more advanced equation:
    X = (3 * Y) + (2/W)
    
    In this case, when you set the values of variables (as in step 4, above), set Y to 14, and W to 1. This should produce a value of 44 for variable X when the code is "played" by the simulator.

  8. Finally, write and test a PIPPIN program that calculates the average of the values in memory locations X, Y, and Z, and stores the result in W.

Labs

MODULES:


Home Search Resources Objectives Feedback Order Form Credits

Copyright Notice
© 1998 PWS Publishing Company, All Rights Reserved.