Пример #1
0
#!/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)
Пример #2
0
#!/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 printBasicRep,extractTotalArea,extractSlackTime,extractFileList,sortFileList,extractTruncLSBs,checkResult,message, basicAnalysis, printBasicAnalysisRes,extractRepType
from arithmetic import integerTo2sFileConverter

rep_file_list=extractFileList(s.rep_trunc_mult_path,s.rep_trunc_mult_ID)
sortFileList(rep_file_list)
rep_tuple_list=[]
for rep_file in rep_file_list:
    trunc_lsbs=int(extractTruncLSBs(rep_file))
    if trunc_lsbs!=0:
        rep_type=extractRepType(rep_file)
        if rep_type=="area":
            value=extractTotalArea(s.rep_trunc_mult_path+'/'+rep_file)
        if rep_type=="timing":
            value=extractSlackTime(s.rep_trunc_mult_path+'/'+rep_file)
        rep_tuple_list+=[(trunc_lsbs,rep_type,value)]
with open(s.log_rep_trunc_mult_fpath,"w") as log_pointer:
    for rep_tuple in rep_tuple_list:
        printBasicRep(log_pointer,rep_tuple)
#       6) Compute error statistics from filter with multiplier with approx compressors.
#       7) Collect synthesis results from multiplier with approx compressors.
#       8) Collect synthesis results from filter with multiplier with approx compressors.

# Importing all functions I Need
import settings_analysis as s
from os import walk
import os
import sys
sys.path.append(s.arith_path)
sys.path.append('..')
from arithmetic import integerTo2sFileConverter, computeTruncResult, truncResults
from analysis_lib import printString, printBasicRep, extractApproxCompr, extractTotalArea, extractSlackTime, extractRepType, checkResult, extractTruncLSBs, basicAnalysis, extractFileList, sortFileList, message, printBasicAnalysisRes

# 0) Test the results from truncated architecture multiplier.
res_file_list = extractFileList(s.res_trunc_mult_path, s.res_trunc_mult_ID)
sortFileList(res_file_list)
for res_file in res_file_list:
    trunc_lsbs = int(extractTruncLSBs(res_file))
    if trunc_lsbs != 0:
        computeTruncResult(s.input_sample_fname, s.sw_res_fname, s.max_out_par,
                           trunc_lsbs)
        truncResults(s.sw_res_fname, s.sw_res_fname + ".truncated",
                     s.mult_out_par)
        check = checkResult(s.res_trunc_mult_path + '/' + res_file,
                            s.sw_res_fname + ".truncated")
        if check != 0:
            message(
                "Result for multiplier with {} truncated bit are WRONG! {} wrong result"
                .format(trunc_lsbs, check))
        else:
Пример #4
0
#!/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)