Commit 4d6f493f by sakundu

Added macro shuffeling script.

Signed-off-by: sakundu <sakundu@ucsd.edu>
parent b71fa571
......@@ -21,6 +21,7 @@
- [genJobList.py](./genJobList.py): It create a run directory to run Flow-1 and Flow-2 for each design on all platforms and writes out the job file. You can use this job file to submit a GNU Parallel job.
- **Example**: python ./util/genJobList.py (ensure you are in the [Flows](../) directory.)
- [plc_pb_to_placement_tcl.py](./plc_pb_to_placement_tcl.py): It writes out the *.plc file from the clustreed-protobuf netlist.
- [shuffle_macro.tcl](./shuffle_macro.tcl): It shuffle same type (having same reference name.) macros. First source this tcl file and then use shuffle_macros command to shuffle the macro location. This script randomly shuffle macros. If macro A moves to position of macro B then the orientation of macro A will be the initial orientation of macro B.
- Shell Scripts:
- [run_CodeFlow.sh](./run_CodeFlow.sh): This runs the [flow.py](./flow.py) in the run directory to generate clustred netlist.
- **Example**: In the run directory just use *./run_CodeFlow.sh* command to generate the clustred netlist while using Flow-4. Make sure *PHY_SYNTH* is set to 1 or some greater value.
......
......@@ -4,11 +4,18 @@ This script generates OpenDB database from LEF/DEF
import odb
import sys
import os
import re
design = sys.argv[1]
def_file = sys.argv[2]
output_dir = sys.argv[3]
work_dir = re.search(r'(/\S+/MacroPlacement)', os.getcwd()).group(1)
sys.path.append(f'{work_dir}/Flows/util')
from convert_odb2bookshelf import OdbToBookshelf
lef_dir = '../../../../../Enablements/NanGate45/lef'
lef_list = [f'{lef_dir}/NangateOpenCellLibrary.tech.lef',
f'{lef_dir}/NangateOpenCellLibrary.macro.mod.lef',
......@@ -45,4 +52,13 @@ if new_db is None:
if odb.db_diff(db, new_db):
exit("ERROR: Difference found in exported and imported DB")
print(f"Successfully generated ODB format from LEF/DEF for {design}")
\ No newline at end of file
print(f"Successfully generated ODB format from LEF/DEF for {design}")
bs = OdbToBookshelf(
opendbpy=odb,
opendb=db,
cellPadding=0,
modeFormat="ISPD11",
layerCapacity='layeradjust_empty.tcl')
bs.WriteBookshelf(f'{design}_pad0_ISPD11')
/home/mgwoo/95_openroad/rosettaStone/github/RosettaStone/odbComm/namemap.py
\ No newline at end of file
......@@ -94,8 +94,8 @@ for line in lines:
if id_pattern.match(words[0]) and (len(words) == 5):
idx = int(words[0])
if node_list[idx].pb_type == '"MACRO"':
x = words[1]
y = words[2]
x = float(words[1]) - float(node_list[idx].width)/2.0
y = float(words[2]) - float(node_list[idx].height)/2.0
orient = orientMap[words[3]]
isFixed = words[4]
macro_name = node_list[idx].name.replace('_[', '\[')
......
proc shuffle1 {list} {
set n [llength $list]
for {set i 0} {$i < $n} {incr i} {
set j [expr {int(rand() * $n)}]
set temp [lindex $list $j]
set list [lreplace $list $j $j [lindex $list $i]]
set list [lreplace $list $i $i $temp]
}
return $list
}
proc shuffle_macros {} {
foreach macro_ref [dbget [dbget top.insts.cell.subClass block -p ].name -u] {
set macro_list [dbget [dbget top.insts.cell.name $macro_ref -p2 ].name]
set pt_x_list [dbget [dbget top.insts.cell.name $macro_ref -p2 ].pt_x]
set pt_y_list [dbget [dbget top.insts.cell.name $macro_ref -p2 ].pt_y]
set orient_list [dbget [dbget top.insts.cell.name $macro_ref -p2 ].orient]
set number_macros [llength $macro_list]
set shuffle_macros [shuffle1 $macro_list]
## Unplace all macros ##
dbset [dbget top.insts.cell.name $macro_ref -p2 ].pStatus unplaced
set i 0
set k 0
foreach macro $shuffle_macros {
set pt_x [lindex $pt_x_list $i]
set pt_y [lindex $pt_y_list $i]
set orient [lindex $orient_list $i]
placeInstance $macro $pt_x $pt_y $orient -fixed
incr i
if {[lindex $macro_list $i] != $macro} {
incr k
}
}
puts "$k macros (ref name: ${macro_ref}) are shuffled"
}
}
\ No newline at end of file
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