//! The main function int main(int argc, char *argv[]) { unsigned int cycle_count; // Switch to external Oscillator 0. pm_switch_to_osc0(&AVR32_PM, FOSC0, OSC0_STARTUP); // Initialize the DSP debug module dsp_debug_initialization(FOSC0); // Get the actual cycle count cycle_count = Get_sys_count(); // Perform a convolution dsp32_vect_conv(vect1, vect2, VECT2_SIZE, vect3, VECT3_SIZE); // Calculate the number of cycles cycle_count = Get_sys_count() - cycle_count; // Print the number of cycles dsp32_debug_printf("Cycle count: %d\n", cycle_count); // Print the output signal dsp32_debug_print_vect(vect1, VECT2_SIZE + VECT3_SIZE - 1); while(1); }
/** * \brief Function to perform Vector Convolution * \param size Pointer to store output Vector Size */ int convolution(int *size) { int cycle_count; // Conditions CHECK_CONDITIONS(VECT1_SIZE >= (VECT2_SIZE + VECT3_SIZE - 1)) CHECK_CONDITIONS(VECT2_SIZE >= 8) CHECK_CONDITIONS(VECT3_SIZE >= 8) if (VECT2_SIZE > VECT3_SIZE) CHECK_CONDITIONS(VECT1_SIZE >= (VECT2_SIZE + 2*VECT3_SIZE - 2)) else CHECK_CONDITIONS(VECT1_SIZE >= (VECT3_SIZE + 2*VECT2_SIZE - 2)) *size = VECT2_SIZE + VECT3_SIZE - 1; cycle_count = Get_sys_count(); // Perform a convolution dsp32_vect_conv(vect1, vect2, VECT2_SIZE, vect3, VECT3_SIZE); return Get_sys_count() - cycle_count; }