| |||
##usage command: calibredrv ./flatten_gds_partial.tcl topcell_name
## this command will flatten the given gds, except the cells define in GOLDEN_CELL
## topcell.swap.gds should be found in the same folder,
#or change the layout_IN to gds file. Output flatten GDS top cell cel name will be topCellName_flatten
#created by twoz
##user define begin#######
##first argument in the command arguments.
set TOPCELL [lindex $argv 0]
#define input GDS.
set LAYOUT_IN ${TOPCELL}.gds
#define output GDS after flatten.
set LAYOUT_OUT ${TOPCELL}.flatten.gds
#define golden cell list that not be flattened.
set GOLDEN_CEL {Gold_cell1 Gold_cell2}
##end of user define#############
set L1 [layout create $LAYOUT_IN -dt_expand]
set TOPCELL1 [$L1 topcell]
set cellList [$L1 cells]
#flatten each cell, except golden cell.
foreach cell $cellList {if { [lsearch $GOLDEN_CEL $cell0] != -1 }
{puts "skip golden cell.\n"}
else
{$L1 expand cell $cell}
#end if
}
#end foreach
# change the top cell name.
$L1 cellname $TOPCELL1 ${TOPCELL1}_flatten
# write the flatten GDS
$L1 gdsout $LAYOUT_OUT ${TOPCELL1}_flatten