|
mov r0, #0
Loop: cmp r0, #1000 <----+
beq Done |
instr 1 | 100 instructions
instr 2 |
... | Each instruction is store
add r0, r0, #1 | in 1 memory location (for simplicity)
b Loop <----+
Done: ...
|
The loop is executed for 1000 times
|
# instructions fetched = 1000 × 100 Time needed to fetch 1 instr = 50 nsec Total time needed to fetch insr = 50 × 1000 × 100 = 5,000,000 nsec Avg time = 5,000,000 / 100000 = 50 nsec per instruction |
First time throught the loop: # instructions fetched = 1 × 100 Time needed to fetch 1 instr = 50 nsec (from memory) Total time needed = 50 × 1 × 100 = 5000 nsec |
|
|
|
|