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.

求教6713中跑DSPLIB用时与说明文档不符的问题



我在6713芯片中使用了DSPLIB库的DSPF_sp_dotprod函数,根据文档说明,消耗的机器周期数应该是数据长度的一半,但是不管时软仿还是硬仿,测量得到的机器周期数都不对。

测试程序如下:



/* * main.c * * Created on: 2016-11-4 * Author: YuHaoxin */ #include "DSPF_sp_dotprod.h" #include "std.h" #include "mem.h" #include "clk.h" #include <stdio.h> #include "tsk.h" void tsk(void){ const int len=2048; const loop=128; float *x=MEM_calloc(0,len*sizeof(float),0x8); float *y=MEM_calloc(0,len*sizeof(float),0x16); float z; LgUns start,stop,used; int n; start=CLK_gethtime(); for(n=0;n<loop;n++){ DSPF_sp_dotprod(x,y,len); } stop=CLK_gethtime(); used=(stop-start)*CLK_cpuCyclesPerHtime(); printf("%u cycs per loop\n",used/loop); } int main(void){ TSK_create((Fxn)tsk,NULL); return 0; }

代码、x和y指向的地址都在IRAM内,L2 cache已关闭。
软仿时输出
3647 cycs per loop
硬仿时机器周期计数大概是4000左右,而根据官方文档,应当是1000左右,请问是我哪里弄错了吗?