Example #1
0
def main():
    """Rois all parts for a family by calling "make roi_only" over all parts
    with the same device as XRAY_PART.

    Example:
        prjxray$ ./utils/roi_all.py --db-root database/artix7/ --part xc7a100tfgg676-1
    """
    env = os.environ.copy()
    db_root = util.get_db_root()
    assert db_root
    part = util.get_part()
    assert part

    information = util.get_part_information(db_root, part)

    valid_devices = []
    for name, device in util.get_devices(db_root).items():
        if device['fabric'] == information['device']:
            valid_devices.append(name)

    tasks = []

    for part, data in util.get_parts(db_root).items():
        if data['device'] in valid_devices:
            cwd = os.getenv('XRAY_FUZZERS_DIR')

            tasks.append((part, cwd))

    with mp.Pool() as pool:
        for _ in pool.imap_unordered(worker, tasks):
            pass
Example #2
0
    def __init__(self, bitsfile, verbose=None, db_root=None, part=None):
        self.db_root = db_root
        if self.db_root is None:
            self.db_root = util.get_db_root()

        self.part = part
        if self.part is None:
            self.part = util.get_part()
            assert self.part, "No part specified."

        self.verbose = verbose if verbose is not None else os.getenv(
            'VERBOSE', 'N') == 'Y'
        self.load_grid()
        self.load_bits(bitsfile)
        '''
        self.tags[site][name] = value
        Where:
        -site: ex 'SLICE_X13Y101'
        -name: ex 'CLB.SLICE_X0.AFF.DMUX.CY'
        '''
        self.site_tags = dict()
        self.tile_tags = dict()

        # output after compiling
        self.segments_by_type = None

        # hacky...improve if we encounter this more
        self.def_bt = 'CLB_IO_CLK'
        self.index_sites()
Example #3
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        found_xadc = False
        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['XADC']:
                found_xadc = True
                break

        if not found_xadc:
            continue

        int_grid_x = loc.grid_x + 3
        int_tile_type = 'INT_L'

        int_tile_locs = []
        for dy in range(-1, 1):
            int_tile_locs.append((int_grid_x, loc.grid_y + dy), )

        int_tiles = []
        for int_tile_loc in int_tile_locs:
            int_gridinfo = grid.gridinfo_at_loc(int_tile_loc)
            assert int_gridinfo.tile_type == int_tile_type, (
                int_gridinfo.tile_type, int_tile_type)

            int_tiles.append(grid.tilename_at_loc(int_tile_loc))

        yield tile_name, int_tiles
Example #4
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()

    tile_list = []
    for tile_name in sorted(grid.tiles()):
        if "IOB33" not in tile_name or "SING" in tile_name:
            continue
        tile_list.append(tile_name)

    get_xy = util.create_xy_fun('[LR]IOB33_')
    tile_list.sort(key=get_xy)

    for iob_tile_name in tile_list:
        iob_gridinfo = grid.gridinfo_at_loc(
            grid.loc_of_tilename(iob_tile_name))

        iob33s = [k for k, v in iob_gridinfo.sites.items() if v == "IOB33S"][0]
        iob33m = [k for k, v in iob_gridinfo.sites.items() if v == "IOB33M"][0]

        top_sites = {
            "IOB": iob33m,
            "ILOGIC": iob33m.replace("IOB", "ILOGIC"),
            "IDELAY": iob33m.replace("IOB", "IDELAY"),
        }

        bot_sites = {
            "IOB": iob33s,
            "ILOGIC": iob33s.replace("IOB", "ILOGIC"),
            "IDELAY": iob33s.replace("IOB", "IDELAY"),
        }

        yield iob_tile_name, top_sites, bot_sites
Example #5
0
def gen_fifos():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['IN_FIFO']:
                if gridinfo.tile_type[-1] == 'L':
                    int_grid_x = loc.grid_x + 2
                    int_tile_type = 'INT_L'
                else:
                    int_grid_x = loc.grid_x - 2
                    int_tile_type = 'INT_R'

                int_tile_locs = [(int_grid_x, loc.grid_y + idx - 5)
                                 for idx in range(12)]

                int_tiles = []
                for int_tile_loc in int_tile_locs:
                    int_gridinfo = grid.gridinfo_at_loc(int_tile_loc)
                    assert int_gridinfo.tile_type == int_tile_type, (
                        int_tile_loc, int_gridinfo.tile_type, int_tile_type)

                    int_tiles.append(grid.tilename_at_loc(int_tile_loc))

                yield site_name, int_tiles
Example #6
0
def main():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()

    luts = LutMaker()

    def gen_sites(desired_site_type):
        for tile_name in sorted(grid.tiles()):
            loc = grid.loc_of_tilename(tile_name)
            gridinfo = grid.gridinfo_at_loc(loc)
            for site, site_type in gridinfo.sites.items():
                if site_type == desired_site_type:
                    yield tile_name, site

    print('''
module top();

    (* KEEP, DONT_TOUCH *)
    LUT6 dummy();
''')

    for site_type in ["PCIE_2_1"]:
        for _, site in gen_sites(site_type):
            print_site(ports[site_type], luts, site, site_type)

    for l in luts.create_wires_and_luts():
        print(l)

    print('endmodule')
