Wednesday, April 20, 2016

Pre-Filter C Program (without CSV File read) Needed for Vivado HLS

#include <stdio.h>

int main(){
Pre();

}

int Pre(){


/*Pre-Filter*/
double time[502] = {-2.7e-07,-2.68e-07,-2.66e-07,-2.64e-07,-2.62e-07,-2.6e-07,-2.58e-07,-2.56e-07,-2.54e-07,-2.52e-07,-2.5e-07,-2.48e-07,-2.46e-07,-2.44e-07,-2.42e-07,-2.4e-07,-2.38e-07,-2.36e-07,-2.34e-07,-2.32e-07,-2.3e-07,-2.28e-07,-2.26e-07,-2.24e-07,-2.22e-07,-2.2e-07,-2.18e-07,-2.16e-07,-2.14e-07,-2.12e-07,-2.1e-07,-2.08e-07,-2.06e-07,-2.04e-07,-2.02e-07,-2e-07,-1.98e-07,-1.96e-07,-1.94e-07,-1.92e-07,-1.9e-07,-1.88e-07,-1.86e-07,-1.84e-07,-1.82e-07,-1.8e-07,-1.78e-07,-1.76e-07,-1.74e-07,-1.72e-07,-1.7e-07,-1.68e-07,-1.66e-07,-1.64e-07,-1.62e-07,-1.6e-07,-1.58e-07,-1.56e-07,-1.54e-07,-1.52e-07,-1.5e-07,-1.48e-07,-1.46e-07,-1.44e-07,-1.42e-07,-1.4e-07,-1.38e-07,-1.36e-07,-1.34e-07,-1.32e-07,-1.3e-07,-1.28e-07,-1.26e-07,-1.24e-07,-1.22e-07,-1.2e-07,-1.18e-07,-1.16e-07,-1.14e-07,-1.12e-07,-1.1e-07,-1.08e-07,-1.06e-07,-1.04e-07,-1.02e-07,-1e-07,-9.84e-08,-9.64e-08,-9.44e-08,-9.24e-08,-9.04e-08,-8.84e-08,-8.64e-08,-8.44e-08,-8.24e-08,-8.04e-08,-7.84e-08,-7.64e-08,-7.44e-08,-7.24e-08,-7.04e-08,-6.84e-08,-6.64e-08,-6.44e-08,-6.24e-08,-6.04e-08,-5.84e-08,-5.64e-08,-5.44e-08,-5.24e-08,-5.04e-08,-4.84e-08,-4.64e-08,-4.44e-08,-4.24e-08,-4.04e-08,-3.84e-08,-3.64e-08,-3.44e-08,-3.24e-08,-3.04e-08,-2.84e-08,-2.64e-08,-2.44e-08,-2.24e-08,-2.04e-08,-1.84e-08,-1.64e-08,-1.44e-08,-1.24e-08,-1.04e-08,-8.37e-09,-6.37e-09,-4.37e-09,-2.37e-09,-3.69e-10,1.63e-09,3.63e-09,5.63e-09,7.63e-09,9.63e-09,1.16e-08,1.36e-08,1.56e-08,1.76e-08,1.96e-08,2.16e-08,2.36e-08,2.56e-08,2.76e-08,2.96e-08,3.16e-08,3.36e-08,3.56e-08,3.76e-08,3.96e-08,4.16e-08,4.36e-08,4.56e-08,4.76e-08,4.96e-08,5.16e-08,5.36e-08,5.56e-08,5.76e-08,5.96e-08,6.16e-08,6.36e-08,6.56e-08,6.76e-08,6.96e-08,7.16e-08,7.36e-08,7.56e-08,7.76e-08,7.96e-08,8.16e-08,8.36e-08,8.56e-08,8.76e-08,8.96e-08,9.16e-08,9.36e-08,9.56e-08,9.76e-08,9.96e-08,1.02e-07,1.04e-07,1.06e-07,1.08e-07,1.1e-07,1.12e-07,1.14e-07,1.16e-07,1.18e-07,1.2e-07,1.22e-07,1.24e-07,1.26e-07,1.28e-07,1.3e-07,1.32e-07,1.34e-07,1.36e-07,1.38e-07,1.4e-07,1.42e-07,1.44e-07,1.46e-07,1.48e-07,1.5e-07,1.52e-07,1.54e-07,1.56e-07,1.58e-07,1.6e-07,1.62e-07,1.64e-07,1.66e-07,1.68e-07,1.7e-07,1.72e-07,1.74e-07,1.76e-07,1.78e-07,1.8e-07,1.82e-07,1.84e-07,1.86e-07,1.88e-07,1.9e-07,1.92e-07,1.94e-07,1.96e-07,1.98e-07,2e-07,2.02e-07,2.04e-07,2.06e-07,2.08e-07,2.1e-07,2.12e-07,2.14e-07,2.16e-07,2.18e-07,2.2e-07,2.22e-07,2.24e-07,2.26e-07,2.28e-07,2.3e-07,2.32e-07,2.34e-07,2.36e-07,2.38e-07,2.4e-07,2.42e-07,2.44e-07,2.46e-07,2.48e-07,2.5e-07,2.52e-07,2.54e-07,2.56e-07,2.58e-07,2.6e-07,2.62e-07,2.64e-07,2.66e-07,2.68e-07,2.7e-07,2.72e-07,2.74e-07,2.76e-07,2.78e-07,2.8e-07,2.82e-07,2.84e-07,2.86e-07,2.88e-07,2.9e-07,2.92e-07,2.94e-07,2.96e-07,2.98e-07,3e-07,3.02e-07,3.04e-07,3.06e-07,3.08e-07,3.1e-07,3.12e-07,3.14e-07,3.16e-07,3.18e-07,3.2e-07,3.22e-07,3.24e-07,3.26e-07,3.28e-07,3.3e-07,3.32e-07,3.34e-07,3.36e-07,3.38e-07,3.4e-07,3.42e-07,3.44e-07,3.46e-07,3.48e-07,3.5e-07,3.52e-07,3.54e-07,3.56e-07,3.58e-07,3.6e-07,3.62e-07,3.64e-07,3.66e-07,3.68e-07,3.7e-07,3.72e-07,3.74e-07,3.76e-07,3.78e-07,3.8e-07,3.82e-07,3.84e-07,3.86e-07,3.88e-07,3.9e-07,3.92e-07,3.94e-07,3.96e-07,3.98e-07,4e-07,4.02e-07,4.04e-07,4.06e-07,4.08e-07,4.1e-07,4.12e-07,4.14e-07,4.16e-07,4.18e-07,4.2e-07,4.22e-07,4.24e-07,4.26e-07,4.28e-07,4.3e-07,4.32e-07,4.34e-07,4.36e-07,4.38e-07,4.4e-07,4.42e-07,4.44e-07,4.46e-07,4.48e-07,4.5e-07,4.52e-07,4.54e-07,4.56e-07,4.58e-07,4.6e-07,4.62e-07,4.64e-07,4.66e-07,4.68e-07,4.7e-07,4.72e-07,4.74e-07,4.76e-07,4.78e-07,4.8e-07,4.82e-07,4.84e-07,4.86e-07,4.88e-07,4.9e-07,4.92e-07,4.94e-07,4.96e-07,4.98e-07,5e-07,5.02e-07,5.04e-07,5.06e-07,5.08e-07,5.1e-07,5.12e-07,5.14e-07,5.16e-07,5.18e-07,5.2e-07,5.22e-07,5.24e-07,5.26e-07,5.28e-07,5.3e-07,5.32e-07,5.34e-07,5.36e-07,5.38e-07,5.4e-07,5.42e-07,5.44e-07,5.46e-07,5.48e-07,5.5e-07,5.52e-07,5.54e-07,5.56e-07,5.58e-07,5.6e-07,5.62e-07,5.64e-07,5.66e-07,5.68e-07,5.7e-07,5.72e-07,5.74e-07,5.76e-07,5.78e-07,5.8e-07,5.82e-07,5.84e-07,5.86e-07,5.88e-07,5.9e-07,5.92e-07,5.94e-07,5.96e-07,5.98e-07,6e-07,6.02e-07,6.04e-07,6.06e-07,6.08e-07,6.1e-07,6.12e-07,6.14e-07,6.16e-07,6.18e-07,6.2e-07,6.22e-07,6.24e-07,6.26e-07,6.28e-07,6.3e-07,6.32e-07,6.34e-07,6.36e-07,6.38e-07,6.4e-07,6.42e-07,6.44e-07,6.46e-07,6.48e-07,6.5e-07,6.52e-07,6.54e-07,6.56e-07,6.58e-07,6.6e-07,6.62e-07,6.64e-07,6.66e-07,6.68e-07,6.7e-07,6.72e-07,6.74e-07,6.76e-07,6.78e-07,6.8e-07,6.82e-07,6.84e-07,6.86e-07,6.88e-07,6.9e-07,6.92e-07,6.94e-07,6.96e-07,6.98e-07,7e-07,7.02e-07,7.04e-07,7.06e-07,7.08e-07,7.1e-07,7.12e-07,7.14e-07,7.16e-07,7.18e-07,7.2e-07,7.22e-07,7.24e-07,7.26e-07,7.28e-07,7.3e-07,7.32e-07
};
double amp[502] = {-0.00650676,-0.00330688,-0.00650676,-0.00330688,-0.00490682,-0.00330688,-0.00490682,-0.00490682,-0.00330688,-0.00330688,-0.00650676,-0.00490682,-0.00330688,-0.00330688,-0.00330688,-0.00650676,-0.00170694,-0.00330688,-0.00490682,-0.00490682,-0.00170694,-0.00490682,-0.00650676,-0.00650676,-0.00490682,-0.000107004,-0.00170694,-0.00330688,-0.00650676,-0.00490682,-0.00170694,-0.00330688,-0.00650676,-0.00170694,-0.00170694,-0.00170694,-0.00330688,-0.00330688,-0.00330688,-0.00490682,-0.00490682,-0.00490682,-0.00490682,-0.00170694,-0.00490682,-0.00650676,-0.00490682,-0.00330688,-0.00650676,-0.000107004,-0.000107004,-0.00650676,-0.00330688,-0.00330688,-0.0081067,-0.00650676,-0.00490682,-0.00490682,-0.00330688,-0.00170694,-0.00650676,-0.000107004,-0.00650676,-0.0081067,-0.00650676,-0.00490682,-0.00650676,-0.00490682,-0.00490682,-0.00330688,-0.00490682,-0.00650676,-0.00650676,-0.0081067,-0.00490682,-0.00490682,-0.00490682,-0.00330688,-0.00330688,-0.00650676,-0.0081067,-0.00650676,-0.00490682,-0.00330688,-0.000107004,-0.00330688,-0.00490682,0.00149293,-0.00490682,-0.00330688,-0.00650676,-0.000107004,-0.00330688,-0.00650676,-0.00170694,-0.00490682,-0.00330688,-0.00330688,-0.00330688,-0.00490682,-0.00330688,-0.00490682,-0.00330688,-0.00330688,-0.00650676,-0.00650676,-0.00330688,-0.00330688,-0.00330688,-0.00170694,-0.000107004,-0.00330688,-0.00650676,-0.00490682,-0.00490682,-0.00490682,-0.000107004,-0.00170694,-0.00490682,-0.00490682,-0.0081067,-0.00650676,-0.00650676,-0.0129065,-0.00970664,-0.0129065,-0.0161064,-0.0177063,-0.0193063,-0.0225061,-0.025706,-0.0321058,-0.025706,-0.0337057,-0.0337057,-0.0369056,-0.0353057,-0.0385055,-0.0385055,-0.0433053,-0.0433053,-0.0465052,-0.0481052,-0.051305,-0.051305,-0.0545049,-0.051305,-0.052905,-0.0561049,-0.0545049,-0.0545049,-0.0609047,-0.0609047,-0.0545049,-0.0593047,-0.0593047,-0.0593047,-0.0609047,-0.0577048,-0.0561049,-0.0657045,-0.0561049,-0.0609047,-0.0609047,-0.0609047,-0.0609047,-0.0625046,-0.0609047,-0.0609047,-0.0641045,-0.0577048,-0.0609047,-0.0609047,-0.0609047,-0.0609047,-0.0625046,-0.0577048,-0.0609047,-0.0625046,-0.0593047,-0.0561049,-0.0577048,-0.0561049,-0.051305,-0.0577048,-0.0545049,-0.0577048,-0.0593047,-0.0577048,-0.0545049,-0.052905,-0.051305,-0.0593047,-0.0481052,-0.052905,-0.0497051,-0.052905,-0.051305,-0.0481052,-0.0497051,-0.0481052,-0.0481052,-0.0497051,-0.0433053,-0.0417054,-0.0465052,-0.0449053,-0.0417054,-0.0417054,-0.0417054,-0.0385055,-0.0417054,-0.0433053,-0.0385055,-0.0401055,-0.0353057,-0.0385055,-0.0433053,-0.0401055,-0.0337057,-0.0337057,-0.027306,-0.0337057,-0.0337057,-0.0289059,-0.0305058,-0.0321058,-0.0305058,-0.0289059,-0.027306,-0.027306,-0.025706,-0.0289059,-0.027306,-0.0289059,-0.0241061,-0.0209062,-0.025706,-0.0241061,-0.0241061,-0.027306,-0.0225061,-0.0241061,-0.0225061,-0.0209062,-0.0209062,-0.0209062,-0.0225061,-0.0209062,-0.0193063,-0.0177063,-0.0177063,-0.0177063,-0.0177063,-0.0209062,-0.0161064,-0.0177063,-0.0161064,-0.0177063,-0.0161064,-0.0161064,-0.0177063,-0.0145065,-0.0129065,-0.0161064,-0.0129065,-0.0113066,-0.0113066,-0.0129065,-0.0113066,-0.0129065,-0.0129065,-0.0129065,-0.0113066,-0.0129065,-0.0081067,-0.0129065,-0.0113066,-0.0081067,-0.0129065,-0.0113066,-0.0113066,-0.0113066,-0.0113066,-0.00970664,-0.0113066,-0.0081067,-0.0081067,-0.0113066,-0.0081067,-0.00650676,-0.0081067,-0.00970664,-0.0081067,-0.00650676,-0.00650676,-0.0081067,-0.0081067,-0.0081067,-0.0081067,-0.00970664,-0.00650676,-0.00330688,-0.00970664,-0.00490682,-0.00490682,-0.00490682,-0.00650676,-0.00490682,-0.00170694,-0.0081067,-0.00170694,-0.0081067,-0.00970664,-0.00650676,-0.00650676,-0.00330688,-0.00170694,-0.0081067,-0.00650676,-0.00490682,-0.00650676,-0.00490682,-0.00650676,-0.00650676,-0.0081067,-0.00330688,-0.00970664,-0.00650676,-0.00490682,-0.00650676,-0.00490682,-0.00330688,-0.00490682,-0.00330688,-0.00490682,-0.00650676,-0.000107004,-0.00490682,-0.00650676,-0.00650676,-0.0081067,-0.00490682,-0.00650676,-0.00650676,-0.00170694,-0.00490682,-0.00330688,-0.00490682,-0.00490682,-0.00330688,-0.0081067,-0.00490682,-0.00650676,-0.00330688,-0.00490682,-0.00490682,-0.00330688,-0.00330688,-0.00490682,-0.0081067,-0.00330688,-0.00330688,-0.00490682,-0.00490682,-0.0081067,-0.00170694,-0.00330688,-0.00490682,-0.00330688,-0.00490682,-0.00490682,-0.00650676,-0.00490682,-0.00490682,-0.00490682,-0.00490682,-0.00330688,-0.00650676,-0.00330688,-0.00490682,-0.00330688,-0.00330688,-0.00490682,-0.0081067,-0.00650676,-0.00650676,-0.0081067,-0.00970664,-0.00490682,-0.00650676,-0.00170694,-0.00170694,-0.00170694,-0.00650676,-0.00490682,-0.0081067,-0.00490682,-0.00170694,-0.00330688,-0.00650676,-0.00330688,-0.00650676,-0.00330688,-0.00490682,-0.00490682,-0.00650676,-0.00490682,-0.00970664,-0.00330688,-0.00650676,-0.00490682,-0.00650676,-0.00330688,-0.00490682,-0.00650676,-0.00650676,-0.00490682,-0.00650676,-0.00330688,-0.00170694,-0.00650676,-0.00330688,-0.00650676,-0.00490682,-0.00490682,-0.00490682,-0.00330688,-0.00330688,-0.00490682,-0.00490682,-0.00330688,-0.00650676,-0.00490682,-0.000107004,-0.0081067,-0.00650676,-0.00490682,-0.00650676,-0.00490682,-0.00330688,-0.00650676,-0.0081067,-0.00330688,-0.0081067,-0.00650676,-0.00490682,-0.00490682,-0.00490682,-0.00650676,0.00149293,-0.00490682,-0.00490682,-0.00650676,-0.00490682,-0.00170694,-0.00650676,-0.00650676,-0.00650676,-0.00490682,-0.00170694,-0.00330688,-0.00490682,-0.00170694,-0.00650676,-0.0081067,-0.00490682,-0.00330688,-0.00970664,-0.00970664,-0.000107004,-0.00650676,-0.00490682,-0.00330688,-0.00490682,-0.00650676,-0.00490682,-0.0081067,-0.0081067,-0.00650676,-0.0081067,-0.00650676,-0.00650676,-0.0081067,-0.00650676,-0.00490682,-0.0081067,-0.00490682,-0.0081067,-0.00970664,-0.00490682,-0.00490682,-0.00970664,-0.00650676,-0.00170694,-0.00650676,-0.00490682,-0.00650676,-0.00650676,-0.00170694,-0.00330688,-0.0081067
};
int i=0;
int count = 0;
int time_size = 502;
/*int amp_size = 6;
printf("FIRST Pre - Filtered Time = %e \n", time[0]);
double time [] -= float time[0];*/
printf("Non-Filtered TIME AND AMPLITUDE: \n");
Non: for(i = 0; i < time_size; i++){
printf("Non - Pre - Filtered Time = %e \t", time[i]);
printf("Non - Pre - Filtered Amp = %f \n", amp[i]);
count++;
}
printf("Pre-Filtered TIME AND AMPLITUDE: \n");
double time_2[502]={};
double amp_2[502]={};
for(i = 0; i < time_size; i++){
time_2[i]= time[i] - time[0];
amp_2[i] = -amp[i];
printf("Pre - Filtered Time = %e \t", time_2[i]);
printf("Pre - Filtered Amp = %f \n", amp_2[i]);

}

return 0;
}

No comments:

Post a Comment