From 6386c56647216dcd6c81fe4d745cc19075f6e699 Mon Sep 17 00:00:00 2001 From: Erik Kooistra <kooistra@astron.nl> Date: Tue, 21 Apr 2015 06:24:19 +0000 Subject: [PATCH] Added verbosity level (0, 1 or 2, default 0) to config script. --- tools/oneclick/base/modelsim_config.py | 49 ++++++++++++++---------- tools/oneclick/base/quartus_config.py | 52 ++++++++++++++------------ 2 files changed, 58 insertions(+), 43 deletions(-) diff --git a/tools/oneclick/base/modelsim_config.py b/tools/oneclick/base/modelsim_config.py index 686318acd1..05750c8cea 100755 --- a/tools/oneclick/base/modelsim_config.py +++ b/tools/oneclick/base/modelsim_config.py @@ -310,38 +310,47 @@ 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 + + # Parse command line arguments toolsetSelect = ['unb1', 'unb2'] - 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','--toolset', help=arghelp_str, default=toolsetSelect[0], required=False) + 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, 1', type=int, default=0, required=False) args = vars(argparser.parse_args()) - if args['toolset'] not in toolsetSelect: - print 'Toolset %s is not supported' % args['toolset'] + 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' - toolset = args['toolset'] - toolFileName = 'hdltool_' + toolset + '.cfg' - + arg_verbosity = args['verbosity'] + + # Create and use msim object msim = ModelsimConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName=toolFileName) - print '#' - print '# ModelsimConfig:' - print '#' - print '' - print 'HDL library paths that are found in $%s:' % msim.libRootDir - for p in msim.libs.filePaths: - print ' ', p + if arg_verbosity>=2: + print arg_verbosity + print '#' + print '# ModelsimConfig:' + print '#' + print '' + print 'HDL library paths that are found in $%s:' % msim.libRootDir + for p in msim.libs.filePaths: + print ' ', p - print '' - print 'Derive library compile order = ', msim.derive_lib_order('sim') + if arg_verbosity>=1: + print '' + print 'Derive library compile order = ', msim.derive_lib_order('sim') - print '' - print 'get_lib_build_dirs for simulation:' - for sim_dir in msim.get_lib_build_dirs('sim'): - print ' ', sim_dir + if arg_verbosity>=2: + print arg_verbosity + 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 for simulation.' diff --git a/tools/oneclick/base/quartus_config.py b/tools/oneclick/base/quartus_config.py index c105a00ed8..c598b2780a 100755 --- a/tools/oneclick/base/quartus_config.py +++ b/tools/oneclick/base/quartus_config.py @@ -220,40 +220,47 @@ 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 + + # Parse command line arguments toolsetSelect = ['unb1', 'unb2'] 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','--toolset', help=arghelp_str, default=toolsetSelect[0], required=False) + argparser.add_argument('-v','--verbosity', help='verbosity 0, 1, 2', type=int, default=0, required=False) args = vars(argparser.parse_args()) - if args['toolset'] not in toolsetSelect: - print 'Toolset %s is not supported' % args['toolset'] + 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) - - toolset = args['toolset'] - toolFileName = 'hdltool_' + toolset + '.cfg' + toolFileName = 'hdltool_' + arg_toolset + '.cfg' + arg_verbosity = args['verbosity'] + + # Create and use qsyn object qsyn = QuartusConfig(toolRootDir=os.path.expandvars('$RADIOHDL/tools'), libFileName='hdllib.cfg', toolFileName=toolFileName) - print '#' - print '# QuartusConfig:' - print '#' - print '' - 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:' % 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): - if d['synth_top_level_entity']=='': - print ' %-30s' % d['hdl_lib_name'], ':', d['hdl_lib_name'] - else: - print ' %-30s' % d['hdl_lib_name'], ':', d['synth_top_level_entity'] + if arg_verbosity>=2: + print '#' + print '# QuartusConfig:' + print '#' + print '' + print 'HDL library paths that are found in $%s:' % qsyn.libRootDir + for p in qsyn.libs.filePaths: + print ' ', p + + if arg_verbosity>=1: + print '' + print 'HDL libraries with a top level entity for synthesis that are found in $%s:' % qsyn.libRootDir + print ' %-40s' % 'HDL library', ': Top level entity' + syn_dicts = qsyn.libs.get_dicts(key='synth_top_level_entity') + for d in cm.listify(syn_dicts): + if d['synth_top_level_entity']=='': + print ' %-40s' % d['hdl_lib_name'], ':', d['hdl_lib_name'] + else: + print ' %-40s' % d['hdl_lib_name'], ':', d['synth_top_level_entity'] print '' print 'Create Quartus IP library qip files for all HDL libraries in $%s.' % qsyn.libRootDir @@ -266,7 +273,6 @@ if __name__ == '__main__': 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.' % (qsyn.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.' % (qsyn.technologyNames, qsyn.libRootDir) -- GitLab