Commit 89e4d8e8 by Dinple

bug fixes

parent c612bdbc
......@@ -7,3 +7,4 @@ CodeElements/Plc_client/test/*/*
CodeElements/Plc_client/plc_client_os.py
CodeElements/Plc_client/__pycache__/*
CodeElements/Plc_client/proto_reader.py
CodeElements/Plc_client/plc_client.py
......@@ -23,6 +23,8 @@ Example:
Todo:
* Add Documentation
* Clean up
* location information update not correctly after restore placement
* test if cell < 5, congestion cost computation
"""
......@@ -429,7 +431,8 @@ class PlacementCost(object):
elif all(it in line_item for it in ['MACROs'])\
and len(line_item) == 2:
_macros_cnt = int(line_item[1])
elif all(re.match(r'[0-9N\.\-]+', it) for it in line_item):
elif all(re.match(r'[0-9NEWS\.\-]+', it) for it in line_item)\
and len(line_item) == 5:
# [node_index] [x] [y] [orientation] [fixed]
_node_plc[int(line_item[0])] = line_item[1:]
......@@ -473,6 +476,11 @@ class PlacementCost(object):
if ifInital:
self.init_plc = plc_pth
# recompute cost from new location
self.FLAG_UPDATE_CONGESTION = True
self.FLAG_UPDATE_DENSITY = True
self.FLAG_UPDATE_WIRELENGTH = True
# extracted information from .plc file
info_dict = self.__read_plc(plc_pth)
......@@ -499,7 +507,9 @@ class PlacementCost(object):
self.hard_macro_indices +\
self.soft_macro_indices) == list(info_dict['node_plc'].keys())
except AssertionError:
print('[PLC IDICES MISMATCH ERROR]')
print('[PLC INDICES MISMATCH ERROR]', len(sorted(self.port_indices +\
self.hard_macro_indices +\
self.soft_macro_indices)), len(list(info_dict['node_plc'].keys())))
exit(1)
for mod_idx in info_dict['node_plc'].keys():
......
......@@ -34,6 +34,18 @@ Example:
--marv 5\
--smooth 2
$ python3 -m Plc_client.plc_client_os_test --netlist ./Plc_client/test/ariane133/netlist.pb.txt\
--plc ./Plc_client/test/ariane133/initial.plc\
--width 1599\
--height 1600.06\
--col 24\
--row 21\
--rpmh 10\
--rpmv 10\
--marh 5\
--marv 5\
--smooth 2
Todo:
* Clean up code
* Extract argument from command line
......@@ -208,7 +220,7 @@ class PlacementCostTest():
ifValidate=True,
ifReadComment=False)
self.plc.set_canvas_boundary_check(False)
self.plc.restore_placement(self.PLC_PATH)
# self.plc.restore_placement(self.PLC_PATH)
else:
print("[PLC FILE MISSING] Using only netlist info")
......@@ -228,10 +240,10 @@ class PlacementCostTest():
# HPWL
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())
assert abs(self.plc.get_cost() - self.plc_os.get_cost()) <= 1e-3
except Exception as e:
print("[WIRELENGTH ERROR] Discrepancies found when computing wirelength -- {}".format(str(e)))
print("[WIRELENGTH ERROR] Discrepancies found when computing wirelength -- {}, {}".format(str(self.plc.get_cost()), self.plc_os.get_cost()))
exit(1)
# Density
......@@ -239,7 +251,7 @@ class PlacementCostTest():
assert int(sum(self.plc_os.get_grid_cells_density())) == int(sum(self.plc.get_grid_cells_density()))
assert int(self.plc_os.get_density_cost()) == int(self.plc.get_density_cost())
except Exception as e:
print("[DENSITY ERROR] Discrepancies found when computing density -- {}".format(str(e)))
print("[DENSITY ERROR] Discrepancies found when computing density -- {}, {}".format(str(self.plc.get_density_cost()), self.plc_os.get_density_cost()))
exit(1)
# Congestion
......
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