diff --git a/fpga/hls/parallel_stream.h b/fpga/hls/parallel_stream.h index ac50b37b..10976f9f 100644 --- a/fpga/hls/parallel_stream.h +++ b/fpga/hls/parallel_stream.h @@ -10,7 +10,7 @@ #include namespace hls { - template class stream { + template class stream { private: mutable std::mutex m; std::condition_variable c_empty; diff --git a/fpga/hls/spot_finder.cpp b/fpga/hls/spot_finder.cpp index b69c994d..848c4255 100644 --- a/fpga/hls/spot_finder.cpp +++ b/fpga/hls/spot_finder.cpp @@ -358,6 +358,31 @@ void spot_finder_2(STREAM_512 &data_in, hls::stream> sum_stream_0, sum_stream_1, sum_stream_2; hls::stream> sum2_stream_0, sum2_stream_1, sum2_stream_2; hls::stream> valid_stream_0, valid_stream_1, valid_stream_2; +#pragma HLS STREAM variable=data_stream_0 depth=512 type=fifo +#pragma HLS bind_storage variable=data_stream_0 type=fifo impl=bram +#pragma HLS STREAM variable=data_stream_1 depth=64 type=fifo +#pragma HLS bind_storage variable=data_stream_1 type=fifo impl=bram +#pragma HLS STREAM variable=data_stream_2 depth=64 type=fifo +#pragma HLS bind_storage variable=data_stream_2 type=fifo impl=bram + +#pragma HLS STREAM variable=sum_stream_0 depth=512 type=fifo +#pragma HLS bind_storage variable=sum_stream_0 type=fifo impl=bram +#pragma HLS STREAM variable=sum_stream_1 depth=64 type=fifo +#pragma HLS bind_storage variable=sum_stream_1 type=fifo impl=bram +#pragma HLS STREAM variable=sum_stream_2 depth=64 type=fifo +#pragma HLS bind_storage variable=sum_stream_2 type=fifo impl=bram +#pragma HLS STREAM variable=sum2_stream_0 depth=512 type=fifo +#pragma HLS bind_storage variable=sum2_stream_0 type=fifo impl=bram +#pragma HLS STREAM variable=sum2_stream_1 depth=64 type=fifo +#pragma HLS bind_storage variable=sum2_stream_1 type=fifo impl=bram +#pragma HLS STREAM variable=sum2_stream_2 depth=64 type=fifo +#pragma HLS bind_storage variable=sum2_stream_2 type=fifo impl=bram +#pragma HLS STREAM variable=valid_stream_0 depth=512 type=fifo +#pragma HLS bind_storage variable=valid_stream_0 type=fifo impl=bram +#pragma HLS STREAM variable=valid_stream_1 depth=64 type=fifo +#pragma HLS bind_storage variable=valid_stream_1 type=fifo impl=bram +#pragma HLS STREAM variable=valid_stream_2 depth=64 type=fifo +#pragma HLS bind_storage variable=valid_stream_2 type=fifo impl=bram #ifdef __SYNTHESIS__ spot_finder_col_sum(data_in, data_stream_0, sum_stream_0, sum2_stream_0, valid_stream_0); diff --git a/fpga/hls/spot_finder.h b/fpga/hls/spot_finder.h index d5b001f8..b9bfff4d 100644 --- a/fpga/hls/spot_finder.h +++ b/fpga/hls/spot_finder.h @@ -48,10 +48,16 @@ ap_uint prefix_sum(const ap_uint ext_column_sum) { tmp_sum += column_sum[i]; } + //for (int i = 0; i < 32; i++) { + // tmp_sum += column_sum[i + 2 * FPGA_NBX]; + // line_sum[i] = tmp_sum; + // tmp_sum -= column_sum[i]; + //} + for (int i = 0; i < 32; i++) { - tmp_sum += column_sum[i + 2 * FPGA_NBX]; - line_sum[i] = tmp_sum; - tmp_sum -= column_sum[i]; + line_sum[i] = 0; + for (int j = 0; j < 2 * FPGA_NBX + 1; j++) + line_sum[i] += column_sum[i + j]; } return pack32(line_sum);