Cleanup SPN firmwares

This commit is contained in:
Johannes Wirth 2021-03-19 11:56:13 +01:00
parent 3743cbfecd
commit 8c0211f945
3 changed files with 21 additions and 17 deletions

Binary file not shown.

View File

@ -38,19 +38,20 @@ void fpga_dma(int direction, int fpga_address, int sc_address, int num_bytes) {
}
void check_results(int addr, int k, int step) {
bool result = 0;
double *res_base = (double*) (addr);
int * error_exit = (int *)0xF0000000;
int k0 = 0;
bool result = 0;
double *res_base = (double*) (addr);
int * error_exit = (int *)0xF0000000;
printf("Start result comparison %d - %d\n", k, k+step);
for (int i = 0; i < step; i++) {
//printf("%x%x vs %x%x\n", ((uint32_t*)res_base)[2*i], ((uint32_t*)res_base)[1+2*i], ((uint32_t*)ref_data.data())[2*i+k*20], ((uint32_t*)ref_data.data())[1+2*i+k*20]);
if (!double_equals(res_base[i], ref_data.at(k + i))) {
printf("XSPN ref %d comparison FAILED\n", k + i);
*error_exit = 0x1;
result = 1;
}
}
for (int i = 0; i < step; i++) {
if (!double_equals(res_base[i], ref_data.at(k0 + i))) {
printf("XSPN ref %d comparison FAILED\n", k0 + i);
result = 1;
}
}
if (result == 1) *error_exit = 0x1;
printf("Compared samples %d - %d with the reference\n", k, k+step);
}
@ -86,7 +87,7 @@ int main() {
printf("Result Bytes: %d\n", result_bytes);
uint32_t step = 500;
uint32_t iterations = 10;
uint32_t iterations = 5;
uint32_t in_beats = (step * sample_bytes) / axi_bytes;
@ -108,7 +109,7 @@ int main() {
printf("XSPN finished\n");
spn::interrupt_reg() = 1;
fpga_dma(0, fpga_address_out, out_addr, step * result_bytes);
//check_results(out_addr, k, step);
check_results(out_addr, k, step);
//in_addr += step * sample_bytes; // 5 bytes in each sample
}

View File

@ -26,16 +26,15 @@ void run_xspn(int in_addr, int out_addr, int num_samples, int in_beats, int out_
}
void check_results(int addr, int k, int step) {
int k0 = 0;
bool result = 0;
double *res_base = (double*) (addr);
int * error_exit = (int *)0xF0000000;
for (int i = 0; i < step; i++) {
if (!double_equals(res_base[i], ref_data.at(k + i))) {
printf("%x%x vs %x%x\n", ((uint32_t*)res_base)[2*i], ((uint32_t*)res_base)[1+2*i], ((uint32_t*)ref_data.data())[2*i+k*20], ((uint32_t*)ref_data.data())[1+2*i+k*20]);
printf("XSPN ref %d comparison FAILED\n", k + i);
if (!double_equals(res_base[i], ref_data.at(k0 + i))) {
printf("XSPN ref %d comparison FAILED\n", k0 + i);
result = 1;
}
}
@ -75,7 +74,11 @@ int main() {
printf("Result Bytes: %d\n", result_bytes);
uint32_t step = 500;
<<<<<<< Updated upstream
uint32_t iterations = 20;
=======
uint32_t iterations = 5;
>>>>>>> Stashed changes
uint32_t in_beats = (step * sample_bytes) / axi_bytes;
if (in_beats * axi_bytes < step * sample_bytes) in_beats++;