コード例 #1
0
    {"byte": (12, "false", "true")},
    {"ldst": (11, "store", "load")},
    {" byte": (12, " word", " byte")},
    ("011X XXXX XX", "ldst_imm5<[load],[byte]>", "[ldst][ byte] imm5"),
    ("1001 XXXX XX", "ldst_sprel<[load]>", "[ldst] sp rel"),
    {"load": (11, "false", "true")},
    ("1000 XXXX XX", "ldsth_imm5", "[ldst] half"),
)

d = decoder.Decoder(main, False, 2, (15, 11))

d.prefix = 'thumb_'

#depth = d.tree()

codegen.putfile('../src/thumb_decoding_table.cpp',
                d.gen_tables('ArmIss', ['arm.h'], ['soclib', 'common']))
codegen.putfile('../include/thumb_ops.inc', d.gen_decls())
#codegen.putfile('../src/thumb_instructions.cpp',
#                d.gen_funcs('thumb_'))

depth = d.tree()

d.self_test()

print "Max depth in tables:", depth
print "%d bytes lost in tables on a 32-bits machine" % d.stats(4)
print "%d bytes lost in tables on a 64-bits machine" % d.stats(8)

#funcs = main.funcs()
## print len(funcs), 'functions'
コード例 #2
0
ファイル: arm_global_table.py プロジェクト: walafc0/soclib
# 1902
d = decoder.Decoder(main, False, 2, (27, 24), (20, 20), (7, 7), (4, 4))
# 2240
#d = decoder.Decoder(main, True, 2, (27, 24), (20, 20), (7, 4))
# 2526
#d = decoder.Decoder(main, True, 2, (27, 25), (20, 20))
# 5484
#d = decoder.Decoder(main, True, (27, 25), (21, 20))

#print len(d._Decoder__tables)
#for n, t in enumerate(d.tables()):
#    print n, t

#depth = d.tree()

codegen.putfile('../src/arm_decoding_table.cpp',
                d.gen_tables('ArmIss', ['arm.h'], ['soclib', 'common']))
codegen.putfile('../include/arm_ops.inc',
                d.gen_decls())

depth = d.tree()

d.self_test()

print "Max depth in tables:", depth
print "%d bytes lost in tables on a 32-bits machine" % d.stats(4)
print "%d bytes lost in tables on a 64-bits machine" % d.stats(8)

#funcs = main.funcs()
## print len(funcs), 'functions'

## for i in "000", "001", "010", "011", "100", "101", "110", "111":