Labs

Lab 6.1: Representations

PIPPIN Help

Print
References

These lab exercises rely on two complementary programs1, both of which are translators in the sense that each accepts as input a program written in one language2 and produces as its output a version of the input program in another language. One translator demonstrates the two basic steps involved in translating a program from a high-level languages like JavaScript3, into a lower-level assembly language4, like PIPPIN5 described in our text. The other translates a program from its assembly language form into a machine-readable and machine-executable binary6 form. Taken together, these programs form a modern-day Rosetta stone.

1pp. 13, Mod. 2, 234, 273, 285
2pp. 16, 126, 218-220
3pp. 126, 127, 139–196, 149
4pp. 210, 216
5pp. 210–213, 215, 227–228, 260
6pp. 203–205, 243, 273–274, 282

We start with the PIPPIN Simulator above. This program does much more than just translate a program written in PIPPIN assembly language into its binary form. It actually shows how the resulting binary program is executed by the machine. At this point, though, we're only concerned with how information - numbers, names and operations that appear in PIPPIN - can be represented in binary. (We'll concentrate on the simulator's ability to execute programs in the next module.)

To do this we need only concern ourselves with the right and bottom portions of the program window. Along the right-hand side are memory locations (stored in our machine's "RAM"). The top group of those locations (labeled 0-14, in increments of two) is intended to hold instructions to be executed by our virtual computer. The buttons along the bottom of the window can be used to control the machine as it does the execution. For now, the only buttons we will use are the two labelled Symbolic and Binary. These allow us to view the instructions we enter into the memory locations in either their symbolic form (that is, as we entered them, using PIPPIN codes, variable names, and numbers) or in their binary equivalents.

  1. Enter the following list of symbolic PIPPIN instructions into memory locations 0, 2, 4, and 6, respectively, of our CPU simulator.
    LOD     #2
    ADD     Y
    MUL     X
    STO     W
    
  2. Click on the Binary button to see the binary representation of memory.

  3. Toggle back and forth between Symbolic and Binary modes, until you can see the correspondence between the two representations of the same information. Then answer the following questions
    1. At what address is the MUL X instruction stored? How is that address represented in binary?
    2. What is the binary operation code that corresponds to the symbolic instruction LOD?
    3. How is the number 2 represented in binary?
    4. At what address is variable Y stored, and how is that address represented in binary?
    5. Answer question d, this time for variable X.
    6. Answer question d, this time for variable W.
    7. What are the binary operation codes corresponding to the symbolic PIPPIN instructions ADD? MUL? STO?


  4. Let's reverse the process now to test your understanding. See if you can determine the symbolic PIPPIN program that corresponds to the following sequence of binary codes as they would appear in the first 8 locations of RAM. Use PIPPIN to check your answer.
    	00010100	00000101
    	00000000	10000000
    	00000001	10000011
    	00000011	10000001
    	00000101	10000010
    	11111110	00000000
    	11111110	00000000
    	11111110	00000000
    

Labs

MODULES:


Home Search Resources Objectives Feedback Order Form Credits

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