From fd9a79ec48aed414ce6b8efbfba4d89371c7ce48 Mon Sep 17 00:00:00 2001
From: Reinier van der Walle <walle@astron.nl>
Date: Wed, 11 Apr 2018 13:42:26 +0000
Subject: [PATCH] Added the substitute_key_words function

---
 tools/oneclick/base/hdl_config.py | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/tools/oneclick/base/hdl_config.py b/tools/oneclick/base/hdl_config.py
index dfe39677da..f4cd33667c 100644
--- a/tools/oneclick/base/hdl_config.py
+++ b/tools/oneclick/base/hdl_config.py
@@ -110,7 +110,11 @@ class HdlConfig:
         self.libRootDir = os.path.expandvars(self.tool_dict['lib_root_dir'])
         self.libs = common_dict_file.CommonDictFile(self.libRootDir, libFileName, libFileSections)   # library dict files
         if self.libs.nof_dicts==0: sys.exit('Error : No HDL library config file found')
-        
+       
+        # Substitute key words occurring in hdllib.cfg files with their value.
+        self.substitute_key_words()
+
+ 
         # Keep the generic HDL libraries and remove those that do not match the specified IP technologies
         self.technologyNames = self.tool_dict['technology_names'].split()
         self.removed_dicts = []
@@ -209,7 +213,15 @@ class HdlConfig:
         self.unavailable_use_libs = self.unavailable_use_synth_libs + self.unavailable_use_ip_libs + self.unavailable_use_sim_libs
         self.unavailable_use_libs = cm.unique(self.unavailable_use_libs)                 # aggregate list of use_*_libs
         self.unavailable_include_ip_libs = cm.unique(self.unavailable_include_ip_libs)   # list of include_ip_use_libs
-
+    
+    # The Key value pairs defined in hdltool<toolset>.cfg can be used in hdllib.cfg files. See hdllib.cfg of technology library
+    def substitute_key_words(self):
+        for lib in self.libs.dicts:
+            for lib_key, lib_value in lib.items():
+                for tool_key, tool_value in self.tool_dict.items():
+                    tool_key_string = '<%s>' % tool_key
+                    if tool_key_string in lib_value:
+                         lib[lib_key] = lib_value.replace(tool_key_string,tool_value)  
 
     def check_library_names(self, check_lib_names, lib_names=None):
         """Check that HDL library names exists within the list of library names, if not then exit with Error message.
-- 
GitLab