def work(args):  # main function
    msgb("READING XED DB")
    (chips, chip_db) = chipmodel.read_database(args.chip_filename)

    xeddb = read_xed_db.xed_reader_t(args.state_bits_filename,
                                     args.instructions_filename,
                                     args.widths_filename,
                                     args.element_types_filename)

    (insts, undoc) = check(args.chip, xeddb, chip_db)
    ilist = list(set([x.iclass for x in insts]))
    ilist.sort()
    ulist = list(set([x.iclass for x in undoc]))
    ulist.sort()
    if args.otherchip:
        (insts2, undoc2) = check(args.otherchip, xeddb, chip_db)
        ilist2 = list(set([x.iclass for x in insts2]))
        ulist2 = list(set([x.iclass for x in undoc2]))
        s1 = set(ilist + ulist)
        s2 = set(ilist2 + ulist2)
        d12 = list(s1 - s2)
        d21 = list(s2 - s1)
        d12.sort()
        d21.sort()
        both = list(s1 & s2)
        both.sort()

        for i in d12:
            print("{:20s} IN: {}   NOT IN: {}".format(i, args.chip,
                                                      args.otherchip))
        for i in d21:
            print("{:20s} IN: {}   NOT IN: {}".format(i, args.otherchip,
                                                      args.chip))
        for i in both:
            print("{:20s} BOTH IN: {}   IN: {}".format(i, args.chip,
                                                       args.otherchip))

    else:
        insts.sort(key=lambda x: (x.space, x.iclass, x.isa_set, x.vl))
        undoc.sort(key=lambda x: (x.space, x.iclass, x.isa_set, x.vl))
        print_header()
        for i in insts:
            public = 'PUBLIC'
            if hasattr(i, 'real_opcode') and i.real_opcode == 'N':
                public = 'PRIVATE'
            print_rec(i, public)
        for i in undoc:
            print_rec(i, "UNDOC")
    return 0
Beispiel #2
0
def work(args):  # main function
    msgb("READING XED DB")
    (chips, chip_db) = chipmodel.read_database(args.chip_filename)

    xeddb = read_xed_db.xed_reader_t(args.state_bits_filename,
                                     args.instructions_filename)

    
    (insts,undoc) = check(args.chip, xeddb, chip_db)
    ilist = list(set(map(lambda x: x.iclass, insts)))
    ilist.sort()
    ulist = list(set(map(lambda x: x.iclass, undoc)))
    ulist.sort()
    for i in ilist:
        print i
    for i in ulist:
        print i, "UNDOC"
    return 0
Beispiel #3
0
def work(args):  # main function
    msgb("READING XED DB")
    (chips, chip_db) = chipmodel.read_database(args.chip_filename)

    xeddb = read_xed_db.xed_reader_t(args.state_bits_filename,
                                     args.instructions_filename,
                                     args.widths_filename,
                                     args.element_types_filename)

    (insts, undoc) = check(args.chip, xeddb, chip_db)
    ilist = list(set([x.iclass for x in insts]))
    ilist.sort()
    ulist = list(set([x.iclass for x in undoc]))
    ulist.sort()
    if args.otherchip:
        (insts2, undoc2) = check(args.otherchip, xeddb, chip_db)
        ilist2 = list(set([x.iclass for x in insts2]))
        ulist2 = list(set([x.iclass for x in undoc2]))
        s1 = set(ilist + ulist)
        s2 = set(ilist2 + ulist2)
        d12 = list(s1 - s2)
        d21 = list(s2 - s1)
        d12.sort()
        d21.sort()
        both = list(s1 & s2)
        both.sort()

        for i in d12:
            print("{:20s} IN: {}   NOT IN: {}".format(i, args.chip,
                                                      args.otherchip))
        for i in d21:
            print("{:20s} IN: {}   NOT IN: {}".format(i, args.otherchip,
                                                      args.chip))
        for i in both:
            print("{:20s} BOTH IN: {}   IN: {}".format(i, args.chip,
                                                       args.otherchip))

    else:
        for i in ilist:
            print(i)
        for i in ulist:
            print(i, "UNDOC")
    return 0