Example #7
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()

    tile_list = []
    for tile_name in sorted(grid.tiles()):
        if "IOB33" not in tile_name or "SING" in tile_name:
            continue
        tile_list.append(tile_name)

    get_xy = util.create_xy_fun('[LR]IOB33_')
    tile_list.sort(key=get_xy)

    for iob_tile_name in tile_list:
        iob_gridinfo = grid.gridinfo_at_loc(
            grid.loc_of_tilename(iob_tile_name))

        # Find IOI tile adjacent to IOB
        for suffix in ["IOI3", "IOI3_TBYTESRC", "IOI3_TBYTETERM"]:
            try:
                ioi_tile_name = iob_tile_name.replace("IOB33", suffix)
                ioi_gridinfo = grid.gridinfo_at_loc(
                    grid.loc_of_tilename(ioi_tile_name))
                break
            except KeyError:
                pass

        iob33s = [k for k, v in iob_gridinfo.sites.items() if v == "IOB33S"][0]
        iob33m = [k for k, v in iob_gridinfo.sites.items() if v == "IOB33M"][0]
        idelay_s = iob33s.replace("IOB", "IDELAY")
        idelay_m = iob33m.replace("IOB", "IDELAY")

        yield iob33m, idelay_m, iob33s, idelay_s
Example #8
0
def gen_sites():
    ''' Return dict of ISERDES/OSERDES locations. '''
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()

    xy_fun = util.create_xy_fun('\S+')

    tiles = grid.tiles()

    for tile_name in sorted(tiles):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)
        tile_type = gridinfo.tile_type

        tile = {'tile': tile_name, 'tile_type': tile_type, 'ioi_sites': {}}

        for site_name, site_type in gridinfo.sites.items():
            if site_type in SITE_TYPES:
                xy = xy_fun(site_name)
                if xy not in tile['ioi_sites']:
                    tile['ioi_sites'][xy] = {}

                tile['ioi_sites'][xy][site_type] = site_name

        yield tile
Example #9
0
def main():
    """Rois all parts for a family by calling "make roi_only" over all parts
    with the same device as XRAY_PART.

    Example:
        prjxray$ ./utils/roi_all.py --db-root database/artix7/ --part xc7a100tfgg676-1
    """
    env = os.environ.copy()
    db_root = util.get_db_root()
    assert db_root
    part = util.get_part()
    assert part

    information = util.get_part_information(db_root, part)

    valid_devices = []
    for name, device in util.get_devices(db_root).items():
        if device['fabric'] == information['device']:
            valid_devices.append(name)

    for part, data in util.get_parts(db_root).items():
        if data['device'] in valid_devices:
            command = "make roi_only"
            env['XRAY_PART'] = part
            cwd = os.getenv('XRAY_FUZZERS_DIR')
            subprocess.run(command.split(' '), check=True, env=env, cwd=cwd)
Example #10
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        gridinfo = grid.gridinfo_at_tilename(tile_name)
        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['MMCME2_ADV']:
                yield tile_name, site_name
Example #11
0
def main():
    db_root = get_db_root()
    part = get_part()

    clock_column = ClockColumn(db_root, part)

    segmk = Segmaker("design.bits")

    print("Loading tags from design.txt.")

    with open("route.txt", "r") as f:
        for line in f:
            if 'CLK_BUFG_REBUF' not in line:
                continue

            parts = line.replace('{', '').replace('}', '').strip().replace(
                '\t', ' ').split(' ')
            dst = parts[0]
            pip = parts[3]

            tile_from_pip, pip = pip.split('/')

            if 'CLK_BUFG_REBUF' not in tile_from_pip:
                continue

            tile_type, pip = pip.split('.')
            assert tile_type == 'CLK_BUFG_REBUF'

            wire_a, wire_b = pip.split('<<->>')

            tile_from_wire, dst = dst.split('/')

            assert dst == wire_a

            if tile_from_wire == tile_from_pip:
                b_to_a = wire_a == dst
                a_to_b = not b_to_a
            else:
                b_to_a = wire_a != dst
                a_to_b = not b_to_a

            segmk.add_tile_tag(
                tile_from_pip, '{}.{}'.format(wire_a, wire_b), b_to_a)
            segmk.add_tile_tag(
                tile_from_pip, '{}.{}'.format(wire_b, wire_a), a_to_b)

            clock_column.enable_rebuf(tile_from_pip, wire_a)

    for tile, gclk, active_below, active_above in clock_column.yield_rebuf_state(
    ):
        segmk.add_tile_tag(
            tile, 'GCLK{}_ENABLE_ABOVE'.format(gclk), active_above)
        segmk.add_tile_tag(
            tile, 'GCLK{}_ENABLE_BELOW'.format(gclk), active_below)

    segmk.compile()
    segmk.write(allow_empty=True)
Example #12
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)
        if gridinfo.tile_type in ['DSP_L', 'DSP_R']:
            site_name = sorted(gridinfo.sites.keys())[0]
            yield tile_name, site_name
