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

Define lib_root_dir key in hdltool.cfg instead of as libRootDir class argument.

parent 21c7ae91
No related branches found
No related tags found
No related merge requests found
lib_root_dir = $RADIOHDL
build_dir_sim = $HDL_BUILD_DIR
build_dir_synth = $HDL_BUILD_DIR
tool_name_sim = modelsim
tool_name_synth = quartus
model_tech_dir = /home/software/Mentor/6.6c/modeltech
build_dir_synth = $HDL_BUILD_DIR
tool_name_synth = quartus
......@@ -319,6 +319,9 @@ See also the docstring help text in the Python code:
c) hdltool.cfg key descriptions
- lib_root_dir =
Root directory from where all HDL library configuration files (hdllib.cfg) are searched
- build_dir_sim =
Global root path (e.g. $HDL_BUILD_DIR) to the build directory for simulation. The path gets extended with the
tool_name_sim from hdltool.cfg.
......@@ -726,11 +729,13 @@ h) hdltool.cfg per toolset (see also i, j, k)
and add --toolset command line option.
i) multiple libRootDirs for finding hdllib.cfg files
The libRootDir is now defined via a the 'lib_root_dir' key in the hdltool.cfg.
Currently hdlib.cfg files are search from one rootDir by find_all_dict_file_paths() in common_dict_file.py. It
would be usefule to be able to specify multiple rootDirs for the search path. This allows finding eg. all
hdllib.cfg in two different directory trees without having to specifiy their common higher directory root which
could be a very large tree to search through. Furthermore by being able to specify the rootDirs more precisely
avoids finding unintended hdllib.cfg files.
avoids finding unintended hdllib.cfg files. Support for multiple rootdirs needs to be implemented in
common_dict_file.py because the results from all root dirs need to be in a common object.
j) (FIXED - erko) Central build tree or local build directory
The get_lib_build_dirs() in hdl_config.cfg provides the option to build the sources locally in the library
......
......@@ -56,8 +56,8 @@ import shutil
class HdlConfig:
def __init__(self, libRootDir, toolRootDir, libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[]):
"""Get tool dictionary info from toolRootDir and all HDL library dictionary info from libRootDir:
def __init__(self, toolRootDir, libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[]):
"""Get tool dictionary info from toolRootDir and all HDL library dictionary info for it
- self.tool.dicts = single dictionary that contains the tool info
- self.libs.dicts = list of dictionaries that contains the info of the HDL libraries.
......@@ -67,7 +67,6 @@ class HdlConfig:
['ip_stratixiv', 'ip_arria10'] : The HDL libraries with a hdl_lib_technology that is not '' or does not match one of the technologies
in technologyNames are removed from the list of HDL library dictionaries.
"""
self.libRootDir = libRootDir
self.toolRootDir = toolRootDir
# HDL tool config file
......@@ -76,7 +75,8 @@ class HdlConfig:
if self.tool.nof_dicts >1: sys.exit('Error : Multiple HDL tool config files found')
# HDL library config files
self.libs = common_dict_file.CommonDictFile(libRootDir, libFileName) # library dict files
self.libRootDir = os.path.expandvars(self.tool.get_key_values('lib_root_dir'))
self.libs = common_dict_file.CommonDictFile(self.libRootDir, libFileName) # library dict files
if self.libs.nof_dicts==0: sys.exit('Error : No HDL library config file found')
# Keep the generic HDL libraries and remove those that do not match the specified IP technologies
......@@ -307,11 +307,9 @@ 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
libRootDir = 'RADIOHDL'
#libRootDir = 'UNB'
technologyNames = []
technologyNames = ['ip_stratixiv']
hdl = HdlConfig(libRootDir=os.environ[libRootDir], toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=technologyNames)
hdl = HdlConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=technologyNames)
print '#'
print '# HdlConfig:'
......@@ -347,7 +345,7 @@ if __name__ == '__main__':
print ' ', sim_dir
print ''
if libRootDir=='RADIOHDL':
if hdl.libRootDir=='RADIOHDL':
#use_libs = hdl.derive_all_use_libs('sim', 'unb1_minimal')
#use_libs = hdl.derive_all_use_libs('sim', 'dp')
#use_libs = hdl.derive_all_use_libs('sim', 'tech_xaui')
......@@ -356,7 +354,7 @@ if __name__ == '__main__':
print 'derive_all_use_libs = ', use_libs
lib_order = hdl.derive_lib_order('sim', use_libs)
print 'derive_lib_order = ', lib_order
if libRootDir=='UNB':
if hdl.libRootDir=='UNB':
use_libs = hdl.derive_all_use_libs('sim', 'unb_minimal')
use_libs = hdl.derive_all_use_libs('sim', 'dp')
print 'derive_all_use_libs = ', use_libs
......@@ -367,8 +365,7 @@ if __name__ == '__main__':
key = 'build_dir_synth'
new_value = '$HDL_BUILD_DIR'
# Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
libRootDir = 'RADIOHDL'
hdl = HdlConfig(libRootDir=os.environ[libRootDir], toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[])
hdl = HdlConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[])
for p in hdl.libs.filePathNames:
hdl.libs.change_key_value_in_dict_file(p, key, new_value)
......@@ -377,8 +374,7 @@ if __name__ == '__main__':
insert_value = ''
insertLineNr = 4
# Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
libRootDir = 'RADIOHDL'
hdl = HdlConfig(libRootDir=os.environ[libRootDir], toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[])
hdl = HdlConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[])
for p in hdl.libs.filePathNames:
hdl.libs.insert_key_in_dict_file_at_line_number(p, insert_key, insert_value, insertLineNr)
......@@ -387,8 +383,7 @@ if __name__ == '__main__':
insert_value = '\n'
insert_beforeKey = 'hdl_lib_technology'
# Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
libRootDir = 'RADIOHDL'
hdl = HdlConfig(libRootDir=os.environ[libRootDir], toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[])
hdl = HdlConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[])
for p in hdl.libs.filePathNames:
hdl.libs.insert_key_in_dict_file_before_another_key(p, insert_key, insert_value, insert_beforeKey)
......@@ -396,15 +391,13 @@ if __name__ == '__main__':
old_key = 'hdl_lib_uses'
new_key = 'hdl_lib_uses_synth'
# Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
libRootDir = 'RADIOHDL'
hdl = HdlConfig(libRootDir=os.environ[libRootDir], toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[])
hdl = HdlConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[])
for p in hdl.libs.filePathNames:
hdl.libs.rename_key_in_dict_file(p, old_key, new_key)
if mode==5:
remove_key = 'build_dir_synth'
# Read the dictionary info from all HDL tool and library configuration files in the current directory and the sub directories
libRootDir = 'RADIOHDL'
hdl = HdlConfig(libRootDir=os.environ[libRootDir], toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[])
hdl = HdlConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[])
for p in hdl.libs.filePathNames:
hdl.libs.remove_key_from_dict_file(p, remove_key)
......@@ -32,16 +32,18 @@ import argparse
class ModelsimConfig(hdl_config.HdlConfig):
def __init__(self, libRootDir, toolRootDir, libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[]):
def __init__(self, toolRootDir, libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[]):
"""Get Modelsim tool info from toolRootDir and all HDL library info from libRootDir.
Arguments:
- libRootDir : Root directory from where the hdllib.cfg files are searched for.
- toolRootDir : Root directory from where the hdltool.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
files are searched for.
Files:
- hdltool.cfg : HDL tool configuration dictionary file. One central file.
......@@ -67,7 +69,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, libRootDir, toolRootDir, libFileName, toolFileName, technologyNames)
hdl_config.HdlConfig.__init__(self, toolRootDir, libFileName, toolFileName, technologyNames)
def read_compile_order_from_mpf(self, mpfPathName):
"""Utility to read the compile order of the project files from an existing <mpfPathName>.mpf."""
......@@ -306,8 +308,6 @@ 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
libRootDir = 'RADIOHDL'
technologySelect = ['ip_stratixiv', 'ip_arria10']
arghelp_str = 'choose technology %s (default: %s)' % (technologySelect,technologySelect[0])
......@@ -326,13 +326,13 @@ if __name__ == '__main__':
#technologyNames = ['ip_arria10']
technologyNames = [args['technology']]
msim = ModelsimConfig(libRootDir=os.environ[libRootDir], 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='hdltool.cfg', technologyNames=technologyNames)
print '#'
print '# ModelsimConfig:'
print '#'
print ''
print 'HDL library paths that are found in $%s:' % libRootDir
print 'HDL library paths that are found in $%s:' % msim.libRootDir
for p in msim.libs.filePaths:
print ' ', p
......@@ -357,15 +357,14 @@ 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.' % libRootDir
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
msim.copy_files('sim')
print ''
print 'Create modelsim project files for technology %s and all HDL libraries in $%s.' % (technologyNames, libRootDir)
print 'Create modelsim project files for technology %s and all HDL libraries in $%s.' % (technologyNames, msim.libRootDir)
msim.create_modelsim_project_file(technologyNames)
if mode==1 and libRootDir=='UNB':
libRootDir = 'UNB'
if mode==1 and msim.libRootDir=='UNB':
lib_name = 'unb_common'
# Read compile order from existing <lib_name>.mpf
mpfPathName = os.path.expandvars('$UNB/Firmware/designs/%s/build/synth/quartus/sopc_%s_sim/%s.mpf' % (lib_name, lib_name, lib_name))
......
......@@ -32,16 +32,18 @@ import argparse
class QuartusConfig(hdl_config.HdlConfig):
def __init__(self, libRootDir, toolRootDir, libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[]):
def __init__(self, toolRootDir, libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=[]):
"""Get Quartus tool info from toolRootDir and all HDL library info from libRootDir.
Arguments:
- libRootDir : Root directory from where the hdllib.cfg files are searched for.
- toolRootDir : Root directory from where the hdltool.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
files are searched for.
Files:
- hdltool.cfg : HDL tool configuration dictionary file. One central file.
......@@ -53,7 +55,7 @@ class QuartusConfig(hdl_config.HdlConfig):
- <lib_name>.qsf : Quartus settings file (QSF) for a certain HDL library based on the hdllib.cfg. The file is created by
create_quartus_settings_file(). There is one QSF per Quartus synthesis project.
"""
hdl_config.HdlConfig.__init__(self, libRootDir, toolRootDir, libFileName, toolFileName, technologyNames)
hdl_config.HdlConfig.__init__(self, toolRootDir, libFileName, toolFileName, technologyNames)
def create_quartus_ip_lib_file(self, lib_names=None):
"""Create the Quartus IP file <hdl_lib_name>_lib.qip for all HDL libraries. The <hdl_lib_name>.qip file contains the list of files that are given
......@@ -216,8 +218,6 @@ class QuartusConfig(hdl_config.HdlConfig):
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'
technologySelect = ['ip_stratixiv', 'ip_arria10']
arghelp_str = 'choose technology %s (default: %s)' % (technologySelect,technologySelect[0])
......@@ -234,18 +234,18 @@ if __name__ == '__main__':
#technologyNames = 'ip_stratixiv'
technologyNames = args['technology']
qsyn = QuartusConfig(libRootDir=os.environ[libRootDir], toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=technologyNames)
qsyn = QuartusConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName='hdltool.cfg', technologyNames=technologyNames)
print '#'
print '# QuartusConfig:'
print '#'
print ''
print 'HDL library paths that are found in $%s:' % libRootDir
print 'HDL library paths that are found in $%s:' % qsyn.libRootDir
for p in qsyn.libs.filePaths:
print ' ', p
print ''
print 'HDL libraries with a top level entity for synthesis that are found in $%s:' % libRootDir
print 'HDL libraries with a top level entity for synthesis that are found in $%s:' % qsyn.libRootDir
print ' %-30s' % 'HDL library', ': Top level entity'
syn_dicts = qsyn.libs.get_dicts(key='synth_top_level_entity')
for d in cm.listify(syn_dicts):
......@@ -255,18 +255,18 @@ if __name__ == '__main__':
print ' %-30s' % d['hdl_lib_name'], ':', d['synth_top_level_entity']
print ''
print 'Create Quartus IP library qip files for all HDL libraries in $%s.' % libRootDir
print 'Create Quartus IP library qip files for all HDL libraries in $%s.' % qsyn.libRootDir
qsyn.create_quartus_ip_lib_file()
print ''
print 'Copy Quartus directories and files from HDL library source tree to build_dir_synth for all HDL libraries that are found in $%s.' % libRootDir
print 'Copy Quartus directories and files from HDL library source tree to build_dir_synth for all HDL libraries that are found in $%s.' % qsyn.libRootDir
qsyn.copy_files('synth')
print ''
print 'Create Quartus project files (QPF) for technology %s and all HDL libraries with a top level entity for synthesis that are found in $%s.' % (technologyNames, libRootDir)
print 'Create Quartus project files (QPF) for technology %s and all HDL libraries with a top level entity for synthesis that are found in $%s.' % (technologyNames, qsyn.libRootDir)
qsyn.create_quartus_project_file()
print ''
print 'Create Quartus settings files (QSF) for technology %s and all HDL libraries with a top level entity for synthesis that are found in $%s.' % (technologyNames, libRootDir)
print 'Create Quartus settings files (QSF) for technology %s and all HDL libraries with a top level entity for synthesis that are found in $%s.' % (technologyNames, qsyn.libRootDir)
qsyn.create_quartus_settings_file()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment