fix_mos_gt_add_Group
已有 71 次阅读|
2025-10-20 16:16
|系统分类:芯片设计
procedure(fix_mos_gt()
let((instList tech viaParams )
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
VIA1_Space=0.25 ; via space
VIA1_M1_enc=0.1 ;via enclosure
VIA1_Width=0.22 ;via width
GT_OD_Space=0.22 ;space width
GT_Width=0.7 ;gate connect width
CO="M1_POLYc"
GT_Layer=list("POLY" "drawing")
CO_Layer=list("CONT" "drawing")
AA_Layer=list("DIFF" "drawing")
Direction_GT=1 ;0=>top or right 1=>bottom or left ;0=>turn to mutil ct mode
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;init ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
All_tmp_AA_List=nil
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
cv = geGetEditCellView(getCurrentWindow())
tech = techGetTechFile(cv)
instList = geGetSelSet()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
myList= '()
foreach(inst instList
List_temp=Add_GT_Metal1( inst)
printf("List_temp %A\n" List_temp)
;List=list(List_temp)
;myList=append(myList List)
myList=append(myList List_temp)
);end foreach
printf("myList %A\n" myList)
if(car(instList)~>figGroup then
myGroup=list(car(instList)~>figGroup) ; add SelectFigs group
leReturn() ;return one level
printf("myGroup %A\n" myGroup)
myList=append(myList myGroup)
a=geSelectFigs(myList) ;diff locate layer cant figs
myNewGroup=leHiCreateGroup();newGroup
printf("myNewGroup %A\n" myNewGroup)
myId2=geGetSelSet()
printf("instList %A\n" instList)
printf("myId2 %A\n" myId2)
leHiEditInPlace()
aUnGroup=geSelectFigs(myGroup);ungroup old group
bUnGroup=leHiUngroup()
printf("geSelectFigs %A\n" a)
printf("bUnGroup %A\n" bUnGroup)
printf("UnGroupgeSelectFigs %A\n" aUnGroup)
else
printf("myGroup %A\n" myGroup)
printf("instList %A\n" instList)
);if
) ;endlet
)
procedure(Add_GT_Metal1( inst)
prog((aa_shapes_List gate_shapes_List shapes)
shapes = inst~>master~>shapes
gate_shapes_List=setof(one shapes one~>lpp == GT_Layer)
aa_shapes_List=setof(one shapes one~>lpp == AA_Layer)
GT_shapes_List=Add_GT(gate_shapes_List inst)
AA_shapes_List=Add_AA_gt(aa_shapes_List inst)
newShapes_List = dbLayerAndNot(cv GT_Layer GT_shapes_List AA_shapes_List ); list
printf("newShapes_List %A\n" newShapes_List)
mapcar( lambda((xx) dbDeleteObject(xx)) GT_shapes_List)
mapcar( lambda((xx) dbDeleteObject(xx)) AA_shapes_List)
Gate_Shapes=Direction_Chooce(inst newShapes_List)
;dbMoveFig(Gate_Shapes cv list(x_offset:y_offset "R0"))
foreach( newShapes Gate_Shapes
anBBox=newShapes~>bBox
if(Direction_GT ==1 && Direction_mos == "V" then
;anBBox = list(leftEdge(anBBox):bottomEdge(anBBox) rightEdge(anBBox):bottomEdge(anBBox)- (GT_Width + GT_OD_Space))
anBBox = list(leftEdge(anBBox):bottomEdge(anBBox)+GT_OD_Space rightEdge(anBBox):bottomEdge(anBBox)- GT_Width)
so_anBBox = list(leftEdge(anBBox):bottomEdge(anBBox) rightEdge(anBBox):bottomEdge(anBBox)-2*(GT_Width+GT_OD_Space)+2*VIA1_M1_enc+VIA1_Width)
;anBBox = list(leftEdge(anBBox):bottomEdge(anBBox) rightEdge(anBBox):bottomEdge(anBBox)- GT_Width)
;;;add via
tech=techGetTechFile(cv)
;cPt=hiBoxCenter(anBBox)
cPt=hiBoxCenter(so_anBBox)
overlap_width=abs(xCoord(nth(0 anBBox)) - xCoord(nth(1 anBBox)))
overlap_height=abs(yCoord(nth(0 anBBox)) - yCoord(nth(1 anBBox)))
;via1DefId =techFindViaDefByName(tech viaName)
via1DefId =techFindViaDefByName(tech CO)
;rows=floor(( overlap_height - VIA1_M1_enc * 2.0 + VIA1_Space + 0.01) / (VIA1_Width +VIA1_Space))
rows=1
columns=floor(( overlap_width - VIA1_M1_enc * 2.0 +VIA1_Space + 0.01) / (VIA1_Width +VIA1_Space))
if(columns<=1 then
columns=1
)
viaParams=list(list("cutSpacing" list(VIA1_Space VIA1_Space)) ;via1 space
list("layer1Enc" list(VIA1_M1_enc VIA1_M1_enc));via1 enc
list("layer2Enc" list(VIA1_M1_enc VIA1_M1_enc));via1 enc
list("cutRows" rows)
list("cutColumns" columns)
)
;viaParams_List=ViaParams(via1DefId~>name overlap_width overlap_height)
viaParams_List=viaParams ;printf("debug == %L\n" viaParams_List)
;temp=dbCreateVia(cv via1DefId cPt Rotation viaParams_List)
temp=dbCreateVia(cv via1DefId cPt "R0" viaParams_List)
printf("temp %A\n" temp)
;;;add via
)
if(Direction_GT ==0 && Direction_mos == "V" then
anBBox = list(leftEdge(anBBox):topEdge(anBBox) rightEdge(anBBox):topEdge(anBBox) + GT_Width)
)
if(Direction_GT ==1 && Direction_mos == "H" then
;anBBox = list(leftEdge(anBBox)- GT_Width :bottomEdge(anBBox) leftEdge(anBBox):topEdge(anBBox) )
anBBox = list(leftEdge(anBBox)- GT_Width :bottomEdge(anBBox) leftEdge(anBBox)+GT_OD_Space:topEdge(anBBox) )
;so_anBBox = list(leftEdge(anBBox)- GT_Width :bottomEdge(anBBox) leftEdge(anBBox)+(GT_Width+GT_OD_Space):topEdge(anBBox) )
so_anBBox = list(leftEdge(anBBox)+2*VIA1_M1_enc+VIA1_Width:bottomEdge(anBBox) leftEdge(anBBox):topEdge(anBBox) )
;;;add via
tech=techGetTechFile(cv)
cPt=hiBoxCenter(so_anBBox)
overlap_width=abs(xCoord(nth(0 anBBox)) - xCoord(nth(1 anBBox)))
overlap_height=abs(yCoord(nth(0 anBBox)) - yCoord(nth(1 anBBox)))
via1DefId =techFindViaDefByName(tech CO)
rows=floor(( overlap_height - VIA1_M1_enc * 2.0 + VIA1_Space + 0.01) / (VIA1_Width +VIA1_Space))
;columns=floor(( overlap_width - VIA1_M1_enc * 2.0 +VIA1_Space + 0.01) / (VIA1_Width +VIA1_Space))
columns=1
if(rows<=1 then
rows=1
)
viaParams=list(list("cutSpacing" list(VIA1_Space VIA1_Space)) ;via1 space
list("layer1Enc" list(VIA1_M1_enc VIA1_M1_enc));via1 enc
list("layer2Enc" list(VIA1_M1_enc VIA1_M1_enc));via1 enc
list("cutRows" rows)
list("cutColumns" columns)
)
viaParams_List=viaParams ;printf("debug == %L\n" viaParams_List)
temp=dbCreateVia(cv via1DefId cPt "R0" viaParams_List)
printf("temp %A\n" temp)
;;;add via
)
if(Direction_GT ==0 && Direction_mos == "H" then
anBBox = list(rightEdge(anBBox) + GT_Width:bottomEdge(anBBox) rightEdge(anBBox):topEdge(anBBox) )
)
newShapes~>bBox=anBBox ;this is change gate rect
myNewShapes=newShapes ;this is change gate rect
;build_plus = dbCopyFig(newShapes cv inst~>transform) ;want to build select puls
cPt=hiBoxCenter(anBBox)
;Add_Via(cPt anBBox CO "R0")
);end foreach
printf("myNewShapes %A\n" myNewShapes)
return(list(myNewShapes temp))
);end let
)
procedure(Direction_Chooce(inst newShapes)
prog((xcoord_list shapes_tmp yy_offset myList_X myList_Y xxxx)
myList_X=nil
myList_Y=nil
newShapes_tmp =nil
foreach(one newShapes
myList_X=append1(myList_X xCoord(hiBoxCenter(one~>bBox)))
myList_Y=append1(myList_Y yCoord(hiBoxCenter(one~>bBox)))
)
myList_X=sort(myList_X lambda((a b) lessp(a b)))
myList_Y=sort(myList_Y lambda((a b) lessp(a b)))
cond(
(inst~>orient=="R0" || inst~>orient=="R180" || inst~>orient=="MY" || inst~>orient=="MX"
Direction_mos = "V"
if(Direction_GT ==0 then
foreach(xxxx newShapes
if(yCoord(hiBoxCenter(xxxx~>bBox)) != car(myList_Y) then
newShapes_tmp=append1(newShapes_tmp xxxx)
else
dbDeleteObject(xxxx)
)
)
return(newShapes_tmp)
else
foreach(xxxx newShapes
if(yCoord(hiBoxCenter(xxxx~>bBox)) != nth( length(myList_Y)-1 myList_Y) then
newShapes_tmp=append1(newShapes_tmp xxxx)
else
dbDeleteObject(xxxx)
)
)
return(newShapes_tmp)
)
)
(inst~>orient=="R90" || inst~>orient=="R270" || inst~>orient=="MYR90" || inst~>orient=="MXR90"
Direction_mos = "H"
if(Direction_GT == 0 then
foreach(xxxx newShapes
if(xCoord(hiBoxCenter(xxxx~>bBox)) != car(myList_X) then
newShapes_tmp=append1(newShapes_tmp xxxx)
else
dbDeleteObject(xxxx)
)
)
return(newShapes_tmp)
else
foreach(xxxx newShapes
if(xCoord(hiBoxCenter(xxxx~>bBox)) != nth(length(myList_X)-1 myList_X) then
newShapes_tmp=append1(newShapes_tmp xxxx)
else
dbDeleteObject(xxxx)
)
)
return(newShapes_tmp)
)
)
)
)
)
procedure(Add_AA_gt(shapes inst)
prog((AA_tmp)
temp0_AA_List=nil
foreach(shape shapes
AA_tmp = dbCopyFig(shape cv inst~>transform)
temp0_AA_List=append1(temp0_AA_List AA_tmp)
;printf("debug>>> %L" car(AA_tmp~>bBox))
All_tmp_AA_List=append1(All_tmp_AA_List AA_tmp~>bBox)
)
return(temp0_AA_List)
)
)
procedure(Add_GT(shapes inst)
prog((GT_tmp)
temp0_GT_List=nil
foreach(shape shapes
GT_tmp = dbCopyFig(shape cv inst~>transform)
temp0_GT_List=append1(temp0_GT_List GT_tmp)
)
return(temp0_GT_List)
)
)
;;procedure(Add_Via(cPt anBBox viaName Rotation)
;;let((tech via1DefId viaParams_List temp)
;; tech=techGetTechFile(cv)
;; overlap_width=abs(xCoord(nth(0 anBBox)) - xCoord(nth(1 anBBox)))
;; overlap_height=abs(yCoord(nth(0 anBBox)) - yCoord(nth(1 anBBox)))
;; via1DefId =techFindViaDefByName(tech viaName)
;; viaParams_List=ViaParams(via1DefId~>name overlap_width overlap_height)
;; ;printf("debug == %L\n" viaParams_List)
;; temp=dbCreateVia(cv via1DefId cPt Rotation viaParams_List)
;; )
;;)
;;procedure(ViaParams(vianame overlap_width overlap_height)
;;prog((rows columns viaParams)
;; rows=floor(( overlap_height - VIA1_M1_enc * 2.0 + VIA1_Space + 0.01) / (VIA1_Width +VIA1_Space))
;; columns=floor(( overlap_width - VIA1_M1_enc * 2.0 +VIA1_Space + 0.01) / (VIA1_Width +VIA1_Space))
;; if(rows<=1 then
;; rows=1
;; )
;; if(columns<=1 then
;; columns=1
;; )
;; ;printf("debug %L == %L %L == %L \n" VIA1_M1_enc VIA1_Space rows colums)
;; viaParams=list(list("cutSpacing" list(VIA1_Space VIA1_Space)) ;via1 space
;; list("layer1Enc" list(VIA1_M1_enc VIA1_M1_enc));via1 enc
;; list("layer2Enc" list(VIA1_M1_enc VIA1_M1_enc));via1 enc
;; list("cutRows" rows)
;; list("cutColumns" columns)
;; )
;; return(viaParams)
;;)
;;)