1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
| procedure( PadCoMenu(@optional (phys_Layer nil) (name_Layer nil))
glayerframe=hiCreateFrameField(
?name 'glayerframeid
?labelText "Layers definitions"
?enabled t
)
gtext1frame=hiCreateFrameField(
?name 'gtext1frameid
?labelText " This layer must be copied at the top level"
?enabled t
)
gtext2frame=hiCreateFrameField(
?name 'gtext2frameid
?labelText " ( You can generate it : pad or pad = pad )"
?enabled t
)
techFile = techGetTechFile(geGetEditCellView())
phys_Layer = hiCreateLayerCyclicField(techFile "Physical Layer of Pads" "" leGetValidLayerList(techFile) car(geGetSelSet())~>lpp)
phys_Layer->hiFieldSym='field1
name_Layer = hiCreateLayerCyclicField(techFile "Layer of Pads Names " "" leGetValidLayerList(techFile) car(geGetSelSet())~>lpp)
name_Layer->hiFieldSym='field2
hiCreateAppForm(
?name 'PadCoForm
?formTitle "Pads Coordinates"
?fields list(
list(glayerframe 10:0 300:150 20)
list(phys_Layer 18:25 250:39 155)
list(gtext1frame 15:65 290:20 15)
list(gtext2frame 15:80 290:20 16)
list(name_Layer 18:105 250:39 155)
) ; list
?callback "CCSpadCoord()"
) ; hiCreateAppForm
hiDisplayForm(PadCoForm)
) ; procedure
procedure( CCSpadCoord( )
;prog( (obj objlist1 objlist2 newObjects physLayer nameLayer)
;if(!geGetSelSet() then
;printf(" \n")
;printf("Select something first dunderhead!")
;printf(" \n")
;return(nil)
;)
;obj=nil
;objlist1=geSelSet()
;objlist2=nil
; declares local variables that will be cleared when the program exits
let( (cv myPort allpins allpads physLayer nameLayer)
physLayer=phys_Layer->value
nameLayer=name_Layer->value
; if fromLayer is only the layer name then
; get the purpose from the selected object itself
if( length(physLayer)==1 then
physLayer=list( physLayer cadr(car(geGetSelSet())~>lpp) )
)
if( length(physLayer)==4 then
physLayer=parseString( cadddr( physLayer ) " ()" )
)
; if fromLayer is only the layer name then
; get the purpose from the selected object itself
if( length(nameLayer)==1 then
nameLayer=list( nameLayer cadr(car(geGetSelSet())~>lpp) )
)
if( length(nameLayer)==4 then
nameLayer=parseString( cadddr( nameLayer ) " ()" )
)
cv=geGetWindowCellView()
; opens a file handle to write the output
myPort = outfile("./myPadCoordinates.log")
printf("\n---------------------------------------------------------\n\n")
printf("analyzing the cell : %s %s \n\n",cv~>libName,cv~>cellName)
printf("Physical layer : %s %s\n",car(physLayer),cadr(physLayer))
printf("Pad Name layer : %s %s\n\n",car(nameLayer),cadr(nameLayer))
; the following code only identifies metal1 pin
;allpins = setof(x cv~>shapes (x~>purpose=="pin" && x~>layerName=="metal1"))
;if pins of all layers are required, use this instead
allpins = setof(x cv~>shapes (x~>layerName==car(nameLayer) && x~>purpose==cadr(nameLayer)))
; the following code identifies all the pads
allpads = setof(y cv~>shapes y~>layerName==car(physLayer))
;foreach( pinshape allpins
; printf("\npin : %s\t\t%e\t%e\n",pinshape~>theLabel,car(centerBox(pinshape~>bBox)),cadr(centerBox(pinshape~>bBox)))
;)
;foreach( padshape allpads
; printf("\npad : \t\t%L\t%e\t%e\t%e\t%e\n",centerBox(padshape~>bBox),leftEdge(padshape~>bBox),rightEdge(padshape~>bBox),bottomEdge(padshape~>bBox),topEdge(padshape~>bBox))
;)
printf("Pad coordinates will be written to a log file named myPadCoordinates.log\n")
; use fprintf instead of printf when writing to a file
printf("Pad coordinates list created on : %s\n\n" getCurrentTime())
fprintf(myPort "Pad coordinates list created on : %s\n\n" getCurrentTime())
printf("Pad name\t\tCentre Coordinates\n")
fprintf(myPort "Pad name\t\tCentre Coordinates\n")
printf("========\t\t==================\n")
fprintf(myPort "========\t\t==================\n")
; for each pin in the layout, check the corresponding pad below it
padnum = 0
foreach( pinshape allpins
foreach( padshape allpads
if(
; a pad is associated with a particular pin if it encloses it
(leftEdge(padshape~>bBox) < car(centerBox(pinshape~>bBox))) &&
(rightEdge(padshape~>bBox) > car(centerBox(pinshape~>bBox))) &&
(bottomEdge(padshape~>bBox) < cadr(centerBox(pinshape~>bBox))) &&
(topEdge(padshape~>bBox) > cadr(centerBox(pinshape~>bBox))) then
;option adds tab spacing to the output
fprintf(myPort " %s\t\t\t%L\n",pinshape~>theLabel,centerBox(padshape~>bBox))
printf(" %s\t\t\t%L\n",pinshape~>theLabel,centerBox(padshape~>bBox))
padnum = padnum +1
))) ; if , foreach , foreach
fprintf(myPort "========\t\t==================\n")
fprintf(myPort "\nNumber of pads : %d \n\n",padnum)
printf("Number of pads : %d \n",padnum)
printf("\n\n---------------------------------------------------------\n")
close(myPort) ; close the file handle
myPort = nil ; remove it from memory
);end of let
);end of procedure |