From 33e5d51df807fca35d482ce217de907e61bf6f4c Mon Sep 17 00:00:00 2001
From: Yaman Umuroglu <maltanar@gmail.com>
Date: Tue, 21 Jan 2020 21:16:56 +0000
Subject: [PATCH] [IPI] set vivado_proj attribute correctly at top level

---
 src/finn/transformation/fpgadataflow/codegen_ipstitch.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/finn/transformation/fpgadataflow/codegen_ipstitch.py b/src/finn/transformation/fpgadataflow/codegen_ipstitch.py
index 602aa763b..721e3f600 100644
--- a/src/finn/transformation/fpgadataflow/codegen_ipstitch.py
+++ b/src/finn/transformation/fpgadataflow/codegen_ipstitch.py
@@ -84,13 +84,11 @@ class CodeGen_ipstitch(Transformation):
 
         # create a temporary folder for the project
         vivado_proj = get_by_name(model.model.metadata_props, "vivado_proj", "key")
-        if vivado_proj is None:
+        if vivado_proj is None or not os.path.isdir(vivado_proj.value):
             vivado_proj = onnx.StringStringEntryProto()
             vivado_proj.key = "vivado_proj"
-            vivado_proj.value = ""
-            model.model.metadata_props.append(vivado_proj)
-        if not os.path.isdir(vivado_proj.value):
             vivado_proj.value = tmp.mkdtemp(prefix="vivado_proj_")
+            model.model.metadata_props.append(vivado_proj)
         vivado_proj_dir = vivado_proj.value
         # start building the tcl script
         tcl = []
-- 
GitLab