Skip to content

Commit 26b4c54

Browse files
committed
add catapult 3-clone
1 parent b055233 commit 26b4c54

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

hls4ml/templates/catapult/nnet_utils/nnet_stream.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,26 @@ void clone_stream(ac_channel<data_T> &data, ac_channel<res_T> &res1, ac_channel<
4141
}
4242
}
4343

44+
template <class data_T, class res_T, int N>
45+
void clone_stream(ac_channel<data_T> &data, ac_channel<res_T> &res1, ac_channel<res_T> &res2, ac_channel<res_T> &res3) {
46+
#ifndef __SYNTHESIS__
47+
while (data.available(1))
48+
#endif
49+
{
50+
data_T in_data = data.read();
51+
res_T out_data;
52+
53+
ClonePack:
54+
for (int j = 0; j < data_T::size; j++) {
55+
out_data[j] = in_data[j];
56+
}
57+
58+
res1.write(out_data);
59+
res2.write(out_data);
60+
res3.write(out_data);
61+
}
62+
}
63+
4464
template <class data_T, class res_T, int N> void repack_stream(ac_channel<data_T> &data, ac_channel<res_T> &res) {
4565
if (data_T::size == res_T::size) {
4666
for (int i = 0; i < N / data_T::size; i++) {

0 commit comments

Comments
 (0)