Pipelining and Data Hazards

CSC252 Assignment 5

Mon Apr 1 14:04:21 EST 1996

This assignment builds on the previous one. You are once again supposed to use the MINT simulator but instead of simply counting the instructions, you are supposed to figure out how long they take. MINT has a concept of time measured in processor cycles. A processor cycle is a tick of the processor clock. In an ideal pipeline that number of processor cycles required for program execution should be equal to the number of instructions since you can issue one instruction per cycle. However as we have seen in class, instructions take longer in practice due to data and control hazards. For this assignment we are going to ignore control hazards and only concentrate on data hazards.

When sim_instr or sim_read or sim_write are called you are supposed to figure out which registers they need to use. If there are conflicts then the instruction needs to wait (stall) until these are resolved. What you need to do is assume reservation stations for each register. The instruction should try to record the request for the registers it needs and if they are not available should wait until they become available. Keep in mind that waiting in a loop and checking for a condition is not going to work. You will need to use the new_task () function in order to create tasks for the waiting instructions. You will also need to check for pending tasks every time an instruction completes, and you will need to update the time field in the task data structure in order to account for the amount of time each instruction takes.

Assume the five stage pipeline described in Hennessy and Patterson and presented in class. Use the simple sorting program once again. How long does it take execute this program in a perfect pipeline? How long does it take to execute it in the realistic pipeline you have implemented? What can you do to improve performance if you can not modify the hardware? The assigment is due April 22nd at midnight. Good luck and start early. This is probably the hardest assignment of the semester.





Leonidas Kontothanassis
Mon Apr 1 14:04:00 EST 1996