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

日志

自动打孔和连线的脚本

已有 8 次阅读| 2025-12-23 17:15 |系统分类:芯片设计

hiSetBindKey("layout" "<Key>5" "LineAndVia()")
procedure(findx()
prog((obj obj1)
obj = geGetSortedSelectByLine()
obj1 = geGetSortedSelectByLine()
return(list(obj obj1))   ;已修改
)
)
procedure(conline(list1 list2 dir)
let((s1 s2 w1 w2 a b c d s1b s1e s2b s2e tt tt2 area)   ;已修改,删掉了dir
        x = length(list1)
        while(x>0
                s1 = car(nth(x-1 list1))
                s2 = car(nth(x-1 list2))
                w1 = s1~>width/2
                w2 = s1~>width/2
                a = caar(nth(0 list1)~>beginPt)
                b = caar(nth(x-1 list1)~>beginPt)
                c = cadar(nth(0 list2)~>beginPt)
                d = cadar(nth(x-1 list2)~>beginPt)
        cond(
                ((b-a)*(d-c)>0 tt = 1)
                ((b-a)*(d-c)<0 tt = 0)
        )
        s1b = s1~>beginPt s1e = s1~>endPt
        s2b = s1~>beginPt s2e = s1~>endPt
        cond(
                (dir == "7"
                        when(cadr(s1b) - cadr(s1e) < 0
                                dbSetPathSegPoints(s1 s1e s1b)
                        )
                        when(car(s2b) - car(s2e) < 0
                                dbSetPathSegPoints(s2 s2e s2b)
                        )
                        s1~>beginPt = list(car(s1~>beginPt) cadr(s2~>beginPt) + w2)
                        s2~>beginPt = list(car(s1~>beginPt) + w1 cadr(s2~>beginPt))
                        area = list(
                                                list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) - w2)
                                                list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) + w2)
                                                list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) + w2)
                                                list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) - w2)
                        )
                        tt = abs(tt-1)
                        CreatVia(area tt2)
                )
                (dir == "F"
                        when(cadr(s1b) - cadr(s1e) < 0
                                dbSetPathSegPoints(s1 s1e s1b)
                        )
                        when(car(s2b) - car(s2e) > 0
                                dbSetPathSegPoints(s2 s2e s2b)
                        )
                        s1~>beginPt = list(car(s1~>beginPt) cadr(s2~>beginPt) + w2)
                        s2~>beginPt = list(car(s1~>beginPt) - w1 cadr(s2~>beginPt))
                        area = list(
                                                list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) - w2)
                                                list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) + w2)
                                                list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) + w2)
                                                list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) - w2)
                        )
                        tt2 = abs(tt-1)
                        CreatVia(area tt2)
                )
                (dir == "J"
                        when(cadr(s1b) - cadr(s1e) > 0
                                dbSetPathSegPoints(s1 s1e s1b)
                        )
                        when(car(s2b) - car(s2e) < 0
                                dbSetPathSegPoints(s2 s2e s2b)
                        )
                        s1~>beginPt = list(car(s1~>beginPt) cadr(s2~>beginPt) - w2)
                        s2~>beginPt = list(car(s1~>beginPt) + w1 cadr(s2~>beginPt))
                        area = list(
                                                list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) - w2)
                                                list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) + w2)
                                                list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) + w2)
                                                list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) - w2)
                        )
                        CreatVia(area tt)
                )
                (dir == "L"
                        when(cadr(s1b) - cadr(s1e) > 0
                                dbSetPathSegPoints(s1 s1e s1b)
                                )
                        when(car(s2b) - car(s2e)
                                dbSetPathSegPoints(s2 s2e s2b)
                                )
                        s1~>beginPt = list(car(s1~>beginPt) cadr(s2~>beginPt) - w2)  ;已修改
                        s2~>beginPt = list(car(s1~>beginPt) - w1 cadr(s2~>beginPt))
                        area = list(
                                                list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) - w2)
                                                list(car(s1~>beginPt) - w1 cadr(s2~>beginPt) + w2)
                                                list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) + w2)
                                                list(car(s1~>beginPt) + w1 cadr(s2~>beginPt) - w2)
                        )
                        CreatVia(area tt)
                        )
        )
        x = x - 1
)
)
)  ;这里加了一个括号
procedure(CreatVia(listin t1)
       let((techFile constraintGroupId myViaOptions)  ;已修改,删掉了t1
                cond(
                        (t1 == 0 t2 = "centerRight")
                        (t1 == 1 t2 = "centerLeft")
                        )
                techFile = techGetTechFile(geGetEditRep())
               constraintGroupId = cstFindConstraintGroupIn(techFile "virtuosoDefaultSetup")  ;已修改,函数名为cstFindConstraintGroupIn
                myViaOptions = viaGetViaOptions(constraintGroupId)
                myViaOptions~>automatic~>viaAlignment = t2
                myViaOptions~>automatic~>minNuMCUts = 2
                myViaOptions~>createInRoute = nil
                myViaOptions~>automatic~>preventDRCWithNeighbors = nil
                myViaOptions~>automatic~>cutBBoxOrientation = "horizontal"
                viaGenerateViasInArea(deGetCellView() listin myViaOptions)
                )
        )
