sunhongwei的个人空间 https://blog.eetop.cn/1708597 [收藏] [复制] [分享] [RSS]

空间首页 动态 记录 日志 相册 主题 分享 留言板 个人资料

日志

ICC的 一些proc , 方便操作

热度 10已有 465 次阅读| 2023-10-9 08:26 |系统分类:芯片设计

alias zs zoom_selected


proc cref {} {


get_attribute [get_selection ] ref_name

}




proc rn {net} {

        #report_net -conn $net

        puts "\nConnections for net $net\n"

        puts "\tDriver Pins\t\t\t\tType"

        puts "\t-----------\t\t\t\t--------"

        set n [get_nets $net]

        foreach_in_collection p [get_pins -leaf -of $n -filter "direction == out"] {

            puts "\t[get_attr $p full_name] \t\t\t Output Pin ([get_attr [get_cells -of $p] ref_name ])"

        }

        puts "\n\tLoad Pins\t\t\t\tType"

        puts "\t-----------\t\t\t\t--------"

        foreach_in_collection p [get_pins -leaf -of $n -filter "direction == in"] {

            puts "\t[get_attr $p full_name] \t\t\t Input pin ([get_attr [get_cells -of $p] ref_name ])"

        }

        puts "\n\n"

}



#proc rc {cell} {

#        report_cell -conn $cell

#}


proc rs {} {

    if { ([sizeof_collection [get_selection]] > 0) && ( [get_attr [get_selection] object_class ] == "cell") } {

        #report_cell -conn [get_attr [get_selection] full_name ]

        puts "[get_attr [get_selection] full_name] \t[get_attr [get_selection] ref_name]"

    } else {

        puts "No cell is selected"

    }

}


proc rc {cell} {

        set c [get_cells $cell]

        foreach_in_collection in [get_pins -of $c -filter "direction == in"] {

            puts "\t\t INPUT: [get_attr $in full_name] [get_attr [get_nets -of $in] full_name]" 

        }

        foreach_in_collection out [get_pins -of $c -filter "direction == in"] {

            puts "\t\t OUTPUT: [get_attr $out full_name] [get_attr [get_nets -of $out] full_name]" 

        }


}


proc go {x y} {

    set margin 2

    set x1 [expr $x - $margin]

    set y1 [expr $y - $margin]

    set x2 [expr $x + $margin]

    set y2 [expr $y + $margin]

    gui_zoom -rect [list [list $x1 $y1] [list $x2 $y2]] -window [gui_get_current_window -types Layout -mru]

}



proc sel_cel_from_file { infile } {

    set cells {}

    set in [open $infile r]

    while { [ gets $in line ] >= 0 } {

            if { [ regexp {\S+} $line ] } {

                    regexp {(\S+)} $line match cel

            append_to_collection cells [get_cells $cel]

            }

    }

    close $in

    change_selection $cells

}


proc sel_pin_from_file { infile } {

    set cells {}

    set in [open $infile r]

    while { [ gets $in line ] >= 0 } {

            if { [ regexp {\S+} $line ] } {

                    regexp {(\S+)} $line match cel

            append_to_collection cells [get_pins $cel]

            }

    }

    close $in

    change_selection $cells

}

proc sel_net_from_file { infile } {

    set nets {}

    set clknets {}

    set pciessb {}

    set in [open $infile r]

    while { [ gets $in line ] >= 0 } {

#            if { ![ regexp {^Net: } $line ] } {

#                    continue

#            }

        set netname [lindex $line 0]

        set flag 1

        foreach_in_collection p [get_pins -of [get_net $netname]] {

            set pn [get_attr $p full_name]

            if {[regexp tmac $pn] || [regexp mesh $pn] || [regexp mbf $pn]} {

                append_to_collection clknets [get_net $netname]

                set flag 0

                break

            }

        }

#        if {[regexp BPHY $netname]} {

#            append_to_collection pciessb [get_net $netname]

#            set flag 0

#        }

        if {$flag} {

            append_to_collection nets [get_net $netname]

        }

    }

    close $in

    change_selection $nets

    if {[ sizeof_collection $clknets] > 0 } {

        set skipclk [sizeof_collection $clknets]

        puts "## skip clk $skipclk"

    }

    zoom_selected

#    set skippcie [sizeof_collection $pciessb]

#    puts "## skip pciessb $skippcie"

}



