Files
Jungfraujoch/fpga/hls/save_to_hbm_data.cpp
leonarski_f d315506633 * Enhancements for XFEL
* Enhancements for EIGER
* Writer is more flexible and capable of handling DECTRIS data
2024-03-05 20:41:47 +01:00

49 lines
1.4 KiB
C++

// Copyright (2019-2024) Paul Scherrer Institute
#include "hls_jfjoch.h"
void save_to_hbm_data(STREAM_512 &data_in,
STREAM_512 &data_out,
hls::stream<ap_axiu<256,1,1,1> > &hbm_out_0,
hls::stream<ap_axiu<256,1,1,1> > &hbm_out_1) {
#pragma HLS INTERFACE ap_ctrl_none port=return
#pragma HLS INTERFACE register both axis port=data_in
#pragma HLS INTERFACE register both axis port=data_out
#pragma HLS INTERFACE register both axis port=hbm_out_0
#pragma HLS INTERFACE register both axis port=hbm_out_1
packet_512_t packet_in;
{
#pragma HLS PROTOCOL fixed
data_in >> packet_in;
ap_wait();
data_out << packet_in;
ap_wait();
}
data_in >> packet_in;
Loop_good_packet:
while (! packet_in.user) {
// Process one UDP packet per iteration
#pragma HLS PIPELINE II=1
ap_axiu<256,1,1,1> packet_out;
packet_out.keep = UINT32_MAX;
packet_out.strb = UINT32_MAX;
packet_out.user = 0;
packet_out.dest = 0;
packet_out.id = 0;
packet_out.last = packet_in.last;
packet_out.data = packet_in.data(255, 0);
hbm_out_0 << packet_out;
packet_out.data = packet_in.data(511, 256);
hbm_out_1 << packet_out;
data_in >> packet_in;
}
data_out << packet_in;
}