我正在「拾陆楼」和朋友们讨论有趣的话题,你⼀起来吧?
拾陆楼知识星球入口
#!usr/bin/perl
open rf,"$ARGV[0]";
open wf,">test. tcl";
while (<rf>) {
s/\[(\D[^\s\]]*)?\]/\\\[$1\\\]/g;
if (/current _ instances$/) {
$curinst = "";
$hinst = "";
$orient_mark=0;
next
}
if (/current_instance\s+{(\S+)}/) {
$curinst = "$1";
$curinst =~s/^{//g;
$curinst =~s/}$//g;
$hinst ="-hinstGuide ${curinst}
$curinst ="${curinst}\/";
next
}
if (/insert _ buffer\s+\[get_ pins\s+\{(.*)\}\]\s+(\S+)\s+-new_net_names\s+\{(\S+)\}\s+-new_cell_names\s+\{(\S+)\}\s+-location\s+\{(.*)\}\s+-orientation\s+(\S+)/ ) {
$term_name = "${curinst}$1";
$cell_name = $2;
$net_name = $3;
$name = $4;
$location = $5;
$ori2 = $6;
if ($ori2 eq "N") {$ori = "R0"}
if ($ori2 eq"FS") {$ori = "MX"}
if ($ori2 eq "S") {$ori = "R180"}
if ($ori2 eq"FN") {$ori = "MY"}
print wf "set result [ecoAddRepeater -term $term_name -cell $cell_name -newNetName $net_name -name $name -loc {$location} -bufOrient $ori $hinst]\n";
next
}
if (/add buffer_on_route\s+\[get _ net -of (.*)\]\s+-user_specified_buffers\s+\{\s*(.*)\s*\}\s+.*/) {
$pin = $1;
$ll = $2;
$i = 0;
$inst_list = "";
$cell_list = "";
$pt = "";
$j = 0;
$pin =~ s/^{//g;
$pin =~ s/}$//g;
foreach (split(/\s+/,$ll)) {
$i+=1;
if ($i==1) {
$inst_list="$inst_list $_";
} elsif ($i==2) {
$cell_list="$cell_list $_";
} elsif ($i==3) {
$pt="$pt $_";
} elsif ($i==4) {
$pt="$pt $_";
} elsif ($i==5) {
$i=0;
}
$orient_mark=1;
}
@cell_list = split(/\s+/,$cell _ list);
if ( @cell_list > 1) {
print wf "set result [ecoAddRepeater -net [get_object_name [get_net -of ${curinst}$pin]] -cell \"$cell _ list\" -loc \"$pt\" -name \"$inst _ list\"]\n";
} else {
print wf "set result [ecoAddRepeater -net [get_object_name [get_net -of ${curinst}$pin]] -cell \"$cell_ list\" -loc \"$pt\" -name \"$inst_list\" $hinst]\n";
}
} elsif (/set_cell_location -coordinates\s+{(.*)}\s+-orientation\s+(\S+)\s+\[get_cells\s+{(.*)}/) {
$ori2= $2;
$loc2 = $1;
$c2 = $3;
if ($ori2 eq"N") {$ori = "R0"}
if ($ori2 eq"FS") {$ori = "MX"}
if ($ori2 eq "S") {$ori = "R180"}
if ($ori2 eq"FN") {$ori = "MY"}
@cell_list = split(/\s+/,$cell_list);
if ($orient_mark && @cell_list > 1) {
print wf "dbSet [dbGet -p top.inst.name [lindex \$result $j ]].orient $ori\n";
print wf "dbSet [dbGet -p top.inst.name [lindex \$result $j ]]. pt \"$loc2\"\n";
} else {
print wf "dbSet [dbGet -p top.inst.name ${curinst}$c2]. orient $ori\n";
print wf "dbSet [dbGet -p top.inst.name ${curinst}$c2]. pt \"$loc2\"\n";
}
$j+=3;
} elsif (/size_cell\s{(\S+)}\s+{(\S+)}$/) {
print wf "ecoChangeCell -inst ${curinst}$1 -cell $2\n";
$orient_mark=0;
} else {
$j=0;
print wf $_;
}
close rf;
close wf