def __init__(self, db, tile_type, bits_map): # Name of tile_type that is using the alias self.tile_type = tile_type # Name of aliased tile_type self.alias_tile_type = None # BlockType -> BitAlias map self.alias = {} self.bits_map = bits_map # BlockType -> aliased Bits map self.alias_bits_map = {} # aliased site name to site name map self.sites_rev_map = {} for block_type in bits_map: self.alias[block_type] = bits_map[block_type].alias self.alias_bits_map[block_type] = Bits( base_address=bits_map[block_type].base_address, frames=bits_map[block_type].frames, offset=bits_map[block_type].offset - self.alias[block_type].start_offset, words=bits_map[block_type].words, alias=None, ) if self.alias_tile_type is None: self.alias_tile_type = self.alias[block_type].tile_type else: assert self.alias_tile_type == self.alias[block_type].tile_type self.sites_rev_map[block_type] = {} for site, alias_site in self.alias[block_type].sites.items(): assert alias_site not in self.sites_rev_map[block_type] self.sites_rev_map[block_type][alias_site] = site tile_db = db.tile_types[self.tile_type] self.ppips = {} if tile_db.ppips is not None: with open(tile_db.ppips) as f: self.ppips = read_ppips(f) self.tile_segbits = db.get_tile_segbits(self.alias_tile_type)
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))
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))