Exemplo n.º 1
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
Exemplo n.º 2
0
    def __init__(self, bitsfile, verbose=None, db_root=None, fabric=None):
        self.db_root = db_root
        if self.db_root is None:
            self.db_root = util.get_db_root()
            assert self.db_root, "No db root specified."

        self.fabric = fabric
        if self.fabric is None:
            self.fabric = util.get_fabric()
            assert self.fabric, "No fabric 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()
Exemplo n.º 3
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
Exemplo n.º 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
Exemplo n.º 5
0
def gen_sites():
    ''' Return dict of ISERDES/OSERDES locations. '''
    db = Database(util.get_db_root())
    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
Exemplo n.º 6
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)
Exemplo n.º 7
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')
Exemplo n.º 8
0
def load_iob_segbits():
    """
    Loads IOB segbits from the database to get fasm feature list.
    This function assumes:
    - LIOB33/RIOB33 have the same features.
    - IOB_Y0 and IOB_Y1 have the same features (at least those of interest).
    """
    features = []

    fname = os.path.join(util.get_db_root(), "segbits_liob33.db")
    with open(fname, "r") as fp:
        for line in fp:

            line = line.strip()
            if len(line) == 0:
                continue

            # Parse the line
            fields = line.split(maxsplit=1)
            feature = fields[0]
            bits = fields[1]

            # Parse the feature
            parts = feature.split(".", maxsplit=3)
            if len(parts) >= 3 and parts[1] == "IOB_Y0":
                features.append(".".join(parts[2:]))

    return features
Exemplo n.º 9
0
def gen_sites():
    db = Database(util.get_db_root())
    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
Exemplo n.º 10
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
Exemplo n.º 11
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
Exemplo n.º 12
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)
Exemplo n.º 13
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
Exemplo n.º 14
0
def gen_sites():
    db = Database(util.get_db_root())
    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']:
            for site in sorted(gridinfo.sites.keys()):
                if gridinfo.sites[site] == 'DSP48E1':
                    yield tile_name, site
Exemplo n.º 15
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_CHANNEL']:
                yield tile_name, site_name
Exemplo n.º 16
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 site
Exemplo n.º 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)
        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
Exemplo n.º 18
0
def gen_sites():
    db = Database(util.get_db_root())
    grid = db.grid()
    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']:
                yield tile_name, site_name
Exemplo n.º 19
0
def main():
    parser = argparse.ArgumentParser(
        description=
        "Creates design.json from output of ROI generation tcl script.")
    parser.add_argument('--design_txt', required=True)
    parser.add_argument('--design_info_txt', required=True)
    parser.add_argument('--pad_wires', required=True)

    args = parser.parse_args()

    j = {}
    j['ports'] = []
    j['info'] = {}
    with open(args.design_txt) as f:
        for d in csv.DictReader(f, delimiter=' '):
            j['ports'].append(d)

    with open(args.design_info_txt) as f:
        for l in f:
            name, value = l.strip().split(' = ')

            j['info'][name] = int(value)

    db = Database(get_db_root())
    grid = db.grid()

    roi = Roi(
        db=db,
        x1=j['info']['GRID_X_MIN'],
        y1=j['info']['GRID_Y_MIN'],
        x2=j['info']['GRID_X_MAX'],
        y2=j['info']['GRID_Y_MAX'],
    )

    with open(args.pad_wires) as f:
        for l in f:
            parts = l.strip().split(' ')
            name = parts[0]
            pin = parts[1]
            wires = parts[2:]

            wires_outside_roi = []

            for wire in wires:
                tile = wire.split('/')[0]

                loc = grid.loc_of_tilename(tile)

                if not roi.tile_in_roi(loc):
                    wires_outside_roi.append(wire)

            set_port_wires(j['ports'], name, pin, wires_outside_roi)

    json.dump(j, sys.stdout, indent=2, sort_keys=True)
Exemplo n.º 20
0
def gen_sites():
    db = Database(util.get_db_root())
    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 site_name, phasers
Exemplo n.º 21
0
def gen_sites():
    db = Database(util.get_db_root())
    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
Exemplo n.º 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)

        for site_name, site_type in gridinfo.sites.items():
            if site_type in ['MMCME2_ADV']:
                phasers = find_phasers_for_mmcm(grid, loc)
                hclk_wires = find_hclk_ref_wires_for_mmcm(grid, loc)
                yield tile_name, site_name, phasers, hclk_wires
Exemplo n.º 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)

        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
Exemplo n.º 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 ['PCIE_2_1']:
                pcie_int_tiles = get_pcie_int_tiles(grid, loc)

                yield pcie_int_tiles, site_name
Exemplo n.º 25
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
Exemplo n.º 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)
        sites = []
        for site, site_type in gridinfo.sites.items():
            if site_type == 'BUFMRCE':
                sites.append(site)

        if sites:
            yield tile_name, sorted(sites)
Exemplo n.º 27
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
Exemplo n.º 28
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
Exemplo n.º 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 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
Exemplo n.º 30
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())
    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