hpca/Problem Set Solutions/ILP/problem03

How many cycles would it take the given set of instructions to execute? Assume that the processor can execute instructions in any order that does not violate data dependencies, that all instructions have 1 cycle latencies, and that the processor execution units can execute any of the instructions in the fragment and the processor can execute four instructions at a time.

ADD R2, R2, R3
LD R4, (R5)
SUB R7, R1, R9
MUL R5, R4, R4
SUB R1, R12, R10
ST (R13), R14
OR R15, R14, R12

Solution:

The code will take two cycles to complete. An example of the order of execution is shown below:

C1:     ADD R1, R2, R3                LD R4, (R5)               ST (R13), R14              OR R15, R14, R12 
C2:     SUB R7, R1, R9                MUL R5, R4, R4            SUB R1, R12, R10

Adapted from the New Jersey Institute of Technology CIS650 lecture notes.