44 lines
1.3 KiB
C++
44 lines
1.3 KiB
C++
// Copyright (2019-2023) Paul Scherrer Institute
|
|
|
|
#include <iostream>
|
|
#include <catch2/catch.hpp>
|
|
|
|
#include "../fpga/hls/hls_jfjoch.h"
|
|
|
|
TEST_CASE("FPGA_spot_finder_core","[FPGA][SpotFinder]") {
|
|
STREAM_768 input;
|
|
STREAM_768 output;
|
|
hls::stream<ap_axiu<32,1,1,1>> strong_pixel;
|
|
|
|
ap_int<16> in_photon_count_threshold = 8;
|
|
ap_uint<8> in_strong_pixel_threshold = 16;
|
|
|
|
std::vector<int32_t> 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] = INT24_MIN;
|
|
else
|
|
input_frame[i] = i % RAW_MODULE_COLS;
|
|
}
|
|
|
|
input << packet_768_t{.user = 0};
|
|
for (int i = 0; i < RAW_MODULE_SIZE * sizeof(uint16_t) / 64; i++) {
|
|
ap_int<24> tmp[32];
|
|
for (int j = 0; j < 32; j++)
|
|
tmp[j] = input_frame[i * 32 + j];
|
|
|
|
input << packet_768_t{.data = pack32(tmp), .user = 0};
|
|
}
|
|
|
|
input << packet_768_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);
|
|
} |