Commit ccf490ad by Dinple

fix netlist parser

parent 93752bef
......@@ -159,7 +159,6 @@ class PlacementCost(object):
# node found
if line_item[0] == 'node':
node_cnt += 1
node_name = ''
input_list = []
......@@ -169,9 +168,15 @@ class PlacementCost(object):
# retrieve node name
if line_item[0] == 'name':
node_name = line_item[1]
if node_name == "__metadata__":
print("skipping __metadata__")
else:
# print(node_name)
node_cnt += 1
else:
node_name = 'N/A name'
# advance ptr
line = fp.readline()
line_item = re.findall(r'\w+[^\:\n\\{\}\s"]*', line)
......@@ -198,6 +203,23 @@ class PlacementCost(object):
line_item = re.findall(r'\w+', line)
key = line_item[1]
if key == "macro_name":
# advance, expect value
line = fp.readline()
line_item = re.findall(r'\w+', line)
# advance, expect value item
line = fp.readline()
line_item = re.findall(r'\w+[^\:\n\\{\}\s"]*', line)
attr_dict[key] = line_item
line = fp.readline()
line = fp.readline()
line = fp.readline()
line_item = re.findall(r'\w+', line)
else:
# advance, expect value
line = fp.readline()
line_item = re.findall(r'\w+', line)
......@@ -214,7 +236,9 @@ class PlacementCost(object):
line_item = re.findall(r'\w+', line)
if attr_dict['type'][1] == 'macro':
if node_name == "__metadata__":
logging.info('[NETLIST PARSER INFO] skipping invalid net input')
elif attr_dict['type'][1] == 'macro':
# soft macro
# check if all required information is obtained
try:
......@@ -301,6 +325,7 @@ class PlacementCost(object):
x_offset = attr_dict['x_offset'][1],
y_offset = attr_dict['y_offset'][1],
macro_name = attr_dict['macro_name'][1])
if 'weight' in attr_dict.keys():
hard_macro_pin.set_weight(float(attr_dict['weight'][1]))
......@@ -1677,11 +1702,7 @@ class PlacementCost(object):
return mod.get_width(), mod.get_height()
def make_soft_macros_square(self):
"""
update soft macro width/height base on its square area
"""
pass
def update_soft_macros_position(self, coord_dict):
"""
......@@ -2688,7 +2709,7 @@ class PlacementCost(object):
def main():
test_netlist_dir = './Plc_client/test/'+\
'ariane133'
'ariane_68_1.3'
netlist_file = os.path.join(test_netlist_dir,
'netlist.pb.txt')
plc = PlacementCost(netlist_file)
......
......@@ -44,8 +44,8 @@ Example:
--marv 51.790\
--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\
$ python3 -m Plc_client.plc_client_os_test --netlist ./Plc_client/test/ariane_68_1.3/netlist.pb.txt\
--plc ./Plc_client/test/ariane_68_1.3//initial.plc\
--width 1599\
--height 1600.06\
--col 24\
......@@ -347,7 +347,7 @@ class PlacementCostTest():
self.plc_os.set_placement_grid(self.GRID_COL, self.GRID_ROW)
self.plc_os.display_canvas()
self.unplace_node()
self.plc_os.unplace_all_nodes()
print(np.flip(np.array(self.plc_util.get_node_mask(0)).reshape(35, 33), axis=0))
print(np.flip(np.array(self.plc.get_node_mask(0)).reshape(35, 33), axis=0))
......@@ -800,11 +800,11 @@ def main(args):
# PCT.test_proxy_cost()
# PCT.test_placement_util(keep_save_file=False)
# PCT.test_place_node()
PCT.test_miscellaneous()
# PCT.test_miscellaneous()
# PCT.test_observation_extractor()
# PCT.view_canvas()
# PCT.test_proxy_congestion()
# PCT.test_environment()
PCT.test_environment()
if __name__ == '__main__':
......
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