From b199208d2ef0ad06673ab60176d9cdb3c9a787c4 Mon Sep 17 00:00:00 2001
From: Erik Kooistra <kooistra@astron.nl>
Date: Thu, 22 May 2014 16:09:43 +0000
Subject: [PATCH] Use <lib_name>.mpf instead of same fixed hdllib.mpf for all.

---
 tools/oneclick/base/modelsim_config.py | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/tools/oneclick/base/modelsim_config.py b/tools/oneclick/base/modelsim_config.py
index 8b755ed113..81c7f28207 100644
--- a/tools/oneclick/base/modelsim_config.py
+++ b/tools/oneclick/base/modelsim_config.py
@@ -30,11 +30,10 @@ import os.path
 
 class ModelsimConfig(hdl_config.HdlConfig):
 
-    def __init__(self, libRootDir, toolRootDir='', libFileName='hdllib.cfg', toolFileName='hdltool.cfg'):
+    def __init__(self, libRootDir, toolRootDir, libFileName='hdllib.cfg', toolFileName='hdltool.cfg'):
         """Get Modelsim tool info from toolRootDir and all HDL library info from libRootDir."""
         hdl_config.HdlConfig.__init__(self, libRootDir, toolRootDir, libFileName, toolFileName)
         # Modelsim
-        self.MODELSIM_MPF_NAME = 'hdllib.mpf'
 
     def read_compile_order_from_mpf(self, mpfPathName):
         """Utility to read the compile order of the project files from an existing <mpfPathName>.mpf and save it into hdl_order.out."""
@@ -70,14 +69,14 @@ class ModelsimConfig(hdl_config.HdlConfig):
         lib_dicts = self.libs.get_dicts('hdl_lib_name', lib_names)
         for lib_dict in cm.listify(lib_dicts):
             # Open mpf
-            mpf_name = self.MODELSIM_MPF_NAME
+            lib_name = lib_dict['hdl_lib_name']
+            mpf_name = lib_name + '.mpf'
             mpf_path = self.get_lib_build_sim_dirs(lib_dict)
             cm.mkdir(mpf_path)
             mpfPathName = os.path.join(mpf_path, mpf_name)
             with open(mpfPathName, 'w') as fp:
                 # Write [Library] section for afileNamell used libraries
                 fp.write('[Library]\n')
-                lib_name = lib_dict['hdl_lib_name']
                 use_lib_names = self.derive_all_use_libs(lib_name)
                 use_lib_dicts = self.libs.get_dicts('hdl_lib_name', use_lib_names)
                 use_lib_build_sim_dirs = self.get_lib_build_sim_dirs(use_lib_dicts)
@@ -137,9 +136,10 @@ class ModelsimConfig(hdl_config.HdlConfig):
                 fp.write('resolution = 1ps\n')
                 fp.write('IterationLimit = 100\n')
                 fp.write('DefaultRadix = decimal\n')
-
-    def create_modelsim_project_files_file(self, fileNamePath='modelsim_project_files.txt', lib_names=None):
+                
+    def create_modelsim_project_files_file(self, fileNamePath=None, lib_names=None):
         """Create file with list of the Modelsim project files for all HDL libraries in the specified list of lib_names."""
+        if fileNamePath==None: fileNamePath=os.path.join(self.toolRootDir, 'modelsim', 'modelsim_project_files.txt')
         if lib_names==None: lib_names=self.lib_names
         with open(fileNamePath, 'w') as fp:
             lib_dicts = self.libs.get_dicts('hdl_lib_name', lib_names)
@@ -152,8 +152,8 @@ if __name__ == '__main__':
     # Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
     libRootDir = 'RADIOHDL'
     #libRootDir = 'UNB'
-    msim = ModelsimConfig(libRootDir=os.environ[libRootDir], toolRootDir=os.environ['UNB'], libFileName='hdllib.cfg', toolFileName='hdltool.cfg')
-
+    msim = ModelsimConfig(libRootDir=os.environ[libRootDir], toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg')
+    
     print '#'
     print '# ModelsimConfig:'
     print '#'
-- 
GitLab