proc list_std { } {

    array unset count

    foreach_in_collection std [get_cells -hier -filter "mask_layout_type==std"] {

        set ref [get_attr $std ref_name]

        if (![info exist count($ref)]) {

            set count($ref) 1

        } else {

            incr count($ref)

        }

    }

    foreach ref [lsort [array names count]] {

        puts [format "%20s %10d" $ref $count($ref)]

    }

}


proc list_vt { } {

    set vts [list ul ur urd uh uhd]

    foreach vt $vts {

        set count($vt) 0

    }

    foreach_in_collection std [get_cells -hier -filter "mask_layout_type==std"] {

        set ref [get_attr $std ref_name]

        regsub {.*\d} $ref {} ref;

        incr count($ref)

    }

    foreach vt $vts {

        puts "## $vt $count($vt)"

    }

}



proc rewire { p1 p2 } {

    #p1: output, p2 input

    set net1 [get_nets -quiet -of [get_pins $p1]]

    set net2 [get_nets -quiet -of [get_pins $p2]]

    if {[sizeof_collection $net1] ==0 || [sizeof_collection $net2] == 0 } {

        puts "WARN: no nets on pin $p1 or $p2"

    } else {

        disconnect_net $net2 [get_pins $p2]

        #connect_net $net1 [get_pins $p2]

        connect_pin -driver [get_pins $p1] [get_pins $p2] -port_name rewire

    }

}


proc sc { cell } {

    change_selection [get_cells $cell]

    gui_zoom -fit -selection -window [gui_get_current_window -types Layout -mru]

}


proc sp { pin } {

    change_selection [get_pins $pin]

    gui_zoom -fit -selection -window [gui_get_current_window -types Layout -mru]

}


proc spo { pin } {

    change_selection [get_ports $pin]

}

#proc s { pin } {

#    change_selection [get_nets -of [get_pins $pin]]

#    hilight_collection red [get_pins -leaf -of [get_nets -of $pin] -filter "direction == out"]

#    hilight_collection green [get_pins -leaf -of [get_nets -of $pin] -filter "direction == in"]

#    #change_selection [get_pins -leaf -of [get_nets -of $pin]]

#    gui_zoom -fit -selection -window [gui_get_current_window -types Layout -mru]

#    #change_selection [get_pins -leaf -of [get_nets -of $pin] -filter "direction == in"]

#    puts "## [sizeof_collection [get_pins -leaf -of [get_nets -of $pin] -filter "direction == in"]]"

#}



proc sn { net } {

    change_selection [get_nets $net]

    hilight_collection red [get_pins -leaf -of [get_nets $net] -filter "direction == out"]

    hilight_collection green [get_pins -leaf -of [get_nets $net] -filter "direction == in"]

    gui_zoom -fit -selection -window [gui_get_current_window -types Layout -mru]

    puts "## [sizeof_collection [get_pins -leaf -of [get_nets $net] -filter "direction == in"]]"

    #foreach_in_collection pin [get_pins -leaf -of [get_nets $net] -filter "direction == in"] {

    #    puts "[get_attr [get_pins $pin] full_name]"

    #}

}


proc hilight_collection { color collection } {

   # gui_change_highlight -remove -color $color

    gui_set_highlight_options -current_color $color

    gui_change_highlight -collection $collection

}


