CS 301, Fall 2000 Assignment #2: 10 Points. Due Date: Friday, 9/22/00. Read sections 2.1-2.6 of the text. (2) 1. Problem 2.1. Draw a diagram of a skeleton SAL program. Identify the different parts of the program. Show which pieces are optional and where the instructions and data belong. (2) 2. Run the program in Figure 2.1 on the spim simulator. Use single step mode to determine: (a) the address where the 'done' instruction begins and (b) the number of machine language instructions which must be executed to perform the four SAL instructions beginning at __start. Use the unix 'script' command to log your run. You may then edit the 'typescript' file and print it.** (1) 3. Suppose the Pascal statement in Figure 2.2 contained no 'else' clause. Write SAL code to execute the 'if' using as few instructions as possible. (3) 4. Write a SAL program that prints out a line of N dashes ('-') followed by a single 'X', where N is a positive integer entered by the user in response to a prompt from the program. Run the program using the spim simulator and hand in both the program and the output from the simulator.** (2) 5. The code in Figure 2.6 can be improved by replacing the unconditional branch at the end of the loop with a conditional branch. Both codes will contain the same number of instructions, but the number of instructions executed by the loop will differ. Write the SAL code to replace the unconditional branch with a conditional branch so the program produces exactly the same result for any exponent greater than or equal to zero. For an exponent of 5, count how many instructions are executed by each program. Hint: See Problem 2.10. **For full credit, turn in well commented program listings, including your name and the problem number, and the results of the computer run for this problem.