def run(fn_in, fn_out, verbose=False): database = json.load(open(fn_in, "r")) # Load a map of sites to base addresses # Need to figure out the # FIXME: generate frames from part file (or equivilent) # See https://github.com/SymbiFlow/prjxray/issues/327 # FIXME: generate words from pitch int_frames, int_words = localutil.get_int_params() tdb_fns = [ ("iob", 42, 4), ("ioi", 42, 4), ("mmcm", 30, 49), ("pll", 30, 27), ("monitor", 30, 101), ("bram", 28, 10), ("bram_block", 128, 10), ("clb", 36, 2), ("cfg", 30, 101), ("dsp", 28, 10), ("clk_hrow", 30, 18), ("clk_bufg", 30, 8), ("hclk_cmt", 30, 10), ("hclk_ioi", 42, 1), ("pcie", 36, 101), ("gtp_common", 32, 101), ("gtp_channel", 32, 22), ("clb_int", int_frames, int_words), ("iob_int", int_frames, int_words), ("bram_int", int_frames, int_words), ("dsp_int", int_frames, int_words), ("fifo_int", int_frames, int_words), ("ps7_int", int_frames, int_words), ("cfg_int", int_frames, int_words), ("monitor_int", int_frames, int_words), ("orphan_int_column", int_frames, int_words), ("gtp_int_interface", int_frames, int_words), ("pcie_int_interface", int_frames, int_words), ] tile_frames_map = localutil.TileFrames() for (subdir, frames, words) in tdb_fns: tdb_fn = os.path.join(subdir, 'build_{}'.format(os.environ['XRAY_PART']), 'segbits_tilegrid.tdb') if not os.path.exists(tdb_fn): verbose and print('Skipping {}, file not found!'.format(tdb_fn)) continue for (tile, frame, wordidx) in load_db(tdb_fn): tilej = database[tile] verbose and print("Add %s %08X_%03u" % (tile, frame, wordidx)) localutil.add_tile_bits(tile, tilej, frame, wordidx, frames, words, tile_frames_map) # Save xjson.pprint(open(fn_out, "w"), database)
#!/usr/bin/env python3 import sys import json from prjxray.xjson import pprint if __name__ == "__main__": if len(sys.argv) == 1: import doctest doctest.testmod() else: assert len(sys.argv) == 2 d = json.load(open(sys.argv[1])) pprint(sys.stdout, d)