Midterm Exam, CSCI 312, Fall 2017
- Make sure you answer each question completely and thoughtfully.
- Please make sure your answers are clearly labeled with the question number.
- Please write neatly and make any diagrams as neat as you can. If I can't read it, it is wrong.
- Point values are listed by each question.
- [6 points] Draw a diagram that represents the WOMBAT CPU. Label all parts.
- Fetch-Decode-Execute
- [6 points] Describe what happens at each phase of the Fetch-Decode-Execute cycle.
- [4 points] Using RTN, describe at a component level what occurs during the Execute phase of a WOMBAT add instruction.
- [4 points] Registers
- What is a special purpose register? Give an example of a special purpose register in the WOMBAT architecture.
- What is a general purpose register? Give an example of a general purpose register in the WOMBAT architecture.
- [8 points] The authors of our book describe four factors that affect CPU performance. Name each and describe how it affects the performance of a program.
- [2 points] A CPU has a clock that runs at 2.0 GHz. Assume the CPI for this machine is 1. How long does it take to execute a single instruction. Please give your answer in proper units. Please show all work.
- A processor, running at 2GHz, has three classes of instructions with characteristics for a given program listed in the table below.
Class | CPI | Frequency |
---|
A | 1 | 20% |
B | 2 | 20% |
C | 4 | 60% |
- [2 points] Compute the average CPI for this machine.
- [2 points] If the program requires 2x109 instructions, how long will it take to execute this program.
- [2 points] A programmer has written an optimizer for the compiler that will reduce the frequency of instructions in class C to 40% but increase the frequency of instructions in class A and B to 25% and 35% respectively. In addition, the number of instructions required for the program will change to be 2.3x109. Should you use this compiler optimization and why? Show all work and an unsupported answer is wrong.
- For a 4 input MUX
- [4 points] Describe the input, output and function of this MUX.
- [2 points] Draw a circuit to implement this MUX.
- [6 points] Design and implement a circuit which takes two bits as input and adds a third bit such that the number of 1s in the three bits is always odd. Your answer should include a truth table, an equation and a circuit.