//This is the application that uses your multiplier. //Make sure you rename this to main.cc. #include #include "system.h" #include "altera_avalon_performance_counter.h" #include "conv.h" int testFunction(); int main() { PERF_RESET(PERFORMANCE_COUNTER_0_BASE); PERF_START_MEASURING(PERFORMANCE_COUNTER_0_BASE); int result = 0; result = testFunction(); PERF_STOP_MEASURING(PERFORMANCE_COUNTER_0_BASE); alt_u64 time = 0; time = perf_get_section_time(PERFORMANCE_COUNTER_0_BASE, 1); printf("That was fun, the answer is %d, it took %d cycles\n", result, time); /* Event loop never exits. */ while (1); return 0; } int testFunction(){ int i; int j; int y = 0; PERF_BEGIN(PERFORMANCE_COUNTER_0_BASE,1); for(j = 0; j<1000; j++){ for ( i=0; i < LENGTH; i++) { y = y + ALT_CI_MY_MULT(h[i],x[i]); //name of the mult instruction } } PERF_END(PERFORMANCE_COUNTER_0_BASE,1); return y; }