在线咨询
eetop公众号 创芯大讲堂 创芯人才网
切换到宽版

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

手机号码,快捷登录

手机号码,快捷登录

找回密码

  登录   注册  

快捷导航
搜帖子
12
返回列表 发新帖
楼主: 月开

[求助] skill中pcell实现finger的问题

[复制链接]
 楼主| 发表于 2023-10-11 13:09:52 | 显示全部楼层
/*************************
* program : rectMain     *
* filename: cdfpcell_tr  *
* language: cadence skill*
* author  : nfmao        *
* date    : 2008-5-27    *
* web  :www.chalayout.com*
**************************/

;;control range of stretch
procedure(stretchRang(info)
let((minwidth maxwidth width)
minwidth=info->userData->min
maxwidth=info->userData->max
width=info->paramVal + info->increment
width=max(minwidth width)
width=min(maxwidth width)
));proce_width_rang


;;echo range of input value
procedure(inputRange()
let((width)
width=cdfgData->w->value
width=max(width 0.1)
width=min(width 2.0)
cdfgData->w->value=width
printf("rang of width is 0.1-2.0,current value to %2.3f\n" width)
));proce_inputRange


;;create cdf parameters
procedure(cdfCreate()
let((
(cellid ddGetObj(libname cellname))
)

if((cdfid=cdfGetBaseCellCDF(cellid)) then
  param=car(cdfid~>parameters~>name)
  when(param  cdfDeleteParam(cdfFindParamByName(cdfid param)))
);if

cdfid=cdfCreateBaseCellCDF(cellid)
cdfCreateParam(cdfid
?name "w"
?prompt "width"
?type "float"
?defValue 0.4
?callback "inputRange()"
);w

cdfSaveCDF(cdfid)
));proce_cdfcreate


