예제 #1
0
def run(file1, file2, output, title, original_title):
    if (not file1) or (not file2) or (not output) or (not title):
        print '''
           Please learn how to use it through -h
           You should run it as:
           python write_csv.py --file1=*** --file2=*** --output=***  title=*** --original-title=***
           '''
        sys.exit()
    a1 = read_csv_note(file1)
    a2 = read_csv_note(file2)
    compare_title = a1[1][1:]  # Provide the title you want to compare
    #compare_title = ['Register',    'Slice']
    title_dic = get_conf_options(param_conf_file)
    compare_title = title_dic['Comp_Title'][title]
    compare_title = compare_title.split(',')
    compare_title = [item.strip() for item in compare_title]
    original_title = title_dic['Original_Title'][original_title]
    original_title = original_title.split(',')
    original_title = [item.strip() for item in original_title]
    file_return, static_result, compare_average = compare_csv(
        a1, a2, output, original_title, compare_title)
    note1 = process_note(a1[2])
    note2 = process_note(a2[2])
    write_csv(note1, note2, file1, file2, file_return)
    return_dic = {}  # filename:static_result,compare_average
    return_dic[file_return] = [static_result, compare_average]
    import write_excel2
    write_excel2.write_excel(file_return, return_dic)
    return file_return, return_dic
def run_web(src, cmp, comp_title, original_title, output):
    #opt = option()
    src_csv = src
    cmp_csvs = cmp
    compare_title = comp_title
    original_title = original_title
    output = output
    cmp_csvs = cmp_csvs.split(',')
    src_csv_content = csv_content(src_csv)
    cmp_csv_contents = []
    title_dic = get_conf_options(param_conf_file)
    if compare_title.find('l25') != -1:
        compare_title = title_dic['Comp_Title'][compare_title]
        compare_title = compare_title.split(',')
        compare_title = [item.strip() for item in compare_title]
    else:
        compare_title = compare_title.split(',')
    if original_title.find('Design') != -1:
        original_title = original_title.split(',')

    else:
        original_title = title_dic['Original_Title'][original_title]
        original_title = original_title.split(',')
        original_title = [item.strip() for item in original_title]
    for cmp in cmp_csvs:
        if os.path.isfile(cmp):
            cmp_csv_contents.append(csv_content(cmp))
    write_csv_o = write_csv(src_csv_content, cmp_csv_contents, output,
                            compare_title, original_title, '')

    write_csv_o.write_file()
def run():
    opt = option()
    src_csv = opt.src
    cmp_csvs = opt.cmp
    compare_title = opt.comp_title
    original_title = opt.original_title
    output = opt.output
    no_fmax = opt.no_fmax
    cmp_csvs = cmp_csvs.split(',')
    src_csv_content = csv_content(src_csv)
    cmp_csv_contents = []
    title_dic = get_conf_options(param_conf_file)
    compare_title = title_dic['Comp_Title'][compare_title]
    compare_title = compare_title.split(',')
    compare_title = [item.strip() for item in compare_title]
    original_title = title_dic['Original_Title'][original_title]
    original_title = original_title.split(',')
    original_title = [item.strip() for item in original_title]
    for cmp in cmp_csvs:
        if os.path.isfile(cmp):
            cmp_csv_contents.append(csv_content(cmp))
    write_csv_o = write_csv(src_csv_content, cmp_csv_contents, output,
                            compare_title, original_title, '')

    write_csv_o.write_file()
예제 #4
0
def get_flow_conf(a_file):
    a_dict = xConf.get_conf_options(a_file)
    flow = a_dict.get("flow")
    '''run_scuba = 1
run_synthesis = 1
synthesis = synpwrap
; synthesis = lse


run_translate = 1
run_map = 1
run_map_trce = 1

run_par = 1
run_trce = 1

run_bitgen = 1

    '''
    t = dict()
    for key, value in flow.items():
        if value == "1":
            value = True
        elif value == "0":
            value = False
        t[key] = value
    return t
예제 #5
0
    def create_conf_options(self):
        _conf = self.qa_options.get("conf")
        if not_exists(_conf):
            # unix cannot find </trunk/bin/runLattice.py/../../conf> path
            #_scripts_path = os.path.abspath(sys.argv[0])
            #_conf = os.path.join(os.path.dirname(_scripts_path), "..", _conf)
            _conf = os.path.join(os.path.dirname(__file__), "..",'..', _conf)
        if not_exists(_conf, "Configuration path"):
            return 1
        _conf = os.path.abspath(_conf)
        self.qa_options["conf"] = _conf

        conf_files = glob.glob(os.path.join(_conf, "*.conf"))
        self.conf_options = get_conf_options(conf_files)
def for_QoR(line, param_conf=''):
    src_csv = get_cmd_value(line, 'src')
    cmp_csvs = get_cmd_value(line, 'cmp')
    compare_title = get_cmd_value(line, 'Comp_Title')
    original_title = get_cmd_value(line, 'Original_Title')
    output = get_cmd_value(line, 'output')
    no_fmax = get_cmd_value(line, 'no-fmax')
    cmp_csvs = cmp_csvs.replace('"', '')
    cmp_csvs = cmp_csvs.split(',')
    src_csv_content = csv_content(src_csv, no_fmax)
    cmp_csv_contents = []
    param_conf_file = os.path.join(os.path.dirname(__file__), 'param.conf')
    if param_conf:
        if os.path.isfile(param_conf):
            param_conf_file = param_conf
        else:
            print 'Error, can not find file:%s\n\n' % param_conf
            sys.exit(-1)
    title_dic = get_conf_options(param_conf_file)
    try:
        compare_title = title_dic['Comp_Title'][compare_title]
    except:
        print 'Error, can not find key:%s' % compare_title
        sys.exit(-1)
    compare_title = compare_title.split(',')
    compare_title = [item.strip() for item in compare_title]
    try:
        original_title = title_dic['Original_Title'][original_title]
    except:
        print 'Error, can not find key:%s' % original_title
        sys.exit(-1)

    original_title = original_title.split(',')
    original_title = [item.strip() for item in original_title]
    if set(compare_title) - set(original_title):
        print 'Error, you have to make sure compare_title is a sub set of original title \n\n\n\n'
        sys.exit(-1)
    for cmp in cmp_csvs:
        if os.path.isfile(cmp):
            cmp_csv_contents.append(csv_content(cmp, no_fmax))
            #print cmp,111
    write_csv_o = write_csv(src_csv_content, cmp_csv_contents, output,
                            compare_title, original_title, '', no_fmax)
    write_csv_o.write_file()
    os.remove(output)
