44#include " nnet_common.h"
55#include " nnet_conv1d_latency.h"
66#include " nnet_conv1d_resource.h"
7+ #include " nnet_function_stubs.h"
78#include < cstdlib>
89
910namespace nnet {
@@ -38,11 +39,7 @@ void conv_1d_cl(data_T data[CONFIG_T::in_width * CONFIG_T::n_chan], res_T res[CO
3839 // Inlining helps reduce latency, but may also cause timing issues in some cases, use carefully.
3940 // #pragma HLS INLINE recursive
4041
41- if (CONFIG_T::strategy == nnet::latency) {
42- conv_1d_latency_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
43- } else {
44- conv_1d_resource_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
45- }
42+ CONFIG_T::template conv_kernel<data_T, res_T, CONFIG_T>::conv (data, res, weights, biases);
4643}
4744
4845template <class data_T , class res_T , typename CONFIG_T>
@@ -55,13 +52,28 @@ void pointwise_conv_1d_cl(data_T data[CONFIG_T::in_width * CONFIG_T::n_chan],
5552 // Inlining helps reduce latency, but may also cause timing issues in some cases, use carefully.
5653 // #pragma HLS INLINE recursive
5754
58- // Nothing special to be done for io_parallel implementation
59- if (CONFIG_T::strategy == nnet::latency) {
55+ CONFIG_T::template conv_kernel<data_T, res_T, CONFIG_T>::conv (data, res, weights, biases);
56+ }
57+
58+ template <class data_T , class res_T , typename CONFIG_T> class Conv1DLatency : public Conv1DKernel <data_T, res_T, CONFIG_T> {
59+ public:
60+ static void conv (data_T data[CONFIG_T::in_width * CONFIG_T::n_chan], res_T res[CONFIG_T::out_width * CONFIG_T::n_filt],
61+ typename CONFIG_T::weight_t weights[CONFIG_T::filt_width * CONFIG_T::n_chan * CONFIG_T::n_filt],
62+ typename CONFIG_T::bias_t biases[CONFIG_T::n_filt]) {
63+ // #pragma HLS INLINE region
6064 conv_1d_latency_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
61- } else {
65+ }
66+ };
67+
68+ template <class data_T , class res_T , typename CONFIG_T> class Conv1DResource : public Conv1DKernel <data_T, res_T, CONFIG_T> {
69+ public:
70+ static void conv (data_T data[CONFIG_T::in_width * CONFIG_T::n_chan], res_T res[CONFIG_T::out_width * CONFIG_T::n_filt],
71+ typename CONFIG_T::weight_t weights[CONFIG_T::filt_width * CONFIG_T::n_chan * CONFIG_T::n_filt],
72+ typename CONFIG_T::bias_t biases[CONFIG_T::n_filt]) {
73+ // #pragma HLS INLINE region
6274 conv_1d_resource_cl<data_T, res_T, CONFIG_T>(data, res, weights, biases);
6375 }
64- }
76+ };
6577
6678} // namespace nnet
6779
0 commit comments