procedure(LineAndVia()
        let((selid sel1 sel2 sel1lx sel1ly sel1rx sel1ry sel2lx sel2ly sel2rx sel2ry dir)
                selid = findx()
                sel1 = car(selid)
                sel2 = cadr(selid)
                if(length(sel1) != length(sel2)
                        then
                                printf("chong xin xuan ze !")
                        else
                                when(caar(car(sel1)~>beginPt) != caar(car(sel1)~>endPt)
                                        sel1 = cadr(selid)
                                        sel2 = car(selid)
                                        )
                                sel1lx = caar(car(car(sel1)~>bBox)) sel1ly = cadar(car(car(sel1)~>bBox))
                                sel1rx = caadr(car(car(sel1)~>bBox)) sel1ry = cadadr(car(car(sel1)~>bBox))
                                sel2lx = caar(car(car(sel2)~>bBox)) sel2ly = cadar(car(car(sel2)~>bBox))
                                sel2rx = caadr(car(car(sel2)~>bBox)) sel2ry = cadadr(car(car(sel2)~>bBox))
                                cond(
                                        ((sel2rx + sel2lx)/2 < sel1lx && sel2ly > (sel1ry + sel1ly)/2
                                                dir = "7"
                                                conline(sel1 sel2 dir)
                                                )
                                        ((sel2rx + sel2lx)/2 > sel1rx && sel2ly > (sel1ry + sel1ly)/2
                                                dir = "F"
                                                conline(sel1 sel2 dir)
                                                )
                                        ((sel2rx + sel2lx)/2 < sel1lx && sel2ry < (sel1ry + sel1ly)/2
                                                dir = "J"
                                                conline(sel1 sel2 dir)
                                                )
                                        ((sel2rx + sel2lx)/2 > sel1rx && sel2ry < (sel1ry + sel1ly)/2
                                                dir = "L"
                                                conline(sel1 sel2 dir)

                                                )
                                        )
                        )
                )
        )

评论 (0 个评论)

  • 0

    周排名
  • 0

    月排名
  • 0

    总排名
  • 0

    关注
  • 40

    粉丝
  • 14

    好友
  • 133

    获赞
  • 12

    评论
  • 221

    访问数
关闭

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


手机版| 小黑屋| 关于我们| 联系我们| 用户协议&隐私声明| 版权投诉通道| EETOP 创芯网
( 京ICP备:10050787号 京公网安备:11010502037710 ) |网站地图

GMT+8, 2025-12-23 21:57 , Processed in 0.013542 second(s), 7 queries , Gzip On, Redis On.

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