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

Added get_lib_dicts_from_lib_names().

parent f86e462f
No related branches found
No related tags found
No related merge requests found
...@@ -53,6 +53,7 @@ import sys ...@@ -53,6 +53,7 @@ import sys
import os import os
import os.path import os.path
import shutil import shutil
import argparse
class HdlConfig: class HdlConfig:
...@@ -166,7 +167,7 @@ class HdlConfig: ...@@ -166,7 +167,7 @@ class HdlConfig:
. The lib_names list must include all used libs, so if necessary first call derive_all_use_libs(). . The lib_names list must include all used libs, so if necessary first call derive_all_use_libs().
""" """
if lib_names==None: lib_names=self.lib_names if lib_names==None: lib_names=self.lib_names
lib_dicts = self.libs.get_dicts('hdl_lib_name', lib_names) lib_dicts = self.libs.get_dicts('hdl_lib_name', values=lib_names)
# use list() to take local copy to avoid modifying list order of self.lib_names which matches self.libs.dicts list order # use list() to take local copy to avoid modifying list order of self.lib_names which matches self.libs.dicts list order
lib_order = list(lib_names) lib_order = list(lib_names)
for lib_dict in cm.listify(lib_dicts): for lib_dict in cm.listify(lib_dicts):
...@@ -186,6 +187,20 @@ class HdlConfig: ...@@ -186,6 +187,20 @@ class HdlConfig:
return lib_order return lib_order
def get_lib_dicts_from_lib_names(self, lib_names=None):
"""Get list the HDL libraries lib_dicts from list of HDL libraries lib_names and preseve the library order.
"""
if lib_names==None: lib_names=self.lib_names
# Cannot use:
#lib_dicts = self.libs.get_dicts('hdl_lib_name', values=lib_names)
# because then the order of self.libs.dicts is used
lib_dicts = []
for lib_name in cm.listify(lib_names):
lib_dict = self.libs.dicts[self.lib_names.index(lib_name)]
lib_dicts.append(lib_dict)
return lib_dicts
def get_tool_build_dir(self, build_type): def get_tool_build_dir(self, build_type):
"""Get the central tool build directory. """Get the central tool build directory.
...@@ -239,7 +254,7 @@ class HdlConfig: ...@@ -239,7 +254,7 @@ class HdlConfig:
The file is read by commands.do in Modelsim to avoid having to derive the library compile order in TCL. The file is read by commands.do in Modelsim to avoid having to derive the library compile order in TCL.
""" """
if lib_names==None: lib_names=self.lib_names if lib_names==None: lib_names=self.lib_names
lib_dicts = self.libs.get_dicts('hdl_lib_name', lib_names) lib_dicts = self.libs.get_dicts('hdl_lib_name', values=lib_names)
for lib_dict in cm.listify(lib_dicts): for lib_dict in cm.listify(lib_dicts):
lib_name = lib_dict['hdl_lib_name'] lib_name = lib_dict['hdl_lib_name']
use_libs = self.derive_all_use_libs(build_type, lib_name) use_libs = self.derive_all_use_libs(build_type, lib_name)
...@@ -321,9 +336,25 @@ if __name__ == '__main__': ...@@ -321,9 +336,25 @@ if __name__ == '__main__':
mode = 0 mode = 0
if mode==0: if mode==0:
# Parse command line arguments
toolsetSelect = ['unb1', 'unb2']
argparser = argparse.ArgumentParser(description='Create Modelsim mpf files for all hdllib.cfg')
argparser.add_argument('-t','--toolset', help='choose toolset %s (default: %s)' % (toolsetSelect,toolsetSelect[0]), default=toolsetSelect[0], required=False)
argparser.add_argument('-v','--verbosity', help='verbosity >= 0 for more info', type=int, default=0, required=False)
args = vars(argparser.parse_args())
arg_toolset = args['toolset']
if arg_toolset not in toolsetSelect:
print 'Toolset %s is not supported' % arg_toolset
print 'Hint: give argument -h for possible options'
sys.exit(1)
toolFileName = 'hdltool_' + arg_toolset + '.cfg'
arg_verbosity = args['verbosity']
# Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories # Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
hdl = HdlConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool_<toolset>.cfg') hdl = HdlConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName=toolFileName)
print '#' print '#'
print '# HdlConfig:' print '# HdlConfig:'
print '#' print '#'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment