Homework 6 - Extra Credit on Chapters 4 and 7

Due: Monday March 18, 2013 by noon

Since this is an extra credit assignment, absolutely NO LATE assignments will be accepted. The solution will be posted before class on this day so it can be discussed in the review session.

  1. (6 pts) Answer the following questions about loop unrolling. Assume the code is scheduled for fast execution on the MIPS pipeline and branches resolve in the MEM stage when answering.
    1. Unroll the following loop code once (i.e. it will now have two iterations is one loop body).
               Loop:  lw  $t1, 0($s0)
                      add $v0, $v0, $t1
                      add $s0, $s0, $s2
                      slt $t0, $s0, $s1
                      beq $t0, $s3, Loop
              
    2. Show the schedule for the original loop.
    3. Show the schedule for the unrolled loop.
  2. (4 pts) Using the code from Question 1, unroll the loop three times so that it contains four iterations in one loop body. Assume the loop always executes a multiple of four times.
    1. Show the unrolled loop.
    2. Schedule the loop on the static multiple-issue version of the MIPS pipeline.
  3. (2 pts) What speedup do you get (in terms of clock cycles) for going from a single pipeline to a static multiple issue pipeline for the code example in Question 1?
  4. (4 pts) There are two ways to iterate through an array: using index numbers and using pointer arithmetic. Compare how the two approaches differ when using loop unrolling and static multiple-issue.
  5. (4 pts) Describe a programming situation which would be well-suited to be adapted to multithreading for use on a multiple issue or multi-core processor. The program should do more than one task concurrently with mutual exclusion between the tasks.