From 49b8f79f0e4998e30277f1b8d21d6e5a6b4deefa Mon Sep 17 00:00:00 2001 From: Yaman Umuroglu <maltanar@gmail.com> Date: Wed, 22 Apr 2020 00:07:29 +0100 Subject: [PATCH] [HLSCustomOp] correct order of ops in TLastMarker --- src/finn/custom_op/fpgadataflow/tlastmarker.py | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/finn/custom_op/fpgadataflow/tlastmarker.py b/src/finn/custom_op/fpgadataflow/tlastmarker.py index 432bcb3d9..e5a5fed6c 100644 --- a/src/finn/custom_op/fpgadataflow/tlastmarker.py +++ b/src/finn/custom_op/fpgadataflow/tlastmarker.py @@ -91,12 +91,22 @@ class TLastMarker(HLSCustomOp): def docompute(self): self.code_gen_dict["$DOCOMPUTE$"] = [ - "unsigned int n = (numIters == 0 ? NumItersPerImg : numIters);" - "for(unsigned int i=0; i<n; i++) {", - "#pragma HLS PIPELINE II=1", + "unsigned int n = 1;", "OutDType t;", - "t.set_data(in0.read());", "t.set_keep(-1);", + "io_section: { // start of cycle accurate region", + "#pragma HLS protocol fixed", + "// do a first read from stream before we decide on numIters", + "// giving software a chance to set up the numIters prior to startup", + "t.set_data(in0.read());", + "n = (numIters == 0 ? NumItersPerImg : numIters);", + "t.set_last(n==1);", + "out.write(t);", + "} // end of cycle accurate region", + "// do one less iteration than spec since we already did one", + "for(unsigned int i=1; i<n; i++) {", + "#pragma HLS PIPELINE II=1", + "t.set_data(in0.read());", "t.set_last(i==(n-1));", "out.write(t);", "}", -- GitLab