EETOP 创芯网论坛 (原名:电子顶级开发网)

标题: 分享一些脚本 [打印本页]

作者: okfunny    时间: 2016-11-15 20:18
标题: 分享一些脚本
开个帖子,分享一些常用的脚本由于公司信息安全的原因,有些不能提供完整的脚本,但是思路可以讲解一下,或者是一个简单版本。
大致按照如下格式
名字:
语言:
功能:
内容:
使用方法:
作者: okfunny    时间: 2016-11-15 20:24
1.
名字:layout_get_hlist.sh   
语言:shell
功能:从cdl网表当中抽取hcell list
内容:
#!/bin/csh -f
grep -i ".subckt” $1 | awk '{print $2, $2}' >! hlist
使用方法:
layout_get_hlist.sh your.cdl
作者: okfunny    时间: 2016-11-15 20:26
本帖最后由 okfunny 于 2016-11-16 07:39 编辑

1.
名字:layout_get_hlist.sh   
语言:shell
功能:从cdl网表当中抽取hcell list
内容:
#!/bin/csh -f
grep -i ".subckt” $1 | awk '{print $2, $2}' >! hlist
使用方法:需要把cds.lib 拷贝到与脚本相同的目录
layout_get_hlist.sh your.cdl
作者: okfunny    时间: 2016-11-16 07:30
2.
名字:layout_ic61_strmout.sh
语言:shell
功能:用脚本导出GDS
内容:
#!/bin/csh -f
set cellname = $2
set library = $1

$CDSHOME/tools/dfII/bin/strmout \
-library $library \
-strmFile $cellname.gds \
-runDir . \
-topCell $cellname \
-view layout \
-logFile strmOut.log \
-converDot node \
-case Preserve


使用方法:
layout_ic61_strmout.sh library cell
作者: okfunny    时间: 2016-11-16 07:31
本帖最后由 okfunny 于 2016-11-16 07:39 编辑

3.
名字:layout_ic61_cdlout.sh
语言:shell
功能:用脚本导出CDL  网表
内容:
#!/bin/csh -f
set cellname = $2
set library = $1
set include_file = "`pwd`/source.added"

cat << EOF >! si.env
simLibName = "$library"
simCellName = "$cellname"
simViewName = "schematic"
netlistType = "Connection By Name"
hnlNtlistFIleName = "$cellname.cdl"
incFile = "$include_file"
...
EOF
# ... 省略的地方请打开一个工作目录下的 si.env 文件补充完整

cat /dev/null >! netlist
$CDSHOME/tools/dfII/bin/si -batch -command netlist

使用方法:需要把cds.lib 拷贝到与脚本相同的目录
layout_ic61_cdlout.sh library cell
作者: 楚卓清    时间: 2016-11-16 08:38
回复 5# okfunny
请教一下 “cat /dev/null >! netlist ”的作用是什么,如果没有这个貌似也可以运行,会有什么影响么?
作者: okfunny    时间: 2016-11-16 09:01
本帖最后由 okfunny 于 2016-11-16 09:03 编辑

4.
名字:layout_cross_ruler.il
语言:skill
功能:显示以点击出为交点的十字交叉尺子
内容:
procedure(layout_cross_ruler()
        let((cv bbox xy xLL yLL xUR yUR)
        cv = geGetEditCellView()
        bbox = cv~>bBox
        xy = hiGetPoint(getCurrentWindow())
        xLL = caar(bbox)
        yLL = cadar(bbox)
        xUR = caadr(bbox)
        yUR = cadadr(bbox)
        leCreateRuler(cv list(xy xLL:cadr(xy)))
        leCreateRuler(cv list(xy xUR:cadr(xy)))
        leCreateRuler(cv list(xy car(xy):yLL))
        leCreateRuler(cv list(xy car(xy):yUR))
        ))

hiSetBindKey("layout" "<Key>v" "layout_cross_ruler()")

使用方法:
在CIW中加载
load "layout_cross_ruler.il"
在版图中按 v
作者: okfunny    时间: 2016-11-16 09:02


   
回复  okfunny
请教一下 “cat /dev/null >! netlist ”的作用是什么,如果没有这个貌似也可以运行,会有 ...
楚卓清 发表于 2016-11-16 08:38


能用就不用管它了
作者: Zongxiao    时间: 2016-11-16 09:19
赞一个
作者: gcxmax    时间: 2016-11-16 11:35
能写脚本的都是牛人!
作者: dafteric    时间: 2016-11-17 11:19
本帖最后由 dafteric 于 2016-11-17 11:23 编辑

好贴,我也来分享一个。


名字:PutOnGrid.il
语言:SKILL
功能:消除版图中的off grid
内容:


procedure( OnGrid( Point )
if( listp( Point ) then
mapcar( lambda( (x) OnGrid(x) ) Point)
else
round((Point/Grid))*Grid
)
)

procedure( PutOnGrid( Grid )
let(( SelectObj )
SelectObj = geGetSelSet()
foreach( Object SelectObj
cond(
(Object~>objType == "path"
Polygon = leConvertShapeToPolygon(Object)
Polygon~>points = OnGrid(Polygon~>points)
)

(Object~>objType == "polygon"
Object~>points = OnGrid(Object~>points)
)

(Object~>objType == "rect"
Object~>bBox = OnGrid(Object~>bBox)
)

(Object~>objType == "inst" || Object~>objType == "mosaic"
Object~>xy = OnGrid(Object~>xy)
)
)
)
)
)


使用方法:在CIW中load这个il文件。使用时输OnGrid(0.005),如果你的最小格点是0.005的话。
作者: okfunny    时间: 2016-11-18 15:43
5.
名字:layout_get_gds_layer.tcl
语言: tcl
功能:获取gds 中的gds number 和 data type
内容:

set L [layout create cellname.gds -noReport -dtExpand]
puts "layer: [lsort -dictionary [$L layers]]"

使用方法:
修改cellname.gds 为实际的gds
然后执行 calibredrv layout_get_gds_layer.tcl
作者: okfunny    时间: 2016-11-18 15:46
回复 11# dafteric


谢谢分享,
作者: kaikai_92    时间: 2016-11-18 16:04
我的使用还停留在./的地步
作者: kaikai_92    时间: 2016-11-18 16:05
回复 11# dafteric


   想问下off  grid是啥。。。
作者: 冰点火龙    时间: 2016-11-19 09:58
回复 15# kaikai_92


   就是不在grid点上
作者: okfunny    时间: 2016-11-21 20:12
5.
名字:layout_save_sub_from_top.tcl
语言: tcl
功能:从gds中保存指定cell 为另一个gds
内容:

set L [layout create top.gds]
$L gdsout sub_cell.gds sub_cell

使用方法:
修改cellname.gds 为实际的gds
然后执行 calibredrv layout_save_sub_from_top.tcl
这个是从以前的帖子里搬过来的
http://bbs.eetop.cn/thread-611704-1-1.html
作者: okfunny    时间: 2016-11-22 09:42
本帖最后由 okfunny 于 2016-11-22 09:50 编辑

6.
名字:layout_drc.sh
语言: c shell
功能:脚本的方式执行drc, 并且显示结果
内容:

#!/bin/csh -f
set cell_name = $1
set drc_rule = "your_drc.cal"
set gds_dir = "../gds"
sed -e 's#\(LAYOUT PRIMARY\).*#\1 \"'$cell_name'\"#g' \
        -e 's#\(LAYOUT PATH\).*#\1 \"'$gds_dir/$cell_name.gds'\"#g' \
        -e 's#\(DRC SUMMARY REPORT\).*#\1 \"'drc.rep'\"#g' \
        $drc_rule >! _drc.cal_

calibre -drc -64 -hier -hyper -turbo 2 _drc.cal_
grep "TOTAL Result Count = [1-9]" drc.rep

使用方法:
修改drc_rule 为实际drc rule file 的路径
修改 gds_dir 为gds存放的路径
然后执行 layout_drc.sh cell_name
类似的,你可以仿照这个写个执行 LVS 的脚本了
作者: okfunny    时间: 2016-11-22 09:49
7.
名字:layout_drc_auto.sh
语言: c shell
功能:脚本的方式执行导出gds ,然后执行drc 检查, 并且显示结果
内容:

#!/bin/csh -f
set cell_name = $1
cd gds_dir #改成你自己的gds保存路径
layout_ic61_strmout.sh $cell_name
cd drc_dir #改成你自己的执行drc 的路径
layout_drc.sh $cell_name

使用方法:
然后执行 layout_drc_auto.sh cell_name

类似的,你可以仿照这个写个自动导出cdl 和 gds, 然后执行lvs 的脚本了
作者: fan309550595    时间: 2016-11-22 21:48
赞一个!
作者: zhangyanyan    时间: 2016-11-25 10:11
本帖最后由 zhangyanyan 于 2016-11-25 10:33 编辑

回复 19# okfunny
作者: tangzi11    时间: 2016-11-25 14:46
大家再接再厉呀,继续分享
作者: zhangyanyan    时间: 2016-11-28 11:27
学习啦,谢谢分享
作者: 冉#薛定谔的猫    时间: 2016-11-28 11:31
楼主好人
作者: xiuqi180    时间: 2016-11-28 17:04
谢谢分享
作者: sdfiyrwe    时间: 2016-12-13 15:22
棒棒哒
作者: wbautumn    时间: 2016-12-13 17:20
学习了,谢谢楼主分享
作者: 陆赛杰    时间: 2016-12-16 10:07
感谢楼主分享
作者: 十七画    时间: 2017-2-16 14:52
赞赞赞赞
作者: half_honey    时间: 2017-2-17 09:19
楼主赞赞哒 必须顶~
作者: 小威_Liu    时间: 2017-2-17 15:24
回复 12# okfunny


   你好!为什么我这里会提示没有“L” 这个变量。
作者: yushiji    时间: 2017-2-17 17:06
帖子不错,顶起来!
作者: king121989    时间: 2017-3-2 10:10
多谢分享,留个记号,慢慢学习
作者: 小马哥爱逛    时间: 2017-3-16 14:57
厉害了,楼主,以前跑DRC都是gui界面跑的,现在可以执行脚本。但rule里面要设置好啊,不然不知道要跑出来多少错(我是指LVS)
作者: xuejinxin726    时间: 2017-3-17 20:46
回复 4# okfunny


    您好!请问这些脚本文件可以在ic5141中使用吗?
作者: sunnylin    时间: 2017-3-20 10:34
好帖子!谢谢楼主分享!
作者: 心晴    时间: 2017-3-20 20:16
膜拜大牛啊
作者: zhu_hai_chao    时间: 2017-3-29 17:17
我想学习写脚本,不知道怎么开始,请指教!
作者: 冰点火龙    时间: 2017-3-29 20:16
回复 4# okfunny

正好要用到,谢谢楼主分享。
作者: 新人来了    时间: 2017-3-30 09:13
楼主赞赞哒 必须顶~
作者: 18217272879    时间: 2017-3-30 13:47
赞一个
作者: 微芯zgx    时间: 2017-3-30 15:01
站个位置
作者: even810223    时间: 2017-4-1 15:54
好棒,虽然现在不会,先收着,总有用的一天。
作者: ganzhenkai    时间: 2017-4-1 19:17
学习了,谢谢大神!!
作者: wink1988    时间: 2017-4-3 17:23
牛人!!佩服!
作者: isunxun    时间: 2017-4-6 10:04
拿过来自己学一学
作者: isunxun    时间: 2017-4-6 10:05
拿过来自己学一学
作者: 快乐的潜行者    时间: 2017-5-3 21:35
好东西,谢谢分享
作者: 柳淑    时间: 2017-5-4 11:49
楼主好人啊!以前找过好多次这类的脚本,都是加了密的,现在终于有不加密的脚本可用了
作者: hahalucky    时间: 2017-5-4 13:22
感觉很好。就是不知道怎么使用?
作者: 九品芝麻狐    时间: 2017-5-4 17:49
本帖最后由 九品芝麻狐 于 2017-5-4 17:50 编辑

