flow.py 3.39 KB
Newer Older
ZhiangWang033 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
import os
import argparse
import time
import shutil
import sys
from math import sqrt
sys.path.append('../Clustering/src')
sys.path.append('../Gridding/src')
sys.path.append('../Grouping/src')
sys.path.append('../FormatTranslators/src')

from clustering import Clustering
from gridding import GriddingLefDefInterface
from grouping import Grouping
from FormatTranslators import LefDef2ProBufFormat


setup_file = "setup.tcl"
design = "ariane"
macro_lefs = ["./lefs/fakeram45_256x16.lef"]

ZhiangWang033 committed
22 23 24


"""
ZhiangWang033 committed
25 26 27 28 29
##############################################
### Call Gridding Function
##############################################
gridding_src_dir = '../Gridding/src'
tolerance = 0.01
30 31
min_n_rows = 10
min_n_cols = 10
ZhiangWang033 committed
32 33 34
max_n_rows = 50
max_n_cols = 50
max_rows_times_cols = 3000
35
halo_width = 5
ZhiangWang033 committed
36

37
gridding = GriddingLefDefInterface(gridding_src_dir, design, setup_file, tolerance, halo_width,
ZhiangWang033 committed
38 39 40 41
                                   min_n_rows, min_n_cols, max_n_rows, max_n_cols,
                                   max_rows_times_cols)
num_rows = gridding.GetNumRows()
num_cols = gridding.GetNumCols()
ZhiangWang033 committed
42 43 44 45 46
"""

num_rows = 19
num_cols = 19

ZhiangWang033 committed
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69

##############################################
### Call Grouping Function
##############################################
grouping_src_dir = '../Grouping/src'
grouping_rpt_dir = 'grouping_rpt'
K_in = 1
K_out = 1
global_net_threshold = 300
grouping = Grouping(design, num_rows, num_cols, K_in, K_out, setup_file, global_net_threshold, grouping_src_dir)

# clean the rpt_dir
if not os.path.exists(grouping_rpt_dir):
    os.mkdir(grouping_rpt_dir)

cmd = "mv " + design + ".fix " + grouping_rpt_dir
os.system(cmd)

cmd = "mv " + design + ".fix.old " + grouping_rpt_dir
os.system(cmd)

fixed_file = grouping_rpt_dir + "/" + design + ".fix.old"

ZhiangWang033 committed
70 71 72
exit()


ZhiangWang033 committed
73 74 75 76
##############################################
### Call Clustering Function
##############################################
clustering_src_dir = '../Clustering/src'
ZhiangWang033 committed
77 78 79 80 81 82
#chip_width = gridding.GetChipWidth()
#chip_height = gridding.GetChipHeight()
#num_std_cells = gridding.GetNumStdCells()
chip_width = 1599.99
chip_height = 1600.06
num_std_cells = 87452
83
grid_width = chip_width / num_cols
ZhiangWang033 committed
84 85 86 87
Nparts = 500

# Based on the description of circuit training, [see line 180 at grouper.py]
# we set the following thresholds
ZhiangWang033 committed
88
step_threshold = sqrt(chip_width * chip_height) / 4.0
ZhiangWang033 committed
89 90 91 92 93 94 95 96 97
distance = step_threshold / 2.0
max_num_vertices = num_std_cells / Nparts / 4
Replace = False
print("[INFO] step_threshold : ", step_threshold)
print("[INFO] distance : ", distance)
print("[INFO] max_num_vertices : ", max_num_vertices)


clustering = Clustering(design, clustering_src_dir, fixed_file, step_threshold, distance,
98
             grid_width, max_num_vertices, global_net_threshold, Nparts, setup_file, Replace)
ZhiangWang033 committed
99 100 101 102

cluster_def = "./results/OpenROAD/clustered_netlist.def"
cluster_lef = "./results/OpenROAD/clusters.lef"

ZhiangWang033 committed
103 104 105

exit()

ZhiangWang033 committed
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123
######################################################################
### Convert the clustered netlist to the Protocol Buffer Format
######################################################################
translator_src_dir = '../FormatTranslators/src'
openroad_exe = translator_src_dir + "/utils/openroad"
lef_list = []
lef_list.append(cluster_lef)
for macro_lef in macro_lefs:
    lef_list.append(macro_lef)

LefDef2ProBufFormat(lef_list, cluster_def, design, openroad_exe, global_net_threshold)


### Print Summary Information
print("*"*80)
print("[INFO] number of clusters : ", clustering.GetNumClusters())