;;create pcell objects
procedure(rectCreate(@key cv w l)
let((rectLayer varw pcParameters pcParamProp varw0)
rectLayer=31
;tf=techGetTechFile(cv)
;mind=techGetSpacingRule(tf "minWidth" rectLayer )

;;create rect
;;first  method
;varw=nth(0 cv~>parameters~>value)~>value

;;second method
pcParameters = cv~>parameters~>value
pcParamProp = car(exists(prop pcParameters ((prop~>name) == "w")))
varw = (pcParamProp~>value)
;;study exists
;;exists(x '(1 2 3 4) (x>1)) => (2 3 4)

varw0=varw
varw0=max(varw0 0.1)
varw0=min(varw0 2.0)
rectObj=rodCreateRect(?cvId cv ?width varw0 ?length l ?layer rectLayer)
dbReplaceProp(cv "viewSubType" "string" "maskLayoutParamCell")
dbReplaceProp(cv "instNamePrefix" "string" "rectPcell")

;;add stretch handle
rodAssignHandleToParameter(
?parameter "w"
?rodObj rectObj
?handleName "centerRight"
?moveOrigin nil
?displayName "width"
?displayExpression "varw"
?stretchType "relative"
?stretchDir "x"
?updateIncrement 0.01
?userData list(nil 'min 0.1 'max 2.0)
?userFunction "stretchRang"
);rodAssignHandleToParameter

));proce_rectCreate

;;study list(nil 'min 0.1)
;;please refer to assoc & tconc
;;access ->min

;;main function
procedure(rectMain()
let((
(libname "test")
(cellname "rect")
)

libid=ddGetObj(libname)
cvid=pcDefinePCell(
;object
(list ddGetObj(libname) cellname "layout"
);list

;parameters
(
(w float 0.4)
);params

;body
let((w uw)
uw=0.4
rectCreate(?cv pcCellView ?w uw ?l uw)
return(t)
);let_w
);pcDefinePCell

if(cvid then
;;save pcell
dbSave(cvid)
;loadCDF
cdfCreate()
);if_cvid

);let_lib_cellname
);procedure_rectMain

rectMain()
 楼主| 发表于 2023-10-11 13:21:52 | 显示全部楼层
code参考

pcelltoskill.txt

4.83 KB, 下载次数: 11 , 下载积分: 资产 -2 信元, 下载支出 2 信元

 楼主| 发表于 2023-12-2 10:49:02 | 显示全部楼层
分享文件

CreateMultipath.il.pdf

86.65 KB, 下载次数: 8 , 下载积分: 资产 -2 信元, 下载支出 2 信元

 楼主| 发表于 2024-1-10 10:31:50 | 显示全部楼层
/*
effect:Fix the path edge which beyond the via
write by:???        update by:fire
date:2023/11/16
version:2.0
*/

procedure(FixEdgeMain()
    if(!boundp('limitValueForm) || limitValueForm==nil then
        hiCreateOptionsForm(
            'limitValueForm
            "limitValueForm"
            list(hiCreateStringField(?name 'limitValueField ?prompt "limitValue" ?value "5"))
        )
    );end if
    enterPoint(
        ?prompts list("Enter a point which on the via")
        ?form limitValueForm
        ?doneProc "FixEdge"
    )
);end procedure

procedure(FixEdge(win bool points)
    let((limitValue cv point pointbBox viaList layer1 layer2 viabBox viax viay viaxL xiaxR xiayT viayB RectangleList Rectlayer polygonList polygonlayer pathList pathlayer netList netmetal width notCutNet netEndPoint netBeginPoint netBeginx netBeginy netEndx netEndy dy1 dy2 netBeginxbk netBeginybk net2bBox via2List path2List pathSeg2List rect2List net2List yMin yMax layer21 layer22 dx1 dx2 xMin xMax polygon polygons)

        limitValue=atof(limitValueForm->limitValueField->value)       
        cv=win->cellView
        point=car(points)
        when(point
            when(deGetEIP(win) point=geWindowToEditPoint(win point));end when
            pointbBox=list(xCoord(point)-0.01:yCoord(point)-0.01 xCoord(point)+0.01:yCoord(point)+0.01)
            viaList=leSearchHierarchy(cv pointbBox 0 "via" nil)

            foreach(via viaList
                layer1=dbGetViaLayer(via "layer1")
                layer2=dbGetViaLayer(via "layer2")
                viabBox=via~>bBox
                viax=car(via~>origin)
                viay=cadr(via~>origin)
                viaxL=caar(via~>bBox)
                viaxR=caadr(via~>bBox)
                viayT=cadadr(via~>bBox)
                viayB=cadar(via~>bBox)

                RectangleList=leSearchHierarchy(cv viabBox 0 "rectangle" nil)
                foreach(Rect RectangleList
                    Rectlayer=Rect~>layerName
                    if(Rectlayer==layer1 || Rectlayer==layer2 then
                        ;leConvertPolygonToPath(Rect)
                        leConvertShapeToPathSeg(Rect)
                    );end if
                );end foreach
                
                polygonList=leSearchHierarchy(cv viabBox 0 "polygon" nil)
                foreach(polygon polygonList
                    polygonlayer=polygon~>layerName
                    if(polygonlayer==layer1 || polygonlayer==layer2 then
                        ;leConvertPolygonToPath(polygon)
                        leConvertShapeToPathSeg(polygon)
                    );end if
                );end foreach
                           
                pathList=leSearchHierarchy(cv viabBox 0 "path" nil)
                foreach(path pathList
                    pathlayer=path~>layerName
                    if(pathlayer==layer1 || pathlayer==layer2 then
                        leConvertShapeToPathSeg(path)
                    );end if
                );end foreach
                
                netList=leSearchHierarchy(cv viabBox 0 "pathSeg" nil)
                foreach(net netList
                    netmetal=net~>layerName
                    if(netmetal==layer1 || netmetal==layer2 then
                        net~>endStyle="truncate"
                        net~>beginStyle="truncate"
                        width=net~>width
                        notCutNet=0
                        netEndPoint=net~>endPt
                        netBeginPoint=net~>beginPt
                        netBeginx=car(netBeginPoint)
                        netBeginy=cadr(netBeginPoint)
                        netEndx=car(netEndPoint)
                        netEndy=cadr(netEndPoint)
                        if(netBeginy!=netEndy then                    ;Vetical
                            dy1=abs(netBeginy-viay)
                            dy2=abs(netEndy-viay)
                            if(dy1<limitValue || dy2<limitValue then
                                if(dy2>dy1 then                            ;let the netEndx/netEndy close to via
                                        netBeginxbk=netBeginx
                                        netBeginybk=netBeginy
                                        netBeginx=netEndx
                                        netBeginy=netEndy
                                        netEndx=netBeginxbk
                                        netEndy=netBeginybk
                                    );end if
                                    net2bBox=list((netEndx-width/2):netEndy (netEndx+width/2):viay)
                                    via2List=remove(via leSearchHierarchy(cv net2bBox 0 "via" nil))
                                    path2List=leSearchHierarchy(cv net2bBox 0 "path" nil)
                                    pathSeg2List=leSearchHierarchy(cv net2bBox 0 "pathSeg" nil)
                                    rect2List=leSearchHierarchy(cv net2bBox 0 "rectangle" nil)
                                    net2List=append(append(path2List pathSeg2List) rect2List)
                                    net2List=remove(net net2List)
                        net2List=setof(x net2List x~>layerName==layer1 || x~>layerName==layer2)
                                yMin=bottomEdge(car(net2List~>bBox))
                                yMax=topEdge(car(net2List~>bBox))
                                    foreach(net2 net2List
                                        if(net2~>layerName==netmetal then
                                        notCutNet++
                                        );end if
                                    );end foreach
                                    foreach(via2 via2List
                                        layer21=dbGetViaLayer(via2 "layer1")
                                        layer22=dbGetViaLayer(via2 "layer2")
                                        if(layer21==netmetal || layer22==netmetal then
                                        notCutNet++
                                        );end if
                                    );end foreach

                                    if(notCutNet==0 then
                                        if(dy2>dy1 then                            ;via close to the net's begin point
                                        if(netBeginy>netEndy then            ;via close to the net's down
                                            if(viayB>yMin then
                                                net~>beginPt=(netBeginx:yMin)
                                            else
                                                net~>beginPt=(netBeginx:viayB)
                                            );end if
                                                else                                    ;via close to the net's up
                                            if(viayT>yMax then
                                                net~>beginPt=(netBeginx:viayT)
                                            else
                                                net~>beginPt=(netBeginx:yMax)
                                            );end if
                                                );end if
                                        else                                    ;via close to the net's end point
                                                if(netBeginy>netEndy then            ;via close to the net's down
                                            if(viayB>yMin then
                                                net~>endPt=(netEndx:yMin)
                                            else
                                                net~>endPt=(netEndx:viayB)
                                            );end if
                                                else                                    ;via close to the net's up
                                            if(viayT>yMax then
                                                net~>endPt=(netEndx:viayT)
                                            else
                                                net~>endPt=(netEndx:yMax)
                                            );end if
                                                );end if
                                        );end if
                                    else
                                        notCutNet=0
                                    );end if
                            );end if
                        else                                        ;Horizontal
                            dx1=abs(netBeginx-viax)
                            dx2=abs(netEndx-viax)
                            if(dx1<limitValue || dx2<limitValue then
                                if(dx2>dx1 then                            ;let the netEndx/netEndy close to via
                                        netBeginxbk=netBeginx
                                        netBeginybk=netBeginy
                                        netBeginx=netEndx
                                        netBeginy=netEndy
                                        netEndx=netBeginxbk
                                        netEndy=netBeginybk
                                    );end if
                                    net2bBox=list(netEndxnetEndy-width/2) viaxnetEndy+width/2))
                                    via2List=remove(via leSearchHierarchy(cv net2bBox 0 "via" nil))
                                    path2List=leSearchHierarchy(cv net2bBox 0 "path" nil)
                                    pathSeg2List=leSearchHierarchy(cv net2bBox 0 "pathSeg" nil)
                                    rect2List=leSearchHierarchy(cv net2bBox 0 "retangle" nil)
                                    net2List=append(append(path2List pathSeg2List) rect2List)
                                    net2List=remove(net net2List)
                        net2List=setof(x net2List x~>layerName==layer1 || x~>layerName==layer2)
                                xMin=leftEdge(car(net2List~>bBox))
                                xMax=rightEdge(car(net2List~>bBox))
                                    foreach(net2 net2List
                                        if(net2~>layerName==netmetal then
                                        notCutNet++
                                        );end if
                                    );end foreach
                                    foreach(via2 via2List
                                        layer21=dbGetViaLayer(via2 "layer1")
                                        layer22=dbGetViaLayer(via2 "layer2")
                                        if(layer21==netmetal || layer22==netmetal then
                                        notCutNet++
                                        );end if
                                    );end foreach

                                    if(notCutNet==0 then
                                        if(dx2>dx1 then                            ;via close to the net's begin point
                                        if(netBeginx>netEndx then            ;via close to the net's left
                                            if(viaxL>xMin then
                                                net~>beginPt=(xMin:netEndy)
                                            else
                                                net~>beginPt=(viaxL:netEndy)
                                            );end if
                                        else                                    ;via close to the net's right
                                            if(viaxR>xMax then
                                                net~>beginPt=(viaxR:netEndy)
                                            else
                                                net~>beginPt=(xMax:netEndy)
                                            );end if
                                        );end if
                                        else                                    ;via close to the net's end point
                                        if(netBeginx>netEndx then            ;via close to the net's left
                                            if(viaxL>xMin then
                                                net~>endPt=(xMin:netEndy)
                                            else
                                                net~>endPt=(viaxL:netEndy)
                                            );end if
                                        else                                    ;via close to the net's right
                                            if(viaxR>xMax then
                                                net~>endPt=(viaxR:netEndy)
                                            else
                                                net~>endPt=(xMax:netEndy)
                                            );end if
                                        );end if
                                        );end if
                                    else
                                        notCutNet=0
                                    );end if
                            );end if
                        );end if
                    );end if

                    ;**************convert the pathSeg to path****************
                    if(net~>route~>numObjects>1 then
                        foreach(wire net~>route~>objects
                            polygon=dbConvertPathSegToPolygon(wire)
                            polygons=append1(polygons polygon)
 楼主| 发表于 2024-1-10 10:46:34 | 显示全部楼层
                        );end foreach
                        leConvertPolygonToPath(car(leMergeShapes(polygons)))
                    else
                        leConvertPolygonToPath(dbConvertPathSegToPolygon(net))
                    );end if

                );end foreach
            );end foreach
        );end when
    );end let
);end procedure


hiSetBindKey("Layout" "<Key>4" "FixEdgeMain()")
 楼主| 发表于 2024-3-23 09:17:02 | 显示全部楼层




  1. procedure( ConnectNetByName()
  2. let( (Obj1s Obj2s  Obj1  Obj2  Ob1Name OS1 OS2 Point1 Point2 Point3 Point4 PX1 PX2 PX3 PX4
  3. PY1 PY2 PY3 PY4 Space1 Space2 Space3 Space4 NearPt  TechFile CGroupId MyViaOptions Window NewVia Ob2W Ob1W LeftDown LeftUp RightUp RightDown  Num1 Num2 BigNum SmallNum NEWVIAS)
  4. geSelectBy2PointsLine()
  5. Obj1s=geGetSelSet()
  6. geSelectBy2PointsLine()
  7. Obj2s=geGetSelSet()
  8. foreach(OBJ1x Obj1s
  9. cond(
  10. (OBJ1x~>objType!="pathSeg"
  11. Obj1 = car(leConvertShapeToPathSeg(OBJ1x)));
  12. (OBJ1x~>objType=="pathSeg"
  13. if((xCoord(OBJ1x~>beginPt)==xCoord(OBJ1x~>endPt)&&yCoord(OBJ1x~>beginPt)>yCoord(OBJ1x~>endPt)) || (yCoord(OBJ1x~>beginPt)==yCoord(OBJ1x~>endPt) && xCoord(OBJ1x~>beginPt)>xCoord(OBJ1x~>endPt))
  14. then println("Flip") Obj1 = FlipPathSeg(OBJ1x)
  15. else Obj1 = OBJ1x
  16.    );if
  17. );
  18. );cond
  19. Ob1Name  = Obj1~>net~>name
  20. Ob1W = Obj1~>width/2
  21. ;printf("Mark0:%L \n" Ob1Name)
  22. foreach(OBJ2x Obj2s
  23. if(OBJ2x~>net~>name==Ob1Name
  24. then
  25. ;printf("Mark1:%L \n" OBJ2x~>net~>name)

  26. cond(
  27. (OBJ2x~>objType!="pathSeg"
  28. Obj2 = car(leConvertShapeToPathSeg(OBJ2x)));
  29. (OBJ2x~>objType=="pathSeg"
  30. if((xCoord(OBJ2x~>beginPt)==xCoord(OBJ2x~>endPt)&&yCoord(OBJ2x~>beginPt)>yCoord(OBJ2x~>endPt)) || (yCoord(OBJ2x~>beginPt)==yCoord(OBJ2x~>endPt) && xCoord(OBJ2x~>beginPt)>xCoord(OBJ2x~>endPt))
  31. then Obj2 = FlipPathSeg(OBJ2x)
  32. else Obj2 = OBJ2x
  33.    );if
  34. );
  35. );cond


  36. Ob2W = Obj2~>width/2
  37. Point1 = Obj1~>beginPt Point2 = Obj1~>endPt
  38. Point3 = Obj2~>beginPt Point4 = Obj2~>endPt
  39. PX1 = xCoord(Point1)  PY1 = yCoord(Point1)
  40. PX2 = xCoord(Point2)  PY2 = yCoord(Point2)
  41. PX3 = xCoord(Point3)  PY3 = yCoord(Point3)
  42. PX4 = xCoord(Point4)  PY4 = yCoord(Point4)
  43. Space1 = expt((PX1-PX3) 2) + expt((PY1 - PY3) 2)
  44. Space2 = expt((PX1-PX4) 2) + expt((PY1 - PY4) 2)
  45. Space3 = expt((PX2-PX3) 2) + expt((PY2 - PY3) 2)
  46. Space4 = expt((PX2-PX4) 2) + expt((PY2 - PY4) 2)
  47. if((PX1==PX2)&& (PY3==PY4)
  48. then NearPt = list(PX1 PY3)
  49.      LeftDown = list(PX1-Ob1W PY3-Ob2W) LeftUp = list(PX1-Ob1W PY3+Ob2W)
  50.      RightDown= list(PX1+Ob1W PY3-Ob2W) RightUp= list(PX1+Ob1W PY3+Ob2W)
  51. if(min(Space1 Space2 Space3 Space4) == Space1
  52. then dbSetPathSegPoints(Obj1  list(PX1 PY3-Ob2W) Point2)
  53.      dbSetPathSegPoints(Obj2  list(PX1-Ob1W PY3) Point4)
  54. );if
  55. if(min(Space1 Space2 Space3 Space4) == Space2
  56. then dbSetPathSegPoints(Obj1 list(PX1 PY3-Ob2W) Point2)
  57.      dbSetPathSegPoints(Obj2 Point3 list(PX1+Ob1W PY3))
  58. );if
  59. if(min(Space1 Space2 Space3 Space4) == Space3
  60. then dbSetPathSegPoints(Obj1  Point1 list(PX1 PY3+Ob2W))
  61.      dbSetPathSegPoints(Obj2  list(PX1-Ob1W PY3) Point4)
  62. );if
  63. if(min(Space1 Space2 Space3 Space4) == Space4
  64. then dbSetPathSegPoints(Obj1  Point1 list(PX1 PY3+Ob2W))
  65.      dbSetPathSegPoints(Obj2  Point3 list(PX1+Ob1W PY3))
  66. );if
  67. ;/*******
  68. TechFile = techGetTechFile(geGetEditRep())
  69. CGroupId = cstFindConstraintGroupIn(TechFile "virtuosoDefaultSetup")
  70. MyViaOptions = viaGetViaOptions(CGroupId)
  71. Window = deGetCellView()
  72. NEWVIAS=viaGenerateViasInArea(Window list(LeftDown LeftUp RightUp RightDown) MyViaOptions)
  73. ;****/
  74. );if

  75. if((PY1==PY2) && (PX3==PX4)
  76. then NearPt = list(PX3 PY1)
  77.      LeftDown = list(PX3-Ob2W PY1-Ob1W) LeftUp = list(PX3-Ob2W PY1+Ob1W)
  78.      RightDown= list(PX3+Ob2W PY1-Ob1W) RightUp= list(PX3+Ob2W PY1+Ob1W)
  79. if(min(Space1 Space2 Space3 Space4) == Space1
  80. then dbSetPathSegPoints(Obj1  list(PX3-Ob2W PY1) Point2)
  81.      dbSetPathSegPoints(Obj2  list(PX3 PY1-Ob1W) Point4)
  82. );if
  83. if(min(Space1 Space2 Space3 Space4) == Space2
  84. then ;dbSetPathSegStyle(Obj1 car(OS1) "truncate" caddr(OS1) cdddr(OS1))
  85.      dbSetPathSegPoints(Obj1 list(PX3-Ob2W PY1) Point2)
  86.      dbSetPathSegPoints(Obj2 Point3 list(PX3 PY1+Ob1W))
  87. );if
  88. if(min(Space1 Space2 Space3 Space4) == Space3
  89. then ;dbSetPathSegStyle(Obj1 car(OS1) cadr(OS1) "truncate"  cdddr(OS1))
  90.      dbSetPathSegPoints(Obj1  Point1 list(PX3+Ob2W PY1))
  91.      dbSetPathSegPoints(Obj2  list(PX3 PY1-Ob1W) Point4)
  92. );if
  93. if(min(Space1 Space2 Space3 Space4) == Space4
  94. then ;dbSetPathSegStyle(Obj1 car(OS1) cadr(OS1) "truncate"  cdddr(OS1))
  95.      dbSetPathSegPoints(Obj1  Point1 list(PX3+Ob2W PY1))
  96.      dbSetPathSegPoints(Obj2  Point3 list(PX3 PY1+Ob1W))
  97. );if

  98. ;/*******
  99. TechFile = techGetTechFile(geGetEditRep())
  100. CGroupId = cstFindConstraintGroupIn(TechFile "virtuosoDefaultSetup")
  101. MyViaOptions = viaGetViaOptions(CGroupId)
  102. ;MyViaOptions~>automatic~>minNumCuts= 2
  103. Window = deGetCellView()
  104. NEWVIAS=viaGenerateViasInArea(Window list(LeftDown LeftUp RightUp RightDown) MyViaOptions)
  105. ;*******/
  106. );if

  107. /*************Delete extra Vias***********/
  108.   BigNum = max(MetalLayerNumber(Obj1~>layerName) MetalLayerNumber(Obj2~>layerName))
  109. SmallNum = min(MetalLayerNumber(Obj1~>layerName) MetalLayerNumber(Obj2~>layerName))

  110. for(j 0 j=length(NEWVIAS)
  111. ;println(nth(j NEWVIAS)~>viaHeader~>master~>shapes~>layerName)
  112. if(setof(x nth(j NEWVIAS)~>viaHeader~>master~>shapes~>layerName
  113.          MetalLayerNumber(x)<SmallNum-1||MetalLayerNumber(x)>BigNum+1);setof
  114. then dbDeleteObject(nth(j NEWVIAS)) println("Delete extra Vias")

  115. );if
  116. );for
  117. /****************************************/
  118. );if obj2Name==obj1Name
  119. );foreach2
  120. );foreach1
  121. );let
  122. );procedure






复制代码
 楼主| 发表于 2024-3-23 09:17:51 | 显示全部楼层




  1. procedure( ContInOrder()
  2. prog( ( OBJ1 OBJ2 obj1 obj2 Vline Hline HW VW HBP VBP xHBP yHBP xHEP yHEP xVBP yVBP xVEP yVEP
  3.       Space1 Space2 Space3 Space4 LeftDown LeftUp RightUp RightDown TechFile CGroupId
  4.       MyViaOptions Window Num1 Num2 BigNum SmallNum NEWVIAS)

  5. OBJ1 = geGetSortedSelectByLine()
  6. OBJ2 = geGetSortedSelectByLine()
  7. Setlist = mapcar('list OBJ1 OBJ2)
  8. F1=car(OBJ1) L1=cadr(OBJ1)
  9. F2=car(OBJ2) L2=cadr(OBJ2)
  10. foreach(Set Setlist
  11. if(caar(Set)~>objType == "pathSeg"
  12. then obj1 = car(leConvertShapeToPathSeg(leConvertShapeToPolygon( caar(Set))) )
  13.      dbDeleteObject(caar(Set))
  14. else obj1 = car(leConvertShapeToPathSeg(leConvertShapeToPolygon( caar(Set))) )
  15. );
  16. if(caadr(Set)~>objType == "pathSeg"
  17. then obj2 = car(leConvertShapeToPathSeg(leConvertShapeToPolygon(caadr(Set))) )
  18.      dbDeleteObject(caadr(Set))
  19. else obj2 = car(leConvertShapeToPathSeg(leConvertShapeToPolygon(caadr(Set))) )
  20. );if   ***IC617 SKILL BUG.Delete extra pathSeg ***
  21. if(xCoord(obj1~>beginPt)==xCoord(obj1~>endPt) && yCoord(obj2~>beginPt)==yCoord(obj2~>endPt)
  22. then  Vline = obj1 Hline = obj2);if
  23. if(xCoord(obj2~>beginPt)==xCoord(obj2~>endPt) && yCoord(obj1~>beginPt)==yCoord(obj1~>endPt)
  24. then  Vline = obj2 Hline = obj1);if

  25. HW  = Hline~>width/2  VW  = Vline~>width/2
  26. HBP = Hline~>beginPt  HEP = Hline~>endPt
  27. VBP = Vline~>beginPt  VEP = Vline~>endPt

  28. xHBP=xCoord(HBP) yHBP=yCoord(HBP)
  29. xHEP=xCoord(HEP) yHEP=yCoord(HEP)
  30. xVBP=xCoord(VBP) yVBP=yCoord(VBP)
  31. xVEP=xCoord(VEP) yVEP=yCoord(VEP)
  32. Space1 = expt((xHBP-xVBP) 2) + expt((yHBP - yVBP) 2)
  33. Space2 = expt((xHBP-xVEP) 2) + expt((yHBP - yVEP) 2)
  34. Space3 = expt((xHEP-xVBP) 2) + expt((yHEP - yVBP) 2)
  35. Space4 = expt((xHEP-xVEP) 2) + expt((yHEP - yVEP) 2)

  36. cond(
  37. (min(Space1 Space2 Space3 Space4) == Space1
  38. dbSetPathSegPoints(Hline list(xVBP-VW yHBP) HEP)
  39. dbSetPathSegPoints(Vline list(xVBP yHBP-HW) VEP)
  40. ; println("1")  shape  L
  41. );
  42. (min(Space1 Space2 Space3 Space4) == Space2
  43. dbSetPathSegPoints(Hline list(xVBP-VW yHBP) HEP)
  44. dbSetPathSegPoints(Vline VBP list(xVEP yHEP+HW))
  45. ; println("2")  shape  F
  46. );
  47. (min(Space1 Space2 Space3 Space4) == Space3
  48. dbSetPathSegPoints(Hline HBP list(xVBP+VW yHEP))
  49. dbSetPathSegPoints(Vline list(xVBP yHBP-HW) VEP)
  50. ; println("3")  shape _|
  51. );
  52. (min(Space1 Space2 Space3 Space4) == Space4
  53. dbSetPathSegPoints(Hline HBP list(xVBP+VW yHEP))
  54. dbSetPathSegPoints(Vline VBP list(xVEP yHEP+HW))
  55. ; println("4")  shape  7
  56. );
  57. );cond
  58. ;CorePoint = list(xVBP yHBP)
  59. LeftDown =list(xVBP-VW yHBP-HW)  LeftUp =list(xVBP-VW yHBP+HW)  
  60. RightDown=list(xVBP+VW yHBP-HW)  RightUp=list(xVBP+VW yHBP+HW)

  61. TechFile = techGetTechFile(geGetEditRep())
  62. CGroupId = cstFindConstraintGroupIn(TechFile "virtuosoDefaultSetup")
  63. MyViaOptions = viaGetViaOptions(CGroupId)
  64. MyViaOptions~>automatic~>minNumCuts= 2
  65. Window = deGetCellView()
  66. NEWVIAS = viaGenerateViasInArea(Window list(LeftDown LeftUp RightUp RightDown) MyViaOptions)
  67. /*************Delete extra Vias***********/
  68.   BigNum = max(MetalLayerNumber(obj1~>layerName) MetalLayerNumber(obj2~>layerName))
  69. SmallNum = min(MetalLayerNumber(obj1~>layerName) MetalLayerNumber(obj2~>layerName))

  70. for(j 0 j=length(NEWVIAS)
  71. if(setof(x nth(j NEWVIAS)~>viaHeader~>master~>shapes~>layerName
  72.          MetalLayerNumber(x)<SmallNum-1||MetalLayerNumber(x)>BigNum+1);setof
  73. then dbDeleteObject(nth(j NEWVIAS))
  74. );if
  75. );for
  76. /***********Delete extra Vias************/
  77. );foreach
  78. );let
  79. );procedure

  80. /**********Number***********/
  81. procedure(MetalLayerNumber( MetalLayerName )
  82. let((MetalList MetalNum)
  83. MetalList=list("Active" "Poly" "Contact" "MET1" "Via1" "MET2" "Via2" "MET3" "Via3" "MET4" "Via4" "UME" "TopVia" "TTOPME" )
  84. for(i 1 length(MetalList)
  85. if(nth(i-1 MetalList)== MetalLayerName
  86. then
  87. MetalNum=i);if
  88. );for
  89. MetalNum
  90. );let
  91. );proc








复制代码
 楼主| 发表于 3 天前 | 显示全部楼层




  1. ;auto add M1_P2 vias on gates, you can define columns, and the vias will get the longest length
  2. (procedure addgatevias(colnumber gate_width_direction)
  3.     cvId = geGetEditCellView()
  4.     tech = techGetTechFile(cvId)
  5.     cw=hiGetCurrentWindow()
  6.     cg=leGetEditFigGroup(cw)
  7.     viaDefId = techFindViaDefByName(tech "m1_p2")
  8.     shapes=geGetSelSet()
  9.     instances=setof(x shapes x~>objType=="inst")
  10.     (foreach inst instances
  11.         p2bbox = getinstlayermaxbbox(inst "P2")
  12.         p2xmin = car(p2bbox)
  13.         p2xmax = nth(1 p2bbox)
  14.         p2ymin = nth(2 p2bbox)
  15.         p2ymax = nth(3 p2bbox)
  16.         p2height = nth(5 p2bbox)
  17.         p2width = nth(4 p2bbox)
  18.         ;vias row number
  19.         ; 0.181 * (row-2)+0.322<p2height-0.2,row
  20.         (if gate_width_direction == "Y" then
  21.             rownum = floor((p2height-0.2-0.322)/0.181+2)
  22.             (if rownum>1 then
  23.                 p2top = (p2height - (0.181 * (rownum-2)+0.322)-0.1)/2
  24.                 p2top = atof(sprintf(nil "%.2f" p2top))
  25.                 ;finger
  26.                 fingurenumber = length(car(getinstbbox(inst "P2")))/2
  27.                 gatewidth = (p2width+0.281)/fingurenumber-0.281
  28.                 via_y = p2ymin + p2height/2
  29.                 (for i 1 fingurenumber
  30.                     via_x = p2xmin + gatewidth/2 + (gatewidth+0.281)*(i-1)
  31.                     viaParams = list(list("cutRows" rownum) list("cutColumns" colnumber) list("layer1Enc" list(0.03 p2top)))
  32.                     newVia = dbCreateVia(cvId viaDefId list(via_x via_y) "R0" viaParams)
  33.                     if(cg then
  34.                         dbAddFigToFigGroup(cg newVia)
  35.                     )
  36.                 )
  37.             )
  38.         else
  39.             rownum = floor((p2width-0.2-0.322)/0.181+2)
  40.             (if rownum>1 then
  41.                 p2top = (p2width - (0.181 * (rownum-2)+0.322)-0.1)/2
  42.                 p2top = atof(sprintf(nil "%.2f" p2top))
  43.                 ;finger
  44.                 fingurenumber = length(car(getinstbbox(inst "P2")))/2
  45.                 gatewidth = (p2height+0.281)/fingurenumber-0.281
  46.                 via_x = p2xmin + p2width/2
  47.                 (for i 1 fingurenumber
  48.                     via_y = p2ymin + gatewidth/2 + (gatewidth+0.281)*(i-1)
  49.                     viaParams = list(list("cutRows" rownum) list("cutColumns" colnumber) list("layer1Enc" list(0.03 p2top)))
  50.                     newVia = dbCreateVia(cvId viaDefId list(via_x via_y) "R90" viaParams)
  51.                     if(cg then
  52.                         dbAddFigToFigGroup(cg newVia)
  53.                     )
  54.                 )
  55.             )
  56.         )
  57.     )
  58. )

  59. ;instance/pcellpatterncell
  60. (procedure getinstbbox(instance layername)
  61.     let((shapes bboxlist x_list y_list getinstbbox)
  62.         shapes=instance~>master~>shapes
  63.         bboxlist=list()
  64.         x_list=list()
  65.         y_list=list()   
  66.         foreach(ss shapes
  67.             if(ss~>layerName==layername then
  68.                 x_list=append1(x_list car(dbTransformPoint(nth(0 ss~>bBox) dbGetInstTransform(instance))))
  69.                 x_list=append1(x_list car(dbTransformPoint(nth(1 ss~>bBox) dbGetInstTransform(instance))))
  70.                 y_list=append1(y_list nth(1 dbTransformPoint(nth(0 ss~>bBox) dbGetInstTransform(instance))))
  71.                 y_list=append1(y_list nth(1 dbTransformPoint(nth(1 ss~>bBox) dbGetInstTransform(instance))))
  72.                 bboxlist=append1(bboxlist list(dbTransformPoint(nth(0 ss~>bBox) dbGetInstTransform(instance)) dbTransformPoint(nth(1 ss~>bBox) dbGetInstTransform(instance))))
  73.             )
  74.         )
  75.         x_list=sort(x_list 'lessp)
  76.         y_list=sort(y_list 'lessp)
  77.         getinstbbox=list(bboxlist x_list y_list)
  78.         getinstbbox
  79.     )
  80. )

  81. ;instancelayer
  82. (procedure getinstlayermaxbbox(instance layername)
  83. let((W H XMax Xmin YMax YMin bboxlist WHList)
  84. WHList=list()
  85. bboxlist=getinstbbox(instance layername)
  86. XMax=nth(length(nth(1 bboxlist))-1 nth(1 bboxlist))
  87. XMin=car(nth(1 bboxlist))
  88. YMax=nth(length(nth(2 bboxlist))-1 nth(2 bboxlist))
  89. YMin=car(nth(2 bboxlist))
  90. W=XMax-XMin
  91. H=YMax-YMin
  92. WHList=list(XMin XMax YMin YMax W H)
  93. WHList
  94. )
  95. )



  96. procedure( CreateAddGateViasForm( )
  97. ;     let( ( rowIntField colIntField alignRadioField xrefStringField yrefStringField xspaceStringField yspaceStringField)
  98.       let(()        
  99. ;; creating the fields
  100.      colIntField =
  101.          hiCreateIntField(
  102.              ?name       'colIntField
  103.              ?prompt     "Via Column number:"
  104.              ?value   1
  105.              )
  106.             
  107.      alignRadioField =
  108.          hiCreateRadioField(
  109.              ?name       'alignRadioField
  110.              ?choices    '( "X" "Y" )
  111.              ?prompt     "Gate Width Direction:"
  112.              ?value      "Y"
  113.              )
  114. ;; creating the form
  115.      hiCreateAppForm(
  116.          ?name       '__AddGateViasForm__  
  117.          ?formTitle  "AddGateVias"
  118.          ;?initialSize list( 300 260 )
  119.          ?fields     list(
  120.                      list(
  121.                          colIntField
  122.                          15:5 350:25 200
  123.                          )
  124.                      list(
  125.                          alignRadioField
  126.                          15:35 250:25 200
  127.                          )
  128.                      )
  129.          ?callback "addgatevias(colIntField~>value alignRadioField~>value)\nalignRadioField~>defvalue=alignRadioField~>value
  130.          "
  131.         )   
  132. ) ;; close let
  133. ) ;; close procedure

  134. procedure( BFaddgateviasForm( )
  135.      unless( boundp( '__AddGateViasForm__ ) && hiIsFormDisplayed( __AddGateViasForm__ )
  136.             CreateAddGateViasForm( )
  137.              )
  138.      ;alignRadioField~>defvalue="Y"
  139.      hiDisplayForm( __AddGateViasForm__ )
  140. ) ;; close procedure
  141. hiSetBindKey("Layout" "Super<Key>N" "BFaddgateviasForm()")


复制代码
 楼主| 发表于 3 天前 | 显示全部楼层




  1. ;instance/pcellpatterncell
  2. (procedure getinstbbox(instance layername)
  3. let((shapes bboxlist x_list y_list getinstbbox)
  4. shapes=instance~>master~>shapes
  5. bboxlist=list()
  6. x_list=list()
  7. y_list=list()
  8. foreach(ss shapes
  9. if(ss~>layerName==layername then
  10. x_list=append1(x_list car(dbTransformPoint(nth(0 ss~>bBox) dbGetInstTransform(instance))))
  11. x_list=append1(x_list car(dbTransformPoint(nth(1 ss~>bBox) dbGetInstTransform(instance))))
  12. y_list=append1(y_list nth(1 dbTransformPoint(nth(0 ss~>bBox) dbGetInstTransform(instance))))
  13. y_list=append1(y_list nth(1 dbTransformPoint(nth(1 ss~>bBox) dbGetInstTransform(instance))))
  14. bboxlist=append1(bboxlist list(dbTransformPoint(nth(0 ss~>bBox) dbGetInstTransform(instance)) dbTransformPoint(nth(1 ss~>bBox) dbGetInstTransform(instance))))
  15. )
  16. )
  17. x_list=sort(x_list 'lessp)
  18. y_list=sort(y_list 'lessp)
  19. getinstbbox=list(bboxlist x_list y_list)
  20. getinstbbox
  21. )
  22. )

  23. ;instancelayer
  24. (procedure getinstlayermaxbbox(instance layername)
  25. let((W H XMax Xmin YMax YMin bboxlist WHList)
  26. WHList=list()
  27. bboxlist=getinstbbox(instance layername)
  28. XMax=nth(length(nth(1 bboxlist))-1 nth(1 bboxlist))
  29. XMin=car(nth(1 bboxlist))
  30. YMax=nth(length(nth(2 bboxlist))-1 nth(2 bboxlist))
  31. YMin=car(nth(2 bboxlist))
  32. W=XMax-XMin
  33. H=YMax-YMin
  34. WHList=list(XMin XMax YMin YMax W H)
  35. WHList
  36. )
  37. )

  38. ;layer spaceinstancesarray
  39. ;x
  40. (procedure autoarrayinstance(aligndirection rownumber colnumber xlayer ylayer xspace yspace)
  41.     let((shapes instances i sorted_instances_y sorted_inst_y sorted_instances_x xstart arr rowarr upinstBottom sorted_rowarr targetinstLeft sorted_inst sorted_inst_x targetinstTop lastinstRight)
  42.         if(aligndirection=="X" then
  43.             shapes=geGetSelSet()
  44.             println(length(shapes))
  45.             instances=setof(x shapes x~>objType=="inst")
  46.             sorted_instances_y=sort(instances lambda((a b) nth(1,a~>xy) >= nth(1,b~>xy)))
  47.             sorted_inst_y=nth(1,nth(0 sorted_instances_y)~>xy)
  48.             instances=setof(x shapes x~>objType=="inst")
  49.             sorted_instances_x=sort(instances lambda((a b) nth(0,a~>xy) <= nth(0,b~>xy)))
  50.             xstart=nth(0,nth(0 sorted_instances_x)~>xy)
  51.             arr=list()
  52.             ;i-1n-1
  53.             i=0
  54.             rowarr=list()
  55.             upinstBottom=nth(3 getinstlayermaxbbox(car(sorted_instances_y) ylayer))+yspace
  56.             foreach(obj sorted_instances_y
  57.                 if(i<colnumber then
  58.                     rowarr=append1(rowarr obj)
  59.                     i=i+1
  60.                 )
  61.                 if(i==colnumber || obj==nth(i sorted_instances_y) then
  62.                     ;nlistlistylist
  63.                     sorted_rowarr=sort(rowarr lambda((a b) nth(0,a~>xy) <= nth(0,b~>xy)))
  64.                     ;nxy
  65.                     foreach(sorted_inst sorted_rowarr
  66.                         targetinstLeft=nth(0 getinstlayermaxbbox(sorted_inst xlayer))
  67.                         ;x +shift
  68.                         if(sorted_inst==car(sorted_rowarr) then
  69.                             sorted_inst_x=xstart
  70.                         else
  71.                             sorted_inst_x=nth(0 sorted_inst~>xy)-(targetinstLeft-xspace-lastinstRight)  
  72.                         )
  73.                         targetinstTop=nth(3 getinstlayermaxbbox(sorted_inst ylayer))
  74.                         sorted_inst_y=nth(1 sorted_inst~>xy)+(upinstBottom-targetinstTop-yspace)
  75.                         sorted_inst~>xy=list(sorted_inst_x sorted_inst_y)
  76.                         println(sorted_inst~>xy)
  77.                         println(sorted_inst~>xy)
  78.                         lastinstRight=nth(1 getinstlayermaxbbox(sorted_inst xlayer))
  79.                         
  80.                     )
  81.                     upinstBottom=nth(2 getinstlayermaxbbox(car(sorted_rowarr) ylayer))
  82.                     rowarr=list()
  83.                     i=0
  84.                 )
  85.             )
  86.         )
  87.         if(aligndirection=="Y" then
  88.             shapes=geGetSelSet()
  89.             instances=setof(x shapes x~>objType=="inst")
  90.             sorted_instances_x=sort(instances lambda((a b) nth(0,a~>xy) <= nth(0,b~>xy)))
  91.             sorted_inst_x=nth(0,nth(0 sorted_instances_x)~>xy)
  92.             instances=setof(x shapes x~>objType=="inst")
  93.             sorted_instances_y=sort(instances lambda((a b) nth(1,a~>xy) >= nth(1,b~>xy)))
  94.             ystart=nth(1,nth(0 sorted_instances_y)~>xy)
  95.             arr=list()
  96.             ;i-1n-1
  97.             i=0
  98.             colarr=list()
  99.             leftinstRight=nth(0 getinstlayermaxbbox(car(sorted_instances_x) xlayer))-xspace
  100.             foreach(obj sorted_instances_x
  101.                 if(i<rownumber then
  102.                     colarr=append1(colarr obj)
  103.                     i=i+1
  104.                 )
  105.                 if(i==rownumber || obj==nth(i sorted_instances_x) then
  106.                     ;nlistlistylist
  107.                     sorted_colarr=sort(colarr lambda((a b) nth(1,a~>xy) >= nth(1,b~>xy)))
  108.                     ;nxy
  109.                     foreach(sorted_inst sorted_colarr
  110.                         targetinstTop=nth(3 getinstlayermaxbbox(sorted_inst ylayer))
  111.                         ;y +shift
  112.                         if(sorted_inst==car(sorted_colarr) then
  113.                             sorted_inst_y=ystart
  114.                         else
  115.                             sorted_inst_y=nth(1 sorted_inst~>xy)-(targetinstTop+yspace-upinstBottom)  
  116.                         )
  117.                         targetinstLeft=nth(0 getinstlayermaxbbox(sorted_inst xlayer))
  118.                         sorted_inst_x=nth(0 sorted_inst~>xy)+(leftinstRight-targetinstLeft+xspace)
  119.                         sorted_inst~>xy=list(sorted_inst_x sorted_inst_y)
  120.                         println(sorted_inst~>xy)
  121.                         upinstBottom=nth(2 getinstlayermaxbbox(sorted_inst ylayer))
  122.                         
  123.                     )
  124.                     leftinstRight=nth(1 getinstlayermaxbbox(car(sorted_colarr) xlayer))
  125.                     colarr=list()
  126.                     i=0
  127.                 )
  128.             )
  129.         )
  130.     )
  131. )


  132. procedure( CreateAutoArrayForm( )
  133. ;     let( ( rowIntField colIntField alignRadioField xrefStringField yrefStringField xspaceStringField yspaceStringField)
  134.       let(()        
  135. ;; creating the fields
  136.      rowIntField =
  137.          hiCreateIntField(
  138.              ?name       'rowIntField
  139.              ?prompt     "Row number:"
  140.              )
  141.      colIntField =
  142.          hiCreateIntField(
  143.              ?name       'colIntField
  144.              ?prompt     "Column number:"
  145.              )
  146.             
  147.      alignRadioField =
  148.          hiCreateRadioField(
  149.              ?name       'alignRadioField
  150.              ?choices    '( "X" "Y" )
  151.              ?prompt     "first align direction:"
  152.              ?value      "X"
  153.              )
  154.      alignRadioField2 =
  155.          hiCreateRadioField(
  156.              ?name       'alignRadioField2
  157.              ?choices    '( "X" "Y" )
  158.              ?prompt     "first align direction:"
  159.              ?value      "X"
  160.              ?callback   
  161.                 list(
  162.                     lambda((field scope selection)
  163.                         let((editable)
  164.                             editable=if(selection=="On" t nil)
  165.                             hiGetCurrentForm()->eddyStringField1->editable=editable
  166.                             hiGetCurrentForm()->eddyStringField2->editable=editable
  167.                         )
  168.                     )
  169.                 )
  170.          )
  171.      xrefStringField =
  172.          hiCreateStringField(
  173.              ?name       'xrefStringField
  174.              ?prompt     "X Reference layer:"
  175.              )
  176.      yrefStringField =
  177.          hiCreateStringField(
  178.              ?name       'yrefStringField
  179.              ?prompt     "Y Reference layer:"
  180.              )
  181.      xspaceFloatField =
  182.          hiCreateFloatField(
  183.              ?name       'xspaceFloatField
  184.              ?prompt     "X space:"
  185.              )
  186.      yspaceFloatField =
  187.          hiCreateFloatField(
  188.              ?name       'yspaceFloatField
  189.              ?prompt     "Y space:"
  190.              )
  191. ;; creating the form
  192.      hiCreateAppForm(
  193.          ?name       '__autoArrayForm__  
  194.          ?formTitle  "Auto Array"
  195.          ;?initialSize list( 300 260 )
  196.          ?fields     list(
  197.                      list(
  198.                          alignRadioField
  199.                          15:5 350:25 200
  200.                          )
  201.                      list(
  202.                          rowIntField
  203.                          15:35 250:25 200
  204.                          )
  205.                      list(
  206.                          colIntField
  207.                          300:35 250:25 200
  208.                          )
  209.                      list(
  210.                          xrefStringField
  211.                          15:80 250:25 200
  212.                          )
  213.                      list(
  214.                          yrefStringField
  215.                          300:80 250:25 200
  216.                          )
  217.                      list(
  218.                          xspaceFloatField
  219.                          15:120 250:25 200
  220.                          )
  221.                      list(
  222.                          yspaceFloatField
  223.                          300:120 250:25 200
  224.                          )
  225.                      )
  226.          ?callback "autoarrayinstance(alignRadioField~>value rowIntField~>value colIntField~>value xrefStringField~>value yrefStringField~>value xspaceFloatField~>value yspaceFloatField~>value)
  227.          "
  228.         )   
  229. ) ;; close let
  230. ) ;; close procedure

  231. procedure( BFautoArrayForm( )
  232.      unless( boundp( '__autoArrayForm__ ) && hiIsFormDisplayed( __autoArrayForm__ )
  233.              CreateAutoArrayForm( )
  234.              )
  235.      hiDisplayForm( __autoArrayForm__ )
  236. ) ;; close procedure
  237. hiSetBindKey("Layout" "Super<Key>A" "BFautoArrayForm()")


复制代码
您需要登录后才可以回帖 登录 | 注册

本版积分规则

关闭

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

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

GMT+8, 2024-4-29 01:33 , Processed in 0.031132 second(s), 7 queries , Gzip On, Redis On.

eetop公众号 创芯大讲堂 创芯人才网
快速回复 返回顶部 返回列表