forked from Firmware/Firmwares
Give XSPN the address of the input_data array
This commit is contained in:
parent
62cdc0c7b9
commit
3d93e4b9a5
Binary file not shown.
@ -26,23 +26,12 @@ void run_xspn(int in_addr, int out_addr) {
|
||||
spn::start_reg() = 1;
|
||||
}
|
||||
|
||||
void load_input_data(int addr, const int k=0) {
|
||||
int * mem_base = (int *) addr;
|
||||
int offset = k * 5;
|
||||
|
||||
for (size_t i = 0, j = 0; j < 625; i += 4, j++) { // load 5000 samples
|
||||
*(mem_base + j) = input_data.at(offset + i);
|
||||
*(mem_base + j) |= (input_data.at(offset + i + 1) << 8) & 0x0000FF00;
|
||||
*(mem_base + j) |= (input_data.at(offset + i + 2) << 16) & 0x00FF0000;
|
||||
*(mem_base + j) |= (input_data.at(offset + i + 3) << 24) & 0xFF000000;
|
||||
}
|
||||
}
|
||||
|
||||
bool check_results(int addr, int k) {
|
||||
bool result = 0;
|
||||
int step = 500;
|
||||
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++) {
|
||||
if (!double_equals(res_base[i] * ln2, ref_data.at(k + i))) {
|
||||
@ -68,9 +57,8 @@ int main() {
|
||||
spn::interrupt_reg() = 1;
|
||||
printf("READOUT HW:0x%x\n", spn::readout_reg());
|
||||
|
||||
int in_addr = 0x800C0000;
|
||||
int in_addr = (int)input_data.data();
|
||||
int out_addr = 0x800A0000;
|
||||
load_input_data(in_addr);
|
||||
|
||||
int step = 500; // number of samples to be process at once
|
||||
for (int k = 0; k < 10000; k+=step) {
|
||||
@ -78,14 +66,11 @@ int main() {
|
||||
run_xspn(in_addr, out_addr);
|
||||
printf("XSPN processes samples %d - %d\n", k, k+step);
|
||||
|
||||
// pre-load data for the next run while HW accelerator is running
|
||||
if(k<(10000-step))
|
||||
load_input_data(in_addr, k+step);
|
||||
|
||||
wait_for_interrupt();
|
||||
spn::interrupt_reg() = 1;
|
||||
|
||||
ret_val = check_results(out_addr, k);
|
||||
in_addr += 2500;
|
||||
}
|
||||
|
||||
return ret_val;
|
||||
|
Loading…
Reference in New Issue
Block a user