Commit 51923065 by ZhiangWang033

add repel force

parent 60e8c9d9
...@@ -397,9 +397,8 @@ class FDPlacement: ...@@ -397,9 +397,8 @@ class FDPlacement:
if (dist <= 1e-5): if (dist <= 1e-5):
return 1e5, 1e5 return 1e5, 1e5
else: else:
f = self.func_r(dist) f_x = self.repulsive_factor * x_dist / dist
f_x = x_dist / dist * f f_y = self.repulsive_factor * y_dist / dist
f_y = y_dist / dist * f
return f_x, f_y return f_x, f_y
# Pull the objects to the nearest center of the gridcell # Pull the objects to the nearest center of the gridcell
...@@ -417,6 +416,20 @@ class FDPlacement: ...@@ -417,6 +416,20 @@ class FDPlacement:
row_id = self.n_rows - 1 row_id = self.n_rows - 1
self.objects[object_id].y = (row_id + 0.5) * self.grid_height self.objects[object_id].y = (row_id + 0.5) * self.grid_height
# Make sure all the clusters are placed within the canvas
def FitCanvas(self, object_id):
if (self.objects[object_id].x <= 0.0):
self.objects[object_id].x = 0.0
if (self.objects[object_id].x >= self.canvas_width):
self.objects[object_id].x = self.canvas_width
if (self.objects[object_id].y <= 0.0):
self.objects[object_id].y = 0.0
if (self.objects[object_id].y >= self.canvas_height):
self.objects[object_id].y = self.canvas_height
# Force-directed Placement for standard-cell clusters # Force-directed Placement for standard-cell clusters
def Placement(self): def Placement(self):
# initialize the displacement for standard-cell clusters # initialize the displacement for standard-cell clusters
...@@ -501,8 +514,12 @@ class FDPlacement: ...@@ -501,8 +514,12 @@ class FDPlacement:
for j in range(self.num_step): for j in range(self.num_step):
print("Runing Step ", j) print("Runing Step ", j)
self.Placement() self.Placement()
# Based on our understanding, the stdcell clusters can be placed
# at any place in the canvas instead of the center of gridcells
#for cluster in self.stdcell_clusters:
# self.RoundCenter(cluster)
for cluster in self.stdcell_clusters: for cluster in self.stdcell_clusters:
self.RoundCenter(cluster) self.FitCanvas(cluster)
self.WritePbNetlist(self.pb_netlist_file + "." + str(i + 1)) self.WritePbNetlist(self.pb_netlist_file + "." + str(i + 1))
self.WritePlcFile(self.plc_file + "." + str(i + 1)) self.WritePlcFile(self.plc_file + "." + str(i + 1))
self.WritePbNetlist(self.pb_netlist_file + ".final") self.WritePbNetlist(self.pb_netlist_file + ".final")
......
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