// Copyright (2019-2023) Paul Scherrer Institute #include "hls_jfjoch.h" void timer_host(STREAM_512 &data_in, STREAM_512 &data_out, volatile uint64_t &counter) { #pragma HLS INTERFACE register both axis port=data_in #pragma HLS INTERFACE register both axis port=data_out #pragma HLS INTERFACE register ap_vld port=counter #pragma HLS INTERFACE ap_ctrl_none port=return packet_512_t packet_in; data_in >> packet_in; uint64_t counter_internal = 0; counter = 0; data_out << packet_in; data_in >> packet_in; while (!packet_in.user) { #pragma HLS PIPELINE II=1 if (data_out.full()) { if (counter_internal < UINT64_MAX) counter_internal++; } else { data_out << packet_in; data_in >> packet_in; } counter = counter_internal; } data_out << packet_in; }