diff --git a/src/finn/custom_op/fpgadataflow/templates.py b/src/finn/custom_op/fpgadataflow/templates.py
index e2f43f4edf206b32974adaf02fd479f0af522702..dccbb2533940305f90082f1d902e4713b2febfb6 100644
--- a/src/finn/custom_op/fpgadataflow/templates.py
+++ b/src/finn/custom_op/fpgadataflow/templates.py
@@ -1,5 +1,6 @@
 # template for single node execution
 docompute_template = """
+#define AP_INT_MAX_W 4096
 #include "cnpy.h"
 #include "npy2apintstream.hpp"
 #include <vector>
@@ -30,6 +31,7 @@ $SAVEASCNPY$
 
 # cpp file
 ipgen_template = """
+#define AP_INT_MAX_W 4096
 #include "bnn-library.h"
 // includes for network parameters
 $GLOBALS$