question about Virtex-II Pro program execution time

Hi,

I'm working with a virtex-ii pro board. I don't have previous embedded system experience, so I have some wonders about the execution time I measured. I use XTime_GetTime() function in xtime_l.h to retrieve the execution time of the part I want to take the measurement. The following is a simple example I experimented.

// find overhead XTime_GetTime(&start_time); XTime_GetTime(&stop_time); exeTime = stop_time - start_time; printf("\n%llu cycles\n", exeTime );

XTime_GetTime(&start_time); printf("\nstart: %llu\n",start_time); for(i=0; i

Reply to
Eric
Loading thread data ...

...

Actually, the stop_time printf isn't included since it is after XTime_GetTime.

The serial io has a busy wait in it. Perhaps it is taking extra time to write to the serial port.

Are you running from sdram? Are caches on? sdram is very slow and caching can make a huge difference on it.

Are you compiling -O3? Unoptimized code means more slow sdram accesses.

Alan Nishioka

Reply to
Alan Nishioka

Eric,

Alan is most likely on the right track. The program is slowed down by printing to the Uart.

Looking at the numbers I'd say the speed of your UART is 115200 baud. Taking the start and stop bits into account it takes 10 bits to transfer a character resulting in 11520 characters per second maximum throughput on the UART. The program prints 15 characters for the start message, i.e. the program has to wait 14 times before it can print the next character. Thus, the number of cycles it takes to print the start message can be calculated by:

14 characters / 11520 characters per second * 300000000 cycles per second = 364583 cycles

That's pretty close to your measured numbers.

To improve the situation you can:

- use a UART with a buffer (ie. 16550). The hardware will buffer up the characters and send them at the appropriate time. Works for short strings.

- use an interrupt driven UART, ideally combined with a buffer. Software and hardware will buffer the characters and send them at the appropriate time. The buffer in the UART helps to limit to number of interrupts.

- Peter

Eric wrote:

Reply to
Peter Ryser

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.