Created
March 16, 2017 14:42
-
-
Save ciniml/71eafeef1e1d0454c5f832afd9dbacca to your computer and use it in GitHub Desktop.
Fails after "Generating RTL" is shown,
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "simple_dma.hpp" | |
template<size_t TBurstCount> | |
static void burstTransfer(const InputData* input, hls::stream<InputData>& stream, TransferCount transferCount) | |
{ | |
#pragma HLS INLINE off | |
for(; transferCount >= TBurstCount; transferCount -= TBurstCount) { | |
for(TransferCount count = 0; count < TBurstCount; ++count) { | |
#pragma HLS PIPELINE ii=1 | |
stream << *(input++); | |
} | |
} | |
burstTransfer< (TBurstCount/2) >(input, stream, transferCount); | |
} | |
template<> void burstTransfer<0>(const InputData* input, hls::stream<InputData>& stream, TransferCount transferCount) {} | |
static void copyStream(hls::stream<InputData>& inputStream, hls::stream<OutputStreamData>& outputStream, TransferCount transferCount) | |
{ | |
InputData inputData; | |
OutputStreamData outputStreamData; | |
for(TransferCount count = 0; count < transferCount; ++count) { | |
inputStream >> inputData; | |
outputStreamData.data = inputData; // TODO: convert data type if needed. | |
outputStreamData.user = count == 0 ? 1 : 0; | |
outputStreamData.last = count == transferCount-1 ? 1 : 0; | |
outputStream << outputStreamData; | |
} | |
} | |
void simpleDma(const InputData* input, hls::stream<OutputStreamData>& outputStream, TransferCount transferCount) | |
{ | |
#pragma HLS DATAFLOW | |
#pragma HLS INTERFACE s_axilite port=transferCount bundle=control | |
#pragma HLS INTERFACE s_axilite port=return bundle=control | |
#pragma HLS INTERFACE m_axi depth=256 port=input offset=slave bundle=control | |
#pragma HLS INTERFACE axis port=outputStream | |
hls::stream<InputData> inputStream; | |
#pragma HLS STREAM variable=inputStream depth=128 dim=1 | |
burstTransfer<64>(input, inputStream, transferCount); | |
copyStream(inputStream, outputStream, transferCount); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment