写了一个简单的trace path函数------tcl实现

暂时这个函数还只能实现trace out的pin,只能向后trace,不能向前trace。

甚至可能有点小问题。大家如果要用,可能要修改一下,哈哈哈。(有问题的是register的判断标准。这个程序中只是利用了名称中包含reg来判断register,这个方法没有验证是否准确。)

另外这个程序的实现利用的是函数(tracea)的自回归实现一级一级trace cell和net。


 

set path {}
set paths {}

proc trace_path {pin} {
  global path
  global paths
  if {([get_pins -q $pin] == "")&&([get_port -q $pin] == "")} { puts stdout "$pin not exist";return};
  if {([get_attribute [get_pins $pin] direction] == "out" )||([get_attribute [get_port $pin] direction] == "in" )} {
     set path $pin
     tracea $pin
  }
  puts stdout $paths
  set paths {}
  set path {}
}

proc tracea {ppin} {
  global path
  global paths
  set cell_0 [get_object_name [get_cells -of [get_pins $ppin]]]
  foreach_in_collection p [get_pins -of [get_nets -of [get_pins $ppin]]] {
    set pname [get_object_name $p]
    if {[regexp $cell_0.* $pname] == 0} {
        set c [get_object_name [get_cells -of $p]];
        lappend path $c;
        if { (([get_property -q [get_cells $c] is_memory_cell] == "true" ) || ([get_property -q [get_port -q $p ] is_port] == "true") || ([regexp reg $c])) } {
           lappend paths $path;#judge the is port, memory or register
           lreplace $path [expr [llength $path]-1] [expr [llength $path]-1];#delete last element
           continue
        } else {
           set po [get_pins -of_objects $c -filter "direction==out"];#get output pin
tracea $po
           continue

        }
    }
   }
  lreplace $path [expr [llength $path]-1] [expr [llength $path]-1];#delete last element
  return
}

 

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值