Docsity

CS433: Computer Architecture Homework 3 – Spring 2008, Assignments of Computer Architecture and Organization

Toggle sidebar
bg1
CS433: Computer Architecture – Spring 2008
Homework 3
Total Points: 41 Points
Due Date: Feb 29, 2008 by 5:00 pm – NO LATE SUBMISSIONS
Directions:
•Please read the course information handout for information on groups and
collaboration and other homework policies. Note the exception to the late
submission policy for this homework.
•On top of the first page of your homework solutions, please write your name and
NETID, your partner’s name and NETID, and whether you are a 3-hour or 4-hour
student. On each successive page, write your NETID.
•Please show all work that you used to arrive at your answer. Answers without
justification will not receive credit.
•On Campus Students: please submit the homework electronically to
[email protected], or drop it off in the TA Office, 207 Siebel
•I2CS Students: please submit the homework to [email protected]. Please write your
name, NETID, your partner’s name and NETID on the first page of your
homework solutions.
Material required for problems 1 and 2 is covered in Appendix G (and the lecture notes).
Problem 1 [10 points]
Consider the following format for predicated MIPS instructions:
(pT) ADD R1, R2, R3
where the ADD instruction is predicated on the predicate register pT. Assume a set of 1-bit
predicate registers that are set by a compare instruction of the form:
CMP.ne pT, pF = R8, R0
The example above uses a not equal (.ne) comparison relation to match the code fragment above.
(You can assume the availability of any comparison relation with two operands; i.e. .le for less
than or equal to and .gt for greater than.) The above compare sets the 1-bit predicate registers as
follows:
pT = (R8 != R0)
pF = !(R8!= R0)
So pT is true if R8 is not equal to R0, and pF is the complement of pT.
(a) [4 points] Using the predicated instructions described above, write the three basic blocks of
the following code fragment as a single basic block:
pf3
pf4

Partial preview of the text

Download CS433: Computer Architecture Homework 3 – Spring 2008 and more Assignments Computer Architecture and Organization in PDF only on Docsity!

CS433: Computer Architecture – Spring 2008

Homework 3 Total Points: 41 Points Due Date: Feb 29, 2008 by 5:00 pm – NO LATE SUBMISSIONS Directions:

  • Please read the course information handout for information on groups and collaboration and other homework policies. Note the exception to the late submission policy for this homework.
  • On top of the first page of your homework solutions, please write your name and NETID, your partner’s name and NETID, and whether you are a 3 hour or 4 hour student. On each successive page, write your NETID.
  • Please show all work that you used to arrive at your answer. Answers without justification will not receive credit.
  • On Campus Students: please submit the homework electronically to [email protected], or drop it off in the TA Office, 207 Siebel
  • I2CS Students: please submit the homework to [email protected]. Please write your name, NETID, your partner’s name and NETID on the first page of your homework solutions. Material required for problems 1 and 2 is covered in Appendix G (and the lecture notes). Problem 1 [10 points] Consider the following format for predicated MIPS instructions: (pT) ADD R1, R2, R where the ADD instruction is predicated on the predicate register pT. Assume a set of 1 bit predicate registers that are set by a compare instruction of the form: CMP.ne pT, pF = R8, R The example above uses a not equal (.ne) comparison relation to match the code fragment above. (You can assume the availability of any comparison relation with two operands; i.e. .le for less than or equal to and .gt for greater than.) The above compare sets the 1 bit predicate registers as follows: pT = (R8 != R0) pF = !(R8!= R0) So pT is true if R8 is not equal to R0, and pF is the complement of pT. (a) [4 points] Using the predicated instructions described above, write the three basic blocks of the following code fragment as a single basic block:

SUB R1, R13, R

BLT R1, R4, L

ADDI R2, R2,

SW 0(R7), R

J L

L1: DIV.D F0, F0, F

ADD.D F0, F4, F

S.D 0(R8), F

L2: ...

(b) [6 points] What are all the dependencies in your new basic block? Problem 2 [8 points] The example on page G 30 uses a speculative load instruction to move a load above its guarding branch instruction. Consider the following code: instr.1 ; arbitrary instruction instr.2 ; next instruction in block

... ; intervening instructions BEQZ R1, null ; check for null pointer L.D F2, 0(R1) ; load using pointer ADD.D F4, F0, F2 ; dependent ADD.D ... ... null:... ; handle null pointer (a) [4 points] Write the above code using a speculative load (sL.D) and a speculation check instruction (SPECCK) to preserve exception behavior. Where should the load instruction move to to best hide its potentially long latency? (b) [4 points] Assume a speculation check instruction that branches to recovery code. Write the above code speculating on both the load and the dependent add. Use a speculative load, a nonspeculative add, a check instruction, and the block of recovery code. How should the speculated load and the add be scheduled with respect to each other?

Problem 3 [9 Points]

Consider a system with 4 way set associative cache of 256 KB. The cache line size is 8 words (32 bits per word). The smallest addressable unit is a byte, and memory addresses are 64 bits long. (a) [3 points] Show the division of the bits in a memory address and how they are used to access the cache.

Cache Access Case Cache state change Way prediction entry Tag and valid bits Cache data Desired data is in the predicted way No change Desired data is in the non predicted way Desired data is not in the L2 cache (d) [2 points] For a 1024 KB L2 cache with 64 byte blocks and 8 way set associativity, how many way prediction table entries are needed? (e) [2 points] For an 8 MB L2 cache with 128 byte blocks and 2 way set associativity, how many way prediction table entries are needed? (f) [2 points] What is the difference in the way that the R10000 with only 8K way prediction table entries will support the cache in part d) versus the cache in part e)? Hint: Think about the similarity between a way prediction table and a branch prediction table.