Commit 83935698 by ZhiangWang033

add testcase for groupping

parent d507cb8d
This source diff could not be displayed because it is too large. You can view the blob instead.
import os
import argparse
import time
import shutil
import sys
from math import floor
sys.path.append('./utils')
####################################################################################
#### Extract hypergraph, instance, IO ports and outline from netlist
####################################################################################
def GenerateHypergraph(openroad_exe, setup_file, extract_hypergraph_file):
temp_file = os.getcwd() + "/extract_hypergraph.tcl"
cmd = "cp " + setup_file + " " + temp_file
os.system(cmd)
with open(extract_hypergraph_file) as f:
content = f.read().splitlines()
f.close()
f = open(temp_file, "a")
f.write("\n")
for line in content:
f.write(line + "\n")
f.close()
cmd = openroad_exe + " " + temp_file
os.system(cmd)
cmd = "rm " + temp_file
os.system(cmd)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("design", help = "design name", type = str)
parser.add_argument("n_rows", help = "number of rows", type = int)
parser.add_argument("n_cols", help = "number of cols", type = int)
parser.add_argument("--setup_file", help = "setup file for openroad (default = setup.tcl)", type = str, default = "setup.tcl")
args = parser.parse_args()
design = args.design
n_rows = args.n_rows
n_cols = args.n_cols
setup_file = args.setup_file
pwd = os.getcwd()
# Specify the location of hmetis exe and openroad exe
openroad_exe = pwd + "/utils/openroad"
extract_hypergraph_file = pwd + "/utils/extract_hypergraph.tcl"
# Generate Hypergraph file
rpt_dir = pwd + "/rtl_mp"
hypergraph_file = rpt_dir + "/" + design + ".hgr"
io_name_file = hypergraph_file + ".io"
instance_name_file = hypergraph_file + ".instance"
outline_file = hypergraph_file + ".outline"
GenerateHypergraph(openroad_exe, setup_file, extract_hypergraph_file)
# Generate fix file
fix_file = design + ".fix"
print("[INFO] Generated fix file : ", fix_file)
# Step 1: Grouping bundled IOs based on n_rows and n_cols
with open(outline_file) as f:
content = f.read().splitlines()
f.close()
items = content[0].split()
floorplan_lx = float(items[0])
floorplan_ly = float(items[1])
floorplan_ux = float(items[2])
floorplan_uy = float(items[3])
width = (floorplan_ux - floorplan_lx) / n_cols
height = (floorplan_uy - floorplan_ly) / n_rows
group_map = { }
io_inst_map = { }
vertex_list = []
grid_row_max = 100000000
with open(io_name_file) as f:
content = f.read().splitlines()
f.close()
for line in content:
items = line.split()
io_name = items[0]
vertex_list.append(io_name)
x = (float(items[1]) + float(items[3])) / 2.0
y = (float(items[2]) + float(items[4])) / 2.0
hash_id = floor(y / height) * grid_row_max + floor(x / width)
io_inst_map[io_name] = hash_id
if hash_id not in group_map:
group_map[hash_id] = [io_name]
else:
group_map[hash_id].append(io_name)
hash_id = max(group_map.keys()) + 1
with open(instance_name_file) as f:
content = f.read().splitlines()
f.close()
for line in content:
items = line.split()
inst_name = items[0]
vertex_list.append(inst_name)
if (int(items[1]) == 1):
group_map[hash_id] = [inst_name]
io_inst_map[inst_name] = hash_id
hash_id += 1
glue_inst = { }
with open(hypergraph_file) as f:
content = f.read().splitlines()
f.close()
for i in range(1, len(content)):
items = [vertex_list[int(item) -1] for item in content[i].split()]
if(len(items) > 100):
continue
group_list = []
flag = False
for item in items:
if item in io_inst_map:
flag = True
group_list.append(item)
if (flag == True):
for item in items:
if item not in group_list:
for inst in group_list:
group_map[io_inst_map[inst]].append(item)
if item not in glue_inst:
glue_inst[item] = [inst]
else:
glue_inst[item].append(inst)
for key, value in glue_inst.items():
if(len(value) > 1):
print(value)
group_id = 0
f = open(fix_file, "w")
for key, value in group_map.items():
line = "group_" + str(group_id) + ": "
group_id += 1
for io in value:
line += io + " "
line += "\n"
f.write(line)
f.close()
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.
clk_i 0 876.155 0.07 876.225
rst_ni 0 785.435 0.07 785.505
boot_addr_i[63] 0 1325.28 0.07 1325.34
boot_addr_i[62] 0 658.035 0.07 658.105
boot_addr_i[61] 0 1317.99 0.07 1318.06
boot_addr_i[60] 0 1167.07 0.07 1167.15
boot_addr_i[59] 0 1408.99 0.07 1409.06
boot_addr_i[58] 0 1041.64 0.07 1041.7
boot_addr_i[57] 0 705.355 0.07 705.425
boot_addr_i[56] 0 728.875 0.07 728.945
boot_addr_i[55] 0 1474.52 0.07 1474.58
boot_addr_i[54] 0 1370.92 0.07 1370.98
boot_addr_i[53] 0 825.475 0.07 825.545
boot_addr_i[52] 0 1210.76 0.07 1210.82
boot_addr_i[51] 0 1309.04 0.07 1309.1
boot_addr_i[50] 0 701.715 0.07 701.785
boot_addr_i[49] 0 945.315 0.07 945.385
boot_addr_i[48] 0 1272.64 0.07 1272.7
boot_addr_i[47] 0 1190.88 0.07 1190.94
boot_addr_i[46] 0 1121.71 0.07 1121.79
boot_addr_i[45] 0 1349.07 0.07 1349.15
boot_addr_i[44] 0 1103.52 0.07 1103.58
boot_addr_i[43] 0 1090.92 0.07 1090.98
boot_addr_i[42] 0 763.595 0.07 763.665
boot_addr_i[41] 0 1478.16 0.07 1478.22
boot_addr_i[40] 0 610.715 0.07 610.785
boot_addr_i[39] 0 947.275 0.07 947.345
boot_addr_i[38] 0 1179.95 0.07 1180.03
boot_addr_i[37] 0 832.755 0.07 832.825
boot_addr_i[36] 0 1219.99 0.07 1220.06
boot_addr_i[35] 0 867.195 0.07 867.265
boot_addr_i[34] 0 609.035 0.07 609.105
boot_addr_i[33] 0 1079.99 0.07 1080.06
boot_addr_i[32] 0 990.675 0.07 990.745
boot_addr_i[31] 0 856.275 0.07 856.345
boot_addr_i[30] 0 768.915 0.07 768.985
boot_addr_i[29] 0 1105.47 0.07 1105.55
boot_addr_i[28] 0 1365.31 0.07 1365.39
boot_addr_i[27] 0 1141.59 0.07 1141.67
boot_addr_i[26] 0 1468.92 0.07 1468.98
boot_addr_i[25] 0 840.035 0.07 840.105
boot_addr_i[24] 0 1277.95 0.07 1278.03
boot_addr_i[23] 0 923.475 0.07 923.545
boot_addr_i[22] 0 1236.23 0.07 1236.31
boot_addr_i[21] 0 992.635 0.07 992.705
boot_addr_i[20] 0 1316.31 0.07 1316.39
boot_addr_i[19] 0 941.675 0.07 941.745
boot_addr_i[18] 0 807.275 0.07 807.345
boot_addr_i[17] 0 681.835 0.07 681.905
boot_addr_i[16] 0 854.595 0.07 854.665
boot_addr_i[15] 0 1312.68 0.07 1312.74
boot_addr_i[14] 0 1096.23 0.07 1096.31
boot_addr_i[13] 0 641.795 0.07 641.865
boot_addr_i[12] 0 741.755 0.07 741.825
boot_addr_i[11] 0 1407.04 0.07 1407.1
boot_addr_i[10] 0 1305.4 0.07 1305.46
boot_addr_i[9] 0 1203.47 0.07 1203.55
boot_addr_i[8] 0 1267.04 0.07 1267.1
boot_addr_i[7] 0 1489.07 0.07 1489.15
boot_addr_i[6] 0 1425.23 0.07 1425.31
boot_addr_i[5] 0 983.675 0.07 983.745
boot_addr_i[4] 0 1012.52 0.07 1012.59
boot_addr_i[3] 0 897.995 0.07 898.065
boot_addr_i[2] 0 1439.8 0.07 1439.86
boot_addr_i[1] 0 1136.28 0.07 1136.34
boot_addr_i[0] 0 974.435 0.07 974.505
hart_id_i[63] 0 1107.16 0.07 1107.22
hart_id_i[62] 0 616.315 0.07 616.385
hart_id_i[61] 0 1412.64 0.07 1412.7
hart_id_i[60] 0 1449.04 0.07 1449.1
hart_id_i[59] 0 743.435 0.07 743.505
hart_id_i[58] 0 1209.07 0.07 1209.15
hart_id_i[57] 0 978.075 0.07 978.145
hart_id_i[56] 0 1376.23 0.07 1376.31
hart_id_i[55] 0 887.075 0.07 887.145
hart_id_i[54] 0 938.035 0.07 938.105
hart_id_i[53] 0 1483.47 0.07 1483.55
hart_id_i[52] 0 1452.68 0.07 1452.74
hart_id_i[51] 0 667.275 0.07 667.345
hart_id_i[50] 0 881.755 0.07 881.825
hart_id_i[49] 0 698.075 0.07 698.145
hart_id_i[48] 0 1319.95 0.07 1320.03
hart_id_i[47] 0 1499.71 0.07 1499.79
hart_id_i[46] 0 1347.11 0.07 1347.19
hart_id_i[45] 0 659.995 0.07 660.065
hart_id_i[44] 0 1345.44 0.07 1345.51
hart_id_i[43] 0 980.035 0.07 980.105
hart_id_i[42] 0 1245.19 0.07 1245.27
hart_id_i[41] 0 987.035 0.07 987.105
hart_id_i[40] 0 1061.8 0.07 1061.86
hart_id_i[39] 0 1139.92 0.07 1139.98
hart_id_i[38] 0 1481.8 0.07 1481.86
hart_id_i[37] 0 1258.07 0.07 1258.15
hart_id_i[36] 0 1065.44 0.07 1065.51
hart_id_i[35] 0 994.315 0.07 994.385
hart_id_i[34] 0 1170.71 0.07 1170.79
hart_id_i[33] 0 1385.19 0.07 1385.27
hart_id_i[32] 0 1461.64 0.07 1461.7
hart_id_i[31] 0 1261.71 0.07 1261.79
hart_id_i[30] 0 703.675 0.07 703.745
hart_id_i[29] 0 1310.71 0.07 1310.79
hart_id_i[28] 0 1130.68 0.07 1130.74
hart_id_i[27] 0 1427.19 0.07 1427.27
hart_id_i[26] 0 865.235 0.07 865.305
hart_id_i[25] 0 1001.59 0.07 1001.66
hart_id_i[24] 0 1339.83 0.07 1339.91
hart_id_i[23] 0 1192.56 0.07 1192.62
hart_id_i[22] 0 1088.95 0.07 1089.03
hart_id_i[21] 0 714.595 0.07 714.665
hart_id_i[20] 0 1027.07 0.07 1027.15
hart_id_i[19] 0 1463.59 0.07 1463.67
hart_id_i[18] 0 819.875 0.07 819.945
hart_id_i[17] 0 1019.79 0.07 1019.86
hart_id_i[16] 0 963.515 0.07 963.585
hart_id_i[15] 0 1367.28 0.07 1367.34
hart_id_i[14] 0 1147.19 0.07 1147.27
hart_id_i[13] 0 623.595 0.07 623.665
hart_id_i[12] 0 1490.76 0.07 1490.82
hart_id_i[11] 0 759.955 0.07 760.025
hart_id_i[10] 0 767.235 0.07 767.305
hart_id_i[9] 0 805.315 0.07 805.385
hart_id_i[8] 0 969.115 0.07 969.185
hart_id_i[7] 0 970.795 0.07 970.865
hart_id_i[6] 0 1363.64 0.07 1363.7
hart_id_i[5] 0 1098.19 0.07 1098.27
hart_id_i[4] 0 787.115 0.07 787.185
hart_id_i[3] 0 1494.4 0.07 1494.46
hart_id_i[2] 0 1201.8 0.07 1201.86
hart_id_i[1] 0 1128.99 0.07 1129.06
hart_id_i[0] 0 750.715 0.07 750.785
irq_i[1] 0 649.075 0.07 649.145
irq_i[0] 0 1336.19 0.07 1336.27
ipi_i 0 847.315 0.07 847.385
time_irq_i 0 1163.44 0.07 1163.51
debug_req_i 0 672.595 0.07 672.665
axi_req_o[277] 0 689.115 0.07 689.185
axi_req_o[276] 0 1050.88 0.07 1050.94
axi_req_o[275] 0 1177.99 0.07 1178.06
axi_req_o[274] 0 1132.64 0.07 1132.7
axi_req_o[273] 0 1416.28 0.07 1416.34
axi_req_o[272] 0 959.875 0.07 959.945
axi_req_o[271] 0 934.395 0.07 934.465
axi_req_o[270] 0 814.555 0.07 814.625
axi_req_o[269] 0 652.715 0.07 652.785
axi_req_o[268] 0 1165.4 0.07 1165.46
axi_req_o[267] 0 1314.35 0.07 1314.43
axi_req_o[266] 0 1005.23 0.07 1005.3
axi_req_o[265] 0 899.955 0.07 900.025
axi_req_o[264] 0 1148.88 0.07 1148.94
axi_req_o[263] 0 765.275 0.07 765.345
axi_req_o[262] 0 1250.8 0.07 1250.86
axi_req_o[261] 0 1379.88 0.07 1379.94
axi_req_o[260] 0 1423.56 0.07 1423.62
axi_req_o[259] 0 954.555 0.07 954.625
axi_req_o[258] 0 1243.52 0.07 1243.58
axi_req_o[257] 0 1383.52 0.07 1383.58
axi_req_o[256] 0 1352.71 0.07 1352.79
axi_req_o[255] 0 627.235 0.07 627.305
axi_req_o[254] 0 1016.16 0.07 1016.22
axi_req_o[253] 0 1029.04 0.07 1029.1
axi_req_o[252] 0 1145.23 0.07 1145.31
axi_req_o[251] 0 607.075 0.07 607.145
axi_req_o[250] 0 1172.68 0.07 1172.74
axi_req_o[249] 0 1259.76 0.07 1259.82
axi_req_o[248] 0 1196.19 0.07 1196.27
axi_req_o[247] 0 1456.31 0.07 1456.39
axi_req_o[246] 0 1112.76 0.07 1112.82
axi_req_o[245] 0 1137.95 0.07 1138.03
axi_req_o[244] 0 1063.47 0.07 1063.55
axi_req_o[243] 0 1298.11 0.07 1298.19
axi_req_o[242] 0 1134.31 0.07 1134.39
axi_req_o[241] 0 1254.44 0.07 1254.51
axi_req_o[240] 0 1158.11 0.07 1158.19
axi_req_o[239] 0 910.875 0.07 910.945
axi_req_o[238] 0 956.235 0.07 956.305
axi_req_o[237] 0 1496.35 0.07 1496.43
axi_req_o[236] 0 770.875 0.07 770.945
axi_req_o[235] 0 1085.31 0.07 1085.39
axi_req_o[234] 0 943.635 0.07 943.705
axi_req_o[233] 0 1221.68 0.07 1221.74
axi_req_o[232] 0 1078.04 0.07 1078.1
axi_req_o[231] 0 1328.92 0.07 1328.98
axi_req_o[230] 0 676.235 0.07 676.305
axi_req_o[229] 0 1214.4 0.07 1214.46
axi_req_o[228] 0 1074.4 0.07 1074.46
axi_req_o[227] 0 872.515 0.07 872.585
axi_req_o[226] 0 1143.56 0.07 1143.62
axi_req_o[225] 0 1092.59 0.07 1092.67
axi_req_o[224] 0 1152.52 0.07 1152.58
axi_req_o[223] 0 836.395 0.07 836.465
axi_req_o[222] 0 1467.23 0.07 1467.31
axi_req_o[221] 0 972.755 0.07 972.825
axi_req_o[220] 0 1150.83 0.07 1150.91
axi_req_o[219] 0 1198.16 0.07 1198.22
axi_req_o[218] 0 1003.55 0.07 1003.62
axi_req_o[217] 0 1119.76 0.07 1119.82
axi_req_o[216] 0 852.635 0.07 852.705
axi_req_o[215] 0 1076.35 0.07 1076.43
axi_req_o[214] 0 1008.88 0.07 1008.95
axi_req_o[213] 0 961.835 0.07 961.905
axi_req_o[212] 0 1018.11 0.07 1018.18
axi_req_o[211] 0 1207.11 0.07 1207.19
axi_req_o[210] 0 997.955 0.07 998.025
axi_req_o[209] 0 1283.56 0.07 1283.62
axi_req_o[208] 0 921.795 0.07 921.865
axi_req_o[207] 0 1083.64 0.07 1083.7
axi_req_o[206] 0 674.555 0.07 674.625
axi_req_o[205] 0 1030.71 0.07 1030.79
axi_req_o[204] 0 803.635 0.07 803.705
axi_req_o[203] 0 685.475 0.07 685.545
axi_req_o[202] 0 1059.83 0.07 1059.91
axi_req_o[201] 0 1299.8 0.07 1299.86
axi_req_o[200] 0 630.875 0.07 630.945
axi_req_o[199] 0 1323.59 0.07 1323.67
axi_req_o[198] 0 868.875 0.07 868.945
axi_req_o[197] 0 903.595 0.07 903.665
axi_req_o[196] 0 1434.47 0.07 1434.55
axi_req_o[195] 0 1447.07 0.07 1447.15
axi_req_o[194] 0 1307.07 0.07 1307.15
axi_req_o[193] 0 857.955 0.07 858.025
axi_req_o[192] 0 808.955 0.07 809.025
axi_req_o[191] 0 1343.47 0.07 1343.55
axi_req_o[190] 0 1010.84 0.07 1010.91
axi_req_o[189] 0 919.835 0.07 919.905
axi_req_o[188] 0 1069.07 0.07 1069.15
axi_req_o[187] 0 619.955 0.07 620.025
axi_req_o[186] 0 789.075 0.07 789.145
axi_req_o[185] 0 1390.8 0.07 1390.86
axi_req_o[184] 0 908.915 0.07 908.985
axi_req_o[183] 0 918.155 0.07 918.225
axi_req_o[182] 0 1296.16 0.07 1296.22
axi_req_o[181] 0 708.995 0.07 709.065
axi_req_o[180] 0 1265.35 0.07 1265.43
axi_req_o[179] 0 1047.23 0.07 1047.31
axi_req_o[178] 0 1205.44 0.07 1205.51
axi_req_o[177] 0 636.195 0.07 636.265
axi_req_o[176] 0 1058.16 0.07 1058.22
axi_req_o[175] 0 1039.95 0.07 1040.03
axi_req_o[174] 0 1485.44 0.07 1485.51
axi_req_o[173] 0 645.435 0.07 645.505
axi_req_o[172] 0 799.995 0.07 800.065
axi_req_o[171] 0 939.995 0.07 940.065
axi_req_o[170] 0 1159.8 0.07 1159.86
axi_req_o[169] 0 948.955 0.07 949.025
axi_req_o[168] 0 1457.99 0.07 1458.06
axi_req_o[167] 0 736.155 0.07 736.225
axi_req_o[166] 0 1436.16 0.07 1436.22
axi_req_o[165] 0 634.515 0.07 634.585
axi_req_o[164] 0 914.515 0.07 914.585
axi_req_o[163] 0 1256.11 0.07 1256.19
axi_req_o[162] 0 1225.31 0.07 1225.39
axi_req_o[161] 0 999.915 0.07 999.985
axi_req_o[160] 0 1479.83 0.07 1479.91
axi_req_o[159] 0 1067.11 0.07 1067.19
axi_req_o[158] 0 632.555 0.07 632.625
axi_req_o[157] 0 1036.31 0.07 1036.39
axi_req_o[156] 0 843.675 0.07 843.745
axi_req_o[155] 0 967.155 0.07 967.225
axi_req_o[154] 0 1417.95 0.07 1418.03
axi_req_o[153] 0 1169.04 0.07 1169.1
axi_req_o[152] 0 778.155 0.07 778.225
axi_req_o[151] 0 716.275 0.07 716.345
axi_req_o[150] 0 739.795 0.07 739.865
axi_req_o[149] 0 617.995 0.07 618.065
axi_req_o[148] 0 1470.88 0.07 1470.94
axi_req_o[147] 0 1287.19 0.07 1287.27
axi_req_o[146] 0 661.675 0.07 661.745
axi_req_o[145] 0 692.755 0.07 692.825
axi_req_o[144] 0 1238.19 0.07 1238.27
axi_req_o[143] 0 1252.47 0.07 1252.55
axi_req_o[142] 0 1239.88 0.07 1239.94
axi_req_o[141] 0 1361.68 0.07 1361.74
axi_req_o[140] 0 1034.35 0.07 1034.43
axi_req_o[139] 0 1327.23 0.07 1327.31
axi_req_o[138] 0 601.755 0.07 601.825
axi_req_o[137] 0 818.195 0.07 818.265
axi_req_o[136] 0 1354.4 0.07 1354.46
axi_req_o[135] 0 1465.28 0.07 1465.34
axi_req_o[134] 0 1438.11 0.07 1438.19
axi_req_o[133] 0 670.915 0.07 670.985
axi_req_o[132] 0 738.115 0.07 738.185
axi_req_o[131] 0 1183.59 0.07 1183.67
axi_req_o[130] 0 830.795 0.07 830.865
axi_req_o[129] 0 1032.68 0.07 1032.74
axi_req_o[128] 0 870.835 0.07 870.905
axi_req_o[127] 0 812.595 0.07 812.665
axi_req_o[126] 0 1285.23 0.07 1285.31
axi_req_o[125] 0 816.235 0.07 816.305
axi_req_o[124] 0 892.675 0.07 892.745
axi_req_o[123] 0 850.955 0.07 851.025
axi_req_o[122] 0 848.995 0.07 849.065
axi_req_o[121] 0 1181.64 0.07 1181.7
axi_req_o[120] 0 1230.92 0.07 1230.98
axi_req_o[119] 0 1268.99 0.07 1269.06
axi_req_o[118] 0 930.755 0.07 930.825
axi_req_o[117] 0 752.675 0.07 752.745
axi_req_o[116] 0 712.635 0.07 712.705
axi_req_o[115] 0 792.715 0.07 792.785
axi_req_o[114] 0 665.315 0.07 665.385
axi_req_o[113] 0 1187.23 0.07 1187.31
axi_req_o[112] 0 996.275 0.07 996.345
axi_req_o[111] 0 1101.83 0.07 1101.91
axi_req_o[110] 0 883.435 0.07 883.505
axi_req_o[109] 0 612.675 0.07 612.745
axi_req_o[108] 0 1274.31 0.07 1274.39
axi_req_o[107] 0 654.395 0.07 654.465
axi_req_o[106] 0 1025.4 0.07 1025.46
axi_req_o[105] 0 1174.35 0.07 1174.43
axi_req_o[104] 0 1216.35 0.07 1216.43
axi_req_o[103] 0 861.595 0.07 861.665
axi_req_o[102] 0 1381.56 0.07 1381.62
axi_req_o[101] 0 965.475 0.07 965.545
axi_req_o[100] 0 988.995 0.07 989.065
axi_req_o[99] 0 679.875 0.07 679.945
axi_req_o[98] 0 1199.83 0.07 1199.91
axi_req_o[97] 0 1356.35 0.07 1356.43
axi_req_o[96] 0 916.195 0.07 916.265
axi_req_o[95] 0 1419.92 0.07 1419.98
axi_req_o[94] 0 727.195 0.07 727.265
axi_req_o[93] 0 874.475 0.07 874.545
axi_req_o[92] 0 1194.52 0.07 1194.58
axi_req_o[91] 0 829.115 0.07 829.185
axi_req_o[90] 0 801.675 0.07 801.745
axi_req_o[89] 0 718.235 0.07 718.305
axi_req_o[88] 0 1081.68 0.07 1081.74
axi_req_o[87] 0 1281.59 0.07 1281.67
axi_req_o[86] 0 1116.11 0.07 1116.19
axi_req_o[85] 0 1396.11 0.07 1396.19
axi_req_o[84] 0 621.635 0.07 621.705
axi_req_o[83] 0 1303.44 0.07 1303.51
axi_req_o[82] 0 798.035 0.07 798.105
axi_req_o[81] 0 1087.28 0.07 1087.34
axi_req_o[80] 0 614.355 0.07 614.425
axi_req_o[79] 0 1127.04 0.07 1127.1
axi_req_o[78] 0 901.635 0.07 901.705
axi_req_o[77] 0 700.035 0.07 700.105
axi_req_o[76] 0 1338.16 0.07 1338.22
axi_req_o[75] 0 1014.47 0.07 1014.54
axi_req_o[74] 0 749.035 0.07 749.105
axi_req_o[73] 0 1450.71 0.07 1450.79
axi_req_o[72] 0 1377.92 0.07 1377.98
axi_req_o[71] 0 821.835 0.07 821.905
axi_req_o[70] 0 721.875 0.07 721.945
axi_req_o[69] 0 650.755 0.07 650.825
axi_req_o[68] 0 838.075 0.07 838.145
axi_req_o[67] 0 656.355 0.07 656.425
axi_req_o[66] 0 896.315 0.07 896.385
axi_req_o[65] 0 779.835 0.07 779.905
axi_req_o[64] 0 863.555 0.07 863.625
axi_req_o[63] 0 981.715 0.07 981.785
axi_req_o[62] 0 927.115 0.07 927.185
axi_req_o[61] 0 1270.68 0.07 1270.74
axi_req_o[60] 0 1321.64 0.07 1321.7
axi_req_o[59] 0 841.715 0.07 841.785
axi_req_o[58] 0 628.915 0.07 628.985
axi_req_o[57] 0 1048.92 0.07 1048.98
axi_req_o[56] 0 1388.83 0.07 1388.91
axi_req_o[55] 0 1359.99 0.07 1360.06
axi_req_o[54] 0 1399.76 0.07 1399.82
axi_req_o[53] 0 952.595 0.07 952.665
axi_req_o[52] 0 1430.83 0.07 1430.91
axi_req_o[51] 0 890.715 0.07 890.785
axi_req_o[50] 0 1410.68 0.07 1410.74
axi_req_o[49] 0 1276.28 0.07 1276.34
axi_req_o[48] 0 1218.04 0.07 1218.1
axi_req_o[47] 0 696.395 0.07 696.465
axi_req_o[46] 0 1045.28 0.07 1045.34
axi_req_o[45] 0 754.355 0.07 754.425
axi_req_o[44] 0 1118.07 0.07 1118.15
axi_req_o[43] 0 1401.71 0.07 1401.79
axi_req_o[42] 0 1125.35 0.07 1125.43
axi_req_o[41] 0 1405.35 0.07 1405.43
axi_req_o[40] 0 1403.4 0.07 1403.46
axi_req_o[39] 0 1056.19 0.07 1056.27
axi_req_o[38] 0 925.435 0.07 925.505
axi_req_o[37] 0 1387.16 0.07 1387.22
axi_req_o[36] 0 1445.4 0.07 1445.46
axi_req_o[35] 0 1394.44 0.07 1394.51
axi_req_o[34] 0 1037.99 0.07 1038.06
axi_req_o[33] 0 958.195 0.07 958.265
axi_req_o[32] 0 912.555 0.07 912.625
axi_req_o[31] 0 625.275 0.07 625.345
axi_req_o[30] 0 810.915 0.07 810.985
axi_req_o[29] 0 1350.76 0.07 1350.82
axi_req_o[28] 0 668.955 0.07 669.025
axi_req_o[27] 0 734.475 0.07 734.545
axi_req_o[26] 0 1332.56 0.07 1332.62
axi_req_o[25] 0 1421.59 0.07 1421.67
axi_req_o[24] 0 1472.56 0.07 1472.62
axi_req_o[23] 0 747.075 0.07 747.145
axi_req_o[22] 0 643.475 0.07 643.545
axi_req_o[21] 0 1241.83 0.07 1241.91
axi_req_o[20] 0 1156.16 0.07 1156.22
axi_req_o[19] 0 605.395 0.07 605.465
axi_req_o[18] 0 663.635 0.07 663.705
axi_req_o[17] 0 1330.88 0.07 1330.94
axi_req_o[16] 0 1459.95 0.07 1460.03
axi_req_o[15] 0 1414.31 0.07 1414.39
axi_req_o[14] 0 690.795 0.07 690.865
axi_req_o[13] 0 1292.52 0.07 1292.58
axi_req_o[12] 0 976.395 0.07 976.465
axi_req_o[11] 0 950.915 0.07 950.985
axi_req_o[10] 0 794.395 0.07 794.465
axi_req_o[9] 0 1023.43 0.07 1023.51
axi_req_o[8] 0 647.115 0.07 647.185
axi_req_o[7] 0 774.515 0.07 774.585
axi_req_o[6] 0 687.155 0.07 687.225
axi_req_o[5] 0 1294.47 0.07 1294.55
axi_req_o[4] 0 1290.83 0.07 1290.91
axi_req_o[3] 0 1232.59 0.07 1232.67
axi_req_o[2] 0 907.235 0.07 907.305
axi_req_o[1] 0 772.555 0.07 772.625
axi_req_o[0] 0 1476.19 0.07 1476.27
axi_resp_i[81] 0 719.915 0.07 719.985
axi_resp_i[80] 0 859.915 0.07 859.985
axi_resp_i[79] 0 694.435 0.07 694.505
axi_resp_i[78] 0 1247.16 0.07 1247.22
axi_resp_i[77] 0 1372.59 0.07 1372.67
axi_resp_i[76] 0 834.435 0.07 834.505
axi_resp_i[75] 0 1498.04 0.07 1498.1
axi_resp_i[74] 0 1492.71 0.07 1492.79
axi_resp_i[73] 0 745.395 0.07 745.465
axi_resp_i[72] 0 1374.28 0.07 1374.34
axi_resp_i[71] 0 1054.52 0.07 1054.58
axi_resp_i[70] 0 1052.56 0.07 1052.62
axi_resp_i[69] 0 1007.2 0.07 1007.27
axi_resp_i[68] 0 710.955 0.07 711.025
axi_resp_i[67] 0 1123.4 0.07 1123.46
axi_resp_i[66] 0 1454.35 0.07 1454.43
axi_resp_i[65] 0 929.075 0.07 929.145
axi_resp_i[64] 0 1279.92 0.07 1279.98
axi_resp_i[63] 0 1099.88 0.07 1099.94
axi_resp_i[62] 0 1428.88 0.07 1428.94
axi_resp_i[61] 0 827.155 0.07 827.225
axi_resp_i[60] 0 845.355 0.07 845.425
axi_resp_i[59] 0 879.795 0.07 879.865
axi_resp_i[58] 0 1228.95 0.07 1229.03
axi_resp_i[57] 0 1301.76 0.07 1301.82
axi_resp_i[56] 0 1443.44 0.07 1443.51
axi_resp_i[55] 0 707.315 0.07 707.385
axi_resp_i[54] 0 885.395 0.07 885.465
axi_resp_i[53] 0 823.515 0.07 823.585
axi_resp_i[52] 0 776.195 0.07 776.265
axi_resp_i[51] 0 761.635 0.07 761.705
axi_resp_i[50] 0 1109.11 0.07 1109.19
axi_resp_i[49] 0 1154.47 0.07 1154.55
axi_resp_i[48] 0 725.515 0.07 725.585
axi_resp_i[47] 0 1341.8 0.07 1341.86
axi_resp_i[46] 0 894.355 0.07 894.425
axi_resp_i[45] 0 1176.31 0.07 1176.39
axi_resp_i[44] 0 603.435 0.07 603.505
axi_resp_i[43] 0 905.275 0.07 905.345
axi_resp_i[42] 0 1432.52 0.07 1432.58
axi_resp_i[41] 0 723.555 0.07 723.625
axi_resp_i[40] 0 1094.56 0.07 1094.62
axi_resp_i[39] 0 1070.76 0.07 1070.82
axi_resp_i[38] 0 932.715 0.07 932.785
axi_resp_i[37] 0 1185.28 0.07 1185.34
axi_resp_i[36] 0 1368.95 0.07 1369.03
axi_resp_i[35] 0 936.355 0.07 936.425
axi_resp_i[34] 0 1358.04 0.07 1358.1
axi_resp_i[33] 0 790.755 0.07 790.825
axi_resp_i[32] 0 781.795 0.07 781.865
axi_resp_i[31] 0 1212.71 0.07 1212.79
axi_resp_i[30] 0 1110.8 0.07 1110.86
axi_resp_i[29] 0 783.475 0.07 783.545
axi_resp_i[28] 0 1487.11 0.07 1487.19
axi_resp_i[27] 0 1263.4 0.07 1263.46
axi_resp_i[26] 0 1441.76 0.07 1441.82
axi_resp_i[25] 0 796.355 0.07 796.425
axi_resp_i[24] 0 638.155 0.07 638.225
axi_resp_i[23] 0 1021.76 0.07 1021.83
axi_resp_i[22] 0 1161.76 0.07 1161.82
axi_resp_i[21] 0 1248.83 0.07 1248.91
axi_resp_i[20] 0 1334.52 0.07 1334.58
axi_resp_i[19] 0 1234.56 0.07 1234.62
axi_resp_i[18] 0 757.995 0.07 758.065
axi_resp_i[17] 0 683.515 0.07 683.585
axi_resp_i[16] 0 889.035 0.07 889.105
axi_resp_i[15] 0 756.315 0.07 756.385
axi_resp_i[14] 0 1188.92 0.07 1188.98
axi_resp_i[13] 0 1288.88 0.07 1288.94
axi_resp_i[12] 0 1223.64 0.07 1223.7
axi_resp_i[11] 0 1114.44 0.07 1114.51
axi_resp_i[10] 0 1398.07 0.07 1398.15
axi_resp_i[9] 0 1392.47 0.07 1392.55
axi_resp_i[8] 0 639.835 0.07 639.905
axi_resp_i[7] 0 1227.28 0.07 1227.34
axi_resp_i[6] 0 1043.59 0.07 1043.67
axi_resp_i[5] 0 985.355 0.07 985.425
axi_resp_i[4] 0 1072.71 0.07 1072.79
axi_resp_i[3] 0 878.115 0.07 878.185
axi_resp_i[2] 0 732.515 0.07 732.585
axi_resp_i[1] 0 730.835 0.07 730.905
axi_resp_i[0] 0 678.195 0.07 678.265
This source diff could not be displayed because it is too large. You can view the blob instead.
import os
import argparse
import time
import shutil
import sys
from math import floor
####################################################################################
#### Extract hypergraph, instance, IO ports and outline from netlist
####################################################################################
def GenerateHypergraph(openroad_exe, setup_file, extract_hypergraph_file):
temp_file = os.getcwd() + "/extract_hypergraph.tcl"
cmd = "cp " + setup_file + " " + temp_file
os.system(cmd)
with open(extract_hypergraph_file) as f:
content = f.read().splitlines()
f.close()
f = open(temp_file, "a")
f.write("\n")
for line in content:
f.write(line + "\n")
f.close()
cmd = openroad_exe + " " + temp_file
os.system(cmd)
cmd = "rm " + temp_file
os.system(cmd)
####################################################################################
#### TraverseFanout in BFS manner
####################################################################################
def TraverseFanout(vertices_list, hyperedges_list, vertex_hash, seed_id, root_id, K_out):
# update the root vertex
vertex_hash[root_id] = [seed_id, 0]
visited = []
wavefront = []
wavefront.append(root_id)
while (len(wavefront) > 0):
vertex_id = wavefront.pop(0)
visited.append(vertex_id)
level_id = vertex_hash[vertex_id][1] + 1
if (level_id <= K_out):
for hyperedge_id in vertices_list[vertex_id]:
hyperedge = hyperedges_list[hyperedge_id]
# This hyperedge is driven by current edge
if (hyperedge[0] == vertex_id):
for i in range(1, len(hyperedge)):
if hyperedge[i] in visited:
pass
else:
if (vertex_hash[hyperedge[i]][1] > level_id):
vertex_hash[hyperedge[i]] = [seed_id, level_id]
wavefront.append(hyperedge[i])
elif (vertex_hash[hyperedge[i]][1] == level_id and vertex_hash[hyperedge[i]][1] > seed_id):
vertex_hash[hyperedge[i]] = [seed_id, level_id]
wavefront.append(hyperedge[i])
####################################################################################
#### TraverseFanin in BFS manner
####################################################################################
def TraverseFanin(vertices_list, hyperedges_list, vertex_hash, seed_id, root_id, K_in):
# update the root vertex
vertex_hash[root_id] = [seed_id, 0]
visited = []
wavefront = []
wavefront.append(root_id)
while (len(wavefront) > 0):
vertex_id = wavefront.pop(0)
visited.append(vertex_id)
level_id = vertex_hash[vertex_id][1] + 1
if (level_id <= K_in):
for hyperedge_id in vertices_list[vertex_id]:
hyperedge = hyperedges_list[hyperedge_id]
# This hyperedge is not driven by vertex_id
if (hyperedge[0] != vertex_id):
driver_id = hyperedge[0]
if driver_id in visited:
pass
else:
if (vertex_hash[driver_id][1] > level_id):
vertex_hash[driver_id] = [seed_id, level_id]
wavefront.append(driver_id)
elif (vertex_hash[driver_id][1] == level_id and vertex_hash[driver_id][1] > seed_id):
vertex_hash[driver_id] = [seed_id, level_id]
wavefront.append(driver_id)
def Grouping(design, n_rows, n_cols, K_in, K_out, setup_file, global_net_threshold, src_dir):
pwd = os.getcwd()
# Specify the location of hmetis exe and openroad exe
openroad_exe = src_dir + "/utils/openroad"
extract_hypergraph_file = src_dir + "/utils/extract_hypergraph.tcl"
# Generate Hypergraph file
rpt_dir = pwd + "/rtl_mp"
hypergraph_file = rpt_dir + "/" + design + ".hgr"
io_name_file = hypergraph_file + ".io"
instance_name_file = hypergraph_file + ".instance"
outline_file = hypergraph_file + ".outline"
fix_file = pwd + "/" + design + ".fix"
original_fix_file = pwd + "/" + design + ".fix.old"
GenerateHypergraph(openroad_exe, setup_file, extract_hypergraph_file)
# read hypergraph
# Each vertex corresponds to the hyperedge_id incident to it
# Each hyperedge corresponds to the vertices in it
with open (hypergraph_file) as f:
content = f.read().splitlines()
f.close()
items = content[0].split()
num_hyperedges = int(items[0])
num_vertices = int(items[1])
vertices_list = [[] for i in range(num_vertices)]
hyperedges_list = []
hyperedge_id = 0
for i in range(num_hyperedges):
items = content[i+1].split()
# ignore all the global nets
if (len(items) > global_net_threshold):
pass
hyperedge = [int(item) - 1 for item in items]
hyperedges_list.append(hyperedge)
for vertex in hyperedge:
vertices_list[vertex].append(hyperedge_id)
hyperedge_id += 1
# sort all the macros and IOs based on lexicographically smallest macro name
# get all the IOs and macros as seeds
seed_list = []
vertex_map = { }
vertex_name_list = []
# read all the IOs
io_pos_map = { }
with open(io_name_file) as f:
content = f.read().splitlines()
f.close()
vertex_id = 0
for line in content:
items = line.split()
io_name = items[0]
x = (float(items[1]) + float(items[3])) / 2.0
y = (float(items[2]) + float(items[4])) / 2.0
io_pos_map[io_name] = (x, y)
seed_list.append(io_name)
vertex_map[io_name] = vertex_id
vertex_name_list.append(io_name)
vertex_id += 1
# read all the instances (including macros)
with open(instance_name_file) as f:
content = f.read().splitlines()
f.close()
for line in content:
items = line.split()
inst_name = items[0]
vertex_map[inst_name] = vertex_id
vertex_name_list.append(inst_name)
vertex_id += 1
if (int(items[1]) == 1):
seed_list.append(inst_name)
# sort the seed
seed_list.sort()
# grouping all the directly K_in fanins and K_out fanouts respect to
# ios and instances.
vertex_hash = [[len(seed_list), max(K_in, K_out) + 1] for i in range(len(vertex_map))]
for i in range(len(seed_list)):
TraverseFanout(vertices_list, hyperedges_list, vertex_hash, i, vertex_map[seed_list[i]], K_out)
TraverseFanin(vertices_list, hyperedges_list, vertex_hash, i, vertex_map[seed_list[i]], K_in)
# group IOs to bundled pins based on their position
with open(outline_file) as f:
content = f.read().splitlines()
f.close()
items = content[0].split()
floorplan_lx = float(items[0])
floorplan_ly = float(items[1])
floorplan_ux = float(items[2])
floorplan_uy = float(items[3])
# get the vertical distance and horizontal distance
width = (floorplan_ux - floorplan_lx) / n_cols
height = (floorplan_uy - floorplan_ly) / n_rows
initial_group_map = { }
grid_row_max = 100000000
for io_name, pos in io_pos_map.items():
hash_id = floor( pos[1] / height) * grid_row_max + floor( pos[0] / width)
if hash_id not in initial_group_map:
initial_group_map[hash_id] = [io_name]
else:
initial_group_map[hash_id].append(io_name)
# final group list
group_list = [ ]
for hash_id, ios in initial_group_map.items():
group_list.append(ios)
for seed in seed_list:
if seed not in io_pos_map:
group_list.append([seed])
group_id_map = { }
for i in range(len(group_list)):
for vertex in group_list[i]:
group_id_map[vertex] = i
for i in range(len(vertex_hash)):
seed_id = vertex_hash[i][0]
if (seed_id < len(seed_list)):
vertex_name = vertex_name_list[i]
seed_name = seed_list[seed_id]
if vertex_name not in group_list[group_id_map[seed_name]]:
group_list[group_id_map[seed_name]].append(vertex_name)
f = open(original_fix_file, "w")
for group in group_list:
line = ""
for vertex in group:
line += vertex + ","
line = line[0:-1]
f.write(line + '\n')
f.close()
f = open(fix_file, "w")
for group in group_list:
line = ""
for vertex in group:
if vertex not in seed_list:
line += vertex + ","
if (len(line) > 0):
line = line[0:-1]
f.write(line + '\n')
f.close()
shutil.rmtree(rpt_dir)
import os
import argparse
import time
import shutil
import sys
from math import floor
sys.path.append('./utils')
####################################################################################
#### Extract hypergraph, instance, IO ports and outline from netlist
####################################################################################
def GenerateHypergraph(openroad_exe, setup_file, extract_hypergraph_file):
temp_file = os.getcwd() + "/extract_hypergraph.tcl"
cmd = "cp " + setup_file + " " + temp_file
os.system(cmd)
with open(extract_hypergraph_file) as f:
content = f.read().splitlines()
f.close()
f = open(temp_file, "a")
f.write("\n")
for line in content:
f.write(line + "\n")
f.close()
cmd = openroad_exe + " " + temp_file
os.system(cmd)
cmd = "rm " + temp_file
os.system(cmd)
####################################################################################
#### TraverseFanout in BFS manner
####################################################################################
def TraverseFanout(vertices_list, hyperedges_list, vertex_hash, seed_id, root_id, K_out):
# update the root vertex
vertex_hash[root_id] = [seed_id, 0]
visited = []
wavefront = []
wavefront.append(root_id)
while (len(wavefront) > 0):
vertex_id = wavefront.pop(0)
visited.append(vertex_id)
level_id = vertex_hash[vertex_id][1] + 1
if (level_id <= K_out):
for hyperedge_id in vertices_list[vertex_id]:
hyperedge = hyperedges_list[hyperedge_id]
# This hyperedge is driven by current edge
if (hyperedge[0] == vertex_id):
for i in range(1, len(hyperedge)):
if hyperedge[i] in visited:
pass
else:
if (vertex_hash[hyperedge[i]][1] > level_id):
vertex_hash[hyperedge[i]] = [seed_id, level_id]
wavefront.append(hyperedge[i])
elif (vertex_hash[hyperedge[i]][1] == level_id and vertex_hash[hyperedge[i]][1] > seed_id):
vertex_hash[hyperedge[i]] = [seed_id, level_id]
wavefront.append(hyperedge[i])
####################################################################################
#### TraverseFanin in BFS manner
####################################################################################
def TraverseFanin(vertices_list, hyperedges_list, vertex_hash, seed_id, root_id, K_in):
# update the root vertex
vertex_hash[root_id] = [seed_id, 0]
visited = []
wavefront = []
wavefront.append(root_id)
while (len(wavefront) > 0):
vertex_id = wavefront.pop(0)
visited.append(vertex_id)
level_id = vertex_hash[vertex_id][1] + 1
if (level_id <= K_in):
for hyperedge_id in vertices_list[vertex_id]:
hyperedge = hyperedges_list[hyperedge_id]
# This hyperedge is not driven by vertex_id
if (hyperedge[0] != vertex_id):
driver_id = hyperedge[0]
if driver_id in visited:
pass
else:
if (vertex_hash[driver_id][1] > level_id):
vertex_hash[driver_id] = [seed_id, level_id]
wavefront.append(driver_id)
elif (vertex_hash[driver_id][1] == level_id and vertex_hash[driver_id][1] > seed_id):
vertex_hash[driver_id] = [seed_id, level_id]
wavefront.append(driver_id)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--design", help = "design name", type = str, default = "ariane")
parser.add_argument("--n_rows", help = "number of rows", type = int, default = "128")
parser.add_argument("--n_cols", help = "number of cols", type = int, default = "128")
parser.add_argument("--K_in", help = "K_in", type = int, default = "1")
parser.add_argument("--K_out", help = "K_out", type = int, default = "1")
parser.add_argument("--setup_file", help = "setup file for openroad (default = setup.tcl)", type = str, default = "setup.tcl")
parser.add_argument("--global_net_threshold", help = "global net threshold", type = int, default = 100)
args = parser.parse_args()
design = args.design
n_rows = args.n_rows
n_cols = args.n_cols
instance_list = []
K_in = args.K_in
K_out = args.K_out
setup_file = args.setup_file
global_net_threshold = args.global_net_threshold
pwd = os.getcwd()
# Specify the location of hmetis exe and openroad exe
openroad_exe = pwd + "/utils/openroad"
extract_hypergraph_file = pwd + "/utils/extract_hypergraph.tcl"
# Generate Hypergraph file
rpt_dir = pwd + "/rtl_mp"
hypergraph_file = rpt_dir + "/" + design + ".hgr"
io_name_file = hypergraph_file + ".io"
instance_name_file = hypergraph_file + ".instance"
outline_file = hypergraph_file + ".outline"
fix_file = pwd + "/" + design + ".fix"
original_fix_file = pwd + "/" + design + ".fix.old"
#GenerateHypergraph(openroad_exe, setup_file, extract_hypergraph_file)
# read hypergraph
# Each vertex corresponds to the hyperedge_id incident to it
# Each hyperedge corresponds to the vertices in it
with open (hypergraph_file) as f:
content = f.read().splitlines()
f.close()
items = content[0].split()
num_hyperedges = int(items[0])
num_vertices = int(items[1])
vertices_list = [[] for i in range(num_vertices)]
hyperedges_list = []
hyperedge_id = 0
for i in range(num_hyperedges):
items = content[i+1].split()
# ignore all the global nets
if (len(items) > global_net_threshold):
pass
hyperedge = [int(item) - 1 for item in items]
hyperedges_list.append(hyperedge)
for vertex in hyperedge:
vertices_list[vertex].append(hyperedge_id)
hyperedge_id += 1
# sort all the macros and IOs based on lexicographically smallest macro name
# get all the IOs and macros as seeds
seed_list = []
vertex_map = { }
vertex_name_list = []
# read all the IOs
io_pos_map = { }
with open(io_name_file) as f:
content = f.read().splitlines()
f.close()
vertex_id = 0
for line in content:
items = line.split()
io_name = items[0]
x = (float(items[1]) + float(items[3])) / 2.0
y = (float(items[2]) + float(items[4])) / 2.0
io_pos_map[io_name] = (x, y)
seed_list.append(io_name)
vertex_map[io_name] = vertex_id
vertex_name_list.append(io_name)
vertex_id += 1
# read all the instances (including macros)
with open(instance_name_file) as f:
content = f.read().splitlines()
f.close()
for line in content:
items = line.split()
inst_name = items[0]
vertex_map[inst_name] = vertex_id
vertex_name_list.append(inst_name)
vertex_id += 1
if (int(items[1]) == 1):
seed_list.append(inst_name)
# sort the seed
seed_list.sort()
# grouping all the directly K_in fanins and K_out fanouts respect to
# ios and instances.
vertex_hash = [[len(seed_list), max(K_in, K_out) + 1] for i in range(len(vertex_map))]
for i in range(len(seed_list)):
TraverseFanout(vertices_list, hyperedges_list, vertex_hash, i, vertex_map[seed_list[i]], K_out)
TraverseFanin(vertices_list, hyperedges_list, vertex_hash, i, vertex_map[seed_list[i]], K_in)
# group IOs to bundled pins based on their position
with open(outline_file) as f:
content = f.read().splitlines()
f.close()
items = content[0].split()
floorplan_lx = float(items[0])
floorplan_ly = float(items[1])
floorplan_ux = float(items[2])
floorplan_uy = float(items[3])
# get the vertical distance and horizontal distance
width = (floorplan_ux - floorplan_lx) / n_cols
height = (floorplan_uy - floorplan_ly) / n_rows
initial_group_map = { }
grid_row_max = 100000000
for io_name, pos in io_pos_map.items():
hash_id = floor( pos[1] / height) * grid_row_max + floor( pos[0] / width)
if hash_id not in initial_group_map:
initial_group_map[hash_id] = [io_name]
else:
initial_group_map[hash_id].append(io_name)
# final group list
group_list = [ ]
for hash_id, ios in initial_group_map.items():
group_list.append(ios)
for seed in seed_list:
if seed not in io_pos_map:
group_list.append([seed])
group_id_map = { }
for i in range(len(group_list)):
for vertex in group_list[i]:
group_id_map[vertex] = i
for i in range(len(vertex_hash)):
seed_id = vertex_hash[i][0]
if (seed_id < len(seed_list)):
vertex_name = vertex_name_list[i]
seed_name = seed_list[seed_id]
if vertex_name not in group_list[group_id_map[seed_name]]:
group_list[group_id_map[seed_name]].append(vertex_name)
f = open(original_fix_file, "w")
for group in group_list:
line = ""
for vertex in group:
line += vertex + ","
line = line[0:-1]
f.write(line + '\n')
f.close()
f = open(fix_file, "w")
for group in group_list:
line = ""
for vertex in group:
if vertex not in seed_list:
line += vertex + ","
if (len(line) > 0):
line = line[0:-1]
f.write(line + '\n')
f.close()
shutil.rmtree(rpt_dir)
#######################################################################
### Author: Zhiang, May, 2022
### Uses OpenROAD API to convert the netlist to a hypergraph (in hemtis format)
### This file cannot be used directly. It will be called by
### generate_cluster.py
### All the parameters set here are meaningless.
### !!! Please don't touch this file !!!
########################################################################
read_verilog $netlist
link_design $top_design
read_sdc $sdc
read_def $def_file -floorplan_initialize
#Generate the hypergraph
partition_design -max_num_inst 2000000 -min_num_inst 40000 \
-max_num_macro 12 -min_num_macro 4 \
-net_threshold 20 -virtual_weight 50 \
-num_hop 0 -timing_weight 1000 \
-report_file ${top_design}.hgr
exit
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.
import os
import sys
import argparse
# Load the src files
sys.path.append('../src')
from grouping import Grouping
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("--design", help = "design name", type = str, default = "ariane")
parser.add_argument("--n_rows", help = "number of rows", type = int, default = "128")
parser.add_argument("--n_cols", help = "number of cols", type = int, default = "128")
parser.add_argument("--K_in", help = "K_in", type = int, default = "1")
parser.add_argument("--K_out", help = "K_out", type = int, default = "1")
parser.add_argument("--setup_file", help = "setup file for openroad (default = setup.tcl)", type = str, default = "setup.tcl")
parser.add_argument("--global_net_threshold", help = "global net threshold", type = int, default = 100)
args = parser.parse_args()
design = args.design
n_rows = args.n_rows
n_cols = args.n_cols
K_in = args.K_in
K_out = args.K_out
setup_file = args.setup_file
global_net_threshold = args.global_net_threshold
# To use the grouping function, you need to specify the directory of src file
src_dir = "../src"
Grouping(design, n_rows, n_cols, K_in, K_out, setup_file, global_net_threshold, src_dir)
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