下面这段程序中,在ccs4.12下的软件模拟器中和在dsp开发板上测出的时钟周期是不同的,为什么呢?谢谢!
#include <stdio.h>
#include<c6x.h>
unsigned int t_start_l,t_start_h;
unsigned int t_stop_l,t_stop_h;
unsigned int t_overhead_l,t_overhead_h;
int main(int argc, char *argv[])
{
int i;
TSCL = 0;
TSCH = 0;
t_start_l = TSCL;
t_start_h = TSCH;
/*
for (i=0; i<100000000; i++)
{
;
}
*/
/*此处是我想计时的代码,比较长,这里没有列出
*/
t_stop_l = TSCL;
t_stop_h = TSCH;
t_overhead_l = t_stop_l - t_start_l;
t_overhead_h = t_stop_h - t_start_h;
printf("done, t_overhead_h = 0x%08x\tt_overhead_l=0x%08x\n",t_overhead_h,t_overhead_l);
}
|