Beispiel #4
0
def work(args):  # main function
    msgb("READING XED DB")
    (chips, chip_db) = chipmodel.read_database(args.chip_filename)

    xeddb = read_xed_db.xed_reader_t(args.state_bits_filename,
                                     args.instructions_filename,
                                     args.widths_filename,
                                     args.element_types_filename)

    # base chip instr
    bi = chip_list(args.basechip, xeddb, chip_db)
    # newer chip instr
    ni = chip_list(args.newchip, xeddb, chip_db)

    missing_new = []
    for b in bi:
        found = False
        for n in ni:
            if b.iclass == n.iclass:
                found = True
                break
        if not found:
            missing_new.append(b)

    missing_old = []
    for n in ni:
        found = False
        for b in bi:
            if n.iclass == b.iclass:
                found = True
                break
        if not found:
            missing_old.append(n)

    missing_old.sort(key=lambda x: x.iclass)
    missing_new.sort(key=lambda x: x.iclass)

    for i in missing_old:
        print("+{}   {}    {} {}".format(i.iclass, i.isa_set, i.space, i.vl))
    for i in missing_new:
        print("-{}   {}    {} {}".format(i.iclass, i.isa_set, i.space, i.vl))
    return 0
def work(args):  # main function
    gen_setup.msge("READING XED DB")
    (chips, chip_db) = chipmodel.read_database(args.chip_filename)

    xeddb = gen_setup.read_db(args)

    # base chip instr
    bi = chip_list(args.basechip, xeddb, chip_db)
    # newer chip instr
    ni = chip_list(args.newchip, xeddb, chip_db)

    missing_new = []
    for b in bi:
        found = False
        for n in ni:
            if b.iclass == n.iclass:
                found = True
                break
        if not found:
            missing_new.append(b)

    missing_old = []
    for n in ni:
        found = False
        for b in bi:
            if n.iclass == b.iclass:
                found = True
                break
        if not found:
            missing_old.append(n)

    missing_old.sort(key=lambda x: x.iclass)
    missing_new.sort(key=lambda x: x.iclass)

    for i in missing_old:
        print("+{}   {}    {} {}".format(i.iclass, i.isa_set, i.space, i.vl))
    for i in missing_new:
        print("-{}   {}    {} {}".format(i.iclass, i.isa_set, i.space, i.vl))
    return 0
Beispiel #6
0
def work(args):  # main function
    msgb("READING XED DB")
    (chips, chip_db) = chipmodel.read_database(args.chip_filename)

    xeddb = gen_setup.read_db(args)

    isasets = set()
    for r in xeddb.recs:
        isasets.add(r.isa_set)

    classes = {}
    for i in isasets:
        c = 'general'
        if 'XOP' in i:
            c = 'xop'
        elif 'SSE' in i:
            c = 'sse'
        elif 'AVX512' in i:
            c = 'avx512'
        elif 'ICL' in i:
            c = 'avx512'
        elif 'AVX' in i:
            c = 'avx'
        elif 'FMA' in i:
            c = 'avx'
        elif 'F16C' in i:
            c = 'avx'
        elif 'MMX' in i:
            c = 'mmx'
        classes[i] = c

    chip_icount_histo_tup = []
    for c in chips:
        r = check(c, xeddb, chip_db, classes)
        chip_icount_histo_tup.append(r)

    groups = ['general', 'mmx', 'sse', 'avx', 'avx512']

    for inst in xeddb.recs:
        if classes[inst.isa_set] == 'general' and inst.scalar:
            print("GPR SCALAR", inst.iclass)

    tlist = []
    for s in chip_icount_histo_tup:
        t = []
        (chip, icount, histo) = s
        t.append("{0:20s} {1:4d}".format(chip, icount))
        for scalar in ['.sc', '']:
            for x in groups:
                k = x + scalar
                t.append("{0:7s}:{1:4d}".format(k, histo[k]))
        tlist.append((icount, " ".join(t)))

    def keyfn(x):
        return x[0]

    tlist.sort(key=keyfn)

    for x, y in tlist:
        print(y)

    return 0
Beispiel #7
0
def read_chips(args):
    chips, chip_db = chipmodel.read_database(args.chip_filename)
    return chips, chip_db