From 5253b65397c736a4d442a334e721dbdaa8577489 Mon Sep 17 00:00:00 2001
From: auphelia <jakobapk@web.de>
Date: Tue, 28 Jan 2020 12:38:07 +0000
Subject: [PATCH] [HLSCustomOp] Added function and two abstract methods to
 estimate resources of hls custom op

---
 src/finn/custom_op/fpgadataflow/__init__.py | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/finn/custom_op/fpgadataflow/__init__.py b/src/finn/custom_op/fpgadataflow/__init__.py
index 3f64b8940..e9f990d58 100644
--- a/src/finn/custom_op/fpgadataflow/__init__.py
+++ b/src/finn/custom_op/fpgadataflow/__init__.py
@@ -5,7 +5,6 @@ import subprocess
 from finn.custom_op import CustomOp
 from finn.core.utils import CppBuilder, IPGenBuilder
 import finn.custom_op.fpgadataflow.templates
-from pyverilator import PyVerilator
 
 
 class HLSCustomOp(CustomOp):
@@ -35,6 +34,20 @@ class HLSCustomOp(CustomOp):
             "sim_mode": ("s", False, ""),
         }
 
+    def node_res_estimation(self):
+        resources = []
+        resources.append("BRAMs: " + str(self.bram_estimation()))
+        resources.append("LUTs: " + str(self.lut_estimation()))
+        return resources
+
+    @abstractmethod
+    def bram_estimation(self):
+        pass
+
+    @abstractmethod
+    def lut_estimation(self):
+        pass
+
     def code_generation_ipgen(self, model, fpgapart, clk):
         node = self.onnx_node
 
-- 
GitLab