Skip to content

Commit 3b8c61d

Browse files
Chuck SongGitHub Enterprise
authored andcommitted
Merge pull request #140 from RepoOps/xf_compression-20200915-223349
Vitis Compression Library Update,
2 parents 6b87d49 + 88c0764 commit 3b8c61d

File tree

670 files changed

+81725
-6886
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

670 files changed

+81725
-6886
lines changed

data_compression/.gitignore

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
*.swp
2+
*.swo
3+
*.wdb
4+
*.wcfg
5+
jks.*
6+
*.prj
7+
TestResults
8+
*.log
9+
*.protoinst
10+
build_dir.*
11+
_x_temp.*
12+
.Xil
13+
sample_*.ini
14+
emconfig.json
15+
profile*.csv
16+
timeline*.csv
17+
*xclbin.run_summary
18+
reports
19+
build
20+
obj_*
21+
_x_temp.*
22+
*.o
23+
*.lo

data_compression/Jenkinsfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
@Library('pipeline-library')_
22

3-
VitisLibPipeline (branch: 'next', libname: 'xf_compression', run_sw_in_pr: 'true', TARGETS: 'hls_csim:vitis_sw_emu', email: 'heeran@xilinx.com', devtest: 'RunDeploy.sh', TOOLVERSION: '2020.1_daily_latest')
3+
VitisLibPipeline (branch: 'master', libname: 'xf_compression', run_sw_in_pr:
4+
'true', TARGETS: 'hls_csim:hls_csynth:hls_cosim:vitis_sw_emu:vitis_hw_emu',
5+
upstream_dependencies: 'xf_security,master,../security', email: 'heeran@xilinx.com', devtest: 'RunDeploy.sh', TOOLVERSION: '2020.1_released')

data_compression/L1/include/hw/axi_stream_utils.hpp

