Forum Discussion
Altera_Forum
Honored Contributor
15 years agoA couple of suggestions.
1) don't force a short int for NIOS. Compilers are free to choose a number of different int sizes based on the 'natural' size of the int for the targeted processor. Short int on the ARM is probably selecting the ARM register size, whereas the NIOS is having to do extra work to mask each access to 16-bits rather than the 32-bit register size. Just use a plain int and you will get each processors 'natural' register size. 2) Try forcing a 32-bit int for each processor and see what happens. uint32_t for NIOS, and the same for ARM (or maybe long int if stdint is not available for the ARM compiler). The results might be interesting. 3) for fastest counting, trywhile(wait--); // yes, this is valid C code.
// Test is for NON-zero, not true/falseinstead of all that extra code. It's easier for a compiler to optimize.