Re: [hatari-devel] Hatari profiler updates and DSP cycle questions

[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]


Hi Eero,

It is difficult to tell from this code because it is full of unusual instructions and I would expect this kind of code to be executed only once in a normal program. I don't really know what the code is doing. e.g. the 'andi' instruction is immediately before an infinite loop so how could it execute more than once, and produce variance? (it shows a variance of 2)

Special instructions that change the control registers (like omr, sr, ssr) also have funny cycle calculations and I would need to look at the manual - they don't occur very often.

It is much easier to study timings for normal ALU instructions moves since they are usually trivial to estimate and occur everywhere.

D.

On 1 February 2013 11:11, Eero Tamminen <oak@xxxxxxxxxxxxxx> wrote:
Hi,

On perjantai 01 helmikuu 2013, laurent.sallafranque@xxxxxxx wrote:
> I've given a look at the code of this add instruction in dsp_cpu.c
>
> This instruction is one of the hardcoded instr. (see dsp_add_x1_a()
> function)
>
> It can not take any other value than 2 cycles.
....
> Eero, this problem may be for you.

I tried it again, this time by profiling DSP right from the bootup
and I didn't anymore get that thing.  What I got was:
---------------
$ fgrep '%' doomino.txt | grep -C1 ', [^0])'
p:0000  0c0040         (04 cyc)  jmp p:$0040
0.00% (2, 10, 6)
p:001e  0d004b         (04 cyc)  jsr p:$004b
0.00% (1, 4, 0)
p:0040  0500b9         (02 cyc)  movec #$00,sr
0.00% (2, 8, 4)
p:0041  08f4be 000000  (06 cyc)  movep #$000000,x:$fffe
0.00% (1, 6, 0)
--
p:0047  08f4a8 000004  (06 cyc)  movep #$000004,x:$ffe8
0.00% (2, 12, 0)
p:0049  0000ba         (02 cyc)  andi #$00,omr
0.00% (2, 6, 2)
p:004a  0c004a         (04 cyc)  jmp p:$004a
0.00% (10401, 41604, 0)
p:004b  0444bd         (02 cyc)  movec ssl,x0
0.00% (2, 4, 0)
p:004c  04c4b9         (02 cyc)  movec x0,sr
0.00% (2, 8, 4)
p:004d  0aa803         (04 cyc)  bclr #3,x:$ffe8
0.00% (1, 4, 0)
p:004e  0aa804         (04 cyc)  bclr #4,x:$ffe8
0.01% (50148, 300886, 2)
p:004f  05f420 00ffff  (04 cyc)  movec #$00ffff,m0
0.00% (1, 4, 0)
p:0050  00ffff         (02 cyc)  movec #$00ffff,m0
0.00% (152, 912, 0)
p:0051  0450bb         (02 cyc)  movec sp,r0
22.12% (119824922, 479299686, 2)
p:0052  000000         (02 cyc)  nop
0.00% (1, 2, 0)
---------------

My guess is that earlier I had started profiling right on the "add"
instruction and it got wrong cycles just single time because of this
(like you above see address "0000" to have 6 cycles difference).

Are the "movec", "andi" and "bclr" instructions above such that
their cycles can change?


I changed profiler so that it sets prev_pc to 0xFFFF at profile start,
so that cycles information for instruction before profiling starts,
goes there.

After that I got for first instruction:
---
p:0000  0c0040         (04 cyc)  jmp p:$0040
0.00% (2, 10, 2)
---

Does that look better?


        - Eero





Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/