proc split_load_2 { net { eco_string ECO } { buf BUFFD4BWP16P90CPD }} {

   ## when loads in different hier, insert_buffer cmd will insert more than 1 buffers

   if { [string match "ECO" $eco_string] } {

        set tmp1 [ lindex [date] 1]

        set tmp2 [ lindex [date] 2]

        set eco_string ECO_${tmp1}_${tmp2} 

    }

   set win_llx [lindex [lindex [ gui_get_setting -window [gui_get_current_window -types Layout -mru] -setting designWindow ] 0] 0] 

   set win_lly [lindex [lindex [ gui_get_setting -window [gui_get_current_window -types Layout -mru] -setting designWindow ] 1] 1] 

   set win_urx [lindex [lindex [ gui_get_setting -window [gui_get_current_window -types Layout -mru] -setting designWindow ] 1] 0] 

   set win_ury [lindex [lindex [ gui_get_setting -window [gui_get_current_window -types Layout -mru] -setting designWindow ] 0] 1] 

   set pin_in_window [list ]

   foreach_in_collection pin [get_pins -leaf -of [get_nets $net] -filter "direction == in"] {

      set pin_llx [lindex [lindex [get_attribute [get_pins $pin ] bbox ] 0 ] 0 ]

      set pin_lly [lindex [lindex [get_attribute [get_pins $pin ] bbox ] 0 ] 1 ]

      if { ( $pin_llx > $win_llx ) && ($pin_llx < $win_urx ) && ($pin_lly > $win_lly ) && ($pin_lly < $win_ury ) } {

        lappend pin_in_window [get_attr $pin  full_name]

      }

   }


    set net_shape [ get_net_shapes -of [get_nets  $net ] -intersect " $win_llx $win_lly $win_urx $win_ury"]

    set net_poly [convert_to_polygon $net_shape]

    set win_poly "$win_llx $win_ury $win_urx $win_ury  $win_urx $win_lly $win_llx $win_lly $win_llx $win_ury"

    set win_poly_2 [resize_polygon -size 0.01 $win_poly]

    set win_poly_3 [compute_polygons -boolean NOT  $win_poly_2 $win_poly]

    set int_sect_poly [compute_polygons -boolean AND $win_poly_3 $net_poly]

    set x [lindex [lindex [lindex $int_sect_poly 0] 0] 0]

    set y [lindex [lindex [lindex $int_sect_poly 0] 0] 1]


    puts "set ecobufs \[insert_buffer \"$pin_in_window\"  -new_cell_names $eco_string -new_net_names $eco_string $buf\]"

    puts "move_objects \$ecobufs -to \"$x $y\""

}


proc split_load { net { eco_string ECO } { buf BUFFD4BWP16P90CPD }} {

   if { [string match "ECO" $eco_string] } {

        set tmp1 [ lindex [date] 1]

        set tmp2 [ lindex [date] 2]

        set eco_string ECO_${tmp1}_${tmp2} 

    }

   set win_llx [lindex [lindex [ gui_get_setting -window [gui_get_current_window -types Layout -mru] -setting designWindow ] 0] 0]

   set win_lly [lindex [lindex [ gui_get_setting -window [gui_get_current_window -types Layout -mru] -setting designWindow ] 1] 1]

   set win_urx [lindex [lindex [ gui_get_setting -window [gui_get_current_window -types Layout -mru] -setting designWindow ] 1] 0]

   set win_ury [lindex [lindex [ gui_get_setting -window [gui_get_current_window -types Layout -mru] -setting designWindow ] 0] 1]

   set pin_in_window [list ]

   foreach_in_collection pin [get_pins -leaf -of [get_nets $net] -filter "direction == in"] {

      set pin_llx [lindex [lindex [get_attribute [get_pins $pin ] bbox ] 0 ] 0 ]

      set pin_lly [lindex [lindex [get_attribute [get_pins $pin ] bbox ] 0 ] 1 ]

      if { ( $pin_llx > $win_llx ) && ($pin_llx < $win_urx ) && ($pin_lly > $win_lly ) && ($pin_lly < $win_ury ) } {

        lappend pin_in_window [get_attr $pin  full_name]

      }

   }


  if { [llength $pin_in_window ] == 0 } {

    puts "WARN: nothing found belongs to net $net inside current window\n"

  } else {

    set net_shape [ get_net_shapes -of [get_nets  $net ] -intersect " $win_llx $win_lly $win_urx $win_ury"]

    set net_poly [convert_to_polygon $net_shape]

    set win_poly "$win_llx $win_ury $win_urx $win_ury  $win_urx $win_lly $win_llx $win_lly $win_llx $win_ury"

    set win_poly_2 [resize_polygon -size 0.01 $win_poly]

    set win_poly_3 [compute_polygons -boolean NOT  $win_poly_2 $win_poly]

    set int_sect_poly [compute_polygons -boolean AND $win_poly_3 $net_poly]

    set x [lindex [lindex [lindex $int_sect_poly 0] 0] 0]

    set y [lindex [lindex [lindex $int_sect_poly 0] 0] 1]

    set drv_pin_name [get_attr [get_pins -of [get_nets $net] -leaf -filter "direction == out"]  full_name]

    set drv_name [get_attr [get_cells -of $drv_pin_name ] full_name]

    set drv_net_name [get_attr [get_nets $net] full_name]

    set eco_buf_name ${drv_name}_${eco_string}

    #create_cell $eco_buf_name $buf

    puts "create_cell $eco_buf_name $buf"

    #connect_pin -from [get_pins $drv_pin_name] -to [get_pins $eco_buf_name/I]

    puts "connect_pin -from \[get_pins $drv_pin_name\] -to \[get_pins $eco_buf_name/I\]"

    foreach pin $pin_in_window {

        #rewire $eco_buf_name/Z $pin

        puts "rewire $eco_buf_name/Z $pin"

    }

    puts "move_objects \[get_cells $eco_buf_name*\] -to \"$x $y\""

 }

}


