Consider the following code:


MOV r0,#Vector ;point to Vector
MOV r2,#10 ;loop count
Loop LDR r1,[r0] ;Repeat: get element
SUBS r2,r2,#1 ;decrement loop count and set Z flag
MUL r1,r1,#5
STR r1,[r0] ;save result
ADD r0,r0,#4 ;point to next
BNE Loop ;until all done (branch on Z flag).


Suppose this ARM?like code is executed on a 4?stage pipeline with internal forwarding. The load instruction has
one cycle penalty and the multiply instruction introduces two stall cycles into the execute phase. Assume the
taken branch has no penalty.
a. How many instructions are executed by this code?
b. Draw a timing diagram for the first iteration showing stalls. Assume internal forwarding.
c. How many cycles does it take to execute this code?


a. There are two pre?loop instructions and a 6?instruction loop repeated 10 times. Total = 2 + 10 × 6 = 62.

b. The following shows the code of one pass round the loop



c. It takes 11 cycles to make one pass round the loop. However, it takes 14 cycles to execute all the instructions

in a loop fully. The total number of cycles is 2 (preloop) + 10 × 11 + 3 (post loop) = 115.

Computer Science & Information Technology

You might also like to view...

Which port is the most common port used to connect input and output devices?

A) Parallel B) Universal serial bus (USB) C) FireWire D) Ethernet

Computer Science & Information Technology

A splash screen like the one in the accompanying figure can be used to make a program appear to load faster than it actually does.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

Many authorities suggest that corporate and government ________ pose the greatest risk to identity fraud with varying motivations and unintentional facilitation

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

The number of branches associated with a node is the _____ of the node.

A. degree B. count C. factor D. size

Computer Science & Information Technology