From cbc3a58c32acbd42ebf4a3ad995150fcf6c41696 Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Thu, 9 Apr 2020 01:43:10 +0100
Subject: [PATCH] [Transform] support synth resource analysis mode for
 AnnotateRes

---
 src/finn/analysis/fpgadataflow/hls_synth_res_estimation.py | 4 ++--
 src/finn/transformation/fpgadataflow/annotate_resources.py | 3 +++
 2 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/finn/analysis/fpgadataflow/hls_synth_res_estimation.py b/src/finn/analysis/fpgadataflow/hls_synth_res_estimation.py
index 68738aba9..c7db5b1d9 100644
--- a/src/finn/analysis/fpgadataflow/hls_synth_res_estimation.py
+++ b/src/finn/analysis/fpgadataflow/hls_synth_res_estimation.py
@@ -34,9 +34,9 @@ import finn.util.basic as util
 
 
 def hls_synth_res_estimation(model):
-    """Extracts the results from the vivado synthesis.
+    """Extracts the FPGA resource results from the Vivado HLS synthesis estimates.
 
-    Returns {node name : resource estimation}."""
+    Returns {node name : resources_dict}."""
 
     res_dict = {}
     for node in model.graph.node:
diff --git a/src/finn/transformation/fpgadataflow/annotate_resources.py b/src/finn/transformation/fpgadataflow/annotate_resources.py
index 4806c2eb6..d192372a7 100644
--- a/src/finn/transformation/fpgadataflow/annotate_resources.py
+++ b/src/finn/transformation/fpgadataflow/annotate_resources.py
@@ -31,6 +31,7 @@ from finn.transformation import Transformation
 from finn.transformation.move_reshape import _is_fpgadataflow_node
 from finn.analysis.fpgadataflow.res_estimation import res_estimation
 from finn.analysis.fpgadataflow.hls_synth_res_estimation import hls_synth_res_estimation
+from finn.analysis.fpgadataflow.post_synth_res import post_synth_res
 
 
 class AnnotateResources(Transformation):
@@ -53,6 +54,8 @@ class AnnotateResources(Transformation):
             res_fxn = res_estimation
         elif self.mode == "hls":
             res_fxn = hls_synth_res_estimation
+        elif self.mode == "synth":
+            res_fxn = post_synth_res
         else:
             raise Exception("Unrecognized mode for AnnotateResources")
         res_dict = model.analysis(res_fxn)
-- 
GitLab