def main(): # Parse PKT3 types with open(sys.argv[1], 'r') as filp: packets = parse_packet3(filp) # Register database parse regdb = None for filename in sys.argv[2:]: with open(filename, 'r') as filp: try: db = RegisterDatabase.from_json(json.load(filp)) if regdb is None: regdb = db else: regdb.update(db) except json.JSONDecodeError as e: print('Error reading {}'.format(sys.argv[1]), file=sys.stderr) raise # The ac_debug code only distinguishes by gfx_level regdb.merge_chips(['gfx8', 'fiji', 'stoney'], 'gfx8') # Write it all out w = TableWriter() w.write(regdb, packets)
def main(): parser = argparse.ArgumentParser() parser.add_argument( '--chip', dest='chips', type=str, nargs='*', help='Chip for which to generate the header (all chips if unspecified)' ) parser.add_argument('--sort', choices=['name', 'address'], default='address', help='Sort key for registers, fields, and enum values') parser.add_argument('--guard', type=str, help='Name of the #include guard') parser.add_argument('files', metavar='FILE', type=str, nargs='+', help='Register database file') args = parser.parse_args() regdb = None for filename in args.files: with open(filename, 'r') as filp: db = RegisterDatabase.from_json(json.load(filp)) if regdb is None: regdb = db else: regdb.update(db) deduplicate_enums(regdb) deduplicate_register_types(regdb) w = HeaderWriter(regdb, guard=args.guard) w.print(sys.stdout, sort=args.sort)
def main(): regdb = RegisterDatabase() for filename in sys.argv[1:]: with open(filename, 'r') as filp: regdb.update(RegisterDatabase.from_json(json.load(filp))) deduplicate_enums(regdb) deduplicate_register_types(regdb) print(regdb.encode_json_pretty())
def json_canonicalize(filp, chips = None): regdb = RegisterDatabase.from_json(json.load(filp)) if chips is not None: for regmap in regdb.register_mappings(): assert not hasattr(regmap, 'chips') regmap.chips = [chips] deduplicate_enums(regdb) deduplicate_register_types(regdb) deduce_missing_register_types(regdb) regdb.garbage_collect() return regdb.encode_json_pretty()
def main(): regdb_filename = sys.argv[1] with open(regdb_filename, 'r') as filp: regdb = RegisterDatabase.from_json(json.load(filp)) if len(sys.argv) > 2: for regmap in regdb.register_mappings(): assert not hasattr(regmap, 'chips') regmap.chips = [sys.argv[2]] deduplicate_enums(regdb) deduplicate_register_types(regdb) deduce_missing_register_types(regdb) regdb.garbage_collect() print(regdb.encode_json_pretty())
return None gfx10_fmt = self.plain_gfx10_formats[key] return Object( img_format=gfx10_fmt.img_format, flags=gfx10_fmt.flags + extra_flags, ) return None if __name__ == '__main__': vk_formats = parse(sys.argv[1]) with open(sys.argv[2], 'r') as filp: db = RegisterDatabase.from_json(json.load(filp)) gfx10_formats = [ Gfx10Format(entry) for entry in db.enum('IMG_FORMAT').entries ] mapping = Gfx10FormatMapping(vk_formats, gfx10_formats) formats = [] for fmt in vk_formats: if fmt.name in HARDCODED: obj = HARDCODED[fmt.name] else: obj = mapping.map(fmt) if obj is not None: