Module 6 Dan Works 7-25-1999 a. At what address is the MUL X instruction stored? How is that address represented in binary? Address 4 00000100 b. What is the binary operation code that corresponds to the symbolic instruction LOD? 00010100 c. How is the number 2 represented in binary? 00000010 d. At what address is variable Y stored, and how is that address represented in binary? 10000010 e. Answer question d, this time for variable X. 10000001 f. Answer question d, this time for variable W. 10000000 g. What are the binary operation codes corresponding to the symbolic PIPPIN instructions: ADD? 00000000 MUL? 00000010 STO? 00000101 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 LOD 5 00000000 10000000 ADD 128 00000001 10000011 SUB 131 00000011 10000001 DIV 129 00000101 10000010 DIV 130 11111110 00000000 Doesn't appear to be a valid code. 11111110 00000000 Doesn't appear to be a valid code. 11111110 00000000 Doesn't appear to be a valid code. Now, let's try to parse a few expressions by hand. For each of the statements below, draw its parse tree on a sheet of paper. Then, use Rosetta to see if you tree is correct. a. Y = 5 - Z + X Done -DW b. Y = 5 - (Z + X) Done -DW c. Y = 5 - ((Z + X)/2) Done -DW Let's reverse the process again and see if you can match parse trees with their corresponding statements. For each of the parse trees below, write the statement that it represents. Use Rosetta to confirm your answers. A. Y = X - 3 * 2 B. Y = 2 + (X - 3) C: Y = X - 3 * 2 For each of the following statements, determine - without using Rosetta! - the PIPPIN code that would be generated for it. Then, use Rosetta to verify your answers. a. Y = Z * 3 - X LOD Z MUL # 3 SUB X STO Y b. X = (Y + 5) /2 LOD Y ADD # 5 DIV # 2 STO X c. Z = (W * W) + (X * X) LOD W MUL W STO T1 LOD X MUL X ADD T1 STO Z For each of the PIPPIN code segments below, find a statement that corresponds to it. Use Rosetta to confirm your suspicions. a. LOD Z ANSWER: X = Z / 2 DVI #2 STO X b. LOD Z ANSWER: X = (Z / 2) * Y DVI #2 MUL Y STO X c. LDI #2 ANSWER: X = Z / (2 * Y) MUL Y STO T1 LOD Z DIV T1 STO X 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. ANSWER: The equation is: W = (X + Y + Z) / 3 The Code is: LOD X ADD Y ADD Z DIV # 3 STO W ___________________________________________________________________ Modify your web site on the basis of any criticisms received from your classmates. Done-DW Streamlined Photo page # 4. Restored missing picture On page # 3.