Exemplo n.º 1
0
def batch_build(path, tfo):
	# from multiprocessing import Process
	start_time = time.time()
	print('Start batch build')
	file_list_list = tfo_parser(path, tfo)
	report_file = os.path.join(FILE_ROOT_PATH, path, tfo.rstrip('.tfo') + '_report.log')
	print('path =', path)
	print('report_path =', report_file)
	print('ROOT =', FILE_ROOT_PATH)
	report(report_file, 'Batch build for '+tfo)
	for project_path, file_list in file_list_list:
		try:
			s_time = time.time()
			pattern = PatternGen(project_path, file_list=file_list)
			pattern.write()
			e_time = time.time()
			key = 'Build time for {:<30}:'.format(pattern.project_name)
			value = e_time - s_time
			report(report_file, key, value)
		# try:
		# 	_thread.start_new_thread(pattern.write, ())
		# except Exception:
		# 	print("Error: unable to start thread")
		# proc = Process(target=pattern.write, args=())
		# proc.start()
		# proc.join()
		except Exception as err:
			key = 'An exception occurs in {}:'.format(project_path)
			report(report_file, key, err)
	print('Batch build finished')
	end_time = time.time()
	report(report_file, 'Total build time:', end_time - start_time)
	print("\nTotal time: " + str(end_time - start_time))
Exemplo n.º 2
0
def batch_trf2vcd(path, tfo):
	print('Start batch trf2vcd')
	file_list_list = tfo_parser(path, tfo)
	print(file_list_list)
	start_time = time.time()
	report_file = os.path.join(FILE_ROOT_PATH, path, tfo.rstrip('.tfo') + '_report.log')
	report(report_file, 'Batch trf2vcd for ' + tfo)
	for project_path, file_list in file_list_list:
		try:
			temp_path = os.path.join(project_path, 'temp.json')
			if os.path.isfile(temp_path):
				s_time = time.time()
				pattern = PatternGen(project_path, file_list=file_list)
				trf = pattern.project_name + '.trf'
				vcd = pattern.project_name + '_trf.vcd'
				pattern.trf2vcd(trf, vcd, flag='bypass')
				e_time = time.time()
				key = 'Trf2vcd time for {:<30}:'.format(pattern.project_name)
				value = e_time - s_time
				report(report_file, key, value)
			else:
				print('temp.json not found. Please build ptn first.')
		except Exception as err:
			key = 'An exception occurs in {}:'.format(project_path)
			report(report_file, key, err)
	print('Batch trf2vcd finished')
	end_time = time.time()
	report(report_file, 'Total trf2vcd time:', end_time - start_time)
	print("\nTotal time: " + str(end_time - start_time))
Exemplo n.º 3
0
def batch_merge(path, tfo):
	print('Start batch merge')
	file_list_list = tfo_parser(path, tfo)
	# print(file_list_list)
	start_time = time.time()
	# report_file = os.path.join(FILE_ROOT_PATH, path, tfo.rstrip('.tfo') + '_report.log')
	report_file = os.path.join(path, tfo.rstrip('.tfo') + '_report.log')
	report(report_file, 'Batch merge for ' + tfo)
	for project_path, file_list in file_list_list:
		try:
			# pattern = PatternGen(os.path.join(path, project_path), file_list=file_list)
			pattern = PatternGen(project_path, file_list=file_list)
			s_time = time.time()
			period = pattern.digital_param['period']
			# print(type(period))
			vcd1 = os.path.join(project_path, pattern.file_list['VCD'])
			vcd2 = os.path.join(project_path, pattern.project_name + '_trf.vcd')
			vcdm_path = os.path.join(project_path, pattern.project_name + '_merge.vcd')
			vcd_merge(vcd1, vcd2, period, vcdm_path)
			e_time = time.time()
			key = 'Merge time for {:<30}:'.format(pattern.project_name)
			value = e_time - s_time
			report(report_file, key, value)
		except Exception as err:
			key = 'An exception occurs in {}:'.format(project_path)
			report(report_file, key, err)
	print('Batch merge finished')
	end_time = time.time()
	report(report_file, 'Total merge time:', end_time - start_time)
	print("\nTotal time: " + str(end_time - start_time))
Exemplo n.º 4
0
def batch_merge(path, tfo):
	from mytools import VcdFile, vcd_merge
	print('Start batch merge')
	file_list_list = tfo_parser(path, tfo)
	# print(file_list_list)
	start_time = time.time()
	report_file = os.path.join(path, tfo.rstrip('.tfo') + '_report.log')
	report(report_file, 'Batch merge for ' + tfo)
	for project_path, file_list in file_list_list:
		try:
			pattern = PatternGen(os.path.join(path, project_path), file_list=file_list)
			s_time = time.time()
			period = pattern.digital_param['period']
			vcd1_path = os.path.join(project_path, pattern.file_list['VCD'])
			vcd2_path = os.path.join(project_path, pattern.project_name + '_trf.vcd')
			vcdm_path = os.path.join(project_path, pattern.project_name + '_merge.vcd')
			vcd1 = VcdFile(vcd1_path, period=period)
			vcd1.get_vcd_info()
			vcd2 = VcdFile(vcd2_path, period=period)
			vcd2.get_vcd_info()
			vcdm = vcd_merge(vcd1, vcd2, vcdm_path)
			vcdm.gen_vcd(vcdm_path)
			e_time = time.time()
			key = 'Merge time for {:<30}:'.format(pattern.project_name)
			value = e_time - s_time
			report(report_file, key, value)
		except Exception as err:
			key = 'An exception occurs in {}:'.format(project_path)
			report(report_file, key, err)
	print('Batch merge finished')
	end_time = time.time()
	report(report_file, 'Total merge time:', end_time - start_time)
	print("\nTotal time: " + str(end_time - start_time))