回复 7# okfunny


   你好,我在启动icfb的目录下vi一个.il文件,然后把你发的十字标尺代码打上去,然后在ciw 中load不成功,显示*Error* Lineread/read:  syntax error encountered in input  
请问这是什么情况,谢谢
作者: luoyutong730    时间: 2017-5-5 15:08
感谢楼主分享
作者: sca110224    时间: 2017-5-11 17:27
mark 一下
作者: t_zheng    时间: 2017-5-11 22:23
回复 7# okfunny


   这是好东西!!!
作者: apachee    时间: 2017-5-16 18:20
回复 11# dafteric


   你好,请问在CIW窗口中load 源代码文件后,再输入什么命令?谢谢, 能举个列子说明下吗?
作者: 丰行    时间: 2017-5-19 15:34
你好能共享个5141导gds的吗
作者: 丰行    时间: 2017-5-27 09:28
回复 6# 楚卓清
请教一下netlist指的是文件吗
作者: 上官天    时间: 2017-6-6 15:00

作者: uestc.chb1    时间: 2017-6-9 17:20
我赞,楼主好人,无私奉献啊。全部收下了拿来改编,还是有意思的。
作者: uestc.chb1    时间: 2017-6-12 16:00
尝试,IC5141 stream out, 但是IC5141好像没有提供可执行的strmout文件,求指导。
作者: zhuchaohong    时间: 2017-9-20 15:14
回复 3# okfunny


  你这个是可以把所有的cell都提出来的,如果我只想提出top上的cell的话,这个rule怎么修改,大神请帮忙
作者: 楚卓清    时间: 2017-9-20 15:23
回复 60# uestc.chb1


51用pipo
作者: yuniang    时间: 2017-9-21 10:51
hisilicon的那套python我还是服气的。对layout太方便了
离开之后好怀念,现在的bacsh环境一点都不习惯
作者: 巧克力的冬天    时间: 2017-9-21 17:24
谢谢分享
作者: okfunny    时间: 2017-9-21 22:37


   
回复  okfunny


   你好!为什么我这里会提示没有“L” 这个变量。
小威_Liu 发表于 2017-2-17 15:24



不清楚你那为啥报错,一共就两行,第一行就是设置 L 这个变量, 你看看是不是写错了
作者: okfunny    时间: 2017-9-21 22:40


   
回复  okfunny


    您好!请问这些脚本文件可以在ic5141中使用吗?
xuejinxin726 发表于 2017-3-17 20:46



导出gds的脚本ic51不能用,ic51很久没用过了。
你可以先which icfb 然后进入到对应的路径下面,应该有个命令是导出gds的,看下帮助自己改改吧
作者: okfunny    时间: 2017-9-21 22:44


   
我想学习写脚本,不知道怎么开始,请指教!
zhu_hai_chao 发表于 2017-3-29 17:17




  先看别人的脚本,试着去改改我是从 sed 's/aaa/bbb/g' 这个命令开始慢慢研究shell 脚本,后来发现shell 不够用了,再学的python,其实就是要有兴趣,多写多练
作者: okfunny    时间: 2017-9-21 22:48


   
回复  okfunny


   你好,我在启动icfb的目录下vi一个.il文件,然后把你发的十字标尺代码打上去,然后 ...
九品芝麻狐 发表于 2017-5-4 17:49