import re
import csv_compare
from pyExcelerator import *
import style
import traceback
import optparse
import string
xlib = os.path.join(os.path.dirname(__file__), '..', '..', 'bin', 'xlib')
xlib = os.path.abspath(xlib)
if xlib in sys.path:
    pass
else:
    sys.path.append(xlib)
from xConf import get_conf_options
red_range = 0.05
red_range_dic = get_conf_options('param.conf')['red_range']
case_list_path = os.path.join(__file__, '..', '..', '..', 'conf',
                              'case_list.conf')
case_list_path = os.path.abspath(case_list_path)
case_group_dic = get_conf_options(case_list_path)['case_list']
group_cases = {}
for group, cases in case_group_dic.items():
    cases = cases.split()
    for item in cases:
        group_cases.setdefault(group, []).append(item)
all_groups = group_cases.keys()
statistic_tie_list = [['win', 'win'], ['tie', 'tie'], ['lose', 'lose'],
                      ['less15', '<-0.15'], ['less15_5', '-0.15~-0.05'],
                      ['less5_5', '-0.05~-0.05'], ['more5_15', '0.05~-0.15'],
                      ['more15', '>0.15']]
key_order = ['Fmax', 'Regs', 'Luts', 'Slices', 'Runtime', 'MapPMem', 'ParPMem']
예제 #8
0
     if not os.path.isfile(check_conf):
         print 'Error, can not find file:%s \n\n'%check_conf
         sys.exit(-1)
 if suite_file and os.path.isfile(str(suite_file)):
     pass
 else:
     print 'Warning: can not get suite file'
 if not all_command:
     all_command = ''
 if opt.cmd_file:
     if os.path.isfile(opt.cmd_file):
         pass
     else:
         print 'Warning: Can not get file:%s'%opt.cmd_file
     try:
         conf_options = get_conf_options(opt.cmd_file,False)
         signal_cmd_dict = conf_options.get('cmd',{})
         signal_cmd = signal_cmd_dict.get(suite_name,'')
         
         if not signal_cmd:
             signal_cmd = signal_cmd_dict.get('all','')
             
         all_command = all_command + ' '+signal_cmd
     except:
         cmd_hand = file(opt.cmd_file).readlines()
         for signal_cmd in cmd_hand:
             signal_cmd = signal_cmd.strip()
             if signal_cmd:
                 all_command = all_command + ' '+signal_cmd
 try:
     set_value = int(set_value)
예제 #9
0
#           1  the first line should begin with "Desing"
#           2  In the first line, it should contain 'fmax'

# Date     :2013/1/7

#===================================================
import os, sys, re, copy
import time
import shutil, stat
import csv
import glob
from xConf import get_conf_options
case_list_path = os.path.join(__file__, '..', '..', '..', 'conf',
                              'case_list.conf')
case_list_path = os.path.abspath(case_list_path)
case_group_dic = get_conf_options(case_list_path)['case_list']
group_cases = {}
for group, cases in case_group_dic.items():
    cases = cases.split()
    for item in cases:
        group_cases.setdefault(group, []).append(item)
##########################
note_fmax_dic = dict(
    ecp2_60=
    'All sweep from 50MHz to 300MHz stepping in 10MHz;ADPCMtest,adpcm_codec_64ch from 10MHz to 50MHz stepping in 5MHZ ',
    sc_24='All sweep from 100MHz to 400MHz stepping in 10MHz;',
    large_25=
    'Sweeping step is 5MHz step, range is 10-100Mhz; step 10 MHz, range is 50MHz-300MHz',
    xo_103='All sweep from 100MHz to 400MHz stepping in 10MHz;')

##############################################################
예제 #10
0
import os, sys, csv
import re, ConfigParser
import optparse
import traceback

xlib = os.path.join(os.path.dirname(__file__), '..', '..', 'bin', 'xlib')
xlib = os.path.abspath(xlib)
if xlib in sys.path:
    pass
else:
    sys.path.append(xlib)
from xConf import get_conf_options
case_list_path = os.path.join(__file__, '..', '..', '..', 'conf',
                              'case_list.conf')
case_list_path = os.path.abspath(case_list_path)
case_group_dic = get_conf_options(case_list_path)['case_list']
param_conf_file = os.path.join(os.path.dirname(__file__), 'param.conf')
group_cases = {}
for group, cases in case_group_dic.items():
    cases = cases.split()
    for item in cases:
        group_cases.setdefault(group, []).append(item)
all_groups = group_cases.keys()
statistic_tie_list = [['win', 'win'], ['tie', 'tie'], ['lose', 'lose'],
                      ['less15', '<-0.15'], ['less15_5', '-0.15~-0.05'],
                      ['less5_5', '-0.05~-0.05'], ['more5_15', '0.05~-0.15'],
                      ['more15', '>0.15']]


def read_csv(csv_file):
    ''' This function used to read the data from csv file