Esempio n. 1
0
    def parse_options(self):
        _group = ("ecp2_60", "large_25", "sc_24", "xo_103")
        _family = get_family_by_vendor(vendor="")  # all vendors
        parser = optparse.OptionParser()
        parser.add_option("-D",
                          "--debug",
                          action="store_true",
                          help="print debug message")
        parser.add_option("-s", "--from-dir", help="specify source path name")
        parser.add_option("-d",
                          "--to-dir",
                          help="specify destination path name")
        parser.add_option("-f",
                          "--family",
                          type="choice",
                          choices=_family,
                          help="specify family name")
        parser.add_option("-n", "--design", help="specify design name")
        parser.add_option("-g",
                          "--group",
                          type="choice",
                          choices=_group,
                          help="specify group name")

        opts, args = parser.parse_args()

        self.debug = opts.debug
        self.from_dir = opts.from_dir
        self.to_dir = opts.to_dir
        self.family = opts.family
        self.design = opts.design
        self.group = opts.group

        # sanity check
        return self.check_options()
def option():
    _family = xFamily.get_family_by_vendor('lattice')
    _syn_dict = dict(lattice=("synp", "lse"),
                     altera=("synp", "qis"),
                     xilinx=("synp", "xst"),
                     cube=("synp", "lse"))
    _synthesis = _syn_dict.get('lattice')
    public_group = optparse.OptionParser()
    #public_group.add_option("--top-dir", help="specify top source path")
    public_group.add_option("--job-dir",
                            default=os.getcwd(),
                            help="specify job working path")
    #public_group.add_option("--tag", default="", help="specify tag name for results file")
    public_group.add_option("--synthesis",
                            type="choice",
                            default="synp",
                            choices=_synthesis,
                            help="specify synthesis name")
    public_group.add_option("--design", help="specify design name")
    public_group.add_option("--family",
                            type="choice",
                            choices=_family,
                            help="specify family name")
    public_group.add_option(
        "--pap",
        action="store_true",
        help="dump Lattice Performance Achievement Percentage data")
    public_group.add_option("--report-name",
                            default='report.csv',
                            help="specify report_name you want to store")
    opt, args = public_group.parse_args()
    return opt
scan_report_dir = os.path.join(os.path.dirname(__file__),'..','tools','scan_tools')
scan_report_dir = os.path.abspath(scan_report_dir)
if scan_report_dir in sys.path:
    pass
else:
    sys.path.append(scan_report_dir)
import tool_scan_lattice
from xlib import xFamily
from xOS import not_exists, wrap_copy_file, wrap_move_dir,get_unique_file,RecoverPath
from xLog import print_always
from xTools import append_file
from xlib import report_sort
class scan_lattice_cmd:
    def __init__(self,family='',design='',pap=False,report-name='report.csv',
                synthesis='',job-dir=os.getcwd(),):
        _family = xFamily.get_family_by_vendor('lattice')
        _syn_dict = dict(lattice=("synp", "lse"), altera=("synp", "qis"), xilinx=("synp", "xst"), cube=("synp", "lse"))
        _synthesis = _syn_dict.get('lattice')
        if family not in _family:
            print 'Error: wrong family name:%s'%family
            return 
        if synthesis not in _synthesis:
            print 'Error: wrong synthesis tool:%s'%synthesis
            return
        self.family = family
        self.design = design
        self.pap = pap
        self.report_name = report-name
        self.synthesis = synthesis
        self.job_dir = job-dir