1st successful XSPN run. Insert few samples and get one result
This commit is contained in:
parent
8249a0417e
commit
01cfbd34fe
|
@ -84,24 +84,52 @@ void platform_init(){
|
||||||
int main() {
|
int main() {
|
||||||
platform_init();
|
platform_init();
|
||||||
|
|
||||||
|
// write input samples into the memory
|
||||||
|
int * mem_base = (int *) 0x80001000;
|
||||||
|
std::array<uint8_t, 64> input_data = {
|
||||||
|
0, 0, 0, 1, 0,
|
||||||
|
0, 1, 5, 2, 0,
|
||||||
|
0, 0, 8, 0, 0,
|
||||||
|
0, 0, 5, 4, 0,
|
||||||
|
0, 0, 0, 1, 0,
|
||||||
|
0, 0, 0, 1, 0,
|
||||||
|
0, 0, 0, 1, 0,
|
||||||
|
0, 0, 0, 1, 0
|
||||||
|
};
|
||||||
|
|
||||||
|
for(size_t i = 0, j = 0; j < 16; i += 4, j++) {
|
||||||
|
*(mem_base+j) = input_data.at(i);
|
||||||
|
*(mem_base+j) |= input_data.at(i+1) << 8;
|
||||||
|
*(mem_base+j) |= input_data.at(i+2) << 16;
|
||||||
|
*(mem_base+j) |= input_data.at(i+3) << 24;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////
|
||||||
spn::mode_reg() = 1;
|
spn::mode_reg() = 1;
|
||||||
spn::start_reg() = 1;
|
spn::start_reg() = 1;
|
||||||
printf("READOUT reuslt:0x%x\n", spn::readout_reg());
|
printf("READOUT HW:0x%x\n", spn::readout_reg());
|
||||||
spn::interrupt_reg() = 1;
|
spn::interrupt_reg() = 1;
|
||||||
|
|
||||||
spn::input_length_reg() = 5;
|
|
||||||
spn::input_addr_reg() = 0x80000000;
|
|
||||||
spn::output_addr_reg() = 0x80100000;
|
|
||||||
spn::num_of_in_beats_reg() = 5;
|
|
||||||
spn::num_of_out_beats_reg() = 1;
|
|
||||||
spn::mode_reg() = 0;
|
|
||||||
|
|
||||||
uint32_t result_addr = spn::output_addr_reg();
|
|
||||||
|
|
||||||
spn::start_reg() = 1;
|
|
||||||
printf("Start SPN HW accelerator\n");
|
printf("Start SPN HW accelerator\n");
|
||||||
|
spn::mode_reg() = 0;
|
||||||
|
spn::input_length_reg() = 8;
|
||||||
|
spn::input_addr_reg() = 0x80001000;
|
||||||
|
spn::output_addr_reg() = 0x80001000;
|
||||||
|
spn::num_of_in_beats_reg() = 1;
|
||||||
|
spn::num_of_out_beats_reg() = 1;
|
||||||
|
spn::start_reg() = 1;
|
||||||
|
|
||||||
|
delayUS(50);
|
||||||
|
printf("Cycle count:0x%x\n", spn::start_reg());
|
||||||
|
spn::interrupt_reg() = 1;
|
||||||
|
delayUS(10);
|
||||||
|
|
||||||
|
// read calculation results from the memory
|
||||||
|
int result = *mem_base;
|
||||||
|
printf("HW Result:0x%lx\n", result);
|
||||||
|
result = *(mem_base+1);
|
||||||
|
printf("HW Result:0x%lx\n", result);
|
||||||
|
|
||||||
delayUS(100);
|
|
||||||
|
|
||||||
printf("End of execution");
|
printf("End of execution");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in New Issue