示例#1
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))
示例#2
0
def test():
    vcd_ref = VcdFile('pin_test/pin_test.vcd', period='1ps')
    vcd_ref.get_vcd_info()
    vcd1 = VcdFile('pin_test/p1.vcd', period='1ps')
    vcd1.get_vcd_info()
    vcd2 = vcd_merge(vcd_ref, vcd1)
    vcd2.gen_vcd('pin_test/p1_merge.vcd')
示例#3
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))
示例#4
0
#!/usr/bin/python3
# -*- coding:utf-8 -*-
from mytools import VcdFile, vcd_merge
import sys


def test():
    vcd_ref = VcdFile('pin_test/pin_test.vcd', period='1ps')
    vcd_ref.get_vcd_info()
    vcd1 = VcdFile('pin_test/p1.vcd', period='1ps')
    vcd1.get_vcd_info()
    vcd2 = vcd_merge(vcd_ref, vcd1)
    vcd2.gen_vcd('pin_test/p1_merge.vcd')


if __name__ == "__main__":
    if len(sys.argv) == 1:
        test()
    elif len(sys.argv) == 6:
        path1, period1, path2, period2, pathm = sys.argv[1:]
        vcd1 = VcdFile(path1, period=period1)
        vcd1.get_vcd_info()
        vcd2 = VcdFile(path2, period=period2)
        vcd2.get_vcd_info()
        vcdm = vcd_merge(vcd1, vcd2)
        vcdm.gen_vcd(pathm)