// Copyright (2019-2023) Paul Scherrer Institute #include #include #include "../fpga/hls/hls_jfjoch.h" #include "../fpga/hls/spot_finder.h" TEST_CASE("FPGA_spot_finder_core","[FPGA][SpotFinder]") { STREAM_512 input; STREAM_512 output; hls::stream> strong_pixel; ap_int<16> in_photon_count_threshold = 8; ap_uint<16> in_strong_pixel_threshold = 16; std::vector input_frame(RAW_MODULE_SIZE), output_frame(RAW_MODULE_SIZE); for (int i = 0; i < RAW_MODULE_SIZE; i++) { if (i % RAW_MODULE_COLS == 1023) input_frame[i] = INT16_MIN; else input_frame[i] = i % RAW_MODULE_COLS; } auto input_frame_512 = (ap_uint<512> *) input_frame.data(); input << packet_512_t{.user = 0}; for (int i = 0; i < RAW_MODULE_SIZE * sizeof(uint16_t) / 64; i++) input << packet_512_t{.data = input_frame_512[i], .user = 0}; input << packet_512_t{.user = 1}; spot_finder(input, output, strong_pixel, in_photon_count_threshold, in_strong_pixel_threshold); REQUIRE(input.size() == 0); REQUIRE(output.size() == RAW_MODULE_SIZE * sizeof(uint16_t) / 64 + 2); REQUIRE(strong_pixel.size() == RAW_MODULE_SIZE * sizeof(uint16_t) / 64 + 16 + 1); }