Hi Mattew,
I'll try explain You better.
This is my scrpt
I need that on layer 999.1 will be present the NOT of layer 997 only on cell MPW_SL
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#######
# Load file.gds
array set peekdata [layout peek file1.gds.gz -type -topcell -layers -units]
puts "TOPCELL: $peekdata(topcell)"
set format [string toupper $peekdata(type)]
puts $format
set Lone [layout create file1.gds.gz -dt_expand -preservePaths -preserveProperties -preserveTextAttributes]
set precision [expr int (1/([$Lone units]))]
$Lone units microns $precision
foreach mych [$Lone children $peekdata(topcell)] {
puts "STRUCT: $mych \n"
foreach pp [$Lone children $mych] {
puts "$pp \n"
}
}
puts $peekdata(layers)
set mychx1 [exec echo $peekdata(topcell) | sed {s/_TOP/ /g} | awk {{print $1}}]
puts $mychx1
set mychx2 [exec echo ${mychx1}_SL]
puts $mychx2
set bboxlo [$Lone bbox $peekdata(topcell)]
puts $bboxlo
puts $peekdata(units)
################### rename cells on hierarchy #######################
set suff [clock seconds]
set norename ""
foreach mytops [$Lone topcell all] {
set norename "$norename $mytops "
foreach mychild [$Lone children $mytops] {
set norename "$norename $mychild "
}
}
foreach mycell [$Lone cells] {
if { [string first $mycell $norename] == -1} {
set newcell "${mycell}_${suff}"
puts "Renaming $mycell to $newcell"
$Lone cellname $mycell $newcell
} else {
puts "Cell name $mycell unchanged"
}
}
$Lone create layer 997
$Lone create layer 999.1
$Lone create polygon $mychx2 997 [lindex [$Lone bbox $peekdata(topcell)] 0] [lindex [$Lone bbox $peekdata(topcell)] 1] [lindex [$Lone bbox $peekdata(topcell)] 2] [lindex [$Lone bbox $peekdata(topcell)] 3]
################# create temporary gds file starting from both cells ###########################################
if { $format == "GDS" } {
$Lone gdsout $mychx1.gds.gz $mychx1
set Lonet1 [layout create $mychx1.gds.gz -dt_expand -preservePaths -preserveProperties -preserveTextAttributes]
$Lone gdsout $mychx2.gds.gz $mychx2
set Lonet2 [layout create $mychx2.gds.gz -dt_expand -preservePaths -preserveProperties -preserveTextAttributes]
# $Lone gdsout file1.gds.gz
} else {
# $Lone oasisout file1.oas -cBlocks -strictMode
}
# set mychx1 [lindex [$Lone children $peekdata(topcell)] 0]
# set mychx2 [lindex [$Lone children $peekdata(topcell)] 1]
##########################
array set peekdata2 [layout peek file2.gds.gz -type -topcell -layers -units]
puts "TOPCELL: $peekdata2(topcell)"
set format2 [string toupper $peekdata2(type)]
puts $format2
set Ltwo [layout create file2.gds.gz -dt_expand -preservePaths -preserveProperties -preserveTextAttributes]
set precision2 [expr int (1/([$Ltwo units]))]
$Ltwo units microns $precision2
foreach mych2 [$Ltwo children $peekdata2(topcell)] {
puts "STRUCT: $mych2 \n"
foreach pp2 [$Ltwo children $mych2] {
puts "$pp2 \n"
}
}
puts $peekdata2(layers)
set mychy1 [exec echo $peekdata2(topcell) | sed {s/_TOP/ /g} | awk {{print $1}}]
puts $mychy1
set mychy2 [exec echo ${mychy1}_SL]
puts $mychy2
set bboxlo2 [$Ltwo bbox $peekdata2(topcell)]
puts $bboxlo2
puts $peekdata2(units)
################### rename cells on hierarchy #######################
set suff2 [clock seconds]
set norename2 ""
foreach mytops2 [$Ltwo topcell all] {
set norename2 "$norename2 $mytops2 "
foreach mychild2 [$Ltwo children $mytops2] {
set norename2 "$norename2 $mychild2 "
}
}
foreach mycell2 [$Ltwo cells] {
if { [string first $mycell2 $norename2] == -1} {
set newcell2 "${mycell2}_${suff2}"
puts "Renaming $mycell2 to $newcell2"
$Ltwo cellname $mycell2 $newcell2
} else {
puts "Cell name $mycell2 unchanged"
}
}
$Ltwo create layer 997
$Ltwo create layer 999.1
$Ltwo create polygon $mychy2 997 [lindex [$Ltwo bbox $peekdata2(topcell)] 0] [lindex [$Ltwo bbox $peekdata2(topcell)] 1] [lindex [$Ltwo bbox $peekdata2(topcell)] 2] [lindex [$Ltwo bbox $peekdata2(topcell)] 3]
################# create temporary gds file from bosth cells ###########################################
if { $format2 == "GDS" } {
$Ltwo gdsout $mychy1.gds.gz $mychy1
set Ltwot1 [layout create $mychy1.gds.gz -dt_expand -preservePaths -preserveProperties -preserveTextAttributes]
$Ltwo gdsout $mychy2.gds.gz $mychy2
set Ltwot2 [layout create $mychy2.gds.gz -dt_expand -preservePaths -preserveProperties -preserveTextAttributes]
# $Ltwo gdsout file2.gds.gz
} else {
# $Ltwo oasisout file3.oas -cBlocks -strictMode
}
##############################
array set peekdata3 [layout peek file3.gds.gz -type -topcell -layers -units]
puts "TOPCELL: $peekdata3(topcell)"
set format3 [string toupper $peekdata3(type)]
puts $format3
set Lthree [layout create file3.gds.gz -dt_expand -preservePaths -preserveProperties -preserveTextAttributes]
set precision3 [expr int (1/([$Lthree units]))]
$Lthree units microns $precision3
foreach mych3 [$Lthree children $peekdata3(topcell)] {
puts "STRUCT: $mych3 \n"
foreach pp3 [$Lthree children $mych3] {
puts "$pp3 \n"
}
}
puts $peekdata3(layers)
set mychz1 [exec echo $peekdata3(topcell) | sed {s/_TOP/ /g} | awk {{print $1}}]
puts $mychz1
set mychz2 [exec echo ${mychz1}_SL]
puts $mychz2
set bboxlo3 [$Lthree bbox $peekdata3(topcell)]
puts $bboxlo3
puts $peekdata3(units)
################### rename cells on hierarchy #######################
set suff3 [clock seconds]
set norename3 ""
foreach mytops3 [$Lthree topcell all] {
set norename3 "$norename3 $mytops3 "
foreach mychild3 [$Lthree children $mytops3] {
set norename3 "$norename3 $mychild3 "
}
}
foreach mycell3 [$Lthree cells] {
if { [string first $mycell3 $norename3] == -1} {
set newcell3 "${mycell3}_${suff3}"
puts "Renaming $mycell3 to $newcell3"
$Lthree cellname $mycell3 $newcell3
} else {
puts "Cell name $mycell3 unchanged"
}
}
$Lthree create layer 997
$Lthree create layer 999.1
$Lthree create polygon $mychz2 997 [lindex [$Lthree bbox $peekdata3(topcell)] 0] [lindex [$Lthree bbox $peekdata3(topcell)] 1] [lindex [$Lthree bbox $peekdata3(topcell)] 2] [lindex [$Lthree bbox $peekdata3(topcell)] 3]
################# create temporary cells for both cells ###########################################
if { $format3 == "GDS" } {
$Lthree gdsout $mychz1.gds.gz $mychz1
set Lthreet1 [layout create $mychz1.gds.gz -dt_expand -preservePaths -preserveProperties -preserveTextAttributes]
$Lthree gdsout $mychz2.gds.gz $mychz2
set Lthreet2 [layout create $mychz2.gds.gz -dt_expand -preservePaths -preserveProperties -preserveTextAttributes]
# $Ltwo gdsout file3.gds.gz
} else {
# $Ltwo oasisout file3.oas -cBlocks -strictMode
}
###########################################################################################################
# Create empty cell
set Lnew [layout create]
# Create new topcell and children cells for new layout
$Lnew create cell MPW_TOP
$Lnew create cell MPW
$Lnew create cell MPW_SL
$Lnew create ref MPW_TOP MPW 0 0 0 0 1
$Lnew create ref MPW_TOP MPW_SL 0 0 0 0 1
# Copy patterns on new layout
$Lnew import layout $Lonet1 TRUE overwrite
$Lnew import layout $Lonet2 TRUE overwrite
$Lnew import layout $Ltwot1 TRUE overwrite
$Lnew import layout $Ltwot2 TRUE overwrite
$Lnew import layout $Lthreet1 TRUE overwrite
$Lnew import layout $Lthreet2 TRUE overwrite
$Lnew create ref MPW "${mychx1}" -4546500 -3282500 0 0 1
$Lnew create ref MPW_SL "${mychx2}" -4546500 -3282500 0 0 1
$Lnew create ref MPW "${mychx1}" -4546500 -4882500 0 0 1
$Lnew create ref MPW_SL "${mychx2}" -4546500 -4882500 0 0 1
$Lnew create ref MPW "${mychy1}" 0 3743500 0 0 1
$Lnew create ref MPW_SL "${mychy2}" 0 3743500 0 0 1
$Lnew create ref MPW "${mychz1}" 4358500 -3366500 0 0 1
$Lnew create ref MPW_SL "${mychz2}" 4358500 -3366500 0 0 1
$Lnew create layer 998.1
$Lnew create layer 998.2
$Lnew create polygon MPW 998.1 [lindex -6567500] [lindex -8367500] [lindex 6567500] [lindex 8367500]
$Lnew create polygon MPW_SL 998.2 [lindex -6567500] [lindex -8367500] [lindex 6567500] [lindex 8367500]
$Lnew NOT 998.2 997 999.1
# Create final oasis file
$Lnew oasisout MPW_MULTI.oas
array set peekdatao [layout peek MPW_MULTI.oas -type -precision -topcell -topcells -layers]
puts $peekdatao(layers)
exec rm $mychx1.gds.gz $mychx2.gds.gz $mychy1.gds.gz $mychy2.gds.gz $mychz1.gds.gz $mychz2.gds.gz