Commit fdeb44ce by Dinple

plugging into placement_util

parent 89e4d8e8
...@@ -85,6 +85,9 @@ class PlacementCost(object): ...@@ -85,6 +85,9 @@ class PlacementCost(object):
# macro to pins look-up table: [MACRO_NAME] => [PIN_NAME] # macro to pins look-up table: [MACRO_NAME] => [PIN_NAME]
self.hard_macros_to_inpins = {} self.hard_macros_to_inpins = {}
self.soft_macros_to_inpins = {} self.soft_macros_to_inpins = {}
# blockage
self.blockages = []
# read netlist # read netlist
self.__read_protobuf() self.__read_protobuf()
...@@ -929,6 +932,12 @@ class PlacementCost(object): ...@@ -929,6 +932,12 @@ class PlacementCost(object):
""" """
return sorted(self.hard_macro_indices + self.soft_macro_indices) return sorted(self.hard_macro_indices + self.soft_macro_indices)
def set_project_name(self, project_name):
"""
Set Project name
"""
self.project_name = project_name
def get_project_name(self) -> str: def get_project_name(self) -> str:
""" """
Return Project name Return Project name
...@@ -1431,7 +1440,12 @@ class PlacementCost(object): ...@@ -1431,7 +1440,12 @@ class PlacementCost(object):
""" """
Return Vertical/Horizontal Macro Allocation Return Vertical/Horizontal Macro Allocation
""" """
return self.modules[node_idx].get_type() try:
return self.modules_w_pins[node_idx].get_type()
except IndexError:
# NOTE: Google's API return NONE if out of range
print("[INDEX OUT OF RANGE ERROR] Can not process index at {}".format(node_idx))
return None
def make_soft_macros_square(self): def make_soft_macros_square(self):
pass pass
...@@ -1586,9 +1600,6 @@ class PlacementCost(object): ...@@ -1586,9 +1600,6 @@ class PlacementCost(object):
def update_node_coords(self): def update_node_coords(self):
pass pass
def fix_node_coord(self):
pass
def update_port_sides(self): def update_port_sides(self):
pass pass
...@@ -1614,10 +1625,8 @@ class PlacementCost(object): ...@@ -1614,10 +1625,8 @@ class PlacementCost(object):
""" """
pass pass
def fix_node_coord(self): def fix_node_coord(self, node_idx):
"""Find all ports and fix their coordinates. self.modules_w_pins[node_idx].set_fix_flag(True)
"""
pass
def unplace_all_nodes(self): def unplace_all_nodes(self):
pass pass
...@@ -1646,6 +1655,9 @@ class PlacementCost(object): ...@@ -1646,6 +1655,9 @@ class PlacementCost(object):
def get_blockages(self): def get_blockages(self):
pass pass
def create_blockage(self, minx, miny, maxx, maxy, blockage_rate):
self.blockages.append([minx, miny, maxx, maxy, blockage_rate])
def get_ref_node_id(self, node_idx=-1): def get_ref_node_id(self, node_idx=-1):
"""ref_node_id is used for macro_pins. Refers to the macro it belongs to. """ref_node_id is used for macro_pins. Refers to the macro it belongs to.
""" """
......
...@@ -238,6 +238,13 @@ class PlacementCostTest(): ...@@ -238,6 +238,13 @@ class PlacementCostTest():
self.plc_os.set_canvas_size(self.CANVAS_WIDTH, self.CANVAS_HEIGHT) self.plc_os.set_canvas_size(self.CANVAS_WIDTH, self.CANVAS_HEIGHT)
self.plc_os.set_placement_grid(self.GRID_COL, self.GRID_ROW) self.plc_os.set_placement_grid(self.GRID_COL, self.GRID_ROW)
# TODO: Setting blockage has no effect on proxy cost computation
self.plc.create_blockage(0, 0, 400, 400, 1)
self.plc.create_blockage(0, 0, 200, 200, 1)
print(self.plc.get_blockages())
print(self.plc.make_soft_macros_square())
print(self.plc_os.get_soft_macros_count())
# HPWL # HPWL
try: try:
assert int(self.plc_os.get_wirelength()) == int(self.plc.get_wirelength()) assert int(self.plc_os.get_wirelength()) == int(self.plc.get_wirelength())
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment