from utlis import * import os import shutil import argparse def create_and_copy_files(def_dict, target_dir): if not os.path.exists(target_dir): os.makedirs(target_dir) for name, src_file in def_dict.items(): ext = os.path.splitext(src_file)[1] dest_file = os.path.join(target_dir, name + ext) shutil.copy(src_file, dest_file) def main(): parser = argparse.ArgumentParser(description='Execute different functions based on input parameters') parser.add_argument('--formacroplace', action='store_true', help='Process macro placement files') parser.add_argument('--forcellplace', action='store_true', help='Process standard cell placement files') parser.add_argument('--forallcellplace', action='store_true', help='Process all standard cell placement files') parser.add_argument('--afterstage', type=str, choices=['place', 'route', 'cts'], help='Process files after specified stage (place, route, cts)') parser.add_argument('--getnetlist', action='store_true', help='Process netlist files') args = parser.parse_args() if args.formacroplace: def_dict = getMacroDef() create_and_copy_files(def_dict, 'ForMacroPlace') elif args.forcellplace: def_dict = getCellDef() create_and_copy_files(def_dict, 'ForCellPlace') elif args.forallcellplace: def_dict = getAllCellDef() create_and_copy_files(def_dict, 'ForAllCellPlace') elif args.afterstage: def_dict = getAfterDef(args.afterstage) create_and_copy_files(def_dict, f'after_{args.afterstage}') elif args.getnetlist: def_dict = getNetlist() create_and_copy_files(def_dict, 'netlist') if __name__ == '__main__': main()