Updates March 2023

This commit is contained in:
2024-03-14 20:26:03 +01:00
parent affb8d1380
commit 59aacf516d
59 changed files with 1637 additions and 792 deletions

View File

@@ -5,76 +5,96 @@
TEST_CASE("FPGA_FrameGenerator_Cancel") {
STREAM_512 data_out;
std::vector<ap_uint<256>> d_hbm_p0(RAW_MODULE_SIZE/(256/8));
std::vector<ap_uint<256>> d_hbm_p1(RAW_MODULE_SIZE/(256/8));
std::vector<ap_uint<256>> d_hbm_p0(RAW_MODULE_SIZE/(256/8) * 22 * 32);
std::vector<ap_uint<256>> d_hbm_p1(RAW_MODULE_SIZE/(256/8) * 22 * 32);
ap_uint<1> cancel = 1;
FrameGeneratorConfig config{
.frames = 256,
.modules = 8,
.detector_type = SLS_DETECTOR_TYPE_JUNGFRAU
.detector_type = SLS_DETECTOR_TYPE_JUNGFRAU,
.images_in_memory = 0
};
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 0, 0, 0, cancel, config) == 0);
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 16*1024*1024, 0, 0, cancel, config) == 0);
REQUIRE(data_out.size() == 130);
}
TEST_CASE("FPGA_FrameGenerator_WrongDetectorType") {
STREAM_512 data_out;
std::vector<ap_uint<256>> d_hbm_p0(RAW_MODULE_SIZE/(256/8));
std::vector<ap_uint<256>> d_hbm_p1(RAW_MODULE_SIZE/(256/8));
std::vector<ap_uint<256>> d_hbm_p0(RAW_MODULE_SIZE/(256/8) * 22 * 32);
std::vector<ap_uint<256>> d_hbm_p1(RAW_MODULE_SIZE/(256/8) * 22 * 32);
ap_uint<1> cancel = 1;
FrameGeneratorConfig config{
.frames = 256,
.modules = 8,
.detector_type = 0
.detector_type = 0,
.images_in_memory = 0
};
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 0, 0, 0, cancel, config) != 0);
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 16*1024*1024, 0, 0, cancel, config) != 0);
REQUIRE(data_out.size() == 0);
}
TEST_CASE("FPGA_FrameGenerator_WrongModuleCount") {
STREAM_512 data_out;
std::vector<ap_uint<256>> d_hbm_p0(RAW_MODULE_SIZE/(256/8));
std::vector<ap_uint<256>> d_hbm_p1(RAW_MODULE_SIZE/(256/8));
std::vector<ap_uint<256>> d_hbm_p0(RAW_MODULE_SIZE/(256/8) * 22 * 32);
std::vector<ap_uint<256>> d_hbm_p1(RAW_MODULE_SIZE/(256/8) * 22 * 32);
ap_uint<1> cancel = 1;
FrameGeneratorConfig config{
.frames = 256,
.modules = MAX_MODULES_FPGA + 1,
.detector_type = SLS_DETECTOR_TYPE_JUNGFRAU
.detector_type = SLS_DETECTOR_TYPE_JUNGFRAU,
.images_in_memory = 0
};
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 0, 0, 0, cancel, config) != 0);
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 16*1024*1024, 0, 0, cancel, config) != 0);
REQUIRE(data_out.size() == 0);
config.modules = 0;
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 0, 0, 0, cancel, config) != 0);
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 16*1024*1024, 0, 0, cancel, config) != 0);
REQUIRE(data_out.size() == 0);
}
TEST_CASE("FPGA_FrameGenerator_TooManyCells") {
STREAM_512 data_out;
std::vector<ap_uint<256>> d_hbm_p0(RAW_MODULE_SIZE/(256/8) * 22 * 32);
std::vector<ap_uint<256>> d_hbm_p1(RAW_MODULE_SIZE/(256/8) * 22 * 32);
ap_uint<1> cancel = 1;
FrameGeneratorConfig config{
.frames = 256,
.modules = 4,
.detector_type = SLS_DETECTOR_TYPE_JUNGFRAU,
.images_in_memory = 8
};
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 16*1024*1024, 0, 0, cancel, config) == 3);
REQUIRE(data_out.size() == 0);
}
TEST_CASE("FPGA_FrameGenerator_Run_JF") {
STREAM_512 data_out;
std::vector<ap_uint<256>> d_hbm_p0(2*RAW_MODULE_SIZE/(256/8));
std::vector<ap_uint<256>> d_hbm_p1(2*RAW_MODULE_SIZE/(256/8));
std::vector<ap_uint<256>> d_hbm_p0(RAW_MODULE_SIZE/(256/8) * 22 * 32);
std::vector<ap_uint<256>> d_hbm_p1(RAW_MODULE_SIZE/(256/8) * 22 * 32);
ap_uint<1> cancel = 0;
FrameGeneratorConfig config{
.frames = 2,
.modules = 2,
.detector_type = SLS_DETECTOR_TYPE_JUNGFRAU
.detector_type = SLS_DETECTOR_TYPE_JUNGFRAU,
.images_in_memory = 0
};
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 0, 0, 0, cancel, config) == 0);
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 16*1024*1024, 0, 0, cancel, config) == 0);
REQUIRE(data_out.size() == (config.frames * config.modules * 128 + 1) * 130);
}
TEST_CASE("FPGA_FrameGenerator_Run_EIGER") {
STREAM_512 data_out;
std::vector<ap_uint<256>> d_hbm_p0(2*RAW_MODULE_SIZE/(256/8));
std::vector<ap_uint<256>> d_hbm_p1(2*RAW_MODULE_SIZE/(256/8));
std::vector<ap_uint<256>> d_hbm_p0(RAW_MODULE_SIZE/(256/8) * 22 * 32);
std::vector<ap_uint<256>> d_hbm_p1(RAW_MODULE_SIZE/(256/8) * 22 * 32);
ap_uint<1> cancel = 0;
FrameGeneratorConfig config{
.frames = 2,
.modules = 2,
.detector_type = SLS_DETECTOR_TYPE_EIGER
.detector_type = SLS_DETECTOR_TYPE_EIGER,
.images_in_memory = 0
};
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 0, 0, 0, cancel, config) == 0);
REQUIRE(frame_generator(data_out, d_hbm_p0.data(), d_hbm_p1.data(), 16*1024*1024, 0, 0, cancel, config) == 0);
REQUIRE(data_out.size() == (config.frames * config.modules * 256) * 66 + 130); // Trailing packet is JF type!
}