diff --git a/tools/oneclick/base/modelsim_config.py b/tools/oneclick/base/modelsim_config.py index cb03de1d00d53faea1cc1089612b6c9940dc364c..686318acd1640dfdb313c2b9802d544e55d37a41 100755 --- a/tools/oneclick/base/modelsim_config.py +++ b/tools/oneclick/base/modelsim_config.py @@ -32,20 +32,23 @@ import argparse class ModelsimConfig(hdl_config.HdlConfig): - def __init__(self, toolRootDir, libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[]): + def __init__(self, toolRootDir, libFileName='hdllib.cfg', toolFileName='hdltool_<toolset>.cfg'): """Get Modelsim tool info from toolRootDir and all HDL library info from libRootDir. Arguments: - - toolRootDir : Root directory from where the hdltool.cfg file is searched for. + - toolRootDir : Root directory from where the hdltool_<toolset>.cfg file is searched for. - libFileName : Default HDL library configuration file name - toolFileName : Default HDL tools configuration file name - - technologyNames : Include all generic HDL libraries and these technology specific libraries - The libRootDir is defined in the hdltool.cfg file and is the root directory from where the hdllib.cfg + The libRootDir is defined in the hdltool_<toolset>.cfg file and is the root directory from where the hdllib.cfg files are searched for. + The technologyNames parameter is defined in the hdltool_<toolset>.cfg file. All generic HDL libraries and these + technology specific libraries are kept. The technologyNames refer one or more + hdl_libraries_<technologyName>.txt files. + Files: - - hdltool.cfg : HDL tool configuration dictionary file. One central file. + - hdltool_<toolset>.cfg : HDL tool configuration dictionary file. One central file per toolset. - hdllib.cfg : HDL library configuration dictionary file. One file for each HDL library. @@ -69,7 +72,7 @@ class ModelsimConfig(hdl_config.HdlConfig): The <lib_name>_lib_order.txt files are read by the TCL commands.do file in Modelsim. Creating the files in Python and then reading them in TCL makes the commands.do much simpler. """ - hdl_config.HdlConfig.__init__(self, toolRootDir, libFileName, toolFileName, technologyNames) + hdl_config.HdlConfig.__init__(self, toolRootDir, libFileName, toolFileName) def read_compile_order_from_mpf(self, mpfPathName): """Utility to read the compile order of the project files from an existing <mpfPathName>.mpf.""" @@ -122,11 +125,10 @@ class ModelsimConfig(hdl_config.HdlConfig): efpn = os.path.expandvars(fpn) fp.write('%s ' % efpn) - def create_modelsim_project_file(self, technologyNames, lib_names=None): + def create_modelsim_project_file(self, lib_names=None): """Create the Modelsim project file for all technology libraries and RTL HDL libraries. Arguments: - - technologyNames : refers one or more hdl_libraries_<technologyName>.txt files. - lib_names : one or more HDL libraries """ if lib_names==None: lib_names=self.lib_names @@ -142,7 +144,7 @@ class ModelsimConfig(hdl_config.HdlConfig): # Write [Library] section for all used libraries fp.write('[Library]\n') # . map used vendor technology libs to their target directory - for technologyName in cm.listify(technologyNames): + for technologyName in cm.listify(self.technologyNames): tech_dict = self.read_hdl_libraries_technology_file(technologyName) for lib_clause, lib_work in tech_dict.iteritems(): fp.write('%s = %s\n' % (lib_clause, lib_work)) @@ -166,7 +168,7 @@ class ModelsimConfig(hdl_config.HdlConfig): # . work fp.write('work = work\n') # . others modelsim default libs - model_tech_dir = os.path.expandvars(self.tool.get_key_values('model_tech_dir')) + model_tech_dir = os.path.expandvars(self.tool_dict['model_tech_dir']) fp.write('others = %s\n' % os.path.join(model_tech_dir, 'modelsim.ini')) # Write [Project] section for all used libraries @@ -252,7 +254,7 @@ class ModelsimConfig(hdl_config.HdlConfig): project_sim_p_search_libraries = '-L {}' if 'modelsim_search_libraries' in lib_dict: project_sim_p_search_libraries = '-L {' - for sl in lib_dict['modelsim_search_libraries'].split(): + for sl in self.tool_dict['modelsim_search_libraries'].split(): project_sim_p_search_libraries += sl project_sim_p_search_libraries += ' ' project_sim_p_search_libraries += '}' @@ -285,9 +287,9 @@ class ModelsimConfig(hdl_config.HdlConfig): Arguments: - lib_names : one or more HDL libraries """ - fileName = 'modelsim_project_files.txt' # use fixed file name - build_maindir, build_tooldir = self.get_tool_build_dir('sim') - fileNamePath=os.path.join(build_maindir, build_tooldir, fileName) # and use too build dir for file path + fileName = 'modelsim_project_files.txt' # use fixed file name + build_maindir, build_toolsetdir, build_tooldir = self.get_tool_build_dir('sim') + fileNamePath=os.path.join(build_maindir, build_toolsetdir, build_tooldir, fileName) # and use too build dir for file path 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) @@ -308,25 +310,22 @@ if __name__ == '__main__': if mode==0: # Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories - technologySelect = ['ip_stratixiv', 'ip_arria10'] + toolsetSelect = ['unb1', 'unb2'] - arghelp_str = 'choose technology %s (default: %s)' % (technologySelect,technologySelect[0]) + arghelp_str = 'choose toolset %s (default: %s)' % (toolsetSelect,toolsetSelect[0]) argparser = argparse.ArgumentParser(description='Create Modelsim mpf files for all hdllib.cfg') - argparser.add_argument('-t','--technology', help=arghelp_str, default=technologySelect[0], required=False) + argparser.add_argument('-t','--toolset', help=arghelp_str, default=toolsetSelect[0], required=False) args = vars(argparser.parse_args()) - if args['technology'] not in technologySelect: - print 'Technology %s is not supported' % args['technology'] + if args['toolset'] not in toolsetSelect: + print 'Toolset %s is not supported' % args['toolset'] print 'Hint: give argument -h for possible options' sys.exit(1) + toolset = args['toolset'] + toolFileName = 'hdltool_' + toolset + '.cfg' - #technologyNames = ['ip_stratixiv', 'ip_arria10'] - #technologyNames = ['ip_stratixiv'] - #technologyNames = ['ip_arria10'] - technologyNames = [args['technology']] - - msim = ModelsimConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=technologyNames) + msim = ModelsimConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName=toolFileName) print '#' print '# ModelsimConfig:' @@ -357,12 +356,12 @@ if __name__ == '__main__': msim.create_modelsim_project_files_file() print '' - print 'Copy Modelsim directories and files from HDL library source tree to build_dir_sim for all HDL libraries that are found in $%s.' % msim.libRootDir + print 'Copy Modelsim directories and files from HDL library source tree to build_dir for all HDL libraries that are found in $%s.' % msim.libRootDir msim.copy_files('sim') print '' - print 'Create modelsim project files for technology %s and all HDL libraries in $%s.' % (technologyNames, msim.libRootDir) - msim.create_modelsim_project_file(technologyNames) + print 'Create modelsim project files for technology %s and all HDL libraries in $%s.' % (msim.technologyNames, msim.libRootDir) + msim.create_modelsim_project_file() if mode==1 and msim.libRootDir=='UNB': lib_name = 'unb_common'