| 32 | } |
| 33 | |
| 34 | void MultiStageAdd(Data_t const *memoryIn, Data_t *memoryOut) { |
| 35 | #pragma HLS INTERFACE m_axi port=memoryIn offset=slave bundle=gmem0 |
| 36 | #pragma HLS INTERFACE m_axi port=memoryOut offset=slave bundle=gmem1 |
| 37 | #pragma HLS INTERFACE s_axilite port=memoryIn bundle=control |
| 38 | #pragma HLS INTERFACE s_axilite port=memoryOut bundle=control |
| 39 | #pragma HLS INTERFACE s_axilite port=return bundle=control |
| 40 | #pragma HLS DATAFLOW |
| 41 | HLSLIB_DATAFLOW_INIT(); |
| 42 | hlslib::Stream<Data_t> pipes[kStages + 1]; |
| 43 | HLSLIB_DATAFLOW_FUNCTION(MemoryToStream, memoryIn, pipes[0]); |
| 44 | MultiAddStages: |
| 45 | for (int i = 0; i < kStages; ++i) { |
| 46 | #pragma HLS UNROLL |
| 47 | HLSLIB_DATAFLOW_FUNCTION(AddStage, pipes[i], pipes[i + 1]); |
| 48 | } |
| 49 | HLSLIB_DATAFLOW_FUNCTION(StreamToMemory, pipes[kStages], memoryOut); |
| 50 | HLSLIB_DATAFLOW_FINALIZE(); |
| 51 | } |