Commit 97332807 by ZhiangWang033

fixed clustering

parent f6cff733
......@@ -3,7 +3,11 @@ import time
import shutil
import sys
sys.path.append('./utils')
sys.path.append('../../FormatTranslators/src')
from FormatTranslators import Port
from FormatTranslators import Macro
from FormatTranslators import MacroPin
class Clustering:
def __init__(self, design, src_dir, fixed_file, step_threshold = 100.6, distance = 1000.0,
......@@ -37,6 +41,11 @@ class Clustering:
self.placement_density = placement_density
self.GUI = GUI
### Print Information
print("[INFO] step_threshold : ", self.step_threshold)
print("[INFO] distance : ", self.distance)
print("[INFO] max_num_vertices : ", self.max_num_vertices)
# Specify the location of hmetis exe and openroad exe and other utilities
self.hmetis_exe = src_dir + "/utils/hmetis"
self.openroad_exe = src_dir + "/utils/openroad"
......@@ -92,7 +101,13 @@ class Clustering:
self.ConvertFixFile() # Convert fixed file
self.hMetisPartitioner() # Partition the hypergraph
self.BreakClusters() # Break clusters spreading apart
print("[INFO] After finishing BreakClusters(), ", end = "")
print("num_clusters = ", len(self.vertices_in_cluster))
self.MergeSmallClusters() # Merge small clusters with its neighbors
print("[INFO] After finishing MergeSmallClusters(), ", end = "")
print("num_clusters = ", len(self.vertices_in_cluster))
self.CreateInvsCluster() # Generate Innovus Clustering Commands
self.CreateDef() # Generate clustered lef and def file
if (self.RePlace == True):
......@@ -246,8 +261,8 @@ class Clustering:
box = self.vertex_pos[vertex]
cluster_lx = min(cluster_lx, box[0])
cluster_ly = min(cluster_ly, box[1])
cluster_ux = min(cluster_ux, box[2])
cluster_uy = min(cluster_uy, box[3])
cluster_ux = max(cluster_ux, box[2])
cluster_uy = max(cluster_uy, box[3])
return cluster_lx, cluster_ly, cluster_ux, cluster_uy
......@@ -264,8 +279,6 @@ class Clustering:
and ((cluster_uy - cluster_ly) <= self.step_threshold)):
return None
Print("Break This Cluster")
cluster_x = (cluster_lx + cluster_ux) / 2.0
cluster_y = (cluster_ly + cluster_uy) / 2.0
num_x_grid = int((cluster_ux - cluster_x) / self.step_threshold)
......
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
set design "ariane"
set top_design "ariane"
set netlist "./design/ariane.v"
# def file generated by iSpatial flow
# where all the instances have been placed
set def_file "./design/ariane.def"
set ALL_LEFS "
./lefs/NangateOpenCellLibrary.tech.lef
./lefs/NangateOpenCellLibrary.macro.mod.lef
./lefs/fakeram45_256x16.lef
"
set LIB_BC "
./libs/NangateOpenCellLibrary_typical.lib
./libs/fakeram45_256x16.lib
"
set site "FreePDK45_38x28_10R_NP_162NW_34O"
foreach lef_file ${ALL_LEFS} {
read_lef $lef_file
}
foreach lib_file ${LIB_BC} {
read_liberty $lib_file
}
read_lef ./results/OpenROAD/clusters.lef
read_def ./results/OpenROAD/clustered_netlist.def
set global_place_density 0.7
set global_place_density_penalty 8e-5
global_placement -disable_routability_driven -density $global_place_density -init_density_penalty $global_place_density_penalty
write_def ./results/OpenROAD/blob.def
exit
......@@ -10,9 +10,9 @@ if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--design", help="design_name: ariane, MegaBoom_x2 ", type = str, default = "ariane")
parser.add_argument("--fixed_file", help="fixed file generated by grouping", type = str, default = "./fix_files_grouping/ariane.fix.old")
parser.add_argument("--step_threshold", help = "threshold (x and y) to break clusters (in um)", type = float, default = 100.6)
parser.add_argument("--distance", help="distance for merge clusters", type = float, default = 1000.0)
parser.add_argument("--max_num_vertices", help="threshold for samller clusters", type = int, default = 1000000)
parser.add_argument("--step_threshold", help = "threshold (x and y) to break clusters (in um)", type = float, default = 400.0)
parser.add_argument("--distance", help="distance for merge clusters", type = float, default = 200.0)
parser.add_argument("--max_num_vertices", help="threshold for samller clusters", type = int, default = 44)
parser.add_argument("--net_size_threshold", help = "large net threshold", type = int, default = 300)
parser.add_argument("--Nparts", help = "number of clusters (only for hmetis, default = 500)", type = int, default = 500)
parser.add_argument("--setup_file", help = "setup file for openroad (default = setup.tcl)", type = str, default = "setup.tcl")
......
......@@ -69,7 +69,7 @@ Nparts = 500
# Based on the description of circuit training, [see line 180 at grouper.py]
# we set the following thresholds
step_threshold = sqrt(chip_width * chip_height) / 100.0
step_threshold = sqrt(chip_width * chip_height) / 4.0
distance = step_threshold / 2.0
max_num_vertices = num_std_cells / Nparts / 4
Replace = False
......
......@@ -572,7 +572,7 @@ class BookShelf2ProBufFormat:
line_id += 1
# Generate PLC file
# Generate.pb.txt file
def Output(self):
f = open(self.output_file, "w")
for inst_name, inst in self.insts.items():
......@@ -767,7 +767,7 @@ class ODB2ProBufFormat:
self.insts[driver_name].AddSinks(sinks_name)
# Generate PLC file
# Generate.pb.txt file
def Output(self):
f = open(self.output_file, "w")
for inst_name, inst in self.insts.items():
......@@ -785,7 +785,7 @@ class LefDef2ProBufFormat:
self.lef_list = lef_list
self.def_file = def_file
self.design = design
self.output_file = self.design + ".plc"
self.output_file = self.design + ".pb.txt"
self.openroad_exe = openroad_exe
self.net_size_threshold = net_size_threshold
self.file_dir = os.getcwd() + "/rtl_mp"
......
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