#!/usr/bin/python3 import settings_analysis as s import sys sys.path.append(s.arith_path) sys.path.append("../") from os import walk import os from analysis_lib import extractFileList, sortFileList, extractTruncLSBs, checkResult, message, basicAnalysis, printBasicAnalysisRes from arithmetic import integerTo2sFileConverter integerTo2sFileConverter(s.sw_filter_result_fpath, s.sw_filter_result_fpath2s, s.filter_out_par) HW_temp_2sresult = "HW_2sresult.temp" res_file_list = extractFileList(s.res_trunc_filter_path, s.res_trunc_filter_ID) sortFileList(res_file_list) with open(s.log_stat_trunc_filter_fpath, "w") as log_pointer: for res_file in res_file_list: trunc_lsbs = int(extractTruncLSBs(res_file)) if trunc_lsbs != 0: integerTo2sFileConverter(s.res_trunc_filter_path + '/' + res_file, HW_temp_2sresult, s.filter_out_par) analysis_res = basicAnalysis(s.sw_filter_result_fpath2s, HW_temp_2sresult, s.numSamples) printBasicAnalysisRes(log_pointer, analysis_res, trunc_lsbs) os.remove(HW_temp_2sresult)
#!/usr/bin/python3 import settings_analysis as s import sys sys.path.append("../") from os import walk import os from analysis_lib import extractApproxCompr,extractFileList,sortFileList,extractTruncLSBs,checkResult,message, basicAnalysis, printBasicAnalysisRes res_file_list=extractFileList(s.res_approxCompr_mult_path,s.res_approxCompr_mult_ID) sortFileList(res_file_list) with open(s.log_stat_approxCompr_mult_fpath,"w") as log_pointer: for res_file in res_file_list: trunc_lsbs=int(extractApproxCompr(res_file)) if trunc_lsbs!=0: analysis_res=basicAnalysis(s.sw_mult_result_fpath,s.res_approxCompr_mult_path+'/'+res_file,s.numSamples) printBasicAnalysisRes(log_pointer,analysis_res,trunc_lsbs)
os.remove(s.sw_res_fname + ".truncated") # 1) Compute error statistics from truncated multiplier. res_file_list = extractFileList(s.res_trunc_mult_path, s.res_trunc_mult_ID) sortFileList(res_file_list) with open(s.log_stat_trunc_mult_fpath, "w") as log_pointer, open( s.matlab_trunc_values, "w") as matlab_trunc_values_pointer, open( s.matlab_trunc_mult_statMax, "w") as matlab_mult_statMax_pointer, open( s.matlab_trunc_mult_statAvg, "w") as matlab_mult_statAvg_pointer: for res_file in res_file_list: trunc_lsbs = int(extractTruncLSBs(res_file)) if trunc_lsbs != 0: analysis_res = basicAnalysis( s.sw_mult_result_fpath, s.res_trunc_mult_path + '/' + res_file, s.numSamples) printBasicAnalysisRes(log_pointer, analysis_res, trunc_lsbs) printString(matlab_trunc_values_pointer, trunc_lsbs) printString(matlab_mult_statMax_pointer, analysis_res[0]) printString(matlab_mult_statAvg_pointer, analysis_res[1]) integerTo2sFileConverter(s.sw_filter_result_fpath, s.sw_filter_result_fpath2s, s.filter_out_par) HW_temp_2sresult = "HW_2sresult.temp" # 2) Compute error statistics from filter with truncated multiplier. res_file_list = extractFileList(s.res_trunc_filter_path, s.res_trunc_filter_ID) sortFileList(res_file_list) with open(s.log_stat_trunc_filter_fpath, "w") as log_pointer, open( s.matlab_trunc_filter_statMax,
#!/usr/bin/python3 import settings_analysis as s import sys sys.path.append("../") from os import walk import os from analysis_lib import extractFileList, sortFileList, extractTruncLSBs, checkResult, message, basicAnalysis, printBasicAnalysisRes # 1) Compute error statistics from truncated multiplier. res_file_list = extractFileList(s.res_trunc_mult_path, s.res_trunc_mult_ID) sortFileList(res_file_list) with open(s.log_stat_trunc_mult_fpath, "w") as log_pointer: for res_file in res_file_list: trunc_lsbs = int(extractTruncLSBs(res_file)) if trunc_lsbs != 0: analysis_res = basicAnalysis( s.sw_mult_result_fpath, s.res_trunc_mult_path + '/' + res_file, s.numSamples) printBasicAnalysisRes(log_pointer, analysis_res, trunc_lsbs)