Lines changed: 102 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,109 @@
2727
namespace xf {
2828
namespace compression {
2929

30-
typedef ap_uint<8> streamDt;
31-
3230
namespace details {
3331

32+
template <int OUT_DWIDTH>
33+
void hlsStream2axiu(hls::stream<ap_uint<OUT_DWIDTH> >& inputStream,
34+
hls::stream<bool>& inputStreamEos,
35+
hls::stream<ap_axiu<OUT_DWIDTH, 0, 0, 0> >& outAxiStream,
36+
hls::stream<ap_axiu<32, 0, 0, 0> >& outAxiSizeStream,
37+
hls::stream<uint32_t>& inputTotalCmpSizeStream) {
38+
for (uint32_t input_size = inputTotalCmpSizeStream.read(); input_size != 0;
39+
input_size = inputTotalCmpSizeStream.read()) {
40+
bool flag;
41+
do {
42+
ap_uint<OUT_DWIDTH> temp = inputStream.read();
43+
flag = inputStreamEos.read();
44+
ap_axiu<OUT_DWIDTH, 0, 0, 0> tOut;
45+
tOut.data = temp;
46+
tOut.last = flag;
47+
tOut.keep = -1;
48+
outAxiStream << tOut;
49+
} while (!flag);
50+
51+
ap_axiu<32, 0, 0, 0> totalSize;
52+
totalSize.data = input_size;
53+
outAxiSizeStream << totalSize;
54+
}
55+
}
56+
57+
template <int OUT_DWIDTH>
58+
void hlsStreamSize2axiu(hls::stream<ap_uint<OUT_DWIDTH> >& inputStream,
59+
hls::stream<bool>& inputStreamEos,
60+
hls::stream<ap_axiu<OUT_DWIDTH, 0, 0, 0> >& outAxiStream,
61+
hls::stream<ap_axiu<32, 0, 0, 0> >& outAxiSizeStream,
62+
hls::stream<uint32_t>& inputTotalCmpSizeStream,
63+
hls::stream<bool>& inNumBlockStreamEos) {
64+
for (bool eos = inNumBlockStreamEos.read(); eos == false; eos = inNumBlockStreamEos.read()) {
65+
bool flag;
66+
do {
67+
ap_uint<OUT_DWIDTH> temp = inputStream.read();
68+
flag = inputStreamEos.read();
69+
ap_axiu<OUT_DWIDTH, 0, 0, 0> tOut;
70+
tOut.data = temp;
71+
tOut.last = flag;
72+
tOut.keep = -1;
73+
outAxiStream << tOut;
74+
} while (!flag);
75+
76+
ap_axiu<32, 0, 0, 0> totalSize;
77+
totalSize.data = inputTotalCmpSizeStream.read();
78+
outAxiSizeStream << totalSize;
79+
}
80+
}
81+
82+
template <int IN_DWIDTH, int BLCK_SIZE>
83+
void axiu2hlsStreamBlockMaker(hls::stream<ap_axiu<IN_DWIDTH, 0, 0, 0> >& inputAxiStream,
84+
hls::stream<ap_uint<IN_DWIDTH> >& outputStream,
85+
hls::stream<uint32_t>& outputBlockSizeStream,
86+
hls::stream<ap_axiu<32, 0, 0, 0> >& inSizeStream,
87+
hls::stream<ap_uint<32> >& outNumBlockStream) {
88+
constexpr int c_parallelByte = IN_DWIDTH / 8;
89+
for (ap_axiu<32, 0, 0, 0> tempSize = inSizeStream.read(); tempSize.data != 0; tempSize = inSizeStream.read()) {
90+
ap_uint<32> inputSize = tempSize.data;
91+
ap_uint<32> no_blocks = (inputSize - 1) / BLCK_SIZE + 1;
92+
outNumBlockStream << no_blocks;
93+
uint32_t readSize = 0;
94+
95+
for (uint32_t i = 0; i < no_blocks; i++) {
96+
uint32_t block_length = BLCK_SIZE;
97+
if (readSize + BLCK_SIZE > inputSize) block_length = inputSize - readSize;
98+
outputBlockSizeStream << block_length;
99+
for (uint32_t j = 0; j < block_length; j += c_parallelByte) {
100+
#pragma HLS PIPELINE II = 1
101+
ap_axiu<IN_DWIDTH, 0, 0, 0> tempVal = inputAxiStream.read();
102+
ap_uint<IN_DWIDTH> tmpOut = tempVal.data;
103+
outputStream << tmpOut;
104+
}
105+
readSize += BLCK_SIZE;
106+
}
107+
}
108+
outputBlockSizeStream << 0;
109+
outNumBlockStream << 0;
110+
}
111+
112+
template <int IN_DWIDTH>
113+
void axiu2hlsStreamSize(hls::stream<ap_axiu<IN_DWIDTH, 0, 0, 0> >& inputAxiStream,
114+
hls::stream<ap_uint<IN_DWIDTH> >& outputStream,
115+
hls::stream<uint32_t>& outputSizeStream,
116+
hls::stream<ap_axiu<32, 0, 0, 0> >& inSizeStream) {
117+
const int c_parallelByte = IN_DWIDTH / 8;
118+
for (ap_axiu<32, 0, 0, 0> tempSize = inSizeStream.read(); tempSize.data != 0; tempSize = inSizeStream.read()) {
119+
ap_uint<32> inputSize = tempSize.data;
120+
outputSizeStream << inputSize;
121+
for (uint32_t j = 0; j < inputSize; j += c_parallelByte) {
122+
#pragma HLS PIPELINE II = 1
123+
ap_axiu<IN_DWIDTH, 0, 0, 0> tempVal = inputAxiStream.read();
124+
ap_uint<IN_DWIDTH> tmpOut = tempVal.data;
125+
outputStream << tmpOut;
126+
}
127+
}
128+
outputSizeStream << 0;
129+
}
130+
34131
void axis2hlsStreamFixedSize(hls::stream<qdma_axis<8, 0, 0, 0> >& inputAxiStream,
35-
hls::stream<streamDt>& inputStream,
132+
hls::stream<ap_uint<8> >& inputStream,
36133
uint32_t inputSize) {
37134
/**
38135
* @brief Read data from axi stream and write to internal hls stream.
@@ -51,7 +148,7 @@ void axis2hlsStreamFixedSize(hls::stream<qdma_axis<8, 0, 0, 0> >& inputAxiStream
51148
}
52149
}
53150

54-
void hlsStream2axis(hls::stream<streamDt>& outputStream,
151+
void hlsStream2axis(hls::stream<ap_uint<8> >& outputStream,
55152
hls::stream<bool>& outStreamEos,
56153
hls::stream<qdma_axis<8, 0, 0, 0> >& outputAxiStream,
57154
hls::stream<uint32_t>& outStreamSize,
@@ -86,7 +183,7 @@ void hlsStream2axis(hls::stream<streamDt>& outputStream,
86183
outAxiStreamSize.write(tOutSize);
87184
}
88185

89-
void hlsStream2axiStreamFixedSize(hls::stream<streamDt>& hlsInStream,
186+
void hlsStream2axiStreamFixedSize(hls::stream<ap_uint<8> >& hlsInStream,
90187
hls::stream<qdma_axis<8, 0, 0, 0> >& outputAxiStream,
91188
uint32_t originalSize) {
92189
/**

0 commit comments

Comments
 (0)