Commit a4637fb8 by Dinple

updates

parent f6e8f5a1
...@@ -9,4 +9,5 @@ CodeElements/Plc_client/plc_client_os.py ...@@ -9,4 +9,5 @@ CodeElements/Plc_client/plc_client_os.py
CodeElements/Plc_client/__pycache__/* CodeElements/Plc_client/__pycache__/*
CodeElements/Plc_client/proto_reader.py CodeElements/Plc_client/proto_reader.py
CodeElements/Plc_client/plc_client.py CodeElements/Plc_client/plc_client.py
CodeElements/Plc_client/failed_proxy_plc/* CodeElements/failed_proxy_plc/*
\ No newline at end of file CodeElements/CTModel/*
\ No newline at end of file
...@@ -573,6 +573,7 @@ class PlacementCost(object): ...@@ -573,6 +573,7 @@ class PlacementCost(object):
mod_y = float(info_dict['node_plc'][mod_idx][1]) mod_y = float(info_dict['node_plc'][mod_idx][1])
mod_orient = info_dict['node_plc'][mod_idx][2] mod_orient = info_dict['node_plc'][mod_idx][2]
mod_ifFixed = int(info_dict['node_plc'][mod_idx][3]) mod_ifFixed = int(info_dict['node_plc'][mod_idx][3])
except Exception as e: except Exception as e:
print('[ERROR PLC PARSER] %s' % str(e)) print('[ERROR PLC PARSER] %s' % str(e))
...@@ -710,7 +711,7 @@ class PlacementCost(object): ...@@ -710,7 +711,7 @@ class PlacementCost(object):
# Retrieve current pin node position # Retrieve current pin node position
pin_node = self.modules_w_pins[pin_idx] pin_node = self.modules_w_pins[pin_idx]
pin_node_x_offset, pin_node_y_offset = pin_node.get_offset() pin_node_x_offset, pin_node_y_offset = pin_node.get_offset()
# Google's Plc client DOES NOT compute (node_position + pin_offset) when reading input
return (ref_node_x + pin_node_x_offset, ref_node_y + pin_node_y_offset) return (ref_node_x + pin_node_x_offset, ref_node_y + pin_node_y_offset)
def get_wirelength(self) -> float: def get_wirelength(self) -> float:
...@@ -727,6 +728,9 @@ class PlacementCost(object): ...@@ -727,6 +728,9 @@ class PlacementCost(object):
x_coord = [] x_coord = []
y_coord = [] y_coord = []
# default value of weight
weight_fact = 1.0
# NOTE: connection only defined on PORT, soft/hard macro pins # NOTE: connection only defined on PORT, soft/hard macro pins
if curr_type == "PORT" and mod.get_sink(): if curr_type == "PORT" and mod.get_sink():
# add source position # add source position
...@@ -741,38 +745,46 @@ class PlacementCost(object): ...@@ -741,38 +745,46 @@ class PlacementCost(object):
sink = self.modules_w_pins[sink_idx] sink = self.modules_w_pins[sink_idx]
# only consider placed sink # only consider placed sink
ref_sink = self.modules_w_pins[self.get_ref_node_id(sink_idx)] ref_sink = self.modules_w_pins[self.get_ref_node_id(sink_idx)]
# if not placed, skip this edge
if not ref_sink.get_placed_flag(): if not ref_sink.get_placed_flag():
continue x_coord.append(0)
# retrieve location y_coord.append(0)
else:# retrieve location
x_coord.append(self.__get_pin_position(sink_idx)[0]) x_coord.append(self.__get_pin_position(sink_idx)[0])
y_coord.append(self.__get_pin_position(sink_idx)[1]) y_coord.append(self.__get_pin_position(sink_idx)[1])
elif curr_type == "MACRO_PIN": elif curr_type == "MACRO_PIN":
ref_mod = self.modules_w_pins[self.get_ref_node_id(mod_idx)] ref_mod = self.modules_w_pins[self.get_ref_node_id(mod_idx)]
# if not placed, skip this edge
if not ref_mod.get_placed_flag(): if not ref_mod.get_placed_flag():
continue continue
# get pin weight
weight_fact = mod.get_weight()
# add source position # add source position
x_coord.append(self.__get_pin_position(mod_idx)[0]) x_coord.append(self.__get_pin_position(mod_idx)[0])
y_coord.append(self.__get_pin_position(mod_idx)[1]) y_coord.append(self.__get_pin_position(mod_idx)[1])
if mod.get_sink(): if mod.get_sink():
if mod.get_weight() != 0:
norm_fact = mod.get_weight()
for input_list in mod.get_sink().values(): for input_list in mod.get_sink().values():
for sink_name in input_list: for sink_name in input_list:
# retrieve indx in modules_w_pins # retrieve indx in modules_w_pins
input_idx = self.mod_name_to_indices[sink_name] input_idx = self.mod_name_to_indices[sink_name]
sink_ref_mod = self.modules_w_pins[self.get_ref_node_id(mod_idx)]
# if not placed, skip this edge
if not sink_ref_mod.get_placed_flag():
x_coord.append(0)
y_coord.append(0)
else:
# retrieve location # retrieve location
x_coord.append(self.__get_pin_position(input_idx)[0]) x_coord.append(self.__get_pin_position(input_idx)[0])
y_coord.append(self.__get_pin_position(input_idx)[1]) y_coord.append(self.__get_pin_position(input_idx)[1])
if x_coord: if x_coord:
if norm_fact != 1.0: total_hpwl += weight_fact * \
total_hpwl += norm_fact * \
(abs(max(x_coord) - min(x_coord)) + \ (abs(max(x_coord) - min(x_coord)) + \
abs(max(y_coord) - min(y_coord))) abs(max(y_coord) - min(y_coord)))
else:
total_hpwl += (abs(max(x_coord) - min(x_coord))\
+ abs(max(y_coord) - min(y_coord)))
return total_hpwl return total_hpwl
def abu(self, xx, n = 0.1): def abu(self, xx, n = 0.1):
...@@ -2735,19 +2747,6 @@ class PlacementCost(object): ...@@ -2735,19 +2747,6 @@ class PlacementCost(object):
def get_type(self): def get_type(self):
return "MACRO_PIN" return "MACRO_PIN"
# TODO finish this
# class StandardCell:
# def __init__( self, name,
# x = 0.0, y = 0.0, weight = 1.0):
# self.name = name
# self.x = float(x)
# self.y = float(y)
# self.x_offset = 0.0 # not used
# self.y_offset = 0.0 # not used
# self.macro_name = macro_name
# self.weight = weight
# self.sink = {}
def main(): def main():
test_netlist_dir = './Plc_client/test/'+\ test_netlist_dir = './Plc_client/test/'+\
'ariane_68_1.3' 'ariane_68_1.3'
......
...@@ -430,12 +430,15 @@ class PlacementCostTest(): ...@@ -430,12 +430,15 @@ class PlacementCostTest():
str(self.plc.get_cost()), self.plc_os.get_cost())) str(self.plc.get_cost()), self.plc_os.get_cost()))
# if remove all soft macros # if remove all soft macros
# soft_macro_indices = [ soft_macro_indices = [
# m for m in self.plc.get_macro_indices() if self.plc.is_node_soft_macro(m) m for m in self.plc.get_macro_indices() if self.plc.is_node_soft_macro(m)
# ] ]
# for mod_idx in soft_macro_indices: for mod_idx in soft_macro_indices:
# self.plc_os.unplace_node(mod_idx) self.plc_os.unplace_node(mod_idx)
# self.plc.unplace_node(mod_idx) self.plc.unplace_node(mod_idx)
print("GL WIRELENGTH: ", self.plc.get_wirelength())
print("OS WIRELENGTH: ", self.plc_os.get_wirelength())
print("GL WIRELENGTH: ", self.plc.get_wirelength()) print("GL WIRELENGTH: ", self.plc.get_wirelength())
print("OS WIRELENGTH: ", self.plc_os.get_wirelength()) print("OS WIRELENGTH: ", self.plc_os.get_wirelength())
...@@ -985,7 +988,7 @@ def main(args): ...@@ -985,7 +988,7 @@ def main(args):
# PCT.test_place_node() # PCT.test_place_node()
# PCT.test_miscellaneous() # PCT.test_miscellaneous()
# PCT.test_observation_extractor() # PCT.test_observation_extractor()
PCT.view_canvas() # PCT.view_canvas()
# PCT.test_environment() # PCT.test_environment()
......
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