你有截图吗?详细的报错信息,哪一行?你描述的我也看不出来是啥错误
作者: okfunny    时间: 2017-9-21 22:49


   
感觉很好。就是不知道怎么使用?
hahalucky 发表于 2017-5-4 13:22




   使用方法不是写了吗,你说的是哪一个不会用
作者: okfunny    时间: 2017-9-21 22:51


   
回复  dafteric


   你好,请问在CIW窗口中load 源代码文件后,再输入什么命令?谢谢, 能举个列子说明 ...
apachee 发表于 2017-5-16 18:20




  打开需要修改的layout,在 CIW 里面输入
load “xxx.il”
OnGrid(0.005)
作者: okfunny    时间: 2017-9-21 22:58


   
回复  okfunny


  你这个是可以把所有的cell都提出来的,如果我只想提出top上的cell的话,这个rule怎么 ...
zhuchaohong 发表于 2017-9-20 15:14




   8.
名字 layout_get_subcell.csh   
语言:shell
功能:从cdl网表当中抽取top cell 调用到的cell list
内容:
#!/bin/csh -f

set cell = $1:t:r

#注意, |\ 后面没有空格,下面的代码是一条命令,之间不能有空行,
sed -n "/subckt $cell /,$ p" $1 |\
tr '\n' '@' |\
sed 's/@+/ /g' |\
sed 's/@/\n/g' |\
grep "/" |\
sed 's/.*\/ *//g' |\
sort |\
uniq

使用方法:
layout_get_subcell.csh your.cdl
作者: no2rain    时间: 2017-9-25 17:28
回复 56# 丰行

把楼主的改一下就行了,ic5用的是pipo,格式差不多,但我没测试

2.1
名字:layout_ic51_strmout.sh
语言:shell
功能:用脚本导出GDS
内容:
#!/bin/csh -f
set cellname = $2
set library = $1

$CDSHOME/tools/dfII/bin/pipo strmout \
-library $library \
-strmFile $cellname.gds \
-runDir . \
-topCell $cellname \
-view layout \
-logFile strmOut.log \
-converDot node \
-case Preserve


使用方法:
layout_ic51_strmout.sh library cell
作者: no2rain    时间: 2017-9-25 17:32
回复 63# yuniang

请问海思的那套python具体有什么功能,我现在写了几个python,可以实现一些修改gds的功能,想知道还需要添加什么功能
作者: 15069583185    时间: 2017-9-25 17:54
请问,导出cdl的时候我用的si.env 文件然后加入了脚本里面的前面几行和后面两行,貌似不能运行。
作者: yuniang    时间: 2017-9-26 11:02
回复 73# no2rain


    涉及信息安全不在公共场合讨论
作者: shenguopingmars    时间: 2017-9-26 18:56
很实用,对工作帮助不小
作者: leefuture50    时间: 2017-9-26 22:50
名字:Laker工具的工具包
语言:TCL SH Perl
功能:自动打Gate的Co并且补上PO,等等
内容:具体链接
使用方法:具体链接

