Hi,
Through ruuning a simple test code , I wonder the compute speed of AM3359 (720MHZmax) ,
1.Test condition: CCS debug & no-os & starterware example,which located in
C:\ti\AM335X_StarterWare_02_00_00_07\build\armv7a\cgt_ccs\am335x\evmskAM335x\rtc
2. Test example:
First: unsigned int var
for(i=0;i<1000;i++)
{
data += i;
}
Second: float or double var
float testTC17961(float i)
{ return (1*i+2*i*i + 3*i*i*i + 4*i*i*i*i + 5*i*i*i*i*i)/(i*i*i*i+1); }
float testTC17962(float i)
{ return (5*i+2*i*i + 4*i*i*i + 3*i*i*i*i + 2*i*i*i*i*i)/(i*i*i*i+1); }
for( i=0;i<1000;i++)
{
re7961 = re7961 + testTC17961(i);
re7962 = re7962 + testTC17962(i);
}
3. Time method:
through TIMER2 TCRR count value ,i get the time data
4. Test program
edit the rtcClock.cas follows
a: add header
#include "dmtimer.h"
#include "gpio_v2.h"
b: add marco
#define TIMER_INITIAL_COUNT (0x0u)
#define TIMER_RLD_COUNT (0x0)
#define STM_TIM1 HWREG(SOC_DMTIMER_2_REGS + DMTIMER_TCRR)
c: add timer2 setup function as follows,
static void DMTimerSetUp(void)
{
/* Load the counter with the initial count value */
DMTimerCounterSet(SOC_DMTIMER_2_REGS, TIMER_INITIAL_COUNT);
/* Load the load register with the reload count value */
DMTimerReloadSet(SOC_DMTIMER_2_REGS, TIMER_RLD_COUNT);
/* Configure the DMTimer for Auto-reload and compare mode */ DMTimerModeConfigure(SOC_DMTIMER_2_REGS, DMTIMER_AUTORLD_NOCMP_ENABLE);
}
d: modify old main as follow
unsigned int SaveTime1,SaveTime2,SaveTime3,i,data; //global var
float re7961,re7962;
/* ** Main function. */ int main(void)
{ unsigned int userCalendar = 0;
unsigned int userTime = 0;
SaveTime1=SaveTime2=SaveTime3=i=data=0;
/* Configure and enable the MMU. */
MMUConfigAndEnable();
/* Enable all levels of Cache. */
CacheEnable(CACHE_ALL);
DMTimer2ModuleClkConfig(); //add myself
// IntMasterIRQEnable();
DMTimerSetUp();
DMTimerEnable(SOC_DMTIMER_2_REGS); //add myself
SaveTime1 = SaveTime2 =SaveTime3 = re7961 = re7962 = 0; //add myself
while(1)
{
SaveTime1 = STM_TIM1;
/* for(i=0;i<1000;i++)
{
data += i; }*/
for( i=0;i<1000;i++)
{
re7961 = re7961 + testTC17961(i);
re7962 = re7962 + testTC17962(i);
}
SaveTime2 = STM_TIM1;
SaveTime3 = (SaveTime2 - SaveTime1)*0.04;
//0.04 is my timer clk 1/25MHZ is 0.04us, so the SaveTime3 is compute time
//maybe yours is different ,be carefully
}
5 Test result
test var int i ,the time is 5us, and float var is 4500us, double var is 9000us.
So ,i just ... i wonder if somebody could make the same test , i can make a comparation,
or tell me if the test result is ok? i feel the float var's time is too long
Could anyone help me to make the test ?
thanks for ahead.