proc move { x y } {

    if { [sizeof_collection [get_selection ]] < 1 }  {

        echo "WARN: Nothing is selected"

    } else {

        set_attr [get_selection] is_fixed false

        move_object -delta  [list $x $y]  [get_selection]

        echo "INFO: moved [sizeof_collection [get_selection]] objects"

    }


proc rl {} {

    if { [sizeof_collection [get_selection] ] < 1 } {

        echo "WRAN: Nothing is selected"

    } else {

        set ori [get_attr [get_selection] origin]

        set x [lindex $ori 0]

        set y [lindex $ori 1]

        set width [get_attribute [get_selection ] width ]

        set height [get_attribute [get_selection ] height ]

        set orient [get_attr [get_selection] orientation]


        if { $orient == "R0" } {

            echo "set_cell_location \[get_cells [get_attr [get_selection] full_name] \]  -coordinates \"$ori\" -orientation $orient -ignore_fixed"

        } elseif { $orient == "MY" } {

            set x_new [expr $x - $width ]

            set y_new $y

            echo "set_cell_location \[get_cells [get_attr [get_selection] full_name] \]  -coordinates  \"$x_new $y_new \" -orientation $orient -ignore_fixed"

        } elseif { $orient == "MX" } {

            set x_new  $x

            set y_new [expr $y - $height ]

            echo "set_cell_location \[get_cells [get_attr [get_selection] full_name] \]  -coordinates  \"$x_new $y_new \" -orientation $orient -ignore_fixed"


        } elseif { $orient == "R180" } { 

            set x_new [expr $x - $width ]

            set y_new [expr $y - $height ]

            echo "set_cell_location \[get_cells [get_attr [get_selection] full_name] \]  -coordinates \"$x_new $y_new \" -orientation $orient -ignore_fixed"

        }

    }

}



点赞

评论 (0 个评论)

facelist

您需要登录后才可以评论 登录 | 注册

  • 关注TA
  • 加好友
  • 联系TA
  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 1

    关注
  • 2

    粉丝
  • 0

    好友
  • 2

    获赞
  • 4

    评论
  • 229

    访问数
关闭

站长推荐 上一条 /1 下一条

小黑屋| 关于我们| 联系我们| 在线咨询| 隐私声明| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 )

GMT+8, 2024-4-28 07:59 , Processed in 0.025515 second(s), 14 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
返回顶部