http://bbs.eetop.cn/thread-636054-1-1.html
作者: 13728688465    时间: 2017-10-10 16:54
回复 69# okfunny
请问怎么批量导入GDS?我现在用的是virtuoso ic6
作者: ayanzh    时间: 2018-1-18 08:50
谢谢分享
作者: note30933    时间: 2018-1-18 16:32
thank you
作者: XH1    时间: 2018-1-19 16:50
谢谢分享
作者: okfunny    时间: 2018-2-13 23:26
准备通过一个实例给感兴趣的朋友讲讲skill 脚本,“如何通过skill 脚本抓取PAD location“
功能:可以 指定区域, 指定PAD layer, Pin layer, 层次化抓取
作者: reptilian99    时间: 2018-2-15 20:51
Interesting
作者: okfunny    时间: 2018-3-1 22:35


   

        

                
  1. /*
  2. Dcript name: ok_GetPadLocation.il
  3. Author: Okfunny
  4. Date: 2018-03-01
  5. Description: This script is used to get PAD coordinate, user can set PAD layer, Pin layer, extraction range and,
  6.     It contains a very useful function which can use to copy specific layer hierarchially.
  7.     It is also quick start of learning skill, welcome to use and modify it ^_^
  8. Usage:
  9. Copy layer from sub block
  10. 1. select the layer you want to copy in LSW
  11. 2. draw a rectangle in a auxiliary layer to determine which region is copid from
  12. 3. select the rectangle
  13. 4. invoke the function ok_CopyFig(32)

  14. Get pad location
  15. 1. select the PAD layer in LSW
  16. 2. draw a rectangle in a auxiliary layer to determine which region is copid from
  17. 3. select the rectangle
  18. 4. invoke the function ok_GetPadLocation(32)

  19. the output looks like:
  20. create time: Mar  1 22:32:59 2018
  21. there are total 24 pads
  22. Name                    centerX    centerY      width     length
  23. PAD_4                   581.750     58.945     52.000     73.000
  24. PAD_14                  581.750    168.945     52.000     73.000
  25. PAD_24                  581.750    264.985     52.000     73.000

  26. */

  27. ; skill use semicolon to represent comments, use can delete these comments

  28. ; these are built-in fuctions used in this script, you can find usage in cadence help system: cdnshelp
  29. ; car  cadr cadar cadadr last list listp nconc append1 error geGetSelSet geGetEditCellView
  30. ; dbGetOverlaps dbGetHierPathTransform dbCopyFig dbCreateLabel dbDeleteObject
  31. ; hiDisplayMenu hiCreateSimpleMenu hiSetBindKey centerBox
  32. ; leMergeShapes geDeselectAll setof  strcat outfile fprintf getCurrentTime
  33. ; length leIsPointInsideFig dbDeleteObject close view

  34. ; user defined functions start with prefix ok_

  35. ; this is our first user defined fuction, procedure is a keyword to define a function
  36. ; ok_FlatList is function name, testList is argument
  37. ; this function is used to flatten a nested list
  38. procedure(ok_FlatList(testList)
  39.     ; let limits the variable range, and the last value is the return value of the fuction
  40.     ; listNew is a local variable which means it cannot be read and modified outside the function
  41.     ; It is a good habit to use local variable instead of global variable
  42.     let((listNew)
  43.         listNew=nil
  44.         ;listp is used to determine if it is a list
  45.         if(listp(testList)
  46.             then
  47.                 foreach(cell testList
  48.                     if(listp(cell)
  49.                         then
  50.                             ; nconc is used to concatenate two list
  51.                             listNew=nconc(listNew ok_FlatList(cell))
  52.                             ; append1 is used to append a item to a list
  53.                         else
  54.                             listNew=append1(listNew cell)
  55.                     )
  56.                 )
  57.             else
  58.                 ; error throw out a message if listNew is not a list
  59.                 error("ok_FlatList(): argument must be a list")
  60.         )
  61.         listNew
  62.     )
  63. )
  64. ;;Example
  65. ;;tlist=list("a" "b" list(1 2 list("c" 3) list("aa" "bb")))
  66. ;;ok_FlatList(tlist)


  67. ; this is out second user definde function, and the first functon can be involed as a built-in function
  68. ; this function is use to get the last item in a nested list
  69. procedure(ok_GetLast(testList)
  70.     car(last(ok_FlatList(testList)))
  71. )
  72. ;;Example
  73. ;;tlist=list(list(1,2), list(3,4,5,list(6,7)))
  74. ;;ok_GetLast(tlist)

  75. procedure(ok_CopyFigSingal(object x_Depth l_LPP)
  76.     ; prog is similar with let, but it can use the keyword return to return value in anywhere
  77.     prog((cv objHier transList objList objTransList objTransLista newObj list1 listNew)

  78.         ; geGetEditCellView is used to get current view ID, in this case, it means layer view window ID
  79.         ; ~> is operational character which used to access a structure's attributes
  80.         ; geGetEditCellView()~>?  can get all attributes name
  81.         ; geGetEditCellView()~>?? can get all attributes name and value
  82.         ; geGetEditCellView()~>bBox get current window size in a list (X_lowerleft:Y_lowerleft X_upperrignt:Y_upperright)
  83.         cv=geGetEditCellView()

  84.         ; get layers in l_LPP layer, in x_Depth level, in current window cv, in bBox region
  85.         objHier=dbGetOverlaps(cv object~>bBox l_LPP x_Depth t)

  86.         transList=nil

  87.         ; for each obj in in selected objects, loop operating the item
  88.         ; get the transform of the object, transform is a list such as (x:y rotation magnification)
  89.         foreach(obj objHier transList=nconc(transList list(dbGetHierPathTransform(obj))))

  90.         objList=nil
  91.         foreach(obj objHier objList=nconc(objList list(ok_GetLast(list(obj)))))

  92.         ; create a list with shape and it's transform
  93.         objTransList=mapcar('list objList transList)
  94.         objTransLista=setof(x objTransList ! member(car(x)~>objType list("inst" "mosaic")))

  95.         ; copy shape
  96.         newObj=foreach(mapcar xxx objTransLista dbCopyFig(car(xxx) cv cadr(xxx)))

  97.         ; return the new copied layers as a list
  98.         listNew=nconc(list(object) list(newObj))
  99.         return(listNew)
  100.     )
  101. )


  102. ; this is our first usefull function which can copy layers hierarchially
  103. ;
  104. procedure(ok_CopyFig(@optional
  105.     ; x_depth is the maximum level, default is 32
  106.     ; l_lpp is the layer which you want to copy, default is current layer selected in LSW
  107.     ; d_objects a auxiliary layer whose bBox is used to determine which range to copy from
  108.     (x_depth 32) (l_lpp leGetEntryLayer()) (d_objects geGetSelSet()))

  109.     prog((listNew)

  110.         ; if the mode is readonly, it do nothing and pop-up a window
  111.         if(geGetEditCellView()~>mode=="r"
  112.             then
  113.                 ; pop-up a window
  114.                 hiDisplayMenu(hiCreateSimpleMenu(
  115.                     'menu "" list("   read only   ") list(""))
  116.                 )
  117.             else
  118.                 listNew=nil

  119.                 foreach(obj d_objects
  120.                     listNew=nconc(listNew list(ok_CopyFigSingal(obj x_depth l_lpp)))
  121.                     )
  122.                 return(listNew)
  123.         )
  124.     )
  125. )


  126. procedure(ok_GetPadLocation(@optional
  127.     ;optional arguments, if invoke it without any arguments, it will use default value
  128.     ;pinLPP is Pin label layer in top level, default is AP:pin
  129.     ;depth is the maximum level, default is 32
  130.     (pinLPP list("AP" "pin")) (depth 32))

  131.     prog((cv pad_tmp pad labelInCV file outf bbox centerX centerY name)
  132.     cv=geGetEditCellView()

  133.     ; copy all PAD to current level to calculate
  134.     pad_tmp=cadar(ok_CopyFig(depth))

  135.     ; merge copied layers
  136.     pad=leMergeShapes(pad_tmp)
  137.     geDeselectAll()

  138.     ; filter the labels
  139.     labelInCV=setof(x cv~>shapes x~>objType=="label" && x~>lpp==pinLPP)


  140.     ; create a file to store the pad location, the file name is cellname + _padLoacation
  141.     file=strcat(cv~>cellName "_padLoacation")

  142.     ; open the file to write to
  143.     outf=outfile(file)

  144.     ; fprintf is used to write to a file in specific format
  145.     fprintf(outf "create time: %s\n" getCurrentTime())

  146.     ; get the count of pads
  147.     fprintf(outf "there are total %d pads\n" length(pad))

  148.     fprintf(outf "%-20s %10s %10s %10s %10s\n" "Name" "centerX" "centerY" "width" "length")

  149.     foreach(shape pad
  150.         ; calculate the pad coordinate and size
  151.         bbox=shape~>bBox
  152.         centerX=car(centerBox(bbox))
  153.         centerY=cadr(centerBox(bbox))
  154.         width=caadr(bbox) - caar(bbox)
  155.         length=cadadr(bbox) - cadar(bbox)

  156.         ; use this flag to determine if the label is in the pad region
  157.         p_count=1

  158.         ; if the label is inside the pad, then get the pad name
  159.         foreach(label labelInCV
  160.             if(leIsPointInsideFig(shape label~>xy)
  161.                 then
  162.                     label~>xy=centerX:centerY
  163.                     p_count=p_count+1
  164.                     name=label~>theLabel
  165.             )
  166.         )

  167.         if(p_count==0
  168.             then
  169.                 fprintf(outf "%-20s %10.3f %10.3f %10.3f %10.3f\n"
  170.                             "NC" centerX centerY width length)
  171.             else
  172.                 fprintf(outf "%-20s %10.3f %10.3f %10.3f %10.3f\n"
  173.                             name centerX centerY width length)
  174.         )
  175.     )

  176.     ; delete the copied pad layer
  177.     foreach(x pad dbDeleteObject(x))

  178.     ; close the file
  179.     close(outf)


  180.     ; view the location file
  181.     view(file)

  182.     printf("Please find result: %s\n" file)
  183.     )
  184. )

  185. ;set a bindkey with default setting: pin layer AP:pin, pad layer is current layer in LSW
  186. hiSetBindKey("Layout" "Ctrl<Key>b" "ok_GetPadLocation()")

  187. ;set a bindkey with default setting, only copy layer from level 1, layer is current layer in LSW
  188. hiSetBindKey("Layout" "Ctrl<Key>d" "ok_CopyFig(1)")

  189. ;set a bindkey with user defined layer setting: pin layer M11:pin, pad layer is current layer in LSW
  190. hiSetBindKey("Layout" "Ctrl<Key>g" "ok_GetPadLocation(list("Metal11" "pin")")

  191. println("load successfully")

  192.         

   

    复制代码

作者: okfunny    时间: 2018-3-1 22:56
( , 下载次数: 238 )
作者: note30933    时间: 2018-3-2 17:07
thank you
作者: hlj2    时间: 2018-3-3 19:19
学习了
作者: apple2014    时间: 2018-3-5 15:27
谢谢分享
作者: zw1035961900    时间: 2018-3-14 12:44
很不错的帖子!但是IC61以上版本都集成了后面几个脚本的功能
作者: note30933    时间: 2018-3-14 15:31
thank you
作者: okfunny    时间: 2018-3-19 08:48


   
很不错的帖子!但是IC61以上版本都集成了后面几个脚本的功能
zw1035961900 发表于 2018-3-14 12:44




是的,现在IC61有这个功能,我写到这里只是提供一个实例,给初学者提供一个参考
作者: 巍峨山    时间: 2018-3-27 10:55
很不错的帖子
作者: graywang1973    时间: 2018-3-27 16:16
分享是一种美德!
作者: ralinkok    时间: 2018-3-27 17:29
thanks
作者: Jen    时间: 2018-4-9 11:26
感谢楼主无私的分享,学习了,谢谢
作者: Jen    时间: 2018-4-10 10:38
( , 下载次数: 127 ) 求教!!!我用5141为什么会出现这种问题?
作者: be4darkness    时间: 2018-4-10 16:34
学习了,多谢分享
作者: note30933    时间: 2018-4-11 08:47
good point
作者: okfunny    时间: 2018-4-17 19:04
回复 96# Jen


   51没有这个函数
作者: 不识君    时间: 2018-4-18 15:47
太好了,表示正在学skill




欢迎光临 EETOP 创芯网论坛 (原名:电子顶级开发网) (https://bbs.eetop.cn/) Powered by Discuz! X3.5