From f679830f2800f4997f611b63d3cb27a59227ad68 Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Thu, 20 Feb 2020 23:14:04 +0000
Subject: [PATCH] [TLastMarker] fix npysim compilation for TLastMarker

note that the generated code does not actually do anthing,
since TLastMarker executed directly with out=in
---
 src/finn/custom_op/fpgadataflow/tlastmarker.py | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)

diff --git a/src/finn/custom_op/fpgadataflow/tlastmarker.py b/src/finn/custom_op/fpgadataflow/tlastmarker.py
index 3f3bf6e79..31a0347f3 100644
--- a/src/finn/custom_op/fpgadataflow/tlastmarker.py
+++ b/src/finn/custom_op/fpgadataflow/tlastmarker.py
@@ -54,13 +54,8 @@ class TLastMarker(HLSCustomOp):
         ]
 
     def read_npy_data(self):
-        # TLastMarker does not support npysim
         self.code_gen_dict["$READNPYDATA$"] = []
 
-    def strm_decl(self):
-        # TLastMarker does not support npysim
-        self.code_gen_dict["$STREAMDECLARATIONS$"] = []
-
     def docompute(self):
         self.code_gen_dict["$DOCOMPUTE$"] = [
             "for(int i=0; i<NumIters; i++) {",
@@ -74,7 +69,6 @@ class TLastMarker(HLSCustomOp):
         ]
 
     def dataoutstrm(self):
-        # TLastMarker does not support npysim
         self.code_gen_dict["$DATAOUTSTREAM$"] = []
 
     def save_as_npy(self):
@@ -114,3 +108,12 @@ class TLastMarker(HLSCustomOp):
     def get_outstream_width(self):
         stream_width = self.get_nodeattr("StreamWidth")
         return stream_width
+
+    def strm_decl(self):
+        self.code_gen_dict["$STREAMDECLARATIONS$"] = []
+        self.code_gen_dict["$STREAMDECLARATIONS$"].append(
+            'hls::stream<ap_uint<{}>> in0 ("in0");'.format(self.get_instream_width())
+        )
+        self.code_gen_dict["$STREAMDECLARATIONS$"].append(
+            'hls::stream<OutDType> out ("out");'
+        )
-- 
GitLab