Example #13
0
def gen_sites(desired_site_type):
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()

    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)
        for site, site_type in gridinfo.sites.items():
            if site_type == desired_site_type:
                yield loc, gridinfo.tile_type, site
Example #14
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['FIFO18E1']:
                yield tile_name, site_name
Example #15
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile)
        gridinfo = grid.gridinfo_at_loc(loc)
        if gridinfo.tile_type in ['DSP_L', 'DSP_R']:
            for site in sorted(gridinfo.sites.keys()):
                if gridinfo.sites[site] == 'DSP48E1':
                    yield tile, site
Example #16
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)
        if gridinfo.tile_type in ['CFG_CENTER_MID']:
            for site_name in sorted(gridinfo.sites.keys()):
                if site_name.startswith("BSCAN_X0Y0"):
                    yield tile_name, site_name
Example #17
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['PLLE2_ADV']:
                phasers = find_phasers_for_pll(grid, loc)
                yield tile_name, site_name, phasers
Example #18
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        tile_type = tile_name.rsplit("_", 1)[0]

        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['PLLE2_ADV']:
                yield tile_name, tile_type, site_name
Example #19
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['PCIE_2_1']:
                pcie_int_tiles = get_pcie_int_tiles(grid, loc)

                yield pcie_int_tiles, site_name
Example #20
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['GTPE2_COMMON']:
                gtp_int_tile = get_gtp_int_tile(gridinfo.clock_region, grid)

                yield gtp_int_tile, site_name
Example #21
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        if gridinfo.tile_type not in ["PCIE_BOT"]:
            continue

        for site_name, site_type in gridinfo.sites.items():

            return site_name, site_type
Example #22
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        tile_type = tile_name.rsplit("_", 1)[0]

        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['MMCME2_ADV']:
                hclk_wires = find_hclk_ref_wires_for_mmcm(grid, loc)
                yield tile_name, tile_type, site_name, hclk_wires
Example #23
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)
        sites = []
        for site, site_type in gridinfo.sites.items():
            if site_type == 'BUFMRCE':
                sites.append(site)

        if sites:
            yield tile_name, sorted(sites)
Example #24
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        for site_name, site_type in gridinfo.sites.items():
            if site_type in [
                    'BSCAN', 'CAPTURE', 'ICAP', 'USR_ACCESS', 'STARTUP',
                    'FRAME_ECC', 'DCIRESET'
            ]:
                if site_name not in 'ICAP_X0Y0':
                    yield site_name, site_type
Example #25
0
def bram_count():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()

    count = 0
    for tile_name in grid.tiles():
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['RAMBFIFO36E1']:
                count += 1

    return count
Example #26
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        if gridinfo.tile_type not in ['BRAM_L', 'BRAM_R']:
            continue

        sites = {}
        for site_name, site_type in gridinfo.sites.items():
            sites[site_type] = site_name

        yield tile_name, sites
Example #27
0
def gen_sites():
    '''
    IOB33S: main IOB of a diff pair
    IOB33M: secondary IOB of a diff pair
    IOB33: not a diff pair. Relatively rare (at least in ROI...2 of them?)
    Focus on IOB33S to start
    '''
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)

        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['IOB33S', 'IOB33M']:
                yield tile_name, site_name
Example #28
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)
        if gridinfo.tile_type.endswith("_SING"):
            continue
        # Y9 tiles have frame address 1 frame higher than the rest
        # Need to investigate what is so special about them
        if tile_name.endswith("Y9"):
            continue

        sites = []
        for site_name, site_type in gridinfo.sites.items():
            if site_type == 'IDELAYE2':
                yield tile_name, site_name
Example #29
0
def gen_sites():
    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    for tile_name in sorted(grid.tiles()):
        loc = grid.loc_of_tilename(tile_name)
        gridinfo = grid.gridinfo_at_loc(loc)
        if gridinfo.tile_type in ['CLBLL_L', 'CLBLL_R', 'CLBLM_L', 'CLBLM_R']:
            site_name = sorted(gridinfo.sites.keys())[0]
            if gridinfo.tile_type[-1] == 'L':
                int_tile_loc = (loc.grid_x + 1, loc.grid_y)
            else:
                int_tile_loc = (loc.grid_x - 1, loc.grid_y)

            int_tile_name = grid.tilename_at_loc(int_tile_loc)

            if not int_tile_name.startswith('INT_'):
                continue

            yield int_tile_name, site_name
Example #30
0
def run():
    print('''
module top();
    ''')

    int_tiles = []

    db = Database(util.get_db_root(), util.get_part())
    grid = db.grid()
    params = {}
    for int_l_column, int_r_column in gen_orphan_ints(grid):
        for int_l, int_r in zip(int_l_column[1:6:2], int_r_column[1:6:2]):
            build_cross_int(params, grid, int_l, int_r)
            int_tiles.append(int_l)

    print("endmodule")
    with open('top.txt', 'w') as f:
        for tile in int_tiles:
            print(tile, file=f)