This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

测试一段代码在6678上运行时间,感觉不切实际的慢,请专家帮忙看看



我用的6678评估板,感觉DSP跑的很慢,请问是怎么回事啊:

我一个函数在windows上跑需要大概100ms,但是到DSP上至少运行了10s才完成,请问是怎么回事呢。

于是我在main函数里加了一段代码测试:

unsigned long long gu64_count1 = 0;

unsigned long long gu64_count2 = 0;

unsigned long long gu64_count_between = 0;

int main()

{

unsigned int i,j;

gu64_count1 = 0;

gu64_count1 = CSL_tscRead();

for(i=0;i<10000;i++)

for(j=0;j<10000;j++)

{

gu64_count2 = CSL_tscRead();

gu64_count_between = (gu64_count2 - gu64_count1);

}

gu64_count_between = gu64_count_between;

       BIOS_start ();

}

我在倒数第二句打了断点,用秒表计时发现要48秒才能运行到倒数第二句的断点。

此时我看到gu64_count1 为4838573

         gu64_count2 为310121296

相差了   305282723 。如果认为CPU时钟频率是1G,那么应该是这么多纳秒,也就是305ms。  跟48秒钟的实际运行实际完全对不上啊?

请问专家是怎么回事呢? 另外我看了些PLLM寄存器  0x02310110地址的值为:0x00000013  应该是外部时钟50M*20 是1G啊

请帮忙看看,谢谢

  • 你好,测试bencmark时请根据cycle 数统计,不要用秒表来测,如果确实和实际运行时间相差很大,建议检查下主频和时钟。

    从你的代码来看,怎么for循环里也在做cycle相减操作啊,需要实际测试的程序是什么?

    另外 提到在window下测试,请问你是用cycle accurate simulator吗?

  • Thomas Yang

    谢谢您的回复,您的回复对我很有帮助,谢谢

    找到了原因是gel初始化的问题。

    由于bootmode选的是IBL NOR boot on image 0 (default) ,所以在调试的时候:

    下载完out之后打印如下:

    C66xx_0: GEL Output: Setup_Memory_Map...

    C66xx_0: GEL Output: Setup_Memory_Map... Done.

    C66xx_0: GEL Output:

    Connecting Target...

    C66xx_0: GEL Output: DSP core #0

    C66xx_0: GEL Output: No initialization performed since bootmode = 0x00000005

    C66xx_0: GEL Output: You can manually initialize with GlobalDefaultSetup

    应该是gel没有初始化PLL等设置,我的代码里也没有相应初始化,所以可能有问题。

    另外,您的两个问题

    1 for循环里的只是测试,cycle相减没有什么意义

    2 我说的windows上是指把算法弄到VC里跑,然后QueryPerformanceCounter计时。

     

    另外我还想请教两个问题:

    1 我想在代码里手动初始化CPU,PLL相关设置,有C语言相关代码吗?