How to know execution times
Simply ... They were 2 formulas ;)
In fact the overall instruction time will depend of the overlap with the
previous and the following instructions ...
The first formula was in the case that we don't have any effective
address:
CC1+[ CC2 - min(H2,T1) ]+[ CC3 - min(H3,T2)] ...
With:
CCn is the I-Cache column of the instruction n
Tn is the Tail column of the instruction n
Hn is the Head column of the instruction n
min(a,b) is the minimum of a and b
An example:
Code: H T CC
move.l d0,d1 2 0 2
add.l d2,d1 2 0 2
sub.l d3,d2 2 0 2
move.l d1,-(a0) 0 2 4
The execution times will be:
CC1+[CC2-min(H2,T1)]+[CC3-min(H3,T2)]+[CC4-min(H4,T3)]
=2 +[2 -min(2,0) ]+[2 -min(2,0) ]+[4 -min(0,0) ]
=2 + 2 -0 + 2 -0 + 4 -0
=10 cycles
Oh!! What a shame that's exactly the sum of CC!! They were no
overlapped instructions here!!
But imagine we have this:
move.l d0,d1 2 0 2
add.l d2,d1 2 0 2
move.l d1,-(a0) 0 2 4
sub.l d3,d2 2 0 2
This time we will have:
CC1+[CC2-min(H2,T1)]+[CC3-min(H3,T2)]+[CC4-min(H4,T3)]
=2 +[2 -min(2,0) ]+[4 -min(0,0) ]+[2 -min(2,2) ]
=2 + 2 -0 + 4 -0 + 2 -2
=8 cycles
Yeah!! We have win 2 cycles! Notes that the sub after the move take
0 cycles!!
So, as you can see we can win cycles on 030 only in moving some
instructions.
The second formula take in consideration effective address, here it is:
CCea1+ [CCop1 -min(Hop1,Tea1)] + [CCea2 -min(Hea2,Top1)]
+ [CCop2 ...]
+ ...
With:
CCean the effective address time for the instruction-cache-case
CCopn the instruction-cache-case-time for the portion of instruction n
Tean the tail time for the effective address of instruction n
Hean the head time for the effective address of instruction n
Hopn the head time for the operation portion of instruction n
Topn the tail time fot the operation portion of instruction n
min(a,b) the minimum of a and b
It's a little bit more complex than the first one, don't you think ;)
In fact when we have an effective address we must take it as an
instruction ...
Here is an example:
move.l -(a0),d0
We have in reality:
fea -(a0)
move.l EA,d0
So with cycle we will have:
code H T CC
fea -(a0) 2 2 4
move.l EA,d0 0 0 2
Compute now the cycle:
CCea1+ [CCop1 -min(Hop1,Tea1)]
=4 + [2 -min(0 ,2 )]
=4 + 2
=6 cycles
Ok, now you know how compute time cycles ...
|