def getSlotPblockTcl(self, slot: Slot) -> List[str]: """ remove the overlaps with vitis IPs If the slot is an SLR-level slot, then do not remove the DDR region in the middle """ tcl = [] pblock_name = slot.getRTLModuleName() pblock_def = slot.getName() tcl.append(f'create_pblock {pblock_name}') tcl.append(f'resize_pblock {pblock_name} -add {pblock_def}') tcl.append(f'# remove the reserved clock regions for the Vitis infra') tcl.append(f'resize_pblock {pblock_name} -remove {self.VITIS_REGION}') # exclude the DDR region if the DDR region is at the boundary of the slot for ddr in self.ddr_list: ddr_pblock = self.DDR_TO_CLOCK_REGIONS[ddr] ddr_slot = Slot(slot.board, ddr_pblock) if slot.down_left_x == ddr_slot.down_left_x or slot.up_right_x == ddr_slot.up_right_x: if slot.containsChildSlot(ddr_slot): if self.getDDRSlolenRegion(ddr): tcl.append(f'# exclude the area for DDR {ddr}') tcl.append(f'resize_pblock {pblock_name} -remove {self.DDR_TO_CLOCK_REGIONS[ddr]}') tcl.append(f'resize_pblock {pblock_name} -add {{ {self.getDDRSlolenRegion(ddr)} }}') return tcl
def get_actual_usage(v_list: List[Vertex], init_slot: Slot) -> float: usage = 0 for r in RESOURCE_TYPES: total = sum(v.getVertexAndInboundFIFOArea()[r] for v in v_list) avail = init_slot.getArea()[r] percent = round(total / avail, 2) usage = max(usage, percent) return usage
def getAllTwoByTwoCRSlots(self): """ [FIXME] a temporary fix. Get all Slots of 2x2 clock regions for U250 """ slot_list = [] for x in range(0, 8, 2): for y in range(0, 16, 2): slot_list.append( Slot(self.board, f'CLOCKREGION_X{x}Y{y}:CLOCKREGION_X{x+1}Y{y+1}')) return slot_list
def print_vertex_areas(v_list: List[Vertex], init_slot: Slot) -> None: _logger.info('The area of each vertex is listed as below.') _logger.info( 'Note that the area of each vertex includes the area of all its in-bound FIFOs.' ) for v in v_list: _logger.info(f' {v.name}: ' + ' '.join(f'{r}: {v.getVertexAndInboundFIFOArea()[r]}' for r in RESOURCE_TYPES)) _logger.info('The total area of the design:') for r in RESOURCE_TYPES: total = sum(v.getVertexAndInboundFIFOArea()[r] for v in v_list) avail = init_slot.getArea()[r] percent = round(total * 100 / avail, 1) _logger.info(f' {r}: {total} / {avail} = {percent}%')
def __haveOverlappedXRange(self, a : Slot, b : Slot): return min(a.getOrigUpRightX(), b.getOrigUpRightX()) > max(a.getOrigDownLeftX(), b.getOrigDownLeftX())
def createSlot(self, pblock : str): """create a Slot for floorplanning purpose and track the existing Slot objects""" pblock = self.__preprocessPblock(pblock) if pblock not in self.pblock_to_slot: self.pblock_to_slot[pblock] = Slot(self.board, pblock) return self.pblock_to_slot[pblock]
def createSlotForRouting(self, pblock : str): """create a Slot object for global routing purpose""" pblock = self.__preprocessPblock(pblock) if pblock not in self.pblock_to_routing_slot: self.pblock_to_routing_slot[pblock] = Slot(self.board, pblock) return self.pblock_to_routing_slot[pblock]
def __init__(self, slot_name): self.slot_name = slot_name self.slot = Slot(U250_inst, slot_name) self.edges = [] self.neighbors = set()