diff --git a/tools/oneclick/base/modelsim_config.py b/tools/oneclick/base/modelsim_config.py index 15e95aba75942e78dd763e31d5059914d1c18c7e..11efb4b03cb58630b3dd2e96626938b7afffc391 100644 --- a/tools/oneclick/base/modelsim_config.py +++ b/tools/oneclick/base/modelsim_config.py @@ -96,6 +96,27 @@ class ModelsimConfig(hdl_config.HdlConfig): compile_order[k]=project_file_name return compile_order + def create_modelsim_lib_compile_ip_files(self, lib_names=None): + """Create the '<lib_name>_lib_compile_ip.txt' file for all HDL libraries in the specified list of lib_names. + + The file is stored in the sim build directory of the HDL library. + The file is read by commands.do in Modelsim to know which IP needs to be compiled before the library is compiled. + """ + if lib_names==None: lib_names=self.lib_names + lib_dicts = self.libs.get_dicts('hdl_lib_name', lib_names) + for lib_dict in cm.listify(lib_dicts): + if 'modelsim_compile_ip_files' in lib_dict: + compile_ip_files = lib_dict['modelsim_compile_ip_files'].split() + lib_name = lib_dict['hdl_lib_name'] + file_name = lib_name + '_lib_compile_ip.txt' + file_path = self.get_lib_build_dirs('sim', lib_dicts=lib_dict) + cm.mkdir(file_path) + filePathName = os.path.join(file_path, file_name) + with open(filePathName, 'w') as fp: + for fpn in compile_ip_files: + fn = os.path.basename(fpn) + fp.write('%s ' % fn) # write the file name without the full path to it + def create_modelsim_project_file(self, technologyNames, lib_names=None): """Create the Modelsim project file for all technology libraries and RTL HDL libraries. @@ -245,6 +266,10 @@ if __name__ == '__main__': print 'Create library compile order files.' msim.create_lib_order_files() + print '' + print 'Create library compile ip files.' + msim.create_modelsim_lib_compile_ip_files() + print '' print 'Create modelsim projects list file.' msim.create_modelsim_project_files_file()