Skip to content

Commit

Permalink
update the plc API.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 668716826
Change-Id: Iee37ca67ec68cd652c85ceef0f512a51b7d6bd1b
  • Loading branch information
esonghori authored and copybara-github committed Aug 29, 2024
1 parent 73586a3 commit eaa9158
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions circuit_training/dreamplace/plc_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ def initialize_placedb_region_attributes(self, db, plc):
# A region is an array of BB.
region_to_id = {}
next_region_id = 0
movable_node_indices = self._physical_node_indices[:-db.num_terminals]
movable_node_indices = self._physical_node_indices[: -db.num_terminals]
# Ignores macro region constraints for now.
db.node2fence_region_map = np.full(
len(movable_node_indices),
Expand All @@ -604,13 +604,13 @@ def initialize_placedb_region_attributes(self, db, plc):
w, h = math.floor(w), math.floor(h)
for n in movable_node_indices:
areas = plc.get_area_constraint(n)
for area in areas:
assert len(area) == 4
if not areas:
# No area constraints. Set region as the entire canvas.
areas = (0, 0, w, h)
# Areas is a flatten list of BBs.
# Different orders of same BBs will be treated as different regions.
assert len(areas) % 4 == 0
region = tuple(areas)
areas = [[0, 0, w, h]]

region = tuple(sorted([tuple(area) for area in areas]))
if region not in region_to_id.keys():
region_to_id[region] = next_region_id
next_region_id += 1
Expand All @@ -624,7 +624,7 @@ def initialize_placedb_region_attributes(self, db, plc):
for region, rid in region_to_id.items():
db_regions[rid] = region
for i, region in enumerate(db_regions):
db_regions[i] = np.array(region).reshape(-1, 4)
db_regions[i] = np.array(region)

# Finish region initialization.
db.regions = db_regions
Expand All @@ -641,4 +641,3 @@ def initialize_placedb_region_attributes(self, db, plc):
db.flat_region_boxes = np.array([], dtype=db.dtype)
db.flat_region_boxes_start = np.array([0], dtype=np.int32)
db.node2fence_region_map = np.array([], dtype=np.int32)

0 comments on commit eaa9158

Please sign in to comment.