diff --git a/src/finn/custom_op/fpgadataflow/streamingfclayer_batch.py b/src/finn/custom_op/fpgadataflow/streamingfclayer_batch.py index 9c3bd3ac87b94f3e0ff11a2937bf5083aae614f6..0fbf2ad99022c47edca4bae0d0c5740233d302f0 100644 --- a/src/finn/custom_op/fpgadataflow/streamingfclayer_batch.py +++ b/src/finn/custom_op/fpgadataflow/streamingfclayer_batch.py @@ -565,24 +565,12 @@ class StreamingFCLayer_Batch(HLSCustomOp): weight_tensor_pe_flipped = pack_innermost_dim_as_hex_string( weight_tensor_pe_flipped, export_wdt, weight_width_padded, prefix="" ) - weight_stream_len = np.prod(weight_tensor_pe_flipped.shape) - factor = math.ceil(weight_stream_len / 1024) # add zeroes to pad out file to 1024 entries weight_stream = weight_tensor_pe_flipped.flatten() - pad_amt = (factor * 1024) - weight_stream_len - weight_stream = np.pad( - weight_stream, (0, pad_amt), mode="constant", constant_values="0" - ) weight_stream = weight_stream.copy() - i = 0 - j = 0 - for val in weight_stream: - if i == 1024: - i = 0 - j += 1 - with open("{}/memblock_{}.dat".format(code_gen_dir, j), "a+") as f: + with open("{}/memblock_0.dat".format(code_gen_dir), "a+") as f: + for val in weight_stream: f.write(val + "\n") - i += 1 else: raise Exception( """Please set mem_mode to "const", "decoupled", or "external", @@ -1032,9 +1020,7 @@ class StreamingFCLayer_Batch(HLSCustomOp): self.code_gen_dict["$WEIGHT_RANGE$"] = ["[{}:0]".format(weight_width - 1)] self.code_gen_dict["$WEIGHT_WIDTH$"] = [str(weight_width)] self.code_gen_dict["$WSTREAM_DEPTH$"] = [str(self.calc_wmem())] - self.code_gen_dict["$MEM_DEPTH$"] = [ - str(roundup_to_integer_multiple(self.calc_wmem(), 1024)) - ] + self.code_gen_dict["$MEM_DEPTH$"] = [str(self.calc_wmem())] self.code_gen_dict["$RAM_STYLE$"] = [self.get_nodeattr("ram_style")] template = self.decoupled_wrapper