1 // *****************************************************************************
2 // *****************************************************************************
3 // Copyright 2013 - 2015, Cadence Design Systems
4 //
5 // This file is part of the Cadence LEF/DEF Open Source
6 // Distribution, Product Version 5.8.
7 //
8 // Licensed under the Apache License, Version 2.0 (the "License");
9 // you may not use this file except in compliance with the License.
10 // You may obtain a copy of the License at
11 //
12 // http://www.apache.org/licenses/LICENSE-2.0
13 //
14 // Unless required by applicable law or agreed to in writing, software
15 // distributed under the License is distributed on an "AS IS" BASIS,
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied. See the License for the specific language governing
18 // permissions and limitations under the License.
19 //
20 // For updates, support, or to become part of the LEF/DEF Community,
21 // check www.openeda.org for details.
22 //
23 // $Author: dell $
24 // $Revision: #1 $
25 // $Date: 2017/06/06 $
26 // $State: $
27 // *****************************************************************************
28 // *****************************************************************************
29
30 #include <string.h>
31 #include <stdlib.h>
32 #include "defiPinCap.hpp"
33 #include "defiComponent.hpp"
34 #include "defiDebug.hpp"
35 #include "lex.h"
36 #include "defiUtil.hpp"
37
38 BEGIN_LEFDEF_PARSER_NAMESPACE
39
40 ///////////////////////////////////////////////
41 ///////////////////////////////////////////////
42 //
43 // defiPinCap
44 //
45 ///////////////////////////////////////////////
46 ///////////////////////////////////////////////
47
48
setPin(int p)49 void defiPinCap::setPin(int p) {
50 pin_ = p;
51 }
52
53
setCap(double d)54 void defiPinCap::setCap(double d) {
55 cap_ = d;
56 }
57
58
pin() const59 int defiPinCap::pin() const {
60 return pin_;
61 }
62
63
cap() const64 double defiPinCap::cap() const {
65 return cap_;
66 }
67
68
print(FILE * f) const69 void defiPinCap::print(FILE* f) const {
70 fprintf(f, "PinCap %d %5.2f\n", pin_, cap_);
71 }
72
73
74 ///////////////////////////////////////////////
75 ///////////////////////////////////////////////
76 //
77 // defiPinAntennaModel
78 //
79 ///////////////////////////////////////////////
80 ///////////////////////////////////////////////
81
defiPinAntennaModel(defrData * data)82 defiPinAntennaModel::defiPinAntennaModel(defrData *data)
83 : oxide_(0),
84 defData(data)
85 {
86 Init();
87 }
88
89
Init()90 void defiPinAntennaModel::Init() {
91 numAPinGateArea_ = 0; // 5.4
92 APinGateAreaAllocated_ = 0; // 5.4
93 APinGateArea_ = 0;
94 APinGateAreaLayer_ = 0;
95 numAPinMaxAreaCar_ = 0; // 5.4
96 APinMaxAreaCarAllocated_ = 0; // 5.4
97 APinMaxAreaCar_ = 0;
98 APinMaxAreaCarLayer_ = 0;
99 numAPinMaxSideAreaCar_ = 0; // 5.4
100 APinMaxSideAreaCarAllocated_ = 0; // 5.4
101 APinMaxSideAreaCar_ = 0;
102 APinMaxSideAreaCarLayer_ = 0;
103 numAPinMaxCutCar_ = 0; // 5.4
104 APinMaxCutCarAllocated_ = 0; // 5.4
105 APinMaxCutCar_ = 0;
106 APinMaxCutCarLayer_ = 0;
107 oxide_ = 0;
108 }
109
DEF_COPY_CONSTRUCTOR_C(defiPinAntennaModel)110 DEF_COPY_CONSTRUCTOR_C( defiPinAntennaModel ) {
111 this->Init();
112
113 DEF_MALLOC_FUNC( oxide_, char, sizeof(char) * (strlen(prev.oxide_) +1));
114 DEF_COPY_FUNC( numAPinGateArea_ );
115 DEF_COPY_FUNC( APinGateAreaAllocated_ );
116 DEF_MALLOC_FUNC( APinGateArea_, int, sizeof(int) * numAPinGateArea_ );
117 DEF_MALLOC_FUNC_FOR_2D_STR( APinGateAreaLayer_, numAPinGateArea_ );
118
119 DEF_COPY_FUNC( numAPinMaxAreaCar_ );
120 DEF_COPY_FUNC( APinMaxAreaCarAllocated_ );
121 DEF_MALLOC_FUNC( APinMaxAreaCar_, int, sizeof(int) * numAPinMaxAreaCar_ );
122 DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxAreaCarLayer_, numAPinMaxAreaCar_ );
123
124 DEF_COPY_FUNC( numAPinMaxSideAreaCar_ );
125 DEF_COPY_FUNC( APinMaxSideAreaCarAllocated_ );
126 DEF_MALLOC_FUNC( APinMaxSideAreaCar_, int, sizeof(int) * numAPinMaxSideAreaCar_ );
127 DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxSideAreaCarLayer_, numAPinMaxSideAreaCar_ );
128
129 DEF_COPY_FUNC( numAPinMaxCutCar_ );
130 DEF_COPY_FUNC( APinMaxCutCarAllocated_ );
131 DEF_MALLOC_FUNC( APinMaxCutCar_, int, sizeof(int) * numAPinMaxCutCar_ );
132 DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxCutCarLayer_, numAPinMaxCutCar_ );
133
134 }
135
DEF_ASSIGN_OPERATOR_C(defiPinAntennaModel)136 DEF_ASSIGN_OPERATOR_C( defiPinAntennaModel ) {
137 CHECK_SELF_ASSIGN
138 this->Init();
139
140 DEF_MALLOC_FUNC( oxide_, char, sizeof(char) * (strlen(prev.oxide_) +1));
141 DEF_COPY_FUNC( numAPinGateArea_ );
142 DEF_COPY_FUNC( APinGateAreaAllocated_ );
143 DEF_MALLOC_FUNC( APinGateArea_, int, sizeof(int) * numAPinGateArea_ );
144 DEF_MALLOC_FUNC_FOR_2D_STR( APinGateAreaLayer_, numAPinGateArea_ );
145
146 DEF_COPY_FUNC( numAPinMaxAreaCar_ );
147 DEF_COPY_FUNC( APinMaxAreaCarAllocated_ );
148 DEF_MALLOC_FUNC( APinMaxAreaCar_, int, sizeof(int) * numAPinMaxAreaCar_ );
149 DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxAreaCarLayer_, numAPinMaxAreaCar_ );
150
151 DEF_COPY_FUNC( numAPinMaxSideAreaCar_ );
152 DEF_COPY_FUNC( APinMaxSideAreaCarAllocated_ );
153 DEF_MALLOC_FUNC( APinMaxSideAreaCar_, int, sizeof(int) * numAPinMaxSideAreaCar_ );
154 DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxSideAreaCarLayer_, numAPinMaxSideAreaCar_ );
155
156 DEF_COPY_FUNC( numAPinMaxCutCar_ );
157 DEF_COPY_FUNC( APinMaxCutCarAllocated_ );
158 DEF_MALLOC_FUNC( APinMaxCutCar_, int, sizeof(int) * numAPinMaxCutCar_ );
159 DEF_MALLOC_FUNC_FOR_2D_STR( APinMaxCutCarLayer_, numAPinMaxCutCar_ );
160 return *this;
161 }
162
~defiPinAntennaModel()163 defiPinAntennaModel::~defiPinAntennaModel() {
164 Destroy();
165 }
166
167
clear()168 void defiPinAntennaModel::clear() {
169 int i;
170
171 if (oxide_)
172 free((char*)(oxide_));
173 oxide_ = 0;
174
175 for (i = 0; i < numAPinGateArea_; i++) {
176 if (APinGateAreaLayer_[i])
177 free(APinGateAreaLayer_[i]);
178 }
179 numAPinGateArea_ = 0;
180
181 for (i = 0; i < numAPinMaxAreaCar_; i++) {
182 if (APinMaxAreaCarLayer_[i])
183 free(APinMaxAreaCarLayer_[i]);
184 }
185 numAPinMaxAreaCar_ = 0;
186
187 for (i = 0; i < numAPinMaxSideAreaCar_; i++) {
188 if (APinMaxSideAreaCarLayer_[i])
189 free(APinMaxSideAreaCarLayer_[i]);
190 }
191 numAPinMaxSideAreaCar_ = 0;
192
193 for (i = 0; i < numAPinMaxCutCar_; i++) {
194 if (APinMaxCutCarLayer_[i])
195 free(APinMaxCutCarLayer_[i]);
196 }
197 numAPinMaxCutCar_ = 0;
198 }
199
Destroy()200 void defiPinAntennaModel::Destroy() {
201 clear();
202 if (APinGateArea_)
203 free((char*)(APinGateArea_));
204 if (APinGateAreaLayer_)
205 free((char*)(APinGateAreaLayer_));
206 if (APinMaxAreaCar_)
207 free((char*)(APinMaxAreaCar_));
208 if (APinMaxAreaCarLayer_)
209 free((char*)(APinMaxAreaCarLayer_));
210 if (APinMaxSideAreaCar_)
211 free((char*)(APinMaxSideAreaCar_));
212 if (APinMaxSideAreaCarLayer_)
213 free((char*)(APinMaxSideAreaCarLayer_));
214 if (APinMaxCutCar_)
215 free((char*)(APinMaxCutCar_));
216 if (APinMaxCutCarLayer_)
217 free((char*)(APinMaxCutCarLayer_));
218 }
219
220 // 5.5
setAntennaModel(int aOxide)221 void defiPinAntennaModel::setAntennaModel(int aOxide) {
222 switch (aOxide) {
223 case 2:
224 oxide_ = strdup("OXIDE2");
225 break;
226 case 3:
227 oxide_ = strdup("OXIDE3");
228 break;
229 case 4:
230 oxide_ = strdup("OXIDE4");
231 break;
232 default:
233 oxide_ = strdup("OXIDE1");
234 break;
235 }
236 }
237
addAPinGateArea(int value,const char * layer)238 void defiPinAntennaModel::addAPinGateArea(int value, const char* layer) {
239 if (numAPinGateArea_ == APinGateAreaAllocated_) {
240 int i;
241 int max;
242 int lim = numAPinGateArea_;
243 int* nd;
244 char** nl;
245
246 if (APinGateAreaAllocated_ == 0)
247 max = APinGateAreaAllocated_ = 2;
248 else
249 max = APinGateAreaAllocated_ *= 2;
250 nd = (int*)malloc(sizeof(int)*max);
251 nl = (char**)malloc(sizeof(char*)*max);
252 for (i = 0; i < lim; i++) {
253 nd[i] = APinGateArea_[i];
254 nl[i] = APinGateAreaLayer_[i];
255 }
256 free((char*)(APinGateArea_));
257 free((char*)(APinGateAreaLayer_));
258 APinGateArea_ = nd;
259 APinGateAreaLayer_ = nl;
260
261 }
262 APinGateArea_[numAPinGateArea_] = value;
263 if (layer) {
264 APinGateAreaLayer_[numAPinGateArea_] =
265 (char*)malloc(strlen(layer)+1);
266 strcpy(APinGateAreaLayer_[numAPinGateArea_],
267 defData->DEFCASE(layer));
268 } else
269 APinGateAreaLayer_[numAPinGateArea_] = NULL;
270 numAPinGateArea_ += 1;
271 }
272
addAPinMaxAreaCar(int value,const char * layer)273 void defiPinAntennaModel::addAPinMaxAreaCar(int value, const char* layer) {
274 if (numAPinMaxAreaCar_ == APinMaxAreaCarAllocated_) {
275 int i;
276 int max;
277 int lim = numAPinMaxAreaCar_;
278 int* nd;
279 char** nl;
280
281 if (APinMaxAreaCarAllocated_ == 0)
282 max = APinMaxAreaCarAllocated_ = 2;
283 else
284 max = APinMaxAreaCarAllocated_ *= 2;
285 nd = (int*)malloc(sizeof(int)*max);
286 nl = (char**)malloc(sizeof(char*)*max);
287 for (i = 0; i < lim; i++) {
288 nd[i] = APinMaxAreaCar_[i];
289 nl[i] = APinMaxAreaCarLayer_[i];
290 }
291 free((char*)(APinMaxAreaCar_));
292 free((char*)(APinMaxAreaCarLayer_));
293 APinMaxAreaCar_ = nd;
294 APinMaxAreaCarLayer_ = nl;
295
296 }
297 APinMaxAreaCar_[numAPinMaxAreaCar_] = value;
298 if (layer) {
299 APinMaxAreaCarLayer_[numAPinMaxAreaCar_] =
300 (char*)malloc(strlen(layer)+1);
301 strcpy(APinMaxAreaCarLayer_[numAPinMaxAreaCar_],
302 defData->DEFCASE(layer));
303 } else
304 APinMaxAreaCarLayer_[numAPinMaxAreaCar_] = NULL;
305 numAPinMaxAreaCar_ += 1;
306 }
307
addAPinMaxSideAreaCar(int value,const char * layer)308 void defiPinAntennaModel::addAPinMaxSideAreaCar(int value, const char* layer) {
309 if (numAPinMaxSideAreaCar_ == APinMaxSideAreaCarAllocated_) {
310 int i;
311 int max;
312 int lim = numAPinMaxSideAreaCar_;
313 int* nd;
314 char** nl;
315
316 if (APinMaxSideAreaCarAllocated_ == 0)
317 max = APinMaxSideAreaCarAllocated_ = 2;
318 else
319 max = APinMaxSideAreaCarAllocated_ *= 2;
320 nd = (int*)malloc(sizeof(int)*max);
321 nl = (char**)malloc(sizeof(char*)*max);
322 for (i = 0; i < lim; i++) {
323 nd[i] = APinMaxSideAreaCar_[i];
324 nl[i] = APinMaxSideAreaCarLayer_[i];
325 }
326 free((char*)(APinMaxSideAreaCar_));
327 free((char*)(APinMaxSideAreaCarLayer_));
328 APinMaxSideAreaCar_ = nd;
329 APinMaxSideAreaCarLayer_ = nl;
330
331 }
332 APinMaxSideAreaCar_[numAPinMaxSideAreaCar_] = value;
333 if (layer) {
334 APinMaxSideAreaCarLayer_[numAPinMaxSideAreaCar_] =
335 (char*)malloc(strlen(layer)+1);
336 strcpy(APinMaxSideAreaCarLayer_[numAPinMaxSideAreaCar_],
337 defData->DEFCASE(layer));
338 } else
339 APinMaxSideAreaCarLayer_[numAPinMaxSideAreaCar_] = NULL;
340 numAPinMaxSideAreaCar_ += 1;
341 }
342
addAPinMaxCutCar(int value,const char * layer)343 void defiPinAntennaModel::addAPinMaxCutCar(int value, const char* layer) {
344 if (numAPinMaxCutCar_ == APinMaxCutCarAllocated_) {
345 int i;
346 int max;
347 int lim = numAPinMaxCutCar_;
348 int* nd;
349 char** nl;
350
351 if (APinMaxCutCarAllocated_ == 0)
352 max = APinMaxCutCarAllocated_ = 2;
353 else
354 max = APinMaxCutCarAllocated_ *= 2;
355 nd = (int*)malloc(sizeof(int)*max);
356 nl = (char**)malloc(sizeof(char*)*max);
357 for (i = 0; i < lim; i++) {
358 nd[i] = APinMaxCutCar_[i];
359 nl[i] = APinMaxCutCarLayer_[i];
360 }
361 free((char*)(APinMaxCutCar_));
362 free((char*)(APinMaxCutCarLayer_));
363 APinMaxCutCar_ = nd;
364 APinMaxCutCarLayer_ = nl;
365
366 }
367 APinMaxCutCar_[numAPinMaxCutCar_] = value;
368 if (layer) {
369 APinMaxCutCarLayer_[numAPinMaxCutCar_] =
370 (char*)malloc(strlen(layer)+1);
371 strcpy(APinMaxCutCarLayer_[numAPinMaxCutCar_],
372 defData->DEFCASE(layer));
373 } else
374 APinMaxCutCarLayer_[numAPinMaxCutCar_] = NULL;
375 numAPinMaxCutCar_ += 1;
376 }
377
378 // 5.5
antennaOxide() const379 char* defiPinAntennaModel::antennaOxide() const {
380 return oxide_;
381 }
382
hasAPinGateArea() const383 int defiPinAntennaModel::hasAPinGateArea() const {
384 return numAPinGateArea_ ? 1 : 0 ;
385 }
386
hasAPinMaxAreaCar() const387 int defiPinAntennaModel::hasAPinMaxAreaCar() const {
388 return numAPinMaxAreaCar_ ? 1 : 0 ;
389 }
390
hasAPinMaxSideAreaCar() const391 int defiPinAntennaModel::hasAPinMaxSideAreaCar() const {
392 return numAPinMaxSideAreaCar_ ? 1 : 0 ;
393 }
394
hasAPinMaxCutCar() const395 int defiPinAntennaModel::hasAPinMaxCutCar() const {
396 return numAPinMaxCutCar_ ? 1 : 0 ;
397 }
398
numAPinGateArea() const399 int defiPinAntennaModel::numAPinGateArea() const {
400 return numAPinGateArea_;
401 }
402
numAPinMaxAreaCar() const403 int defiPinAntennaModel::numAPinMaxAreaCar() const {
404 return numAPinMaxAreaCar_;
405 }
406
numAPinMaxSideAreaCar() const407 int defiPinAntennaModel::numAPinMaxSideAreaCar() const {
408 return numAPinMaxSideAreaCar_;
409 }
410
numAPinMaxCutCar() const411 int defiPinAntennaModel::numAPinMaxCutCar() const {
412 return numAPinMaxCutCar_;
413 }
414
APinGateArea(int i) const415 int defiPinAntennaModel::APinGateArea(int i) const {
416 return APinGateArea_[i];
417 }
418
hasAPinGateAreaLayer(int i) const419 int defiPinAntennaModel::hasAPinGateAreaLayer(int i) const {
420 return (APinGateAreaLayer_[i] && *(APinGateAreaLayer_[i])) ?
421 1 : 0;
422 }
423
APinGateAreaLayer(int i) const424 const char* defiPinAntennaModel::APinGateAreaLayer(int i) const {
425 return APinGateAreaLayer_[i];
426 }
427
APinMaxAreaCar(int i) const428 int defiPinAntennaModel::APinMaxAreaCar(int i) const {
429 return APinMaxAreaCar_[i];
430 }
431
hasAPinMaxAreaCarLayer(int i) const432 int defiPinAntennaModel::hasAPinMaxAreaCarLayer(int i) const {
433 return (APinMaxAreaCarLayer_[i] && *(APinMaxAreaCarLayer_[i])) ?
434 1 : 0;
435 }
436
APinMaxAreaCarLayer(int i) const437 const char* defiPinAntennaModel::APinMaxAreaCarLayer(int i) const {
438 return APinMaxAreaCarLayer_[i];
439 }
440
APinMaxSideAreaCar(int i) const441 int defiPinAntennaModel::APinMaxSideAreaCar(int i) const {
442 return APinMaxSideAreaCar_[i];
443 }
444
hasAPinMaxSideAreaCarLayer(int i) const445 int defiPinAntennaModel::hasAPinMaxSideAreaCarLayer(int i) const {
446 return (APinMaxSideAreaCarLayer_[i] &&
447 *(APinMaxSideAreaCarLayer_[i])) ? 1 : 0;
448 }
449
APinMaxSideAreaCarLayer(int i) const450 const char* defiPinAntennaModel::APinMaxSideAreaCarLayer(int i) const {
451 return APinMaxSideAreaCarLayer_[i];
452 }
453
APinMaxCutCar(int i) const454 int defiPinAntennaModel::APinMaxCutCar(int i) const {
455 return APinMaxCutCar_[i];
456 }
457
hasAPinMaxCutCarLayer(int i) const458 int defiPinAntennaModel::hasAPinMaxCutCarLayer(int i) const {
459 return (APinMaxCutCarLayer_[i] &&
460 *(APinMaxCutCarLayer_[i])) ? 1 : 0;
461 }
462
APinMaxCutCarLayer(int i) const463 const char* defiPinAntennaModel::APinMaxCutCarLayer(int i) const {
464 return APinMaxCutCarLayer_[i];
465 }
466
467
468 ///////////////////////////////////////////////
469 ///////////////////////////////////////////////
470 //
471 // defiPinPort
472 //
473 ///////////////////////////////////////////////
474 ///////////////////////////////////////////////
475
defiPinPort(defrData * data)476 defiPinPort::defiPinPort(defrData *data)
477 : defData(data)
478 {
479 Init();
480 }
481
Init()482 void defiPinPort::Init() {
483 layersAllocated_ = 0;
484 numLayers_ = 0;
485 layers_ = 0;
486 layerMinSpacing_ = 0;
487 layerMask_ = 0;
488 layerEffectiveWidth_ = 0;
489 xl_ = 0;
490 yl_ = 0;
491 xh_ = 0;
492 yh_ = 0;
493 polysAllocated_ = 0;
494 numPolys_ = 0;
495 polygonNames_ = 0;
496 polyMinSpacing_ = 0;
497 polyMask_ = 0;
498 polyEffectiveWidth_ = 0;
499 polygons_ = 0;
500 viasAllocated_ = 0;
501 numVias_ = 0;
502 viaNames_ = 0;
503 viaX_ = 0;
504 viaY_ = 0;
505 viaMask_ = 0;
506 placeType_ = 0;
507 x_ = 0;
508 y_ = 0;
509 orient_ = 0;
510 }
511
DEF_COPY_CONSTRUCTOR_C(defiPinPort)512 DEF_COPY_CONSTRUCTOR_C( defiPinPort ) {
513 this->Init();
514
515 DEF_COPY_FUNC( layersAllocated_ );
516 DEF_COPY_FUNC( numLayers_ );
517 DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_);
518
519 DEF_MALLOC_FUNC( layerMinSpacing_, int, sizeof(int) * numLayers_);
520 DEF_MALLOC_FUNC( layerEffectiveWidth_, int, sizeof(int) * numLayers_);
521 DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numLayers_);
522 DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numLayers_);
523 DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numLayers_);
524 DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numLayers_);
525 DEF_MALLOC_FUNC( layerMask_, int, sizeof(int) * numLayers_);
526
527 DEF_COPY_FUNC( polysAllocated_ );
528 DEF_COPY_FUNC( numPolys_ );
529 DEF_MALLOC_FUNC_FOR_2D_STR( polygonNames_, numPolys_);
530
531 DEF_MALLOC_FUNC( polyMinSpacing_, int, sizeof(int) * numPolys_);
532 DEF_MALLOC_FUNC( polyMask_, int, sizeof(int) * numPolys_);
533 DEF_MALLOC_FUNC( polyEffectiveWidth_, int, sizeof(int) * numPolys_ );
534 DEF_MALLOC_FUNC_FOR_2D_POINT( polygons_, numPolys_ );
535
536 DEF_COPY_FUNC( viasAllocated_ );
537 DEF_COPY_FUNC( numVias_ );
538 DEF_MALLOC_FUNC_FOR_2D_STR( viaNames_, numVias_);
539
540 DEF_MALLOC_FUNC( viaX_, int, sizeof(int) * numVias_ );
541 DEF_MALLOC_FUNC( viaY_, int, sizeof(int) * numVias_ );
542 DEF_MALLOC_FUNC( viaMask_, int, sizeof(int) * numVias_ );
543 DEF_COPY_FUNC( placeType_ );
544 DEF_COPY_FUNC( x_ );
545 DEF_COPY_FUNC( y_ );
546 DEF_COPY_FUNC( orient_ );
547 }
548
DEF_ASSIGN_OPERATOR_C(defiPinPort)549 DEF_ASSIGN_OPERATOR_C( defiPinPort ) {
550 CHECK_SELF_ASSIGN
551 this->Init();
552
553 DEF_COPY_FUNC( layersAllocated_ );
554 DEF_COPY_FUNC( numLayers_ );
555 DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_);
556
557 DEF_MALLOC_FUNC( layerMinSpacing_, int, sizeof(int) * numLayers_);
558 DEF_MALLOC_FUNC( layerEffectiveWidth_, int, sizeof(int) * numLayers_);
559 DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numLayers_);
560 DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numLayers_);
561 DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numLayers_);
562 DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numLayers_);
563 DEF_MALLOC_FUNC( layerMask_, int, sizeof(int) * numLayers_);
564
565 DEF_COPY_FUNC( polysAllocated_ );
566 DEF_COPY_FUNC( numPolys_ );
567 DEF_MALLOC_FUNC_FOR_2D_STR( polygonNames_, numPolys_);
568
569 DEF_MALLOC_FUNC( polyMinSpacing_, int, sizeof(int) * numPolys_);
570 DEF_MALLOC_FUNC( polyMask_, int, sizeof(int) * numPolys_);
571 DEF_MALLOC_FUNC( polyEffectiveWidth_, int, sizeof(int) * numPolys_ );
572 DEF_MALLOC_FUNC_FOR_2D_POINT( polygons_, numPolys_ );
573
574 DEF_COPY_FUNC( viasAllocated_ );
575 DEF_COPY_FUNC( numVias_ );
576 DEF_MALLOC_FUNC_FOR_2D_STR( viaNames_, numVias_);
577
578 DEF_MALLOC_FUNC( viaX_, int, sizeof(int) * numVias_ );
579 DEF_MALLOC_FUNC( viaY_, int, sizeof(int) * numVias_ );
580 DEF_MALLOC_FUNC( viaMask_, int, sizeof(int) * numVias_ );
581 DEF_COPY_FUNC( placeType_ );
582 DEF_COPY_FUNC( x_ );
583 DEF_COPY_FUNC( y_ );
584 DEF_COPY_FUNC( orient_ );
585 return *this;
586 }
587
~defiPinPort()588 defiPinPort::~defiPinPort() {
589 clear();
590 }
591
clear()592 void defiPinPort::clear() {
593 int i;
594
595 placeType_ = 0;
596 orient_ = 0;
597 x_ = 0;
598 y_ = 0;
599
600 if (layers_) {
601 for (i = 0; i < numLayers_; i++)
602 if (layers_[i]) free(layers_[i]);
603 free((char*)(layers_));
604 free((char*)(xl_));
605 free((char*)(yl_));
606 free((char*)(xh_));
607 free((char*)(yh_));
608 free((char*)(layerMinSpacing_));
609 free((char*)(layerMask_));
610 free((char*)(layerEffectiveWidth_));
611 }
612 layers_ = 0;
613 layerMinSpacing_ = 0;
614 layerEffectiveWidth_ = 0;
615 layerMask_ = 0;
616 numLayers_ = 0;
617 layersAllocated_ = 0;
618 if (polygonNames_) {
619 struct defiPoints* p;
620 for (i = 0; i < numPolys_; i++) {
621 if (polygonNames_[i]) free((char*)(polygonNames_[i]));
622 p = polygons_[i];
623 free((char*)(p->x));
624 free((char*)(p->y));
625 free((char*)(polygons_[i]));
626 }
627 free((char*)(polygonNames_));
628 free((char*)(polygons_));
629 free((char*)(polyMinSpacing_));
630 free((char*)(polyMask_));
631 free((char*)(polyEffectiveWidth_));
632 polygonNames_ = 0;
633 polygons_ = 0;
634 polyMinSpacing_ = 0;
635 polyEffectiveWidth_ = 0;
636 polyMask_ = 0;
637 }
638 numPolys_ = 0;
639 polysAllocated_ = 0;
640 if (viaNames_) {
641 for (i = 0; i < numVias_; i++)
642 if (viaNames_[i]) free(viaNames_[i]);
643 free((char*)(viaNames_));
644 free((char*)(viaX_));
645 free((char*)(viaY_));
646 free((char*)(viaMask_));
647 }
648 viaNames_ = 0;
649 numVias_ = 0;
650 viasAllocated_ = 0;
651 viaMask_ = 0;
652 }
653
addLayer(const char * layer)654 void defiPinPort::addLayer(const char* layer) {
655 if (numLayers_ >= layersAllocated_) {
656 int i;
657 char** newl;
658 int *nxl, *nyl, *nxh, *nyh;
659 int *lms, *lew, *lm;
660
661 layersAllocated_ = layersAllocated_ ?
662 layersAllocated_ * 2 : 8;
663 newl = (char**)malloc(layersAllocated_ * sizeof(char*));
664 nxl = (int*)malloc(layersAllocated_ * sizeof(int));
665 nyl = (int*)malloc(layersAllocated_ * sizeof(int));
666 nxh = (int*)malloc(layersAllocated_ * sizeof(int));
667 nyh = (int*)malloc(layersAllocated_ * sizeof(int));
668 lms = (int*)malloc(layersAllocated_ * sizeof(int));
669 lew = (int*)malloc(layersAllocated_ * sizeof(int));
670 lm = (int*)malloc(layersAllocated_ * sizeof(int));
671
672 for (i = 0; i < numLayers_; i++) {
673 newl[i] = layers_[i];
674 nxl[i] = xl_[i];
675 nyl[i] = yl_[i];
676 nxh[i] = xh_[i];
677 nyh[i] = yh_[i];
678 lms[i] = layerMinSpacing_[i];
679 lew[i] = layerEffectiveWidth_[i];
680 lm[i] = layerMask_[i];
681 }
682 if (numLayers_ > 0) {
683 free((char*)layers_);
684 free((char*)xl_);
685 free((char*)yl_);
686 free((char*)xh_);
687 free((char*)yh_);
688 free((char*)layerMinSpacing_);
689 free((char*)layerEffectiveWidth_);
690 free((char*)layerMask_);
691 }
692 layers_ = newl;
693 xl_ = nxl;
694 yl_ = nyl;
695 xh_ = nxh;
696 yh_ = nyh;
697 layerMinSpacing_ = lms;
698 layerEffectiveWidth_ = lew;
699 layerMask_ = lm;
700 }
701 layers_[numLayers_] = (char*)malloc(strlen(layer)+1);
702 strcpy(layers_[numLayers_], defData->DEFCASE(layer));
703 xl_[numLayers_] = 0;
704 yl_[numLayers_] = 0;
705 xh_[numLayers_] = 0;
706 yh_[numLayers_] = 0;
707 layerMinSpacing_[numLayers_] = -1;
708 layerEffectiveWidth_[numLayers_] = -1;
709 layerMask_[numLayers_] = 0;
710 numLayers_ += 1;
711 }
712
addLayerSpacing(int minSpacing)713 void defiPinPort::addLayerSpacing(int minSpacing) {
714 layerMinSpacing_[numLayers_-1] = minSpacing;
715 }
716
addLayerMask(int mask)717 void defiPinPort::addLayerMask(int mask) {
718 layerMask_[numLayers_-1] = mask;
719 }
720
addLayerDesignRuleWidth(int effectiveWidth)721 void defiPinPort::addLayerDesignRuleWidth(int effectiveWidth) {
722 layerEffectiveWidth_[numLayers_-1] = effectiveWidth;
723 }
724
addLayerPts(int xl,int yl,int xh,int yh)725 void defiPinPort::addLayerPts(int xl, int yl, int xh, int yh) {
726 xl_[numLayers_-1] = xl;
727 yl_[numLayers_-1] = yl;
728 xh_[numLayers_-1] = xh;
729 yh_[numLayers_-1] = yh;
730 }
731
addPolygon(const char * layerName)732 void defiPinPort::addPolygon(const char* layerName) {
733 int *pms, *pdw, *pm;
734 int i;
735
736 if (numPolys_ == polysAllocated_) {
737 char** newn;
738 struct defiPoints** poly;
739 polysAllocated_ = (polysAllocated_ == 0) ?
740 2 : polysAllocated_ * 2;
741 newn = (char**)malloc(sizeof(char*) * polysAllocated_);
742 poly = (struct defiPoints**)malloc(sizeof(struct defiPoints*) *
743 polysAllocated_);
744 pms = (int*)malloc(polysAllocated_ * sizeof(int));
745 pdw = (int*)malloc(polysAllocated_ * sizeof(int));
746 pm = (int*)malloc(polysAllocated_ * sizeof(int));
747
748 for (i = 0; i < numPolys_; i++) {
749 newn[i] = polygonNames_[i];
750 poly[i] = polygons_[i];
751 pms[i] = polyMinSpacing_[i];
752 pdw[i] = polyEffectiveWidth_[i];
753 pm[i] = polyMask_[i];
754 }
755 if (numPolys_ > 0) {
756 free((char*)(polygons_));
757 free((char*)(polygonNames_));
758 free((char*)(polyMinSpacing_));
759 free((char*)(polyEffectiveWidth_));
760 free((char*)(polyMask_));
761 }
762 polygonNames_ = newn;
763 polygons_ = poly;
764 polyMinSpacing_ = pms;
765 polyEffectiveWidth_ = pdw;
766 polyMask_ = pm;
767 }
768 polygonNames_[numPolys_] = strdup(layerName);
769 polygons_[numPolys_] = 0;
770 polyMinSpacing_[numPolys_] = -1;
771 polyEffectiveWidth_[numPolys_] = -1;
772 polyMask_[numPolys_] = 0;
773 numPolys_ += 1;
774 }
775
addPolySpacing(int minSpacing)776 void defiPinPort::addPolySpacing(int minSpacing) {
777 polyMinSpacing_[numPolys_-1] = minSpacing;
778 }
779
addPolyMask(int color)780 void defiPinPort::addPolyMask(int color) {
781 polyMask_[numPolys_-1] = color;
782 }
783
addPolyDesignRuleWidth(int effectiveWidth)784 void defiPinPort::addPolyDesignRuleWidth(int effectiveWidth) {
785 polyEffectiveWidth_[numPolys_-1] = effectiveWidth;
786 }
787
addPolygonPts(defiGeometries * geom)788 void defiPinPort::addPolygonPts(defiGeometries* geom) {
789 struct defiPoints* p;
790 int x, y;
791 int i;
792
793 p = (struct defiPoints*)malloc(sizeof(struct defiPoints));
794 p->numPoints = geom->numPoints();
795 p->x = (int*)malloc(sizeof(int)*p->numPoints);
796 p->y = (int*)malloc(sizeof(int)*p->numPoints);
797 for (i = 0; i < p->numPoints; i++) {
798 geom->points(i, &x, &y);
799 p->x[i] = x;
800 p->y[i] = y;
801 }
802 polygons_[numPolys_-1] = p;
803 }
804
805
addVia(const char * viaName,int ptX,int ptY,int color)806 void defiPinPort::addVia(const char* viaName, int ptX, int ptY, int color) {
807 if (numVias_ >= viasAllocated_) {
808 int i;
809 char** newl;
810 int *nx, *ny, *nm;
811
812 viasAllocated_ = viasAllocated_ ?
813 viasAllocated_ * 2 : 8;
814 newl = (char**)malloc(viasAllocated_ * sizeof(char*));
815 nx = (int*)malloc(viasAllocated_ * sizeof(int));
816 ny = (int*)malloc(viasAllocated_ * sizeof(int));
817 nm = (int*)malloc(viasAllocated_ * sizeof(int));
818 for (i = 0; i < numVias_; i++) {
819 newl[i] = viaNames_[i];
820 nx[i] = viaX_[i];
821 ny[i] = viaY_[i];
822 nm[i] = viaMask_[i];
823 }
824 if (numVias_ > 0) {
825 free((char*)viaNames_);
826 free((char*)viaX_);
827 free((char*)viaY_);
828 free((char*)viaMask_);
829 }
830 viaNames_ = newl;
831 viaX_ = nx;
832 viaY_ = ny;
833 viaMask_ = nm;
834 }
835 viaNames_[numVias_] = (char*)malloc(strlen(viaName)+1);
836 strcpy(viaNames_[numVias_], defData->DEFCASE(viaName));
837 viaX_[numVias_] = ptX;
838 viaY_[numVias_] = ptY;
839 viaMask_[numVias_] = color;
840 numVias_ += 1;
841 }
842
setPlacement(int typ,int x,int y,int orient)843 void defiPinPort::setPlacement(int typ, int x, int y, int orient) {
844 x_ = x;
845 y_ = y;
846 orient_ = orient;
847 placeType_ = typ;
848 }
849
numLayer() const850 int defiPinPort::numLayer() const {
851 return numLayers_;
852 }
853
layer(int index) const854 const char* defiPinPort::layer(int index) const {
855 return layers_[index];
856 }
857
bounds(int index,int * xl,int * yl,int * xh,int * yh) const858 void defiPinPort::bounds(int index, int* xl, int* yl, int* xh, int* yh) const {
859 if (xl) *xl = xl_[index];
860 if (yl) *yl = yl_[index];
861 if (xh) *xh = xh_[index];
862 if (yh) *yh = yh_[index];
863 }
864
hasLayerSpacing(int index) const865 int defiPinPort::hasLayerSpacing(int index) const{
866 if (layerMinSpacing_[index] == -1)
867 return 0;
868 return 1;
869 }
870
hasLayerDesignRuleWidth(int index) const871 int defiPinPort::hasLayerDesignRuleWidth(int index) const{
872 if (layerEffectiveWidth_[index] == -1)
873 return 0;
874 return 1;
875 }
876
layerSpacing(int index) const877 int defiPinPort::layerSpacing(int index) const {
878 return layerMinSpacing_[index];
879 }
880
layerMask(int index) const881 int defiPinPort::layerMask(int index) const {
882 return layerMask_[index];
883 }
884
layerDesignRuleWidth(int index) const885 int defiPinPort::layerDesignRuleWidth(int index) const {
886 return layerEffectiveWidth_[index];
887 }
888
numPolygons() const889 int defiPinPort::numPolygons() const {
890 return numPolys_;
891 }
892
polygonName(int index) const893 const char* defiPinPort::polygonName(int index) const {
894 if (index < 0 || index > numPolys_) {
895 defiError(1, 0, "index out of bounds", defData);
896 return 0;
897 }
898 return polygonNames_[index];
899 }
900
getPolygon(int index) const901 struct defiPoints defiPinPort::getPolygon(int index) const {
902 return *(polygons_[index]);
903 }
904
hasPolygonSpacing(int index) const905 int defiPinPort::hasPolygonSpacing(int index) const{
906 if (polyMinSpacing_[index] == -1)
907 return 0;
908 return 1;
909 }
910
hasPolygonDesignRuleWidth(int index) const911 int defiPinPort::hasPolygonDesignRuleWidth(int index) const{
912 if (polyEffectiveWidth_[index] == -1)
913 return 0;
914 return 1;
915 }
916
polygonSpacing(int index) const917 int defiPinPort::polygonSpacing(int index) const {
918 return polyMinSpacing_[index];
919 }
920
polygonMask(int index) const921 int defiPinPort::polygonMask(int index) const {
922 return polyMask_[index];
923 }
924
polygonDesignRuleWidth(int index) const925 int defiPinPort::polygonDesignRuleWidth(int index) const {
926 return polyEffectiveWidth_[index];
927 }
928
numVias() const929 int defiPinPort::numVias() const {
930 return numVias_;
931 }
932
viaName(int index) const933 const char* defiPinPort::viaName(int index) const {
934 if (index < 0 || index > numVias_) {
935 defiError(1, 0, "index out of bounds", defData);
936 return 0;
937 }
938 return viaNames_[index];
939 }
940
viaPtX(int index) const941 int defiPinPort::viaPtX(int index) const {
942 return viaX_[index];
943 }
944
viaPtY(int index) const945 int defiPinPort::viaPtY(int index) const {
946 return viaY_[index];
947 }
948
viaBottomMask(int index) const949 int defiPinPort::viaBottomMask(int index) const {
950 return viaMask_[index] % 10;
951 }
952
viaTopMask(int index) const953 int defiPinPort::viaTopMask(int index) const {
954 return viaMask_[index] / 100;
955 }
956
viaCutMask(int index) const957 int defiPinPort::viaCutMask(int index) const {
958 return viaMask_[index] / 10 % 10;
959 }
960
hasPlacement() const961 int defiPinPort::hasPlacement() const {
962 return placeType_ == 0 ? 0 : 1 ;
963 }
964
isPlaced() const965 int defiPinPort::isPlaced() const {
966 return placeType_ == DEFI_COMPONENT_PLACED ? 1 : 0 ;
967 }
968
isCover() const969 int defiPinPort::isCover() const {
970 return placeType_ == DEFI_COMPONENT_COVER ? 1 : 0 ;
971 }
972
isFixed() const973 int defiPinPort::isFixed() const {
974 return placeType_ == DEFI_COMPONENT_FIXED ? 1 : 0 ;
975 }
976
placementX() const977 int defiPinPort::placementX() const {
978 return x_;
979 }
980
placementY() const981 int defiPinPort::placementY() const {
982 return y_;
983 }
984
orient() const985 int defiPinPort::orient() const {
986 return orient_;
987 }
988
orientStr() const989 const char* defiPinPort::orientStr() const {
990 return (defiOrientStr(orient_));
991 }
992
993 ///////////////////////////////////////////////
994 ///////////////////////////////////////////////
995 //
996 // defiPin
997 //
998 ///////////////////////////////////////////////
999 ///////////////////////////////////////////////
1000
defiPin(defrData * data)1001 defiPin::defiPin(defrData *data)
1002 : defData(data)
1003 {
1004 Init();
1005 }
1006
1007
Init()1008 void defiPin::Init() {
1009 pinNameLength_ = 0;
1010 pinName_ = 0;
1011 netNameLength_ = 0;
1012 netName_ = 0;
1013 useLength_ = 0;
1014 use_ = 0;
1015 directionLength_ = 0;
1016 direction_ = 0;
1017 hasDirection_ = 0;
1018 hasUse_ = 0;
1019 placeType_ = 0;
1020 orient_ = 0;
1021 xl_ = 0;
1022 yl_ = 0;
1023 xh_ = 0;
1024 yh_ = 0;
1025 x_ = 0;
1026 y_ = 0;
1027 netExprLength_ = 0; // 5.6
1028 netExpr_ = 0; // 5.6
1029 hasNetExpr_ = 0; // 5.6
1030 supplySensLength_ = 0; // 5.6
1031 supplySens_ = 0; // 5.6
1032 hasSupplySens_ = 0; // 5.6
1033 groundSensLength_ = 0; // 5.6
1034 groundSens_ = 0; // 5.6
1035 hasGroundSens_ = 0; // 5.6
1036 layers_ = 0; // 5.6
1037 layersAllocated_ = 0; // 5.6
1038 numLayers_ = 0; // 5.6
1039 polygonNames_ = 0; // 5.6
1040 numPolys_ = 0; // 5.6
1041 polysAllocated_ = 0; // 5.6
1042 polygons_ = 0; // 5.6
1043 numAPinPartialMetalArea_ = 0; // 5.4
1044 APinPartialMetalAreaAllocated_ = 0; // 5.4
1045 APinPartialMetalArea_ = 0;
1046 APinPartialMetalAreaLayer_ = 0;
1047 numAPinPartialMetalSideArea_ = 0; // 5.4
1048 APinPartialMetalSideAreaAllocated_ = 0; // 5.4
1049 APinPartialMetalSideArea_ = 0;
1050 APinPartialMetalSideAreaLayer_ = 0;
1051 numAPinDiffArea_ = 0; // 5.4
1052 APinDiffAreaAllocated_ = 0; // 5.4
1053 APinDiffArea_ = 0;
1054 APinDiffAreaLayer_ = 0;
1055 numAPinPartialCutArea_ = 0; // 5.4
1056 APinPartialCutAreaAllocated_ = 0; // 5.4
1057 APinPartialCutArea_ = 0;
1058 APinPartialCutAreaLayer_ = 0;
1059 antennaModel_ = 0;
1060 viaNames_ = 0; // 5.7
1061 viasAllocated_ = 0; // 5.7
1062 numVias_ = 0; // 5.7
1063 viaX_ = 0; // 5.7
1064 viaY_ = 0; // 5.7
1065 numPorts_ = 0; // 5.7
1066 pinPort_ = 0; // 5.7
1067 numAntennaModel_ = 0;
1068 antennaModelAllocated_ = 0;
1069 polyMinSpacing_ = 0;
1070 polyEffectiveWidth_ = 0;
1071 polyMask_ = 0;
1072 layerMinSpacing_ = 0;
1073 layerEffectiveWidth_ = 0;
1074 layerMask_ =0;
1075 viaMask_ = 0;
1076 }
1077
1078
DEF_COPY_CONSTRUCTOR_C(defiPin)1079 DEF_COPY_CONSTRUCTOR_C( defiPin ) {
1080 this->Init();
1081
1082 DEF_COPY_FUNC( pinNameLength_ );
1083 DEF_MALLOC_FUNC( pinName_, char, sizeof(char) * (strlen(prev.pinName_) +1));
1084 DEF_COPY_FUNC( netNameLength_ );
1085 DEF_MALLOC_FUNC( netName_, char, sizeof(char) * (strlen(prev.netName_) +1));
1086 DEF_COPY_FUNC( hasDirection_ );
1087 DEF_COPY_FUNC( hasUse_ );
1088 DEF_COPY_FUNC( placeType_ );
1089 DEF_COPY_FUNC( orient_ );
1090 DEF_COPY_FUNC( useLength_ );
1091 DEF_MALLOC_FUNC( use_, char, sizeof(char) * (strlen(prev.use_) +1));
1092 DEF_COPY_FUNC( directionLength_ );
1093 DEF_MALLOC_FUNC( direction_, char, sizeof(char) * (strlen(prev.direction_) +1));
1094
1095 DEF_COPY_FUNC( layersAllocated_ );
1096 DEF_COPY_FUNC( numLayers_ );
1097 DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_);
1098 DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numLayers_);
1099 DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numLayers_);
1100 DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numLayers_);
1101 DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numLayers_);
1102 DEF_MALLOC_FUNC( layerMinSpacing_, int, sizeof(int) * numLayers_);
1103 DEF_MALLOC_FUNC( layerEffectiveWidth_, int, sizeof(int) * numLayers_);
1104 DEF_MALLOC_FUNC( layerMask_, int, sizeof(int) * numLayers_);
1105
1106
1107 DEF_COPY_FUNC( numPolys_ );
1108 DEF_COPY_FUNC( polysAllocated_ );
1109 DEF_MALLOC_FUNC_FOR_2D_STR( polygonNames_, numPolys_);
1110 DEF_MALLOC_FUNC( polyMinSpacing_, int, sizeof(int) * numPolys_);
1111 DEF_MALLOC_FUNC( polyEffectiveWidth_, int, sizeof(int) * numPolys_);
1112 DEF_MALLOC_FUNC( polyMask_, int, sizeof(int) * numPolys_);
1113 DEF_MALLOC_FUNC_FOR_2D_POINT( polygons_, numPolys_);
1114
1115 DEF_COPY_FUNC( x_ );
1116 DEF_COPY_FUNC( y_ );
1117 DEF_COPY_FUNC( hasSpecial_ );
1118
1119 DEF_COPY_FUNC( numVias_ );
1120 DEF_COPY_FUNC( viasAllocated_ );
1121 DEF_MALLOC_FUNC_FOR_2D_STR( viaNames_, numVias_);
1122 DEF_MALLOC_FUNC( viaX_, int, sizeof(int) * numVias_);
1123 DEF_MALLOC_FUNC( viaY_, int, sizeof(int) * numVias_);
1124 DEF_MALLOC_FUNC( viaMask_, int, sizeof(int) * numVias_);
1125
1126 DEF_COPY_FUNC( numPorts_ );
1127 DEF_COPY_FUNC( portsAllocated_ );
1128 DEF_MALLOC_FUNC_FOR_2D_MALLOC_NEW( pinPort_, defiPinPort, numPorts_, 1 );
1129
1130 DEF_COPY_FUNC( numAntennaModel_ );
1131 DEF_COPY_FUNC( antennaModelAllocated_ );
1132 DEF_MALLOC_FUNC_FOR_2D( antennaModel_, defiPinAntennaModel, numAntennaModel_, 1);
1133
1134 DEF_COPY_FUNC( numAPinPartialMetalArea_ );
1135 DEF_COPY_FUNC( APinPartialMetalAreaAllocated_ );
1136 DEF_MALLOC_FUNC( APinPartialMetalArea_, int, sizeof(int) * numAPinPartialMetalArea_ );
1137 DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialMetalAreaLayer_, numAPinPartialMetalArea_ );
1138
1139 DEF_COPY_FUNC( numAPinPartialMetalSideArea_ );
1140 DEF_COPY_FUNC( APinPartialMetalSideAreaAllocated_ );
1141 DEF_MALLOC_FUNC( APinPartialMetalSideArea_, int, sizeof(int) * numAPinPartialMetalSideArea_);
1142 DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialMetalSideAreaLayer_, numAPinPartialMetalSideArea_ );
1143
1144 DEF_COPY_FUNC( numAPinDiffArea_ );
1145 DEF_COPY_FUNC( APinDiffAreaAllocated_ );
1146 DEF_MALLOC_FUNC( APinDiffArea_, int, sizeof(int) * numAPinDiffArea_);
1147 DEF_MALLOC_FUNC_FOR_2D_STR( APinDiffAreaLayer_, numAPinDiffArea_ );
1148
1149 DEF_COPY_FUNC( numAPinPartialCutArea_ );
1150 DEF_COPY_FUNC( APinPartialCutAreaAllocated_ );
1151 DEF_MALLOC_FUNC( APinPartialCutArea_, int, sizeof(int) * numAPinPartialCutArea_ );
1152 DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialCutAreaLayer_, numAPinPartialCutArea_ );
1153
1154 DEF_COPY_FUNC( netExprLength_ );
1155 DEF_COPY_FUNC( hasNetExpr_ );
1156 DEF_MALLOC_FUNC( netExpr_, char, sizeof(char) * (strlen(prev.netExpr_) +1));
1157
1158 DEF_COPY_FUNC( supplySensLength_ );
1159 DEF_COPY_FUNC( hasSupplySens_ );
1160 DEF_MALLOC_FUNC( supplySens_, char, sizeof(char) * (strlen(prev.supplySens_) +1));
1161
1162 DEF_COPY_FUNC( groundSensLength_ );
1163 DEF_COPY_FUNC( hasGroundSens_ );
1164 DEF_MALLOC_FUNC( groundSens_, char, sizeof(char) * (strlen(prev.groundSens_) +1));
1165
1166 }
1167
DEF_ASSIGN_OPERATOR_C(defiPin)1168 DEF_ASSIGN_OPERATOR_C( defiPin ) {
1169 CHECK_SELF_ASSIGN
1170 this->Init();
1171 DEF_COPY_FUNC( pinNameLength_ );
1172 DEF_MALLOC_FUNC( pinName_, char, sizeof(char) * (strlen(prev.pinName_) +1));
1173 DEF_COPY_FUNC( netNameLength_ );
1174 DEF_MALLOC_FUNC( netName_, char, sizeof(char) * (strlen(prev.netName_) +1));
1175 DEF_COPY_FUNC( hasDirection_ );
1176 DEF_COPY_FUNC( hasUse_ );
1177 DEF_COPY_FUNC( placeType_ );
1178 DEF_COPY_FUNC( orient_ );
1179 DEF_COPY_FUNC( useLength_ );
1180 DEF_MALLOC_FUNC( use_, char, sizeof(char) * (strlen(prev.use_) +1));
1181 DEF_COPY_FUNC( directionLength_ );
1182 DEF_MALLOC_FUNC( direction_, char, sizeof(char) * (strlen(prev.direction_) +1));
1183
1184 DEF_COPY_FUNC( layersAllocated_ );
1185 DEF_COPY_FUNC( numLayers_ );
1186 DEF_MALLOC_FUNC_FOR_2D_STR( layers_, numLayers_);
1187 DEF_MALLOC_FUNC( xl_, int, sizeof(int) * numLayers_);
1188 DEF_MALLOC_FUNC( yl_, int, sizeof(int) * numLayers_);
1189 DEF_MALLOC_FUNC( xh_, int, sizeof(int) * numLayers_);
1190 DEF_MALLOC_FUNC( yh_, int, sizeof(int) * numLayers_);
1191 DEF_MALLOC_FUNC( layerMinSpacing_, int, sizeof(int) * numLayers_);
1192 DEF_MALLOC_FUNC( layerEffectiveWidth_, int, sizeof(int) * numLayers_);
1193 DEF_MALLOC_FUNC( layerMask_, int, sizeof(int) * numLayers_);
1194
1195
1196 DEF_COPY_FUNC( numPolys_ );
1197 DEF_COPY_FUNC( polysAllocated_ );
1198 DEF_MALLOC_FUNC_FOR_2D_STR( polygonNames_, numPolys_);
1199 DEF_MALLOC_FUNC( polyMinSpacing_, int, sizeof(int) * numPolys_);
1200 DEF_MALLOC_FUNC( polyEffectiveWidth_, int, sizeof(int) * numPolys_);
1201 DEF_MALLOC_FUNC( polyMask_, int, sizeof(int) * numPolys_);
1202 DEF_MALLOC_FUNC_FOR_2D_POINT( polygons_, numPolys_);
1203
1204 DEF_COPY_FUNC( x_ );
1205 DEF_COPY_FUNC( y_ );
1206 DEF_COPY_FUNC( hasSpecial_ );
1207
1208 DEF_COPY_FUNC( numVias_ );
1209 DEF_COPY_FUNC( viasAllocated_ );
1210 DEF_MALLOC_FUNC_FOR_2D_STR( viaNames_, numVias_);
1211 DEF_MALLOC_FUNC( viaX_, int, sizeof(int) * numVias_);
1212 DEF_MALLOC_FUNC( viaY_, int, sizeof(int) * numVias_);
1213 DEF_MALLOC_FUNC( viaMask_, int, sizeof(int) * numVias_);
1214
1215 DEF_COPY_FUNC( numPorts_ );
1216 DEF_COPY_FUNC( portsAllocated_ );
1217 DEF_MALLOC_FUNC_FOR_2D_MALLOC_NEW( pinPort_, defiPinPort, numPorts_, 1 );
1218
1219 DEF_COPY_FUNC( numAntennaModel_ );
1220 DEF_COPY_FUNC( antennaModelAllocated_ );
1221 DEF_MALLOC_FUNC_FOR_2D( antennaModel_, defiPinAntennaModel, numAntennaModel_, 1);
1222
1223 DEF_COPY_FUNC( numAPinPartialMetalArea_ );
1224 DEF_COPY_FUNC( APinPartialMetalAreaAllocated_ );
1225 DEF_MALLOC_FUNC( APinPartialMetalArea_, int, sizeof(int) * numAPinPartialMetalArea_ );
1226 DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialMetalAreaLayer_, numAPinPartialMetalArea_ );
1227
1228 DEF_COPY_FUNC( numAPinPartialMetalSideArea_ );
1229 DEF_COPY_FUNC( APinPartialMetalSideAreaAllocated_ );
1230 DEF_MALLOC_FUNC( APinPartialMetalSideArea_, int, sizeof(int) * numAPinPartialMetalSideArea_);
1231 DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialMetalSideAreaLayer_, numAPinPartialMetalSideArea_ );
1232
1233 DEF_COPY_FUNC( numAPinDiffArea_ );
1234 DEF_COPY_FUNC( APinDiffAreaAllocated_ );
1235 DEF_MALLOC_FUNC( APinDiffArea_, int, sizeof(int) * numAPinDiffArea_);
1236 DEF_MALLOC_FUNC_FOR_2D_STR( APinDiffAreaLayer_, numAPinDiffArea_ );
1237
1238 DEF_COPY_FUNC( numAPinPartialCutArea_ );
1239 DEF_COPY_FUNC( APinPartialCutAreaAllocated_ );
1240 DEF_MALLOC_FUNC( APinPartialCutArea_, int, sizeof(int) * numAPinPartialCutArea_ );
1241 DEF_MALLOC_FUNC_FOR_2D_STR( APinPartialCutAreaLayer_, numAPinPartialCutArea_ );
1242
1243 DEF_COPY_FUNC( netExprLength_ );
1244 DEF_COPY_FUNC( hasNetExpr_ );
1245 DEF_MALLOC_FUNC( netExpr_, char, sizeof(char) * (strlen(prev.netExpr_) +1));
1246
1247 DEF_COPY_FUNC( supplySensLength_ );
1248 DEF_COPY_FUNC( hasSupplySens_ );
1249 DEF_MALLOC_FUNC( supplySens_, char, sizeof(char) * (strlen(prev.supplySens_) +1));
1250
1251 DEF_COPY_FUNC( groundSensLength_ );
1252 DEF_COPY_FUNC( hasGroundSens_ );
1253 DEF_MALLOC_FUNC( groundSens_, char, sizeof(char) * (strlen(prev.groundSens_) +1));
1254 return *this;
1255 }
1256
~defiPin()1257 defiPin::~defiPin() {
1258 Destroy();
1259 }
1260
1261
clear()1262 void defiPin::clear() {
1263 int i;
1264
1265 hasDirection_ = 0;
1266 hasNetExpr_ = 0;
1267 hasSupplySens_ = 0;
1268 hasGroundSens_ = 0;
1269 hasUse_ = 0;
1270 hasSpecial_ = 0;
1271 placeType_ = 0;
1272 orient_ = 0;
1273 x_ = 0;
1274 y_ = 0;
1275
1276 if (layers_) {
1277 for (i = 0; i < numLayers_; i++)
1278 if (layers_[i]) free(layers_[i]);
1279 free((char*)(layers_));
1280 free((char*)(xl_));
1281 free((char*)(yl_));
1282 free((char*)(xh_));
1283 free((char*)(yh_));
1284 free((char*)(layerMinSpacing_));
1285 free((char*)(layerMask_));
1286 free((char*)(layerEffectiveWidth_));
1287 }
1288 layers_ = 0;
1289 layerMinSpacing_ = 0;
1290 layerMask_ = 0;
1291 layerEffectiveWidth_ = 0;
1292 numLayers_ = 0;
1293 layersAllocated_ = 0;
1294 // 5.6
1295 if (polygonNames_) {
1296 struct defiPoints* p;
1297 for (i = 0; i < numPolys_; i++) {
1298 if (polygonNames_[i]) free((char*)(polygonNames_[i]));
1299 p = polygons_[i];
1300 free((char*)(p->x));
1301 free((char*)(p->y));
1302 free((char*)(polygons_[i]));
1303 }
1304 free((char*)(polygonNames_));
1305 free((char*)(polygons_));
1306 free((char*)(polyMinSpacing_));
1307 free((char*)(polyMask_));
1308 free((char*)(polyEffectiveWidth_));
1309 polygonNames_ = 0;
1310 polygons_ = 0;
1311 polyMinSpacing_ = 0;
1312 polyMask_ = 0;
1313 polyEffectiveWidth_ = 0;
1314 }
1315 numPolys_ = 0;
1316 polysAllocated_ = 0;
1317 // 5.7
1318 if (viaNames_) {
1319 for (i = 0; i < numVias_; i++)
1320 if (viaNames_[i]) free(viaNames_[i]);
1321 free((char*)(viaNames_));
1322 free((char*)(viaX_));
1323 free((char*)(viaY_));
1324 free((char*)(viaMask_));
1325 }
1326 viaNames_ = 0;
1327 numVias_ = 0;
1328 viaMask_ = 0;
1329 viasAllocated_ = 0;
1330 // 5.7
1331 if (pinPort_) {
1332 for (i = 0; i < numPorts_; i++) {
1333 if (pinPort_[i]) {
1334 pinPort_[i]->clear();
1335 delete pinPort_[i];
1336 // free(pinPort_[i]);
1337 }
1338 }
1339 free(pinPort_);
1340 }
1341 pinPort_ = 0;
1342 numPorts_ = 0;
1343 portsAllocated_ = 0;
1344
1345 for (i = 0; i < numAPinPartialMetalArea_; i++) {
1346 if (APinPartialMetalAreaLayer_[i])
1347 free(APinPartialMetalAreaLayer_[i]);
1348 }
1349 numAPinPartialMetalArea_ = 0;
1350
1351 for (i = 0; i < numAPinPartialMetalSideArea_; i++) {
1352 if (APinPartialMetalSideAreaLayer_[i])
1353 free(APinPartialMetalSideAreaLayer_[i]);
1354 }
1355 numAPinPartialMetalSideArea_ = 0;
1356
1357 for (i = 0; i < numAPinDiffArea_; i++) {
1358 if (APinDiffAreaLayer_[i])
1359 free(APinDiffAreaLayer_[i]);
1360 }
1361 numAPinDiffArea_ = 0;
1362
1363 for (i = 0; i < numAPinPartialCutArea_; i++) {
1364 if (APinPartialCutAreaLayer_[i])
1365 free(APinPartialCutAreaLayer_[i]);
1366 }
1367 numAPinPartialCutArea_ = 0;
1368
1369 for (i = 0; i < antennaModelAllocated_; i++) { // 5.5
1370 delete antennaModel_[i];
1371 }
1372
1373 numAntennaModel_ = 0;
1374 antennaModelAllocated_ = 0;
1375 }
1376
1377
Destroy()1378 void defiPin::Destroy() {
1379 if (pinName_) free(pinName_);
1380 if (netName_) free(netName_);
1381 if (use_) free(use_);
1382 if (direction_) free(direction_);
1383 if (netExpr_) free(netExpr_);
1384 if (supplySens_) free(supplySens_);
1385 if (groundSens_) free(groundSens_);
1386 pinName_ = 0;
1387 netName_ = 0;
1388 use_ = 0;
1389 direction_ = 0;
1390 netExpr_ = 0;
1391 supplySens_ = 0;
1392 groundSens_ = 0;
1393 pinNameLength_ = 0;
1394 netNameLength_ = 0;
1395 useLength_ = 0;
1396 directionLength_ = 0;
1397 netExprLength_ = 0;
1398 supplySensLength_ = 0;
1399 groundSensLength_ = 0;
1400 layersAllocated_ = 0;
1401 clear();
1402
1403 // 5.4
1404 if (APinPartialMetalArea_)
1405 free((char*)(APinPartialMetalArea_));
1406 if (APinPartialMetalAreaLayer_)
1407 free((char*)(APinPartialMetalAreaLayer_));
1408 if (APinPartialMetalSideArea_)
1409 free((char*)(APinPartialMetalSideArea_));
1410 if (APinPartialMetalSideAreaLayer_)
1411 free((char*)(APinPartialMetalSideAreaLayer_));
1412 if (APinDiffArea_)
1413 free((char*)(APinDiffArea_));
1414 if (APinDiffAreaLayer_)
1415 free((char*)(APinDiffAreaLayer_));
1416 if (APinPartialCutArea_)
1417 free((char*)(APinPartialCutArea_));
1418 if (APinPartialCutAreaLayer_)
1419 free((char*)(APinPartialCutAreaLayer_));
1420 if (antennaModel_)
1421 free((char*)(antennaModel_));
1422 }
1423
1424
Setup(const char * pinName,const char * netName)1425 void defiPin::Setup(const char* pinName, const char* netName) {
1426 int len = strlen(pinName) + 1;
1427 if (pinNameLength_ < len) {
1428 if (pinName_) free(pinName_);
1429 pinName_ = (char*)malloc(len);
1430 pinNameLength_ = len;
1431 }
1432 strcpy(pinName_, defData->DEFCASE(pinName));
1433
1434 len = strlen(netName) + 1;
1435 if (netNameLength_ < len) {
1436 if (netName_) free(netName_);
1437 netName_ = (char*)malloc(len);
1438 netNameLength_ = len;
1439 }
1440 strcpy(netName_, defData->DEFCASE(netName));
1441
1442 clear();
1443
1444 }
1445
1446
setDirection(const char * dir)1447 void defiPin::setDirection(const char* dir) {
1448 int len = strlen(dir) + 1;
1449 if (directionLength_ < len) {
1450 if (direction_) free(direction_);
1451 direction_ = (char*)malloc(len);
1452 directionLength_ = len;
1453 }
1454 strcpy(direction_, defData->DEFCASE(dir));
1455 hasDirection_ = 1;
1456 }
1457
1458
setNetExpr(const char * name)1459 void defiPin::setNetExpr(const char* name) {
1460 int len = strlen(name) + 1;
1461 if (netExprLength_ < len) {
1462 if (netExpr_) free(netExpr_);
1463 netExpr_ = (char*)malloc(len);
1464 netExprLength_ = len;
1465 }
1466 strcpy(netExpr_, defData->DEFCASE(name));
1467 hasNetExpr_ = 1;
1468 }
1469
1470
setSupplySens(const char * name)1471 void defiPin::setSupplySens(const char* name) {
1472 int len = strlen(name) + 1;
1473 if (supplySensLength_ < len) {
1474 if (supplySens_) free(supplySens_);
1475 supplySens_ = (char*)malloc(len);
1476 supplySensLength_ = len;
1477 }
1478 strcpy(supplySens_, defData->DEFCASE(name));
1479 hasSupplySens_ = 1;
1480 }
1481
1482
setGroundSens(const char * name)1483 void defiPin::setGroundSens(const char* name) {
1484 int len = strlen(name) + 1;
1485 if (groundSensLength_ < len) {
1486 if (groundSens_) free(groundSens_);
1487 groundSens_ = (char*)malloc(len);
1488 groundSensLength_ = len;
1489 }
1490 strcpy(groundSens_, defData->DEFCASE(name));
1491 hasGroundSens_ = 1;
1492 }
1493
1494
setUse(const char * use)1495 void defiPin::setUse(const char* use) {
1496 int len = strlen(use) + 1;
1497 if (useLength_ < len) {
1498 if (use_) free(use_);
1499 use_ = (char*)malloc(len);
1500 useLength_ = len;
1501 }
1502 strcpy(use_, defData->DEFCASE(use));
1503 hasUse_ = 1;
1504 }
1505
1506
1507 // 5.6, renamed from setLayer to addLayer for multiple layers allowed
addLayer(const char * layer)1508 void defiPin::addLayer(const char* layer) {
1509
1510 if (numLayers_ >= layersAllocated_) {
1511 int i;
1512 char** newl;
1513 int *nxl, *nyl, *nxh, *nyh;
1514 int *lms, *lew, *lm;
1515
1516 layersAllocated_ = layersAllocated_ ?
1517 layersAllocated_ * 2 : 8;
1518 newl = (char**)malloc(layersAllocated_ * sizeof(char*));
1519 nxl = (int*)malloc(layersAllocated_ * sizeof(int));
1520 nyl = (int*)malloc(layersAllocated_ * sizeof(int));
1521 nxh = (int*)malloc(layersAllocated_ * sizeof(int));
1522 nyh = (int*)malloc(layersAllocated_ * sizeof(int));
1523 lms = (int*)malloc(layersAllocated_ * sizeof(int));
1524 lew = (int*)malloc(layersAllocated_ * sizeof(int));
1525 lm = (int*)malloc(layersAllocated_ * sizeof(int));
1526
1527 for (i = 0; i < numLayers_; i++) {
1528 newl[i] = layers_[i];
1529 nxl[i] = xl_[i];
1530 nyl[i] = yl_[i];
1531 nxh[i] = xh_[i];
1532 nyh[i] = yh_[i];
1533 lms[i] = layerMinSpacing_[i];
1534 lew[i] = layerEffectiveWidth_[i];
1535 lm[i] = layerMask_[i];
1536 }
1537 if (numLayers_ > 0) {
1538 free((char*)layers_);
1539 free((char*)xl_);
1540 free((char*)yl_);
1541 free((char*)xh_);
1542 free((char*)yh_);
1543 free((char*)layerMinSpacing_);
1544 free((char*)layerMask_);
1545 free((char*)layerEffectiveWidth_);
1546 }
1547 layers_ = newl;
1548 xl_ = nxl;
1549 yl_ = nyl;
1550 xh_ = nxh;
1551 yh_ = nyh;
1552 layerMinSpacing_ = lms;
1553 layerEffectiveWidth_ = lew;
1554 layerMask_ = lm;
1555 }
1556 layers_[numLayers_] = (char*)malloc(strlen(layer)+1);
1557 strcpy(layers_[numLayers_], defData->DEFCASE(layer));
1558 xl_[numLayers_] = 0;
1559 yl_[numLayers_] = 0;
1560 xh_[numLayers_] = 0;
1561 yh_[numLayers_] = 0;
1562 layerMinSpacing_[numLayers_] = -1;
1563 layerMask_[numLayers_] = 0;
1564 layerEffectiveWidth_[numLayers_] = -1;
1565 numLayers_ += 1;
1566 }
1567
1568 // 5.6
addLayerPts(int xl,int yl,int xh,int yh)1569 void defiPin::addLayerPts(int xl, int yl, int xh, int yh) {
1570 xl_[numLayers_-1] = xl;
1571 yl_[numLayers_-1] = yl;
1572 xh_[numLayers_-1] = xh;
1573 yh_[numLayers_-1] = yh;
1574 }
1575
1576 // 5.6
addLayerSpacing(int minSpacing)1577 void defiPin::addLayerSpacing(int minSpacing) {
1578 layerMinSpacing_[numLayers_-1] = minSpacing;
1579 }
1580
addLayerMask(int mask)1581 void defiPin::addLayerMask(int mask) {
1582 layerMask_[numLayers_-1] = mask;
1583 }
1584
1585 // 5.6
addLayerDesignRuleWidth(int effectiveWidth)1586 void defiPin::addLayerDesignRuleWidth(int effectiveWidth) {
1587 layerEffectiveWidth_[numLayers_-1] = effectiveWidth;
1588 }
1589
1590
setPlacement(int typ,int x,int y,int orient)1591 void defiPin::setPlacement(int typ, int x, int y, int orient) {
1592 x_ = x;
1593 y_ = y;
1594 orient_ = orient;
1595 placeType_ = typ;
1596 }
1597
1598
pinName() const1599 const char* defiPin::pinName() const {
1600 return pinName_;
1601 }
1602
1603
netName() const1604 const char* defiPin::netName() const {
1605 return netName_;
1606 }
1607
1608
changePinName(const char * pinName)1609 void defiPin::changePinName(const char* pinName) {
1610 int len = strlen(pinName) + 1;
1611 if (pinNameLength_ < len) {
1612 if (pinName_) free(pinName_);
1613 pinName_ = (char*)malloc(len);
1614 pinNameLength_ = len;
1615 }
1616 strcpy(pinName_, defData->DEFCASE(pinName));
1617 }
1618
1619
hasDirection() const1620 int defiPin::hasDirection() const {
1621 return (int)(hasDirection_);
1622 }
1623
1624
hasUse() const1625 int defiPin::hasUse() const {
1626 return (int)(hasUse_);
1627 }
1628
1629
hasLayer() const1630 int defiPin::hasLayer() const {
1631 if (numLayers_ || numPolys_) // 5.6, either layer or polygon is
1632 return 1; // non-zero
1633 else
1634 return 0;
1635 }
1636
1637
hasPlacement() const1638 int defiPin::hasPlacement() const {
1639 return placeType_ == 0 ? 0 : 1 ;
1640 }
1641
1642
isUnplaced() const1643 int defiPin::isUnplaced() const {
1644 return placeType_ == DEFI_COMPONENT_UNPLACED ? 1 : 0 ;
1645 }
1646
1647
isPlaced() const1648 int defiPin::isPlaced() const {
1649 return placeType_ == DEFI_COMPONENT_PLACED ? 1 : 0 ;
1650 }
1651
1652
isCover() const1653 int defiPin::isCover() const {
1654 return placeType_ == DEFI_COMPONENT_COVER ? 1 : 0 ;
1655 }
1656
1657
isFixed() const1658 int defiPin::isFixed() const {
1659 return placeType_ == DEFI_COMPONENT_FIXED ? 1 : 0 ;
1660 }
1661
1662
placementX() const1663 int defiPin::placementX() const {
1664 return x_;
1665 }
1666
1667
placementY() const1668 int defiPin::placementY() const {
1669 return y_;
1670 }
1671
1672
direction() const1673 const char* defiPin::direction() const {
1674 return direction_;
1675 }
1676
1677
use() const1678 const char* defiPin::use() const {
1679 return use_;
1680 }
1681
1682
numLayer() const1683 int defiPin::numLayer() const {
1684 return numLayers_;
1685 }
1686
layer(int index) const1687 const char* defiPin::layer(int index) const {
1688 return layers_[index];
1689 }
1690
1691
bounds(int index,int * xl,int * yl,int * xh,int * yh) const1692 void defiPin::bounds(int index, int* xl, int* yl, int* xh, int* yh) const {
1693 if (xl) *xl = xl_[index];
1694 if (yl) *yl = yl_[index];
1695 if (xh) *xh = xh_[index];
1696 if (yh) *yh = yh_[index];
1697 }
1698
1699 // 5.6
hasLayerSpacing(int index) const1700 int defiPin::hasLayerSpacing(int index) const{
1701 if (layerMinSpacing_[index] == -1)
1702 return 0;
1703 return 1;
1704 }
1705
1706 // 5.6
hasLayerDesignRuleWidth(int index) const1707 int defiPin::hasLayerDesignRuleWidth(int index) const{
1708 if (layerEffectiveWidth_[index] == -1)
1709 return 0;
1710 return 1;
1711 }
1712
1713 // 5.6
layerSpacing(int index) const1714 int defiPin::layerSpacing(int index) const {
1715 return layerMinSpacing_[index];
1716 }
1717
layerMask(int index) const1718 int defiPin::layerMask(int index) const {
1719 return layerMask_[index];
1720 }
1721
1722 // 5.6
layerDesignRuleWidth(int index) const1723 int defiPin::layerDesignRuleWidth(int index) const {
1724 return layerEffectiveWidth_[index];
1725 }
1726
orient() const1727 int defiPin::orient() const {
1728 return orient_;
1729 }
1730
orientStr() const1731 const char* defiPin::orientStr() const {
1732 return (defiOrientStr(orient_));
1733 }
1734
1735
setSpecial()1736 void defiPin::setSpecial() {
1737 hasSpecial_ = 1;
1738 }
1739
1740 // 5.5
addAntennaModel(int oxide)1741 void defiPin::addAntennaModel(int oxide) {
1742 // For version 5.5 only OXIDE1, OXIDE2, OXIDE3, & OXIDE4
1743 // are defined within a pin
1744 defiPinAntennaModel* amo;
1745 int i;
1746
1747 if (numAntennaModel_ == 0) { // does not have antennaModel
1748 if (!antennaModel_) // only need to malloc if it is nill
1749 antennaModel_ = (defiPinAntennaModel**)
1750 malloc(sizeof(defiPinAntennaModel*)*4);
1751 antennaModelAllocated_ = 4;
1752 for (i = 0; i < 4; i++) {
1753 antennaModel_[i] = new defiPinAntennaModel(defData);
1754 }
1755 numAntennaModel_++;
1756 antennaModelAllocated_ = 4;
1757 amo = antennaModel_[0];
1758 } else {
1759 amo = antennaModel_[numAntennaModel_];
1760 numAntennaModel_++;
1761 }
1762 amo->Init();
1763 amo->setAntennaModel(oxide);
1764 return;
1765 }
1766
1767 // 5.5
numAntennaModel() const1768 int defiPin::numAntennaModel() const {
1769 return numAntennaModel_;
1770 }
1771
1772 // 5.5
antennaModel(int index) const1773 defiPinAntennaModel* defiPin::antennaModel(int index) const {
1774 return antennaModel_[index];
1775 }
1776
addAPinPartialMetalArea(int value,const char * layer)1777 void defiPin::addAPinPartialMetalArea(int value, const char* layer) {
1778 if (numAPinPartialMetalArea_ == APinPartialMetalAreaAllocated_) {
1779 int i;
1780 int max;
1781 int lim = numAPinPartialMetalArea_;
1782 int* nd;
1783 char** nl;
1784
1785 if (APinPartialMetalAreaAllocated_ == 0)
1786 max = APinPartialMetalAreaAllocated_ = 2;
1787 else
1788 max = APinPartialMetalAreaAllocated_ *= 2;
1789 nd = (int*)malloc(sizeof(int)*max);
1790 nl = (char**)malloc(sizeof(char*)*max);
1791 for (i = 0; i < lim; i++) {
1792 nd[i] = APinPartialMetalArea_[i];
1793 nl[i] = APinPartialMetalAreaLayer_[i];
1794 }
1795 free((char*)(APinPartialMetalArea_));
1796 free((char*)(APinPartialMetalAreaLayer_));
1797 APinPartialMetalArea_ = nd;
1798 APinPartialMetalAreaLayer_ = nl;
1799
1800 }
1801 APinPartialMetalArea_[numAPinPartialMetalArea_] = value;
1802 if (layer) {
1803 APinPartialMetalAreaLayer_[numAPinPartialMetalArea_] =
1804 (char*)malloc(strlen(layer)+1);
1805 strcpy(APinPartialMetalAreaLayer_[numAPinPartialMetalArea_],
1806 defData->DEFCASE(layer));
1807 } else
1808 APinPartialMetalAreaLayer_[numAPinPartialMetalArea_] = NULL;
1809 numAPinPartialMetalArea_ += 1;
1810 }
1811
1812
addAPinPartialMetalSideArea(int value,const char * layer)1813 void defiPin::addAPinPartialMetalSideArea(int value, const char* layer) {
1814 if (numAPinPartialMetalSideArea_ == APinPartialMetalSideAreaAllocated_) {
1815 int i;
1816 int max;
1817 int lim = numAPinPartialMetalSideArea_;
1818 int* nd;
1819 char** nl;
1820
1821 if (APinPartialMetalSideAreaAllocated_ == 0)
1822 max = APinPartialMetalSideAreaAllocated_ = 2;
1823 else
1824 max = APinPartialMetalSideAreaAllocated_ *= 2;
1825 nd = (int*)malloc(sizeof(int)*max);
1826 nl = (char**)malloc(sizeof(char*)*max);
1827 for (i = 0; i < lim; i++) {
1828 nd[i] = APinPartialMetalSideArea_[i];
1829 nl[i] = APinPartialMetalSideAreaLayer_[i];
1830 }
1831 free((char*)(APinPartialMetalSideArea_));
1832 free((char*)(APinPartialMetalSideAreaLayer_));
1833 APinPartialMetalSideArea_ = nd;
1834 APinPartialMetalSideAreaLayer_ = nl;
1835
1836 }
1837 APinPartialMetalSideArea_[numAPinPartialMetalSideArea_] = value;
1838 if (layer) {
1839 APinPartialMetalSideAreaLayer_[numAPinPartialMetalSideArea_] =
1840 (char*)malloc(strlen(layer)+1);
1841 strcpy(APinPartialMetalSideAreaLayer_[numAPinPartialMetalSideArea_],
1842 defData->DEFCASE(layer));
1843 } else
1844 APinPartialMetalSideAreaLayer_[numAPinPartialMetalSideArea_] = NULL;
1845 numAPinPartialMetalSideArea_ += 1;
1846 }
1847
1848
addAPinGateArea(int value,const char * layer)1849 void defiPin::addAPinGateArea(int value, const char* layer) {
1850 if (numAntennaModel_ == 0) // haven't created any antennaModel yet
1851 addAntennaModel(1);
1852 antennaModel_[numAntennaModel_-1]->addAPinGateArea(value, layer);
1853 }
1854
1855
addAPinDiffArea(int value,const char * layer)1856 void defiPin::addAPinDiffArea(int value, const char* layer) {
1857 if (numAPinDiffArea_ == APinDiffAreaAllocated_) {
1858 int i;
1859 int max;
1860 int lim = numAPinDiffArea_;
1861 int* nd;
1862 char** nl;
1863
1864 if (APinDiffAreaAllocated_ == 0)
1865 max = APinDiffAreaAllocated_ = 2;
1866 else
1867 max = APinDiffAreaAllocated_ *= 2;
1868 nd = (int*)malloc(sizeof(int)*max);
1869 nl = (char**)malloc(sizeof(char*)*max);
1870 for (i = 0; i < lim; i++) {
1871 nd[i] = APinDiffArea_[i];
1872 nl[i] = APinDiffAreaLayer_[i];
1873 }
1874 free((char*)(APinDiffArea_));
1875 free((char*)(APinDiffAreaLayer_));
1876 APinDiffArea_ = nd;
1877 APinDiffAreaLayer_ = nl;
1878
1879 }
1880 APinDiffArea_[numAPinDiffArea_] = value;
1881 if (layer) {
1882 APinDiffAreaLayer_[numAPinDiffArea_] =
1883 (char*)malloc(strlen(layer)+1);
1884 strcpy(APinDiffAreaLayer_[numAPinDiffArea_],
1885 defData->DEFCASE(layer));
1886 } else
1887 APinDiffAreaLayer_[numAPinDiffArea_] = NULL;
1888 numAPinDiffArea_ += 1;
1889 }
1890
1891
addAPinMaxAreaCar(int value,const char * layer)1892 void defiPin::addAPinMaxAreaCar(int value, const char* layer) {
1893 if (numAntennaModel_ == 0) // haven't created any antennaModel yet
1894 addAntennaModel(1);
1895 antennaModel_[numAntennaModel_-1]->addAPinMaxAreaCar(value, layer);
1896 }
1897
1898
addAPinMaxSideAreaCar(int value,const char * layer)1899 void defiPin::addAPinMaxSideAreaCar(int value, const char* layer) {
1900 if (numAntennaModel_ == 0) // haven't created any antennaModel yet
1901 addAntennaModel(1);
1902 antennaModel_[numAntennaModel_-1]->addAPinMaxSideAreaCar(value, layer);
1903 }
1904
1905
addAPinPartialCutArea(int value,const char * layer)1906 void defiPin::addAPinPartialCutArea(int value, const char* layer) {
1907 if (numAPinPartialCutArea_ == APinPartialCutAreaAllocated_) {
1908 int i;
1909 int max;
1910 int lim = numAPinPartialCutArea_;
1911 int* nd;
1912 char** nl;
1913
1914 if (APinPartialCutAreaAllocated_ == 0)
1915 max = APinPartialCutAreaAllocated_ = 2;
1916 else
1917 max = APinPartialCutAreaAllocated_ *= 2;
1918 nd = (int*)malloc(sizeof(int)*max);
1919 nl = (char**)malloc(sizeof(char*)*max);
1920 for (i = 0; i < lim; i++) {
1921 nd[i] = APinPartialCutArea_[i];
1922 nl[i] = APinPartialCutAreaLayer_[i];
1923 }
1924 free((char*)(APinPartialCutArea_));
1925 free((char*)(APinPartialCutAreaLayer_));
1926 APinPartialCutArea_ = nd;
1927 APinPartialCutAreaLayer_ = nl;
1928
1929 }
1930 APinPartialCutArea_[numAPinPartialCutArea_] = value;
1931 if (layer) {
1932 APinPartialCutAreaLayer_[numAPinPartialCutArea_] =
1933 (char*)malloc(strlen(layer)+1);
1934 strcpy(APinPartialCutAreaLayer_[numAPinPartialCutArea_],
1935 defData->DEFCASE(layer));
1936 } else
1937 APinPartialCutAreaLayer_[numAPinPartialCutArea_] = NULL;
1938 numAPinPartialCutArea_ += 1;
1939 }
1940
1941
addAPinMaxCutCar(int value,const char * layer)1942 void defiPin::addAPinMaxCutCar(int value, const char* layer) {
1943 if (numAntennaModel_ == 0) // haven't created any antennaModel yet
1944 addAntennaModel(1);
1945 antennaModel_[numAntennaModel_-1]->addAPinMaxCutCar(value, layer);
1946 }
1947
1948
hasSpecial() const1949 int defiPin::hasSpecial() const {
1950 return (int)hasSpecial_;
1951 }
1952
1953
hasAPinPartialMetalArea() const1954 int defiPin::hasAPinPartialMetalArea() const {
1955 return numAPinPartialMetalArea_ ? 1 : 0 ;
1956 }
1957
1958
hasAPinPartialMetalSideArea() const1959 int defiPin::hasAPinPartialMetalSideArea() const {
1960 return numAPinPartialMetalSideArea_ ? 1 : 0 ;
1961 }
1962
1963
hasAPinDiffArea() const1964 int defiPin::hasAPinDiffArea() const {
1965 return numAPinDiffArea_ ? 1 : 0 ;
1966 }
1967
1968
hasAPinPartialCutArea() const1969 int defiPin::hasAPinPartialCutArea() const {
1970 return numAPinPartialCutArea_ ? 1 : 0 ;
1971 }
1972
1973
numAPinPartialMetalArea() const1974 int defiPin::numAPinPartialMetalArea() const {
1975 return numAPinPartialMetalArea_;
1976 }
1977
1978
numAPinPartialMetalSideArea() const1979 int defiPin::numAPinPartialMetalSideArea() const {
1980 return numAPinPartialMetalSideArea_;
1981 }
1982
1983
numAPinDiffArea() const1984 int defiPin::numAPinDiffArea() const {
1985 return numAPinDiffArea_;
1986 }
1987
1988
numAPinPartialCutArea() const1989 int defiPin::numAPinPartialCutArea() const {
1990 return numAPinPartialCutArea_;
1991 }
1992
1993
APinPartialMetalArea(int i) const1994 int defiPin::APinPartialMetalArea(int i) const {
1995 return APinPartialMetalArea_[i];
1996 }
1997
1998
hasAPinPartialMetalAreaLayer(int i) const1999 int defiPin::hasAPinPartialMetalAreaLayer(int i) const {
2000 return (APinPartialMetalAreaLayer_[i] &&
2001 *(APinPartialMetalAreaLayer_[i])) ? 1 : 0 ;
2002 }
2003
2004
APinPartialMetalAreaLayer(int i) const2005 const char* defiPin::APinPartialMetalAreaLayer(int i) const {
2006 return APinPartialMetalAreaLayer_[i];
2007 }
2008
2009
APinPartialMetalSideArea(int i) const2010 int defiPin::APinPartialMetalSideArea(int i) const {
2011 return APinPartialMetalSideArea_[i];
2012 }
2013
2014
hasAPinPartialMetalSideAreaLayer(int i) const2015 int defiPin::hasAPinPartialMetalSideAreaLayer(int i) const {
2016 return (APinPartialMetalSideAreaLayer_[i] &&
2017 *(APinPartialMetalSideAreaLayer_[i])) ? 1 : 0 ;
2018 }
2019
2020
APinPartialMetalSideAreaLayer(int i) const2021 const char* defiPin::APinPartialMetalSideAreaLayer(int i) const {
2022 return APinPartialMetalSideAreaLayer_[i];
2023 }
2024
2025
APinDiffArea(int i) const2026 int defiPin::APinDiffArea(int i) const {
2027 return APinDiffArea_[i];
2028 }
2029
2030
hasAPinDiffAreaLayer(int i) const2031 int defiPin::hasAPinDiffAreaLayer(int i) const {
2032 return (APinDiffAreaLayer_[i] && *(APinDiffAreaLayer_[i])) ?
2033 1 : 0 ;
2034 }
2035
2036
APinDiffAreaLayer(int i) const2037 const char* defiPin::APinDiffAreaLayer(int i) const {
2038 return APinDiffAreaLayer_[i];
2039 }
2040
2041
APinPartialCutArea(int i) const2042 int defiPin::APinPartialCutArea(int i) const {
2043 return APinPartialCutArea_[i];
2044 }
2045
2046
hasAPinPartialCutAreaLayer(int i) const2047 int defiPin::hasAPinPartialCutAreaLayer(int i) const {
2048 return (APinPartialCutAreaLayer_[i] &&
2049 *(APinPartialCutAreaLayer_[i])) ? 1 : 0 ;
2050 }
2051
2052
APinPartialCutAreaLayer(int i) const2053 const char* defiPin::APinPartialCutAreaLayer(int i) const {
2054 return APinPartialCutAreaLayer_[i];
2055 }
2056
2057
2058 // 5.6
addPolygon(const char * layerName)2059 void defiPin::addPolygon(const char* layerName) {
2060 int *pms, *pdw, *pm;
2061 int i;
2062
2063 if (numPolys_ == polysAllocated_) {
2064 char** newn;
2065 struct defiPoints** poly;
2066 polysAllocated_ = (polysAllocated_ == 0) ?
2067 2 : polysAllocated_ * 2;
2068 newn = (char**)malloc(sizeof(char*) * polysAllocated_);
2069 poly = (struct defiPoints**)malloc(sizeof(struct defiPoints*) *
2070 polysAllocated_);
2071 pms = (int*)malloc(polysAllocated_ * sizeof(int));
2072 pdw = (int*)malloc(polysAllocated_ * sizeof(int));
2073 pm = (int*)malloc(polysAllocated_ * sizeof(int));
2074
2075 for (i = 0; i < numPolys_; i++) {
2076 newn[i] = polygonNames_[i];
2077 poly[i] = polygons_[i];
2078 pms[i] = polyMinSpacing_[i];
2079 pdw[i] = polyEffectiveWidth_[i];
2080 pm[i] = polyMask_[i];
2081 }
2082 if (numPolys_ > 0) {
2083 free((char*)(polygons_));
2084 free((char*)(polygonNames_));
2085 free((char*)(polyMinSpacing_));
2086 free((char*)(polyEffectiveWidth_));
2087 free((char*)(polyMask_));
2088 }
2089 polygonNames_ = newn;
2090 polygons_ = poly;
2091 polyMinSpacing_ = pms;
2092 polyEffectiveWidth_ = pdw;
2093 polyMask_= pm;
2094 }
2095 polygonNames_[numPolys_] = strdup(layerName);
2096 polygons_[numPolys_] = 0;
2097 polyMinSpacing_[numPolys_] = -1;
2098 polyEffectiveWidth_[numPolys_] = -1;
2099 polyMask_[numPolys_] = 0;
2100 numPolys_ += 1;
2101 }
2102
2103
2104 // 5.6
addPolygonPts(defiGeometries * geom)2105 void defiPin::addPolygonPts(defiGeometries* geom) {
2106 struct defiPoints* p;
2107 int x, y;
2108 int i;
2109
2110 p = (struct defiPoints*)malloc(sizeof(struct defiPoints));
2111 p->numPoints = geom->numPoints();
2112 p->x = (int*)malloc(sizeof(int)*p->numPoints);
2113 p->y = (int*)malloc(sizeof(int)*p->numPoints);
2114 for (i = 0; i < p->numPoints; i++) {
2115 geom->points(i, &x, &y);
2116 p->x[i] = x;
2117 p->y[i] = y;
2118 }
2119 polygons_[numPolys_-1] = p;
2120 }
2121
2122
2123 // 5.6
addPolySpacing(int minSpacing)2124 void defiPin::addPolySpacing(int minSpacing) {
2125 polyMinSpacing_[numPolys_-1] = minSpacing;
2126 }
2127
addPolyMask(int color)2128 void defiPin::addPolyMask(int color) {
2129 polyMask_[numPolys_-1] = color;
2130 }
2131
2132 // 5.6
addPolyDesignRuleWidth(int effectiveWidth)2133 void defiPin::addPolyDesignRuleWidth(int effectiveWidth) {
2134 polyEffectiveWidth_[numPolys_-1] = effectiveWidth;
2135 }
2136
2137
2138 // 5.6
numPolygons() const2139 int defiPin::numPolygons() const {
2140 return numPolys_;
2141 }
2142
2143
2144 // 5.6
polygonName(int index) const2145 const char* defiPin::polygonName(int index) const {
2146 if (index < 0 || index > numPolys_) {
2147 defiError(1, 0, "index out of bounds", defData);
2148 return 0;
2149 }
2150 return polygonNames_[index];
2151 }
2152
2153 // 5.6
getPolygon(int index) const2154 struct defiPoints defiPin::getPolygon(int index) const {
2155 return *(polygons_[index]);
2156 }
2157
2158 // 5.6
hasPolygonSpacing(int index) const2159 int defiPin::hasPolygonSpacing(int index) const{
2160 if (polyMinSpacing_[index] == -1)
2161 return 0;
2162 return 1;
2163 }
2164
2165 // 5.6
hasPolygonDesignRuleWidth(int index) const2166 int defiPin::hasPolygonDesignRuleWidth(int index) const{
2167 if (polyEffectiveWidth_[index] == -1)
2168 return 0;
2169 return 1;
2170 }
2171
2172 // 5.6
polygonSpacing(int index) const2173 int defiPin::polygonSpacing(int index) const {
2174 return polyMinSpacing_[index];
2175 }
2176
polygonMask(int index) const2177 int defiPin::polygonMask(int index) const {
2178 return polyMask_[index];
2179 }
2180
2181 // 5.6
polygonDesignRuleWidth(int index) const2182 int defiPin::polygonDesignRuleWidth(int index) const {
2183 return polyEffectiveWidth_[index];
2184 }
2185
2186 // 5.6
hasNetExpr() const2187 int defiPin::hasNetExpr() const {
2188 return (int)(hasNetExpr_);
2189 }
2190
2191 // 5.6
netExpr() const2192 const char* defiPin::netExpr() const {
2193 return netExpr_;
2194 }
2195
2196 // 5.6
hasSupplySensitivity() const2197 int defiPin::hasSupplySensitivity() const {
2198 return (int)(hasSupplySens_);
2199 }
2200
2201 // 5.6
supplySensitivity() const2202 const char* defiPin::supplySensitivity() const {
2203 return supplySens_;
2204 }
2205
2206 // 5.6
hasGroundSensitivity() const2207 int defiPin::hasGroundSensitivity() const {
2208 return (int)(hasGroundSens_);
2209 }
2210
2211 // 5.6
groundSensitivity() const2212 const char* defiPin::groundSensitivity() const {
2213 return groundSens_;
2214 }
2215
2216 // 5.7
addVia(const char * viaName,int ptX,int ptY,int color)2217 void defiPin::addVia(const char* viaName, int ptX, int ptY, int color) {
2218
2219 if (numVias_ >= viasAllocated_) {
2220 int i;
2221 char** newl;
2222 int *nx, *ny, *nm;
2223
2224 viasAllocated_ = viasAllocated_ ?
2225 viasAllocated_ * 2 : 8;
2226 newl = (char**)malloc(viasAllocated_ * sizeof(char*));
2227 nx = (int*)malloc(viasAllocated_ * sizeof(int));
2228 ny = (int*)malloc(viasAllocated_ * sizeof(int));
2229 nm = (int*)malloc(viasAllocated_ * sizeof(int));
2230
2231 for (i = 0; i < numVias_; i++) {
2232 newl[i] = viaNames_[i];
2233 nx[i] = viaX_[i];
2234 ny[i] = viaY_[i];
2235 nm[i] = viaMask_[i];
2236 }
2237 if (numVias_ > 0) {
2238 free((char*)viaNames_);
2239 free((char*)viaX_);
2240 free((char*)viaY_);
2241 free((char*)viaMask_);
2242 }
2243 viaNames_ = newl;
2244 viaX_ = nx;
2245 viaY_ = ny;
2246 viaMask_ = nm;
2247 }
2248 viaNames_[numVias_] = (char*)malloc(strlen(viaName)+1);
2249 strcpy(viaNames_[numVias_], defData->DEFCASE(viaName));
2250 viaX_[numVias_] = ptX;
2251 viaY_[numVias_] = ptY;
2252 viaMask_[numVias_] = color;
2253 numVias_ += 1;
2254 }
2255
2256 // 5.7
numVias() const2257 int defiPin::numVias() const {
2258 return numVias_;
2259 }
2260
2261 // 5.7
viaName(int index) const2262 const char* defiPin::viaName(int index) const {
2263 if (index < 0 || index > numVias_) {
2264 defiError(1, 0, "index out of bounds", defData);
2265 return 0;
2266 }
2267 return viaNames_[index];
2268 }
2269
2270 // 5.7
viaPtX(int index) const2271 int defiPin::viaPtX(int index) const {
2272 return viaX_[index];
2273 }
2274
2275 // 5.7
viaPtY(int index) const2276 int defiPin::viaPtY(int index) const {
2277 return viaY_[index];
2278 }
2279
viaTopMask(int index) const2280 int defiPin::viaTopMask(int index) const {
2281 int cutMaskNum = viaMask_[index] / 10;
2282
2283 if (cutMaskNum) {
2284 return cutMaskNum /= 10;
2285 } else {
2286 return 0;
2287 }
2288 }
2289
viaCutMask(int index) const2290 int defiPin::viaCutMask(int index) const {
2291 int cutMaskNum = viaMask_[index] / 10;
2292
2293 if (cutMaskNum) {
2294 return cutMaskNum % 10;
2295 } else {
2296 return 0;
2297 }
2298 }
2299
viaBottomMask(int index) const2300 int defiPin::viaBottomMask(int index) const {
2301 return viaMask_[index] % 10;
2302 }
2303 // 5.7
addPort()2304 void defiPin::addPort() {
2305 defiPinPort** pp;
2306 defiPinPort* pv;
2307 int i;
2308
2309 if (numPorts_ >= portsAllocated_) {
2310 if (portsAllocated_ == 0) {
2311 pinPort_ = (defiPinPort**) malloc(sizeof(defiPinPort*)*4);
2312 portsAllocated_ = 4;
2313 } else {
2314 portsAllocated_ = portsAllocated_ * 2;
2315 pp = (defiPinPort**) malloc(sizeof(defiPinPort*) *
2316 portsAllocated_);
2317 for (i = 0; i < numPorts_; i++)
2318 pp[i] = pinPort_[i];
2319 free((char*)(pinPort_));
2320 pinPort_ = pp;
2321 }
2322 }
2323 pv = new defiPinPort(defData);
2324 pv->Init();
2325 pinPort_[numPorts_] = pv;
2326 numPorts_ += 1;
2327 }
2328
2329 // 5.7
addPortLayer(const char * layer)2330 void defiPin::addPortLayer(const char* layer) {
2331 int i = numPorts_ - 1;
2332 pinPort_[i]->addLayer(layer);
2333 }
2334
2335 // 5.7
addPortLayerSpacing(int minSpacing)2336 void defiPin::addPortLayerSpacing(int minSpacing) {
2337 int i = numPorts_ - 1;
2338 pinPort_[i]->addLayerSpacing(minSpacing);
2339 }
2340
addPortLayerMask(int color)2341 void defiPin::addPortLayerMask(int color) {
2342 int i = numPorts_ - 1;
2343 pinPort_[i]->addLayerMask(color);
2344 }
2345
2346 // 5.7
addPortLayerDesignRuleWidth(int effectiveWidth)2347 void defiPin::addPortLayerDesignRuleWidth(int effectiveWidth) {
2348 int i = numPorts_ - 1;
2349 pinPort_[i]->addLayerDesignRuleWidth(effectiveWidth);
2350 }
2351
2352 // 5.7
addPortLayerPts(int xl,int yl,int xh,int yh)2353 void defiPin::addPortLayerPts(int xl, int yl, int xh, int yh) {
2354 int i = numPorts_ - 1;
2355 pinPort_[i]->addLayerPts(xl, yl, xh, yh);
2356 }
2357
2358 // 5.7
addPortPolygon(const char * layerName)2359 void defiPin::addPortPolygon(const char* layerName) {
2360 int i = numPorts_ - 1;
2361 pinPort_[i]->addPolygon(layerName);
2362 }
2363
2364 // 5.7
addPortPolySpacing(int minSpacing)2365 void defiPin::addPortPolySpacing(int minSpacing) {
2366 int i = numPorts_ - 1;
2367 pinPort_[i]->addPolySpacing(minSpacing);
2368 }
2369
addPortPolyMask(int color)2370 void defiPin::addPortPolyMask(int color) {
2371 int i = numPorts_ - 1;
2372 pinPort_[i]->addPolyMask(color);
2373 }
2374
2375 // 5.7
addPortPolyDesignRuleWidth(int effectiveWidth)2376 void defiPin::addPortPolyDesignRuleWidth(int effectiveWidth) {
2377 int i = numPorts_ - 1;
2378 pinPort_[i]->addPolyDesignRuleWidth( effectiveWidth);
2379 }
2380
2381 // 5.7
addPortPolygonPts(defiGeometries * geom)2382 void defiPin::addPortPolygonPts(defiGeometries* geom) {
2383 int i = numPorts_ - 1;
2384 pinPort_[i]->addPolygonPts(geom);
2385 }
2386
2387 // 5.7
addPortVia(const char * via,int viaX,int viaY,int color)2388 void defiPin::addPortVia(const char* via, int viaX, int viaY, int color) {
2389 int i = numPorts_ - 1;
2390 pinPort_[i]->addVia(via, viaX, viaY, color);
2391 }
2392
2393 // 5.7
setPortPlacement(int typ,int x,int y,int orient)2394 void defiPin::setPortPlacement(int typ, int x, int y, int orient) {
2395 int i = numPorts_ - 1;
2396 pinPort_[i]->setPlacement(typ, x, y, orient);
2397 }
2398
2399 // 5.7
hasPort() const2400 int defiPin::hasPort() const {
2401 return numPorts_;
2402 }
2403
2404 // 5.7
numPorts() const2405 int defiPin::numPorts() const {
2406 return numPorts_;
2407 }
2408
2409 // 5.7
pinPort(int index) const2410 defiPinPort* defiPin::pinPort(int index) const {
2411 if (index < 0 || index > numPorts_) {
2412 defiError(1, 0, "index out of bounds", defData);
2413 return 0;
2414 }
2415 return pinPort_[index];
2416 }
2417
print(FILE * f) const2418 void defiPin::print(FILE* f) const {
2419 int xl, yl, xh,yh;
2420 int i;
2421
2422 fprintf(f, "PINS '%s' on net '%s'\n", pinName(),
2423 netName());
2424 if (hasDirection())
2425 fprintf(f, "+ DIRECTION '%s'\n", direction());
2426 if (hasNetExpr())
2427 fprintf(f, "+ NETEXPR '%s'\n", netExpr());
2428 if (hasSupplySensitivity())
2429 fprintf(f, "+ SUPPLYSENSITIVITY '%s'\n",
2430 supplySensitivity());
2431 if (hasGroundSensitivity())
2432 fprintf(f, "+ GROUNDSENSITIVITY '%s'\n",
2433 groundSensitivity());
2434 if (hasUse())
2435 fprintf(f, "+ USE '%s'\n", use());
2436 if (hasLayer()) {
2437 for (i = 0; i < numLayer(); i++) {
2438 bounds(i, &xl, &yl, &xh, &yh);
2439 fprintf(f, "+ LAYER '%s' %d %d %d %d\n",
2440 layer(i), xl, yl, xh, yh);
2441 }
2442 }
2443 for (i = 0; i < numPolygons(); i++) {
2444 fprintf(f, "+ POLYGON %s", polygonName(i));
2445 if (hasPolygonSpacing(i)) {
2446 fprintf(f, " SPACING %d", polygonSpacing(i));
2447 }
2448 if (hasPolygonDesignRuleWidth(i)) {
2449 fprintf(f, " DESIGNRULEWIDTH %d",
2450 polygonDesignRuleWidth(i));
2451 }
2452 fprintf(f, "\n");
2453 }
2454 for (i = 0; i < numVias(); i++) {
2455 fprintf(f, "+ VIA %s %d %d\n", viaName(i),
2456 viaPtX(i), viaPtY(i));
2457 }
2458 if (hasPlacement())
2459 fprintf(f, " PLACED %s%s%d %d\n",
2460 isFixed() ? " FIXED" : "",
2461 isCover() ? " COVER" : "",
2462 placementX(),
2463 placementY());
2464 if (hasSpecial())
2465 fprintf(f, "+ SPECIAL\n");
2466 }
2467 END_LEFDEF_PARSER_NAMESPACE
2468
2469