Пример #1
0
def get_gtp_int_tile(clock_region, grid):
    for tile_name in sorted(grid.tiles()):
        if not tile_name.startswith("GTP_INT_INTERFACE"):
            continue

        loc = grid.loc_of_tilename(tile_name)

        left_gridinfo = grid.gridinfo_at_loc(
            GridLoc(loc.grid_x - 1, loc.grid_y))
        right_gridinfo = grid.gridinfo_at_loc(
            GridLoc(loc.grid_x + 1, loc.grid_y))

        if left_gridinfo.tile_type in ["INT_L", "INT_R"]:
            cmt = left_gridinfo.clock_region
        elif right_gridinfo.tile_type in ["INT_L", "INT_R"]:
            cmt = right_gridinfo.clock_region
        else:
            assert False

        gridinfo = grid.gridinfo_at_loc(loc)

        m = GTP_INT_Y_RE.match(tile_name)

        assert m

        int_y = int(m.group(1))

        if clock_region == cmt and int_y % 50 == 26:
            return tile_name
Пример #2
0
 def test_in_roi_overlay(self):
     region_dict = {}
     region_dict['pr1'] = (10, 58, 0, 51)
     region_dict['pr2'] = (10, 58, 52, 103)
     overlay = Overlay(region_dict)
     self.assertFalse(overlay.tile_in_roi(GridLoc(18, 50)))
     self.assertFalse(overlay.tile_in_roi(GridLoc(18, 84)))
     self.assertTrue(overlay.tile_in_roi(GridLoc(8, 50)))
     self.assertTrue(overlay.tile_in_roi(GridLoc(18, 112)))
     self.assertTrue(overlay.tile_in_roi(GridLoc(80, 40)))
Пример #3
0
def get_pcie_int_tiles(grid, pcie_loc):
    def get_site_at_loc(loc):
        gridinfo = grid.gridinfo_at_loc(loc)

        sites = list(gridinfo.sites.keys())

        if len(sites) and sites[0].startswith("SLICE"):
            return sites[0]

        return None

    pcie_int_tiles = list()

    for tile_name in sorted(grid.tiles()):
        if not tile_name.startswith("PCIE_INT_INTERFACE"):
            continue

        m = GTP_INT_Y_RE.match(tile_name)

        assert m

        int_y = int(m.group(1))

        if int_y % 50 == 0:
            loc = grid.loc_of_tilename(tile_name)
            is_left = loc.grid_x < pcie_loc.grid_x

            if is_left:
                for i in range(1, loc.grid_x):
                    loc_grid_x = loc.grid_x - i

                    site = get_site_at_loc(GridLoc(loc_grid_x, loc.grid_y))

                    if site:
                        break
            else:
                _, x_max, _, _ = grid.dims()
                for i in range(1, x_max - loc.grid_x):
                    loc_grid_x = loc.grid_x + i

                    site = get_site_at_loc(GridLoc(loc_grid_x, loc.grid_y))

                    if site:
                        break

            pcie_int_tiles.append((tile_name, is_left, site))

    return pcie_int_tiles
Пример #4
0
    def __init__(self, db, tilegrid):
        self.db = db
        self.tilegrid = tilegrid
        self.loc = {}
        self.tileinfo = {}

        for tile in self.tilegrid:
            tileinfo = self.tilegrid[tile]
            grid_loc = GridLoc(tileinfo['grid_x'], tileinfo['grid_y'])
            assert grid_loc not in self.loc
            self.loc[grid_loc] = tile

            bits = {}

            if 'bits' in tileinfo:
                for k in tileinfo['bits']:
                    segment_type = BlockType(k)
                    base_address = int(tileinfo['bits'][k]['baseaddr'], 0)

                    alias = None
                    if 'alias' in tileinfo['bits'][k]:
                        alias = BitAlias(
                            tile_type=tileinfo['bits'][k]['alias']['type'],
                            start_offset=tileinfo['bits'][k]['alias']
                            ['start_offset'],
                            sites=tileinfo['bits'][k]['alias']['sites'],
                        )

                    bits[segment_type] = Bits(
                        base_address=base_address,
                        frames=tileinfo['bits'][k]['frames'],
                        offset=tileinfo['bits'][k]['offset'],
                        words=tileinfo['bits'][k]['words'],
                        alias=alias,
                    )

            self.tileinfo[tile] = GridInfo(
                bits=bits,
                sites=tileinfo['sites'],
                tile_type=tileinfo['type'],
                pin_functions=tileinfo.get('pin_functions', {}),
            )

        x, y = zip(*self.loc.keys())
        self._dims = (min(x), max(x), min(y), max(y))
Пример #5
0
 def loc_of_tilename(self, tilename):
     tileinfo = self.tilegrid[tilename]
     return GridLoc(tileinfo['grid_x'], tileinfo['grid_y'])
Пример #6
0
    def __init__(self, db, tilegrid):
        self.db = db
        self.tilegrid = tilegrid
        self.loc = {}
        self.tileinfo = {}

        clock_regions = {}

        for tile in self.tilegrid:
            tileinfo = self.tilegrid[tile]
            grid_loc = GridLoc(tileinfo['grid_x'], tileinfo['grid_y'])
            assert grid_loc not in self.loc
            self.loc[grid_loc] = tile

            bits = {}

            if 'bits' in tileinfo:
                for k in tileinfo['bits']:
                    segment_type = BlockType(k)
                    base_address = int(tileinfo['bits'][k]['baseaddr'], 0)

                    alias = None
                    if 'alias' in tileinfo['bits'][k]:
                        alias = BitAlias(
                            tile_type=tileinfo['bits'][k]['alias']['type'],
                            start_offset=tileinfo['bits'][k]['alias']
                            ['start_offset'],
                            sites=tileinfo['bits'][k]['alias']['sites'],
                        )

                    bits[segment_type] = Bits(
                        base_address=base_address,
                        frames=tileinfo['bits'][k]['frames'],
                        offset=tileinfo['bits'][k]['offset'],
                        words=tileinfo['bits'][k]['words'],
                        alias=alias,
                    )

            clock_region = None
            if 'clock_region' in tileinfo:
                if tileinfo['clock_region'] is not None:
                    if tileinfo['clock_region'] not in clock_regions:
                        m = CLOCK_REGION_RE.fullmatch(tileinfo['clock_region'])
                        assert m is not None, tileinfo['clock_region']

                        clock_regions[tileinfo['clock_region']] = ClockRegion(
                            name=tileinfo['clock_region'],
                            x=int(m.group(1)),
                            y=int(m.group(2)))

                    clock_region = clock_regions[tileinfo['clock_region']]

            self.tileinfo[tile] = GridInfo(
                bits=bits,
                sites=tileinfo['sites'],
                prohibited_sites=tileinfo['prohibited_sites'],
                tile_type=tileinfo['type'],
                pin_functions=tileinfo.get('pin_functions', {}),
                clock_region=clock_region,
            )

        x, y = zip(*self.loc.keys())
        self._dims = (min(x), max(x), min(y), max(y))