DOC PREVIEW
U of I CS 232 - Forwarding, Stalling and Hazards

This preview shows page 1 out of 2 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 2 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS232 Spring 2006 Forwarding, Stalling and Hazards October 16, 2006Problem 1: Loop unrolling is a code optimization technique to sp e ed up loops. The code onthe right is functionally equivalent to the code on the left (for even values of $a1).loop: loop:lw $s0, 0($a0) lw $s0, 0($a0)addi $s0, $s0, 100 addi $s0, $s0, 100sw $s0, 0($a0) sw $s0, 0($a0)addi $a0, $a0, 4 lw $s0, 4($a0)addi $a1, $a1, -1 addi $s0, $s0, 100bne $a1, $0, loop sw $s0, 4($a0)addi $a0, $a0, 8addi $a1, $a1, -2bne $a1, $0, loopAssume that full forwarding is implemented, and that branches are resolved in the ID stageand always predicted taken. The initial value of $a1 = 4.(a) Fill the pipeline diagram for iteration 1 of the left code. Include the lw of iteration 2.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16(b) Fill the pipeline diagram for only the first iteration of the right code.1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16(c) Calculate the total number of cycle s required for each piece of code.1CS232 Spring 2006 Forwarding, Stalling and Hazards October 16, 2006Problem 2: Software PipeliningSoftware Pipelining is another code optimization technique to reduce pipeline stalls. The givencode can be rewritten as follows:li $t1, 1lw $s0, 0($a0)loop:addi $s0, $s0, 100sw $s0, 0($a0)lw $s0, 4($a0)addi $a0, $a0, 4addi $a1, $a1, -1bne $a1, $t1, loopaddi $s0, $s0, 100sw $s0, 4($a0)Assume that full forwarding is implemented, and that branches are resolved in the ID stageand always predicted taken. The initial value of $a1 = 4.(a) Fill the pipeline diagram for the first iteration of the loop (don’t include lw):1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16(b) Calculate the number of cycles required for the code to exec ute.(c) Suppose branches are predicted not taken. How many cycles does the code require


View Full Document

U of I CS 232 - Forwarding, Stalling and Hazards

Documents in this Course
Goal

Goal

2 pages

Exam 1

Exam 1

5 pages

Exam 1

Exam 1

6 pages

Exam 2

Exam 2

6 pages

Exam 1

Exam 1

5 pages

Load more
Download Forwarding, Stalling and Hazards
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Forwarding, Stalling and Hazards and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Forwarding, Stalling and Hazards 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?