Skip to content
Snippets Groups Projects
Commit b199208d authored by Eric Kooistra's avatar Eric Kooistra
Browse files

Use <lib_name>.mpf instead of same fixed hdllib.mpf for all.

parent ae04ee82
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......@@ -138,8 +137,9 @@ class ModelsimConfig(hdl_config.HdlConfig):
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,7 +152,7 @@ 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:'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment