====== RP scripts ====== ===== 根据相同的master创建RP ===== proc create_macro_rp {} { set all_macros [get_cells -hierarchical -filter "mask_layout_type==macro"] set all_ref_names [] foreach_in_collection m $all_macros { set ref_name [get_attribute $m ref_name] if { [lsearch $all_ref_names $ref_name] == -1 } { lappend all_ref_names $ref_name } } echo $all_ref_names foreach ref_name $all_ref_names { set macros [get_cells -hierarchical -filter "ref_name==$ref_name"] set count [sizeof_collection $macros] set rp_name $ref_name set cmd "create_rp_group -columns $count -rows 1 $ref_name" echo $cmd eval $cmd for {set i 0} {$i<$count} {incr i} { set macro_name [get_attribute [index_collection $macros $i] full_name ] set cmd "add_to_rp_group -column $i -row 0 -leaf $macro_name StDp::${rp_name}" echo $cmd eval $cmd } } } ===== 读rp脚本,添加keepout ===== ==== 重写rp ==== 使原来rp的行列数翻倍。 proc macro_rp {} { set content [ read [ open "scripts/macro_rp_plain.tcl" ] ] set lines [split $content "\n"] foreach line $lines { set line [string trim $line] set row_patt "" set col_patt "" if { [string compare -length 15 $line create_rp_group] == 0 } { set row_patt {\-rows\s+(\d+)} set col_patt {\-columns\s+(\d+)} } elseif { [string compare -length 15 $line add_to_rp_group] == 0 } { set row_patt {\-row\s+(\d+)} set col_patt {\-column\s+(\d+)} } if { [string length $row_patt] >= 1 } { regexp $row_patt $line match rp_row set new_rows "-row [expr $rp_row*2]" set line [regsub -all $row_patt "$line" "$new_rows"] } if { [string length $col_patt] >= 1 } { regexp $col_patt $line match rp_col set new_col "-column [expr $rp_col*2]" set line [regsub -all $col_patt "$line" "$new_col"] } #echo $line eval $line } } ==== 添加keepout ==== 隔行/隔列添加keepout proc macro_rp_keepout {} { foreach_in_collection rp [all_rp_groups] { set rows [get_attribute $rp rows] set columns [get_attribute $rp columns] set rp_name [get_attribute $rp name] if { $rows > 2 } { for {set i 0} {$i < $rows} {incr i } { if { [expr $i % 2] == 1 } { add_to_rp_group -column 0 -row $i -keepout ${rp_name}_r_$i -height 12 $rp } } } if { $columns > 2 } { for {set i 0} {$i < $columns} {incr i } { if { [expr $i % 2] == 1 } { add_to_rp_group -column $i -row 0 -keepout ${rp_name}_c_$i -width 60 $rp } } } } }