58 lines
1.5 KiB
C++
58 lines
1.5 KiB
C++
// Copyright (2019-2023) Paul Scherrer Institute
|
|
|
|
#include "hls_jfjoch.h"
|
|
|
|
int main() {
|
|
|
|
size_t nframes = 4;
|
|
|
|
int ret = 0;
|
|
|
|
STREAM_512 input;
|
|
STREAM_512 output;
|
|
hls::stream<ap_uint<512>> adu_result;
|
|
hls::stream<axis_completion> compl_in;
|
|
hls::stream<axis_completion> compl_out;
|
|
|
|
input << packet_512_t{.user = 0};
|
|
for (int f = 0; f < nframes; f++) {
|
|
compl_in << axis_completion{.frame_number = f, .module = 0, .last = 0};
|
|
for (int i = 0; i < RAW_MODULE_SIZE * sizeof(uint16_t) / 64; i++)
|
|
input << packet_512_t{.data = 0, .user = 0};
|
|
}
|
|
|
|
compl_in << axis_completion{.last = 1};
|
|
input << packet_512_t{.user = 1};
|
|
|
|
adu_histo(input, output, adu_result, compl_in, compl_out);
|
|
|
|
if (input.size() != 0)
|
|
ret = 1;
|
|
if (compl_in.size() != 0)
|
|
ret = 1;
|
|
|
|
if (output.size() != nframes * RAW_MODULE_SIZE * sizeof(uint16_t) / 64 + 2)
|
|
ret = 1;
|
|
for (int i = 0; i < nframes * RAW_MODULE_SIZE * sizeof(uint16_t) / 64 + 2; i++)
|
|
output.read();
|
|
|
|
if (adu_result.size() != nframes * (ADU_HISTO_BIN_COUNT / 16))
|
|
ret = 1;
|
|
for (int i = 0; i < nframes * (ADU_HISTO_BIN_COUNT / 16); i++)
|
|
adu_result.read();
|
|
|
|
if (compl_out.size() != nframes + 1)
|
|
ret = 1;
|
|
for (int i = 0; i < nframes + 1; i++)
|
|
compl_out.read();
|
|
|
|
if (ret != 0) {
|
|
printf("Test failed !!!\n");
|
|
ret = 1;
|
|
} else {
|
|
printf("Test passed !\n");
|
|
}
|
|
|
|
return ret;
|
|
}
|