-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapmom.il
381 lines (340 loc) · 10.1 KB
/
apmom.il
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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
procedure(PREFIX_mopCB(param) ;_Feb 8 06 quoc 1194
let((procName cdfId libName cellName dpt grid scale sGrid epsilon
minW maxW minL maxL minF maxF minM maxM todo paramId w l m fingers botlevMx toplevMx botlev toplev dwCap dlCap minArea maxArea
)
procName = "PREFIX_mopCB"
cdfId = cdfgData
caseq( concat(cdfId~>type)
((cellData baseCellData userCellData)
libName = cdfId~>id~>lib~>name
cellName = cdfId~>id~>name
)
(instData
libName = cdfId~>id~>master~>libName
cellName = cdfId~>id~>master~>cellName
)
(t
PasAttention()
error("%s: unexpected CDF data type - %L" procName cdfId~>type)
)
) ; ** caseq concat **
dpt = PasGetPdkParams(libName cellName)
grid = dpt->grid
scale = dpt->scale
sGrid = grid*scale
epsilon = sGrid/10.0
minL = PREFIX_mopValue('l ?dpt dpt ?type 'min)
maxL = PREFIX_mopValue('l ?dpt dpt ?type 'max)
minF = PREFIX_mopValue('fingers ?dpt dpt ?type 'min)
maxF = PREFIX_mopValue('fingers ?dpt dpt ?type 'max)
minM = PREFIX_mopValue('m ?dpt dpt ?type 'min)
maxM = PREFIX_mopValue('m ?dpt dpt ?type 'max)
minW = PREFIX_mopValue('w ?dpt dpt ?type 'min)
maxW = PREFIX_mopValue('w ?dpt dpt ?type 'max)
;; process param argument
todo = list(nil)
caseq( param
(l
paramId = cdfId->l
PasCdfValidateFloat(cdfId->l ?min minL ?max maxL ?grid sGrid ?mode 'extreme)
)
(fingers
paramId = cdfId->fingers
PasCdfValidateInt(cdfId->fingers ?min minF ?max maxF ?mode 'extreme)
)
(w
paramId = cdfId->w
PasCdfValidateFloat(cdfId->w ?min minW ?max maxW ?mode 'extreme)
)
(m
paramId = cdfId->m
PasCdfValidateInt(cdfId->m ?min minM ?max maxM ?mode 'extreme)
)
;add for momcap
( (botlev toplev)
PasCdfValidateInt(paramId ?min 1 ?max 3 ?mode 'extreme)
)
( (botlevMx toplevMx)
botlevMx=cdfId->botlevMx->value
toplevMx=cdfId->toplevMx->value
case(botlevMx
("M1" botlev=1)
("M2" botlev=2)
("M3" botlev=3)
);case
case(toplevMx
("M1" toplev=1)
("M2" toplev=2)
("M3" toplev=3)
);case
if(botlev>toplev then
botlev=toplev
botlevMx=toplevMx
);if
PasCdfSetValue(cdfId->botlev botlev t)
PasCdfSetValue(cdfId->toplev toplev t)
PasCdfSetValue(cdfId->botlevMx botlevMx t)
PasCdfSetValue(cdfId->toplevMx toplevMx t)
;PasCdfCommitValue(paramId)
)
) ; ** caseq param **
todo = reverse(todo)
;try to fix min area of apmom
w = cdfParseFloatString(cdfId->w->value)
l = cdfParseFloatString(cdfId->l->value)
if( (cdfId~>id~>master~>cellName =="mom" ||cdfId~>id~>name=="mom") && numberp(w) && numberp(l) then
dw = dpt->dwCap * scale
dl = dpt->dlCap * scale
calculated_area = w * l
minA = dpt->minArea * scale * scale
maxA = dpt->maxArea * scale * scale
if(calculated_area >maxA || calculated_area<minA then
w = dw
l = dl
PasWarn("Area of APMOM invalid, set to default value !")
)
)
PasCdfSetValue(cdfId->w w)
PasCdfSetValue(cdfId->l l)
) ; ** let **
) ; ** procedure PREFIX_mopCB **
procedure(PREFIX_mopValue( ;_Feb 18 03 quoc 1759
param
@key
(dpt nil)
(id nil)
(type 'default)
(returnString nil)
(fingers nil)
)
prog((procName libName cellName scale error_msg retValue)
procName = "PREFIX_mopValue"
;; check required arguments
cond(
(dpt
if( !tablep(dpt) then
PasAttention()
error("%s: ?dpt argument must be a table - %L" procName dpt)
)
libName = dpt->libName
if( !libName then
libName = "Unknown_Lib"
)
cellName = dpt->cellName
if( !cellName then
cellName = "Unknown_Cell"
)
)
(id
if( cdfIsId(id) then
caseq( concat(id~>type)
((cellData baseCellData userCellData)
libName = id~>id~>lib~>name
cellName = id~>id~>name
)
(instData
libName = id~>id~>master~>libName
cellName = id~>id~>master~>cellName
)
(t
PasAttention()
error("%s: unexpected ?id argument - %L" procName id)
)
) ; ** caseq concat **
dpt = PasGetPdkParams(libName cellName)
else
PasAttention()
error("%s: unexpected ?id argument - %L" procName id)
) ; ** if cdfIsId **
)
(t
PasAttention()
error("%s: either ?dpt or ?id argument must be specified" procName)
)
) ; ** cond dpt **
scale = dpt->scale
if( numberp(scale) then
scale = float(scale)
else
PasAttention()
error("%s: scale property must be a number - %L" procName scale)
) ; ** if numberp **
error_msg = "%s: '%s' value is not applicable to the '%s' parameter"
;; process param argument
caseq( param
(model
caseq( type
(default
retValue = dpt->model
if( !stringp(retValue) then
retValue = ""
)
)
(t
PasAttention()
error(error_msg procName type param)
)
) ; ** caseq type **
)
(w
caseq( type
((min minimum)
retValue = dpt->mwCap
)
((max maximum)
retValue = dpt->xwCap
)
(default
retValue = dpt->dwCap || dpt->mwCap
)
(t
PasAttention()
error(error_msg procName type param)
)
) ; ** caseq type **
if( retValue then
if( numberp(retValue) then
retValue = float(retValue)*scale
else
PasAttention()
error("%s: %s width value for %s is not a number - %L"
procName type cellName retValue)
) ; ** if numberp **
else
PasAttention()
error("%s: unable to determine the %s width for '%s/%s'"
procName type libName cellName)
) ; ** if retValue **
)
(l
caseq( type
((min minimum)
retValue = dpt->mlCap
)
((max maximum)
retValue = dpt->xlCap
)
(default
retValue = dpt->dlCap || dpt->mlCap
)
(t
PasAttention()
error(error_msg procName type param)
)
) ; ** caseq type **
if( retValue then
if( numberp(retValue) then
retValue = float(retValue)*scale
else
PasAttention()
error("%s: %s length value for %s is not a number - %L"
procName type cellName retValue)
) ; ** if numberp **
else
PasAttention()
error("%s: unable to determine the %s length for '%s/%s'"
procName type libName cellName)
) ; ** if retValue **
)
(m
caseq( type
((min minimum)
retValue = 1
)
((max maximum)
retValue = dpt->maxM
)
(default
retValue = 1
)
(t
PasAttention()
error(error_msg procName type param)
)
) ; ** caseq type **
if( retValue then
if( numberp(retValue) then
retValue = float(retValue)
else
PasAttention()
error("%s: %s multiplier value for %s is not a number - %L"
procName type cellName retValue)
) ; ** if numberp **
else
PasAttention()
error("%s: unable to determine the %s multiplier for '%s/%s'"
procName type libName cellName)
) ; ** if retValue **
)
(fingers
caseq( type
((min minimum)
retValue = 1
)
((max maximum)
retValue = dpt->maxFingers
)
(default
retValue = 1
)
(t
PasAttention()
error(error_msg procName type param)
)
) ; ** caseq type **
if( retValue then
if( numberp(retValue) then
retValue = float(retValue)
else
PasAttention()
error("%s: %s finger value for %s is not a number - %L"
procName type cellName retValue)
) ; ** if numberp **
else
PasAttention()
error("%s: unable to determine the %s finger for '%s/%s'"
procName type libName cellName)
) ; ** if retValue **
)
) ; ** caseq param **
;; format retValue
if( returnString then
caseq( type(retValue)
(string
;; nothing to do
)
(flonum
retValue = aelSuffixNotation(retValue 6)
;; retValue = sprintf(nil "%g" retValue)
)
(fixnum
retValue = sprintf(nil "%d" retValue)
)
(t ;; list, table, etc.
retValue = sprintf(nil "%L" retValue)
)
) ; ** caseq type **
) ; ** if returnString **
return(retValue)
) ; ** prog **
) ; ** procedure PREFIX_mopValue **
procedure(PREFIX_mopDisplay(param) ;_Feb 18 03 quoc 668
prog((retValue cdfId cv)
retValue = nil
cdfId = cdfgData
cv = geGetEditCellView()
caseq( param
(showSimParams
if( cv~>cellViewType == "maskLayout" then
retValue = t
)
)
( model
if( cv~>cellViewType != "maskLayout" || cdfId~>showSimParams~>value then
retValue = t
)
)
) ; ** caseq param **
return(retValue)
) ; ** prog **
) ; ** procedure PREFIX_mopDisplay **