FPGA: load calibration works as dedicated function of the card
This commit is contained in:
@@ -40,13 +40,6 @@ HLSSimulatedDevice::HLSSimulatedDevice(uint16_t data_stream, size_t in_frame_buf
|
||||
|
||||
MapBuffersStandard(in_frame_buffer_size_modules,
|
||||
(3 + 3 * 16) * max_modules + 2, numa_node);
|
||||
|
||||
auto in_mem_location32 = (uint32_t *) calibration_addr_bram;
|
||||
|
||||
for (int i = 0; i < max_modules * (3 + 3 * 16) + 2; i++) {
|
||||
in_mem_location32[2 * i ] = ((uint64_t) buffer_device[i]) & UINT32_MAX;
|
||||
in_mem_location32[2 * i + 1] = ((uint64_t) buffer_device[i]) >> 32;
|
||||
}
|
||||
}
|
||||
|
||||
void HLSSimulatedDevice::CreateFinalPacket(const DiffractionExperiment& experiment) {
|
||||
@@ -206,7 +199,6 @@ void HLSSimulatedDevice::HLSMainThread() {
|
||||
STREAM_512 raw1;
|
||||
STREAM_512 raw2;
|
||||
STREAM_512 raw3;
|
||||
STREAM_512 raw4;
|
||||
|
||||
STREAM_512 converted_1;
|
||||
STREAM_512 converted_2;
|
||||
@@ -276,24 +268,16 @@ void HLSSimulatedDevice::HLSMainThread() {
|
||||
}
|
||||
});
|
||||
|
||||
// Load external calibration
|
||||
hls_cores.emplace_back([&] { load_calibration(raw1, raw2,
|
||||
hbm.data(),
|
||||
hbm.data(),
|
||||
datamover_in.GetCtrlStream(),
|
||||
datamover_in.GetDataStream(),
|
||||
calibration_addr_bram); });
|
||||
|
||||
// Generate internal packets
|
||||
hls_cores.emplace_back([&] { internal_packet_generator(raw2, raw3, addr1, addr2,
|
||||
hls_cores.emplace_back([&] { internal_packet_generator(raw1, raw2, addr1, addr2,
|
||||
reinterpret_cast<ap_uint<512> *>(internal_pkt_gen_frame.data()),
|
||||
cancel_data_collection); });
|
||||
|
||||
// Timer procedure - count how many times pedestal_corr/gain_corr is not accepting input (to help track down latency issues)
|
||||
hls_cores.emplace_back([&] { timer_host(raw3, raw4, counter_hbm); });
|
||||
hls_cores.emplace_back([&] { timer_host(raw2, raw3, counter_hbm); });
|
||||
|
||||
// 2. Apply pedestal & gain corrections
|
||||
hls_cores.emplace_back([&] { jf_conversion(raw4, converted_1,
|
||||
hls_cores.emplace_back([&] { jf_conversion(raw3, converted_1,
|
||||
addr2, addr3,
|
||||
hbm.data(),
|
||||
hbm.data(),
|
||||
@@ -341,9 +325,6 @@ void HLSSimulatedDevice::HLSMainThread() {
|
||||
if (!raw3.empty())
|
||||
throw std::runtime_error("Raw3 queue not empty");
|
||||
|
||||
if (!raw4.empty())
|
||||
throw std::runtime_error("Raw4 queue not empty");
|
||||
|
||||
if (!converted_1.empty())
|
||||
throw std::runtime_error("Converted_1 queue not empty");
|
||||
|
||||
@@ -370,3 +351,30 @@ void HLSSimulatedDevice::HW_GetStatus(ActionStatus *status) const {
|
||||
status->max_modules = max_modules;
|
||||
status->hbm_size_bytes = hbm_if_size;
|
||||
}
|
||||
|
||||
void HLSSimulatedDevice::HW_LoadCalibration(uint32_t modules, uint32_t storage_cells) {
|
||||
|
||||
if (logger)
|
||||
logger->Info("Load calibration start");
|
||||
|
||||
auto in_mem_location32 = (uint32_t *) calibration_addr_bram;
|
||||
|
||||
for (int i = 0; i < modules * (3 + 3 * storage_cells); i++) {
|
||||
in_mem_location32[2 * i ] = ((uint64_t) buffer_device[i]) & UINT32_MAX;
|
||||
in_mem_location32[2 * i + 1] = ((uint64_t) buffer_device[i]) >> 32;
|
||||
}
|
||||
|
||||
load_calibration(hbm.data(),
|
||||
hbm.data(),
|
||||
modules,
|
||||
storage_cells,
|
||||
hbm_if_size,
|
||||
datamover_in.GetCtrlStream(),
|
||||
datamover_in.GetDataStream(),
|
||||
calibration_addr_bram);
|
||||
if (logger)
|
||||
logger->Info("Load calibration done");
|
||||
|
||||
if (!datamover_in.GetDataStream().empty())
|
||||
throw std::runtime_error("Datamover queue is not empty");
|
||||
}
|
||||
Reference in New Issue
Block a user