HLSSimulatedDevice: moving towards continuous HBM representation
This commit is contained in:
@@ -8,8 +8,6 @@
|
||||
#include "../fpga/hls/datamover_model.h"
|
||||
#include "../fpga/hls/hls_jfjoch.h"
|
||||
|
||||
#define HBM_SIZE (32*1024*1024UL)
|
||||
|
||||
uint16_t checksum(const uint16_t *addr, size_t count) {
|
||||
/* Compute Internet Checksum for "count" bytes
|
||||
* beginning at location "addr".
|
||||
@@ -34,7 +32,7 @@ HLSSimulatedDevice::HLSSimulatedDevice(uint16_t data_stream, size_t in_frame_buf
|
||||
: FPGAAcquisitionDevice(data_stream),
|
||||
datamover_in(Direction::Input),
|
||||
datamover_out(Direction::Output, nullptr, 256),
|
||||
idle(true) {
|
||||
idle(true), hbm(hbm_if_size / 32 * hbm_if_count) {
|
||||
mac_addr = 0xCCAA11223344;
|
||||
ipv4_addr = 0x0132010A;
|
||||
|
||||
@@ -49,10 +47,6 @@ HLSSimulatedDevice::HLSSimulatedDevice(uint16_t data_stream, size_t in_frame_buf
|
||||
in_mem_location32[2 * i ] = ((uint64_t) buffer_device[i]) & UINT32_MAX;
|
||||
in_mem_location32[2 * i + 1] = ((uint64_t) buffer_device[i]) >> 32;
|
||||
}
|
||||
|
||||
for (auto &i: hbm_memory)
|
||||
// i.resize(SIZE_OF_HBM_BLOCK_IN_BYTES);
|
||||
i.resize(HBM_SIZE); // only 32 MiB instead of 256 MiB per HBM interface (should be more than enough for all the tests anyway)
|
||||
}
|
||||
|
||||
void HLSSimulatedDevice::CreateFinalPacket(const DiffractionExperiment& experiment) {
|
||||
@@ -304,12 +298,18 @@ void HLSSimulatedDevice::HLSMainThread() {
|
||||
// 2. Apply pedestal & gain corrections
|
||||
hls_cores.emplace_back([&] { jf_conversion(raw4, converted_1,
|
||||
addr2, addr3,
|
||||
(hbm256_t *) (hbm_memory[0].data()), (hbm256_t *) (hbm_memory[1].data()),
|
||||
(hbm256_t *) (hbm_memory[2].data()), (hbm256_t *) (hbm_memory[3].data()),
|
||||
(hbm256_t *) (hbm_memory[4].data()), (hbm256_t *) (hbm_memory[5].data()),
|
||||
(hbm256_t *) (hbm_memory[6].data()), (hbm256_t *) (hbm_memory[7].data()),
|
||||
(hbm256_t *) (hbm_memory[8].data()), (hbm256_t *) (hbm_memory[9].data()),
|
||||
(hbm256_t *) (hbm_memory[10].data()), (hbm256_t *) (hbm_memory[11].data())); });
|
||||
hbm.data() + 0 * hbm_if_size / 32,
|
||||
hbm.data() + 1 * hbm_if_size / 32,
|
||||
hbm.data() + 2 * hbm_if_size / 32,
|
||||
hbm.data() + 3 * hbm_if_size / 32,
|
||||
hbm.data() + 4 * hbm_if_size / 32,
|
||||
hbm.data() + 5 * hbm_if_size / 32,
|
||||
hbm.data() + 6 * hbm_if_size / 32,
|
||||
hbm.data() + 7 * hbm_if_size / 32,
|
||||
hbm.data() + 8 * hbm_if_size / 32,
|
||||
hbm.data() + 9 * hbm_if_size / 32,
|
||||
hbm.data() + 10 * hbm_if_size / 32,
|
||||
hbm.data() + 11 * hbm_if_size / 32); });
|
||||
|
||||
// Timer procedure - count how many times write_data is not accepting input (to help track down latency issues)
|
||||
hls_cores.emplace_back([&] { timer_host(converted_1, converted_2, counter_host); });
|
||||
@@ -325,10 +325,10 @@ void HLSSimulatedDevice::HLSMainThread() {
|
||||
|
||||
// 3. Write images to HBM
|
||||
hls_cores.emplace_back([&] { save_to_hbm(converted_3, addr4, save_to_hbm_completion,
|
||||
(hbm256_t *) (hbm_memory[12].data()),
|
||||
(hbm256_t *) (hbm_memory[13].data()),
|
||||
(hbm256_t *) (hbm_memory[14].data()),
|
||||
(hbm256_t *) (hbm_memory[15].data()),
|
||||
hbm.data() + 12 * hbm_if_size / 32,
|
||||
hbm.data() + 13 * hbm_if_size / 32,
|
||||
hbm.data() + 14 * hbm_if_size / 32,
|
||||
hbm.data() + 15 * hbm_if_size / 32,
|
||||
save_to_hbm_packets_processed,
|
||||
save_to_hbm_idle,
|
||||
save_to_hbm_err_reg,
|
||||
@@ -410,18 +410,18 @@ void HLSSimulatedDevice::HW_GetStatus(ActionStatus *status) const {
|
||||
|
||||
void HLSSimulatedDevice::HBMTransfer(void *uram, uint64_t hbm_interface, uint64_t hbm_offset, bool hbm_to_uram,
|
||||
uint8_t stride, uint8_t uram_offset) {
|
||||
if (hbm_interface >= HLS_SIM_DEVICE_HBM_INTERFACES)
|
||||
if (hbm_interface >= hbm_if_count)
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "HBM interface out of bounds");
|
||||
if (hbm_offset > HBM_SIZE - (RAW_MODULE_SIZE * sizeof(uint16_t)))
|
||||
if (hbm_offset > hbm_if_size - (RAW_MODULE_SIZE * sizeof(uint16_t)))
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "HBM offset out of bounds");
|
||||
if ((stride != 1) && (stride != 2) && (stride != 4))
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "Only stride of 1, 2 and 4 allowed");
|
||||
if (uram_offset >= stride)
|
||||
throw JFJochException(JFJochExceptionCategory::InputParameterInvalid, "UltraRAM stride out of bounds");
|
||||
|
||||
transfer_hbm((ap_uint<256> *) hbm_memory[hbm_interface].data(),
|
||||
transfer_hbm((ap_uint<256> *) hbm.data(),
|
||||
(ap_uint<256> *) uram,
|
||||
hbm_offset / 32,
|
||||
(hbm_interface * hbm_if_size + hbm_offset) / 32,
|
||||
hbm_to_uram,
|
||||
stride,
|
||||
uram_offset);
|
||||
|
||||
@@ -12,8 +12,6 @@
|
||||
#include "FPGAAcquisitionDevice.h"
|
||||
#include "../jungfrau/jf_packet.h"
|
||||
|
||||
#define HLS_SIM_DEVICE_HBM_INTERFACES (16)
|
||||
|
||||
uint16_t checksum(const uint16_t *addr, size_t count);
|
||||
|
||||
class HLSSimulatedDevice : public FPGAAcquisitionDevice {
|
||||
@@ -23,7 +21,10 @@ class HLSSimulatedDevice : public FPGAAcquisitionDevice {
|
||||
ActionConfig cfg;
|
||||
|
||||
volatile bool idle;
|
||||
std::vector<char> hbm_memory[HLS_SIM_DEVICE_HBM_INTERFACES];
|
||||
|
||||
constexpr static const size_t hbm_if_count = 16;
|
||||
constexpr static const size_t hbm_if_size = 32*1024*1024LU;
|
||||
std::vector<ap_uint<256>> hbm;
|
||||
|
||||
hls::stream<ap_uint<32> > work_request_stream;
|
||||
hls::stream<ap_uint<32> > completion_stream;
|
||||
|
||||
Reference in New Issue
Block a user