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

Renamed get_lib_build_sim_dirs() into get_lib_build_dirs() and distinguish...

Renamed get_lib_build_sim_dirs() into get_lib_build_dirs() and distinguish separate keys for build_sim_dir and build_synth_dir.
parent b199208d
No related branches found
No related tags found
No related merge requests found
......@@ -103,28 +103,43 @@ class HdlConfig:
lib_order.insert(lib_order.index(lib_name), use_lib) # move used lib to just before this lib
return lib_order
def get_lib_build_sim_dirs(self, lib_dicts=None):
"""Get the simulation build directory for all HDL libraries in the specified list of lib_dicts.
def get_lib_build_dirs(self, build_type, build_subdir=None, lib_dicts=None):
"""Get the tool build directory for all HDL libraries in the specified list of lib_dicts.
If key 'build_dir' in HDL library config file is '' then
define build dir by 'sim_tool_name' local to current HDL library directory.
The build_type can be:
'sim' uses the 'build_sim_dir' key in the lib_dict,
'synth' uses the 'build_synth_dir' key in the lib_dict
If the build_subdir is not specfied then it defaults to the tool name key value.
If the build dir key in HDL library config file is '' then
treat the build dir key as local directory in the HDL library directory.
else
define build dir by 'sim_tool_name' local to 'build_dir' directory.
treat the build dir key as central directory.
"""
if lib_dicts==None: lib_dicts=self.libs.dicts
sim_dirs = []
if build_type=='sim':
build_dir_key = 'build_sim_dir'
tool_name_key = 'sim_tool_name'
elif build_type=='synth':
build_dir_key = 'build_synth_dir'
tool_name_key = 'synth_tool_name'
else:
sys.exit('Error : Unknown build type')
if build_subdir==None: build_subdir = self.tool.get_key_values(tool_name_key)
build_dirs = []
for lib_dict in cm.listify(lib_dicts):
lib_path = self.libs.get_filePath(lib_dict)
build_dir = os.path.expandvars(self.libs.get_key_values('build_dir', lib_dict))
sim_tool_name = self.tool.get_key_values('sim_tool_name')
build_dir = os.path.expandvars(self.libs.get_key_values(build_dir_key, lib_dict))
if build_dir=='':
sim_dirs.append(os.path.join(lib_path, build_dir, sim_tool_name))
lib_path = self.libs.get_filePath(lib_dict)
build_dirs.append(os.path.join(lib_path, build_subdir)) # local build directory in HDL library directory
else:
sim_dirs.append(os.path.join(lib_path, build_dir, sim_tool_name))
return cm.unlistify(sim_dirs)
lib_name = lib_dict['hdl_lib_name']
build_dirs.append(os.path.join(build_dir, build_subdir, lib_name)) # central build cdirectory
return cm.unlistify(build_dirs)
def create_lib_order_files(self, lib_names=None):
"""Create the Modelsim project file for all HDL libraries in the specified list of lib_names."""
"""Create the compile order file for all HDL libraries in the specified list of lib_names."""
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):
......@@ -132,7 +147,7 @@ class HdlConfig:
use_libs = self.derive_all_use_libs(lib_name)
lib_order = self.derive_lib_order(use_libs)
file_name = 'hdllib_order.txt'
file_path = self.get_lib_build_sim_dirs(lib_dict)
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:
......@@ -173,14 +188,10 @@ if __name__ == '__main__':
print 'derive_lib_order : ', hdl.derive_lib_order()
print ''
print 'get_lib_build_sim_dirs:'
for sim_dir in hdl.get_lib_build_sim_dirs():
print 'get_lib_build_dirs for simulation:'
for sim_dir in hdl.get_lib_build_dirs('sim'):
print ' ', sim_dir
print ''
print 'create_lib_order_files'
hdl.create_lib_order_files()
print ''
if libRootDir=='RADIOHDL':
print 'derive_all_use_libs = ', hdl.derive_lib_order(hdl.derive_all_use_libs('technology_memory'))
......
......@@ -71,7 +71,7 @@ class ModelsimConfig(hdl_config.HdlConfig):
# Open mpf
lib_name = lib_dict['hdl_lib_name']
mpf_name = lib_name + '.mpf'
mpf_path = self.get_lib_build_sim_dirs(lib_dict)
mpf_path = self.get_lib_build_dirs('sim', lib_dicts=lib_dict)
cm.mkdir(mpf_path)
mpfPathName = os.path.join(mpf_path, mpf_name)
with open(mpfPathName, 'w') as fp:
......@@ -79,7 +79,7 @@ class ModelsimConfig(hdl_config.HdlConfig):
fp.write('[Library]\n')
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)
use_lib_build_sim_dirs = self.get_lib_build_dirs('sim', lib_dicts=use_lib_dicts)
use_lib_clause_names = self.libs.get_key_values('hdl_library_clause_name', use_lib_dicts)
for lib_clause, lib_dir in zip(cm.listify(use_lib_clause_names), cm.listify(use_lib_build_sim_dirs)):
lib_work = os.path.join(lib_dir, 'work')
......@@ -143,7 +143,7 @@ class ModelsimConfig(hdl_config.HdlConfig):
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)
mpf_paths = self.get_lib_build_sim_dirs(lib_dicts)
mpf_paths = self.get_lib_build_dirs('sim', lib_dicts=lib_dicts)
for lib, path in zip(cm.listify(lib_names),cm.listify(mpf_paths)):
fp.write('%s = %s\n' % (lib, path))
......@@ -157,7 +157,17 @@ if __name__ == '__main__':
print '#'
print '# ModelsimConfig:'
print '#'
print 'derive_lib_order = ', msim.derive_lib_order()
print 'Derive library compile order = ', msim.derive_lib_order()
print ''
print 'get_lib_build_dirs for simulation:'
for sim_dir in msim.get_lib_build_dirs('sim'):
print ' ', sim_dir
print ''
print 'Create library compile order files.'
msim.create_lib_order_files()
print ''
print 'Create modelsim projects list file.'
msim.create_modelsim_project_files_file()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment