Docsity

Practice Set Problem - Computer System Organization - Fall 2005 | CS 433, Assignments of Computer Architecture and Organization

Toggle sidebar
bg1
CS433g: Computer System Organization – Fall 2005
Practice Set for Chapter 4
Problem 1
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.
• Using the predicated instructions described above, write the three basic blocks of the
following code fragment as a single basic block:
SUB R1, R13, R14
BNEZ R1, L1
ADDI R2, R2, #1
SW 0(R7), R2
J L2
L1: MULT.D F0, F0, F2
ADD.D F0, F4, F2
S.D 0(R8), F0
L2: ...
• What are all the dependencies in your new basic block?
pf2

Partial preview of the text

Download Practice Set Problem - Computer System Organization - Fall 2005 | CS 433 and more Assignments Computer Architecture and Organization in PDF only on Docsity!

CS433g: Computer System Organization – Fall 2005 Practice Set for Chapter 4

Problem 1

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.

  • 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

BNEZ R1, L

ADDI R2, R2,

SW 0(R7), R

J L

L1: MULT.D F0, F0, F

ADD.D F0, F4, F

S.D 0(R8), F

L2: ...

  • What are all the dependencies in your new basic block?

Problem 2

Consider the following code excerpt from a larger set of instructions:

loop: SW 7(R1), R2 (1) ADD R1, R1, #8 (2) LW R2, 7(R1) (3) ADD R4, R2, R1 (4) SD 200(R7), F2 (5) BEZ R4, loop (6) SW 7(R4), R5 (7) . . .

List all data dependences between the above instructions that a compiler would find. Assume that this code fragment is a portion of a larger piece of code, but the instructions that are not shown do not create additional data dependences.

Is it possible to reorder any instruction pairs that the compiler identifies as dependent?

What additional information is necessary to determine this? For this

part, disregard any instructions that come in between the two dependent instructions.

Problem 3

Solve parts (a) and (b) of Exercise 4.23 in the book.