1 // *****************************************************************************
2 // *****************************************************************************
3 // Copyright 2012 - 2016, 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$
24 //  $Revision$
25 //  $Date$
26 //  $State:  $
27 // *****************************************************************************
28 // *****************************************************************************
29 
30 #include <stdlib.h>
31 #include <stdio.h>
32 #include <string.h>
33 #ifndef WIN32
34 #   include <unistd.h>
35 #endif /* not WIN32 */
36 #include "defwWriter.hpp"
37 
38 char defaultOut[128];
39 
40 // Global variables
41 FILE* fout;
42 
43 #define CHECK_STATUS(status) \
44     if (status) {              \
45         defwPrintError(status); \
46         return(status);         \
47     }
48 
main(int argc,char ** argv)49 int main(int argc, char** argv) {
50     char* outfile;
51     int   status;    // return code, if none 0 means error
52     int   lineNumber = 0;
53 
54     const char** layers;
55     const char** foreigns;
56     const char** shiftLayers;
57     int *foreignX, *foreignY, *foreignOrient;
58     const char** foreignOrientStr;
59     double *coorX, *coorY;
60     double *coorValue;
61     const char **groupExpr;
62     int *xPoints, *yPoints;
63     double *xP, *yP;
64     const char** coorXSN, **coorYSN;
65     bool groupInit = false;
66 
67 
68 #ifdef WIN32
69     // Enable two-digit exponent format
70     _set_output_format(_TWO_DIGIT_EXPONENT);
71 #endif
72 
73     // assign the default
74     strcpy(defaultOut, "def.in");
75     outfile = defaultOut;
76     fout = stdout;
77 
78     argc--;
79     argv++;
80     while (argc--) {
81         if (strcmp(*argv, "-o") == 0) {   // output filename
82             argv++;
83             argc--;
84             outfile = *argv;
85             if ((fout = fopen(outfile, "w")) == 0) {
86                 fprintf(stderr, "ERROR: could not open output file\n");
87                 return 2;
88             }
89         } else if (strncmp(*argv,  "-h", 2) == 0) {  // compare with -h[elp]
90             fprintf(stderr, "Usage: defwrite [-o <filename>] [-help]\n");
91             return 1;
92         } else if (strncmp(*argv,  "-g", 2) == 0) {  // test of group init function.
93             groupInit = 1;
94         } else {
95             fprintf(stderr, "ERROR: Illegal command line option: '%s'\n", *argv);
96             return 2;
97         }
98         argv++;
99     }
100 
101     if (!groupInit) {
102         status = defwInitCbk(fout);
103         CHECK_STATUS(status);
104         status = defwVersion (5, 8);
105         CHECK_STATUS(status);
106         status = defwDividerChar(":");
107         CHECK_STATUS(status);
108         status = defwBusBitChars("[]");
109         CHECK_STATUS(status);
110         status = defwDesignName("muk");
111         CHECK_STATUS(status);
112         status = defwTechnology("muk");
113         CHECK_STATUS(status);
114         status = defwArray("core_array");
115         CHECK_STATUS(status);
116         status = defwFloorplan("DEFAULT");
117         CHECK_STATUS(status);
118         status = defwUnits(100);
119         CHECK_STATUS(status);
120     } else {
121         // initalize
122         status = defwInit(fout, 5, 8, "ON", ":", "[]", "muk", "muk", "core_array",
123                 "DEFAULT", 100);
124         CHECK_STATUS(status);
125     }
126 
127     status = defwNewLine();
128     CHECK_STATUS(status);
129 
130     // history
131     status = defwHistory("Corrected STEP for ROW_9 and added ROW_10 of SITE CORE1 (def)");
132     CHECK_STATUS(status);
133     status = defwHistory("Removed NONDEFAULTRULE from the net XX100 (def)");
134     CHECK_STATUS(status);
135     status = defwHistory("Changed some cell orientations (def)");
136     CHECK_STATUS(status);
137     status = defwNewLine();
138     CHECK_STATUS(status);
139 
140     // FILLS (add another FILLS is here for CCR 746462
141     xP = (double*)malloc(sizeof(double)*7);
142     yP = (double*)malloc(sizeof(double)*7);
143     xP[0] = 2.1;
144     yP[0] = 2.1;
145     xP[1] = 3.1;
146     yP[1] = 3.1;
147     xP[2] = 4.1;
148     yP[2] = 4.1;
149     xP[3] = 5.1;
150     yP[3] = 5.1;
151     xP[4] = 6.1;
152     yP[4] = 6.1;
153     xP[5] = 7.1;
154     yP[5] = 7.1;
155     xP[6] = 8.1;
156     yP[6] = 8.1;
157     status = defwStartFills(5);
158     CHECK_STATUS(status);
159     status = defwFillLayer("MET1");
160     CHECK_STATUS(status);
161     status = defwFillRect(1000, 2000, 1500, 4000);
162     CHECK_STATUS(status);
163     status = defwFillPolygon(5, xP, yP);
164     CHECK_STATUS(status);
165     status = defwFillRect(2000, 2000, 2500, 4000);
166     CHECK_STATUS(status);
167     status = defwFillPolygon(7, xP, yP);
168     CHECK_STATUS(status);
169     status = defwFillRect(3000, 2000, 3500, 4000);
170     CHECK_STATUS(status);
171     status = defwFillLayer("MET2");
172     CHECK_STATUS(status);
173     status = defwFillRect(1000, 2000, 1500, 4000);
174     CHECK_STATUS(status);
175     status = defwFillRect(1000, 4500, 1500, 6500);
176     CHECK_STATUS(status);
177     status = defwFillRect(1000, 7000, 1500, 9000);
178     CHECK_STATUS(status);
179     status = defwFillRect(1000, 9500, 1500, 11500);
180     CHECK_STATUS(status);
181     status = defwFillPolygon(7, xP, yP);
182     CHECK_STATUS(status);
183     status = defwFillPolygon(6, xP, yP);
184     CHECK_STATUS(status);
185     status = defwFillLayer("metal1");
186     CHECK_STATUS(status);
187     status = defwFillLayerMask(1);
188     CHECK_STATUS(status);
189     status = defwFillLayerOPC();
190     CHECK_STATUS(status);
191     status = defwFillRect(100, 200, 150, 400);
192     CHECK_STATUS(status);
193     status = defwFillRect(300, 200, 350, 400);
194     CHECK_STATUS(status);
195     status = defwFillVia("via28");
196     CHECK_STATUS(status);
197     status = defwFillViaMask(2);
198     CHECK_STATUS(status);
199     status = defwFillViaOPC();
200     CHECK_STATUS(status);
201     status = defwFillPoints(1, xP, yP);
202     CHECK_STATUS(status);
203     status = defwFillVia("via26");
204     CHECK_STATUS(status);
205     status = defwFillPoints(3, xP, yP);
206     CHECK_STATUS(status);
207     status = defwEndFills();
208     CHECK_STATUS(status);
209     status = defwNewLine();
210     CHECK_STATUS(status);
211     free((char*)xP);
212     free((char*)yP);
213 
214     // PROPERTYDEFINITIONS
215     status = defwStartPropDef();
216     CHECK_STATUS(status);
217     defwAddComment("defwPropDef is broken into 3 routines, defwStringPropDef");
218     defwAddComment("defwIntPropDef, and defwRealPropDef");
219     status = defwStringPropDef("REGION", "scum", 0, 0, 0 );
220     CHECK_STATUS(status);
221     status = defwIntPropDef("REGION", "center", 0, 0, 0);
222     CHECK_STATUS(status);
223     status = defwRealPropDef("REGION", "area", 0, 0, 0);
224     CHECK_STATUS(status);
225     status = defwStringPropDef("GROUP", "ggrp", 0, 0, 0);
226     CHECK_STATUS(status);
227     status = defwIntPropDef("GROUP", "site", 0, 25, 0);
228     CHECK_STATUS(status);
229     status = defwRealPropDef("GROUP", "maxarea", 0, 0, 0);
230     CHECK_STATUS(status);
231     status = defwStringPropDef("COMPONENT", "cc", 0, 0, 0);
232     CHECK_STATUS(status);
233     status = defwIntPropDef("COMPONENT", "index", 0, 0, 0);
234     CHECK_STATUS(status);
235     status = defwRealPropDef("COMPONENT", "size", 0, 0, 0);
236     CHECK_STATUS(status);
237     status = defwIntPropDef("NET", "alt", 0, 0, 0);
238     CHECK_STATUS(status);
239     status = defwStringPropDef("NET", "lastName", 0, 0, 0);
240     CHECK_STATUS(status);
241     status = defwRealPropDef("NET", "length", 0, 0, 0);
242     CHECK_STATUS(status);
243     status = defwStringPropDef("SPECIALNET", "contype", 0, 0, 0);
244     CHECK_STATUS(status);
245     status = defwIntPropDef("SPECIALNET", "ind", 0, 0, 0);
246     CHECK_STATUS(status);
247     status = defwRealPropDef("SPECIALNET", "maxlength", 0, 0, 0);
248     CHECK_STATUS(status);
249     status = defwStringPropDef("DESIGN", "title", 0, 0, "Buffer");
250     CHECK_STATUS(status);
251     status = defwIntPropDef("DESIGN", "priority", 0, 0, 14);
252     CHECK_STATUS(status);
253     status = defwRealPropDef("DESIGN", "howbig", 0, 0, 15.16);
254     CHECK_STATUS(status);
255     status = defwRealPropDef("ROW", "minlength", 1.0, 100.0, 0);
256     CHECK_STATUS(status);
257     status = defwStringPropDef("ROW", "firstName", 0, 0, 0);
258     CHECK_STATUS(status);
259     status = defwIntPropDef("ROW", "idx", 0, 0, 0);
260     CHECK_STATUS(status);
261     status = defwIntPropDef("COMPONENTPIN", "dpIgnoreTerm", 0, 0, 0);
262     CHECK_STATUS(status);
263     status = defwStringPropDef("COMPONENTPIN", "dpBit", 0, 0, 0);
264     CHECK_STATUS(status);
265     status = defwRealPropDef("COMPONENTPIN", "realProperty", 0, 0, 0);
266     CHECK_STATUS(status);
267     status = defwStringPropDef("NET", "IGNOREOPTIMIZATION", 0, 0, 0);
268     CHECK_STATUS(status);
269     status = defwStringPropDef("SPECIALNET", "IGNOREOPTIMIZATION", 0, 0, 0);
270     CHECK_STATUS(status);
271     status = defwRealPropDef("NET", "FREQUENCY", 0, 0, 0);
272     CHECK_STATUS(status);
273     status = defwRealPropDef("SPECIALNET", "FREQUENCY", 0, 0, 0);
274     CHECK_STATUS(status);
275     status = defwStringPropDef("NONDEFAULTRULE", "ndprop1", 0, 0, 0);
276     CHECK_STATUS(status);
277     status = defwIntPropDef("NONDEFAULTRULE", "ndprop2", 0, 0, 0);
278     CHECK_STATUS(status);
279     status = defwRealPropDef("NONDEFAULTRULE", "ndprop3", 0, 0, 0.009);
280     CHECK_STATUS(status);
281     status = defwRealPropDef("NONDEFAULTRULE", "ndprop4", .1, 1.0, 0);
282     CHECK_STATUS(status);
283     status = defwEndPropDef();
284     CHECK_STATUS(status);
285 
286     // DIEAREA
287     /*
288        status = defwDieArea(-190000, -120000, 190000, 70000);
289        CHECK_STATUS(status);
290        */
291     xPoints = (int*)malloc(sizeof(int)*6);
292     yPoints = (int*)malloc(sizeof(int)*6);
293     xPoints[0] = 2000;
294     yPoints[0] = 2000;
295     xPoints[1] = 3000;
296     yPoints[1] = 3000;
297     xPoints[2] = 4000;
298     yPoints[2] = 4000;
299     xPoints[3] = 5000;
300     yPoints[3] = 5000;
301     xPoints[4] = 6000;
302     yPoints[4] = 6000;
303     xPoints[5] = 7000;
304     yPoints[5] = 7000;
305     status = defwDieAreaList(6, xPoints, yPoints);
306     CHECK_STATUS(status);
307     free((char*)xPoints);
308     free((char*)yPoints);
309 
310     status = defwNewLine();
311     CHECK_STATUS(status);
312 
313     // ROW
314     status = defwRow("ROW_9", "CORE", -177320, -111250, 6, 911, 1, 360, 0);
315     CHECK_STATUS(status);
316     status = defwRealProperty("minlength", 50.5);
317     CHECK_STATUS(status);
318     status = defwStringProperty("firstName", "Only");
319     CHECK_STATUS(status);
320     status = defwIntProperty("idx", 1);
321     CHECK_STATUS(status);
322     status = defwRowStr("ROW_10", "CORE1", -19000, -11000, "FN", 1, 100, 0, 600);
323     CHECK_STATUS(status);
324     status = defwRowStr("ROW_11", "CORE1", -19000, -11000, "FN", 1, 100, 0, 0);
325     CHECK_STATUS(status);
326     status = defwRow("ROW_12", "CORE1", -19000, -11000, 3, 0, 0, 0, 0);
327     CHECK_STATUS(status);
328     status = defwRowStr("ROW_13", "CORE1", -19000, -11000, "FN", 0, 0, 0, 0);
329     CHECK_STATUS(status);
330 
331     // TRACKS
332     layers = (const char**)malloc(sizeof(char*)*1);
333     layers[0] = strdup("M1");
334     status = defwTracks("X", 3000, 40, 120, 1, layers, 2, 1);
335     CHECK_STATUS(status);
336     free((char*)layers[0]);
337     layers[0] = strdup("M2");
338     status = defwTracks("Y", 5000, 10, 20, 1,layers);
339     CHECK_STATUS(status);
340     free((char*)layers[0]);
341     free((char*)layers);
342     status = defwNewLine();
343     CHECK_STATUS(status);
344 
345     // GCELLGRID
346     status = defwGcellGrid("X", 0, 100, 600);
347     CHECK_STATUS(status);
348     status = defwGcellGrid("Y", 10, 120, 400);
349     CHECK_STATUS(status);
350     status = defwNewLine();
351     CHECK_STATUS(status);
352 
353     // DEFAULTCAP
354     /* obsolete in 5.4
355        status = defwStartDefaultCap(4);
356        CHECK_STATUS(status);
357        status = defwDefaultCap(2, 3);
358        CHECK_STATUS(status);
359        status = defwDefaultCap(4, 6);
360        CHECK_STATUS(status);
361        status = defwDefaultCap(8, 9);
362        CHECK_STATUS(status);
363        status = defwDefaultCap(10, 12);
364        CHECK_STATUS(status);
365        status = defwEndDefaultCap();
366        CHECK_STATUS(status);
367        */
368 
369     // CANPLACE
370     status = defwCanPlaceStr("dp", 45, 64, "N", 35, 1, 39, 1);
371     CHECK_STATUS(status);
372 
373     status = defwCanPlace("dp", 45, 64, 1, 35, 1, 39, 1);
374     CHECK_STATUS(status);
375 
376     // CANNOTOCCUPY
377     status = defwCannotOccupyStr("dp", 54, 44, "S", 55, 2, 45, 3);
378     CHECK_STATUS(status);
379 
380     // VIAS
381     status = defwStartVias(7);
382     CHECK_STATUS(status);
383     status = defwViaName("VIA_ARRAY");
384     CHECK_STATUS(status);
385     status = defwViaPattern("P1-435-543-IJ1FS");
386     CHECK_STATUS(status);
387     status = defwViaRect("M1", -40, -40, 40, 40);
388     CHECK_STATUS(status);
389     status = defwViaRect("V1", -40, -40, 40, 40, 3);
390     CHECK_STATUS(status);
391     status = defwViaRect("M2", -50, -50, 50, 50);
392     CHECK_STATUS(status);
393     status = defwOneViaEnd();
394     CHECK_STATUS(status);
395     status = defwViaName("VIA_ARRAY1");
396     CHECK_STATUS(status);
397     status = defwViaRect("M1", -40, -40, 40, 40);
398     CHECK_STATUS(status);
399     status = defwViaRect("V1", -40, -40, 40, 40, 2);
400     CHECK_STATUS(status);
401     status = defwViaRect("M2", -50, -50, 50, 50);
402     CHECK_STATUS(status);
403     status = defwOneViaEnd();
404     CHECK_STATUS(status);
405     status = defwViaName("myUnshiftedVia");
406     CHECK_STATUS(status);
407     status = defwViaViarule("myViaRule", 20, 20, "metal1", "cut12", "metal2",
408             5, 5, 0, 4, 0, 1);
409     CHECK_STATUS(status);
410     status = defwViaViaruleRowCol(2, 3);
411     CHECK_STATUS(status);
412     status = defwOneViaEnd();
413     CHECK_STATUS(status);
414     status = defwViaName("via2");
415     CHECK_STATUS(status);
416     status = defwViaViarule("viaRule2", 5, 6, "botLayer2", "cutLayer2",
417             "topLayer2", 6, 6, 1, 4, 1, 4);
418     CHECK_STATUS(status);
419     status = defwViaViaruleOrigin(10, -10);
420     CHECK_STATUS(status);
421     status = defwViaViaruleOffset(0, 0, 20, -20);
422     CHECK_STATUS(status);
423     status = defwViaViarulePattern("2_F0_2_F8_1_78");
424     CHECK_STATUS(status);
425     status = defwOneViaEnd();
426     CHECK_STATUS(status);
427 
428     status = defwViaName("via3");
429     CHECK_STATUS(status);
430     status = defwViaPattern("P2-435-543-IJ1FS");
431     CHECK_STATUS(status);
432     status = defwViaRect("M2", -40, -40, 40, 40);
433     CHECK_STATUS(status);
434     status = defwOneViaEnd();
435     CHECK_STATUS(status);
436 
437     xP = (double*)malloc(sizeof(double)*6);
438     yP = (double*)malloc(sizeof(double)*6);
439     xP[0] = -2.1;
440     yP[0] = -1.0;
441     xP[1] = -2;
442     yP[1] = 1;
443     xP[2] = 2.1;
444     yP[2] = 1.0;
445     xP[3] = 2.0;
446     yP[3] = -1.0;
447     status = defwViaName("via4");
448     CHECK_STATUS(status);
449     status = defwViaPolygon("M3", 4, xP, yP, 2);
450     CHECK_STATUS(status);
451     status = defwViaRect("M4", -40, -40, 40, 40);
452     CHECK_STATUS(status);
453     xP[0] = 100;
454     yP[0] = 100;
455     xP[1] = 200;
456     yP[1] = 200;
457     xP[2] = 300;
458     yP[2] = 300;
459     xP[3] = 400;
460     yP[3] = 400;
461     xP[4] = 500;
462     yP[4] = 500;
463     xP[5] = 600;
464     yP[5] = 600;
465     status = defwViaPolygon("M5", 6, xP, yP, 3);
466     CHECK_STATUS(status);
467     status = defwOneViaEnd();
468     CHECK_STATUS(status);
469 
470     xP[0] = 200;
471     yP[0] = 200;
472     xP[1] = 300;
473     yP[1] = 300;
474     xP[2] = 400;
475     yP[2] = 500;
476     xP[3] = 100;
477     yP[3] = 300;
478     xP[4] = 300;
479     yP[4] = 200;
480     status = defwViaName("via5");
481     CHECK_STATUS(status);
482     status = defwViaPolygon("M6", 5, xP, yP);
483     CHECK_STATUS(status);
484     status = defwOneViaEnd();
485     CHECK_STATUS(status);
486     free((char*)xP);
487     free((char*)yP);
488     status = defwEndVias();
489     CHECK_STATUS(status);
490 
491     // REGIONS
492     status = defwStartRegions(2);
493     CHECK_STATUS(status);
494     status = defwRegionName("region1");
495     CHECK_STATUS(status);
496     status = defwRegionPoints(-500, -500, 300, 100);
497     CHECK_STATUS(status);
498     status = defwRegionPoints(500, 500, 1000, 1000);
499     CHECK_STATUS(status);
500     status = defwRegionType("FENCE");
501     CHECK_STATUS(status);
502     status = defwStringProperty("scum", "on top");
503     CHECK_STATUS(status);
504     status = defwIntProperty("center", 250);
505     CHECK_STATUS(status);
506     status = defwIntProperty("area", 730000);
507     CHECK_STATUS(status);
508     status = defwRegionName("region2");
509     CHECK_STATUS(status);
510     status = defwRegionPoints(4000, 0, 5000, 1000);
511     CHECK_STATUS(status);
512     status = defwStringProperty("scum", "on bottom");
513     CHECK_STATUS(status);
514     status = defwEndRegions();
515     CHECK_STATUS(status);
516 
517     // COMPONENTMASKSHIFTLAYER
518     shiftLayers = (const char**)malloc(sizeof(char*)*2);
519     shiftLayers[0] = strdup("M3");
520     shiftLayers[1] = strdup("M2");
521 
522     status = defwComponentMaskShiftLayers(shiftLayers, 2);
523 
524     free((char*)shiftLayers[0]);
525     free((char*)shiftLayers[1]);
526     free((char*)shiftLayers);
527 
528     // COMPONENTS
529     foreigns = (const char**)malloc(sizeof(char*)*2);
530     foreignX = (int*)malloc(sizeof(int)*2);
531     foreignY = (int*)malloc(sizeof(int)*2);
532     foreignOrient = (int*)malloc(sizeof(int)*2);
533     foreignOrientStr = (const char**)malloc(sizeof(char*)*2);
534     status = defwStartComponents(11);
535     CHECK_STATUS(status);
536     status = defwComponent("Z38A01", "DFF3", 0, NULL, NULL, NULL, NULL, NULL,
537             0, NULL, NULL, NULL, NULL, "PLACED", 18592, 5400, 6, 0,
538             NULL, 0, 0, 0, 0);
539     CHECK_STATUS(status);
540     status = defwComponentMaskShift(123);
541     CHECK_STATUS(status);
542     status = defwComponentHalo(100, 0, 50, 200);
543     CHECK_STATUS(status);
544     status = defwComponentStr("Z38A03", "DFF3", 0, NULL, NULL, NULL, NULL, NULL,
545             0, NULL, NULL, NULL, NULL, "PLACED", 16576, 45600,
546             "FS", 0, NULL, 0, 0, 0, 0);
547     CHECK_STATUS(status);
548     status = defwComponentHalo(200, 2, 60, 300);
549     CHECK_STATUS(status);
550     status = defwComponent("Z38A05", "DFF3", 0, NULL, NULL, NULL, NULL, NULL,
551             0, NULL, NULL, NULL, NULL, "PLACED", 51520, 9600, 6, 0,
552             NULL, 0, 0, 0, 0);
553     CHECK_STATUS(status);
554     status = defwComponent("|i0", "INV_B", 0, NULL, "INV", NULL, NULL, NULL,
555             0, NULL, NULL, NULL, NULL, NULL, 0, 0, -1, 0,
556             "region1", 0, 0, 0, 0);
557     CHECK_STATUS(status);
558     status = defwComponentHaloSoft(100, 0, 50, 200);
559     CHECK_STATUS(status);
560     status = defwComponent("|i1", "INV_B", 0, NULL, "INV", NULL, NULL, NULL,
561             0, NULL, NULL, NULL, NULL, "UNPLACED", 1000, 1000, 0,
562             0, NULL, 0, 0, 0, 0);
563     CHECK_STATUS(status);
564     status = defwComponent("cell1", "CHM6A", 0, NULL, NULL, "generator", NULL,
565             "USER", 0, NULL, NULL, NULL, NULL, "FIXED", 0, 10, 0,
566             100.4534535, NULL, 0, 0, 0, 0);
567     CHECK_STATUS(status);
568     status = defwComponent("cell2", "CHM6A", 0, NULL, NULL, NULL, NULL,
569             "NETLIST", 0, NULL, NULL, NULL, NULL, "COVER", 120,
570             10, 4, 2, NULL, 0, 0, 0, 0);
571     CHECK_STATUS(status);
572     foreigns[0] = strdup("gds2name");
573     foreignX[0] = -500;
574     foreignY[0] = -500;
575     foreignOrient[0] = 3;
576     status = defwComponent("cell3", "CHM6A", 0, NULL, NULL, NULL, NULL,
577             "TIMING", 1, foreigns, foreignX, foreignY,
578             foreignOrient, "PLACED", 240,
579             10, 0, 0, "region1", 0, 0, 0, 0);
580     CHECK_STATUS(status);
581     status = defwComponentRouteHalo(100, "metal1", "metal3");
582     CHECK_STATUS(status);
583     free((char*)foreigns[0]);
584     foreigns[0] = strdup("gds3name");
585     foreignX[0] = -500;
586     foreignY[0] = -500;
587     foreignOrientStr[0] = strdup("FW");
588     foreigns[1] = strdup("gds4name");
589     foreignX[1] = -300;
590     foreignY[1] = -300;
591     foreignOrientStr[1] = strdup("FS");
592     status = defwComponentStr("cell4", "CHM3A", 0, NULL, "CHM6A", NULL, NULL,
593             "DIST", 2, foreigns, foreignX, foreignY,
594             foreignOrientStr, "PLACED", 360,
595             10, "W", 0, "region2", 0, 0, 0, 0);
596     CHECK_STATUS(status);
597     status = defwComponentHaloSoft(100, 0, 50, 200);
598     CHECK_STATUS(status);
599     status = defwStringProperty("cc", "This is the copy list");
600     CHECK_STATUS(status);
601     status = defwIntProperty("index", 9);
602     CHECK_STATUS(status);
603     status = defwRealProperty("size", 7.8);
604     CHECK_STATUS(status);
605     status = defwComponent("scancell1", "CHK3A", 0, NULL, NULL, NULL, NULL,
606             NULL, 0, NULL, NULL, NULL, NULL, "PLACED", 500,
607             10, 7, 0, NULL, 0, 0, 0, 0);
608     CHECK_STATUS(status);
609     status = defwComponent("scancell2", "CHK3A", 0, NULL, NULL, NULL, NULL,
610             NULL, 0, NULL, NULL, NULL, NULL, "PLACED", 700,
611             10, 6, 0, NULL, 0, 0, 0, 0);
612     CHECK_STATUS(status);
613     status = defwEndComponents();
614     CHECK_STATUS(status);
615     free((char*)foreigns[0]);
616     free((char*)foreigns[1]);
617     free((char*)foreigns);
618     free((char*)foreignX);
619     free((char*)foreignY);
620     free((char*)foreignOrient);
621     free((char*)foreignOrientStr[0]);
622     free((char*)foreignOrientStr[1]);
623     free((char*)foreignOrientStr);
624 
625     xP = (double*)malloc(sizeof(double)*6);
626     yP = (double*)malloc(sizeof(double)*6);
627     xP[0] = 2.1;
628     yP[0] = 2.1;
629     xP[1] = 3.1;
630     yP[1] = 3.1;
631     xP[2] = 4.1;
632     yP[2] = 4.1;
633     xP[3] = 5.1;
634     yP[3] = 5.1;
635     xP[4] = 6.1;
636     yP[4] = 6.1;
637     xP[5] = 7.1;
638     yP[5] = 7.1;
639 
640     // PINS
641     status = defwStartPins(11);
642     CHECK_STATUS(status);
643     status = defwPin("scanpin", "net1", 0, "INPUT", NULL, NULL, 0, 0, -1, NULL,
644             0, 0, 0, 0);
645     CHECK_STATUS(status);
646     status = defwPinPolygon("metal1", 0, 1000, 6, xP, yP);
647     CHECK_STATUS(status);
648     status = defwPinNetExpr("power1 VDD1");
649     CHECK_STATUS(status);
650     status = defwPin("pin0", "net1", 0, "INPUT", "SCAN", NULL, 0, 0, -1, NULL,
651             0, 0, 0, 0);
652     CHECK_STATUS(status);
653     status = defwPinStr("pin0.5", "net1", 0, "INPUT", "RESET", "FIXED", 0, 0, "S",
654             NULL, 0, 0, 0, 0);
655     CHECK_STATUS(status);
656     status = defwPinPolygon("metal2", 0, 0, 4, xP, yP);
657     CHECK_STATUS(status);
658     status = defwPinLayer("metal3", 500, 0, -5000, -100, -4950, -90);
659     CHECK_STATUS(status);
660     status = defwPin("pin1", "net1", 1, NULL, "POWER", NULL, 0, 0, -1, "M1",
661             -5000, -100, -4950, -90);
662     CHECK_STATUS(status);
663     status = defwPinAntennaPinPartialMetalArea(4580, "M1");
664     CHECK_STATUS(status);
665     status = defwPinAntennaPinPartialMetalArea(4580, "M11");
666     CHECK_STATUS(status);
667     status = defwPinAntennaPinPartialMetalArea(4580, "M12");
668     CHECK_STATUS(status);
669     status = defwPinAntennaPinGateArea(4580, "M2");
670     CHECK_STATUS(status);
671     status = defwPinAntennaPinDiffArea(4580, "M3");
672     CHECK_STATUS(status);
673     status = defwPinAntennaPinDiffArea(4580, "M31");
674     CHECK_STATUS(status);
675     status = defwPinAntennaPinMaxAreaCar(5000, "L1");
676     CHECK_STATUS(status);
677     status = defwPinAntennaPinMaxSideAreaCar(5000, "M4");
678     CHECK_STATUS(status);
679     status = defwPinAntennaPinPartialCutArea(4580, "M4");
680     CHECK_STATUS(status);
681     status = defwPinAntennaPinMaxCutCar(5000, "L1");
682     CHECK_STATUS(status);
683     status = defwPin("pin2", "net2", 0, "INPUT", "SIGNAL", NULL, 0, 0, -1, "M1",
684             -5000, 0, -4950, 10);
685     CHECK_STATUS(status);
686     status = defwPinLayer("M1", 500, 0, -5000, 0, -4950, 10);
687     CHECK_STATUS(status);
688     status = defwPinPolygon("M2", 0, 0, 4, xP, yP);
689     CHECK_STATUS(status);
690     status = defwPinPolygon("M3", 0, 0, 3, xP, yP);
691     CHECK_STATUS(status);
692     status = defwPinLayer("M4", 0, 500, 0, 100, -400, 100);
693     CHECK_STATUS(status);
694     status = defwPinSupplySensitivity("vddpin1");
695     CHECK_STATUS(status);
696     status = defwPinGroundSensitivity("gndpin1");
697     CHECK_STATUS(status);
698     status = defwPinAntennaPinPartialMetalArea(5000, NULL);
699     CHECK_STATUS(status);
700     status = defwPinAntennaPinPartialMetalSideArea(4580, "M2");
701     CHECK_STATUS(status);
702     status = defwPinAntennaPinGateArea(5000, NULL);
703     CHECK_STATUS(status);
704     status = defwPinAntennaPinPartialCutArea(5000, NULL);
705     CHECK_STATUS(status);
706     status = defwPin("INBUS[1]", "|INBUS[1]", 0, "INPUT", "SIGNAL", "FIXED",
707             45, -2160, 0, "M2", 0, 0, 30, 135);
708     CHECK_STATUS(status);
709     status = defwPinLayer("M2", 0, 0, 0, 0, 30, 135);
710     CHECK_STATUS(status);
711     status = defwPinAntennaPinPartialMetalArea(1, "M1");
712     CHECK_STATUS(status);
713     status = defwPinAntennaPinPartialMetalSideArea(2, "M1");
714     CHECK_STATUS(status);
715     status = defwPinAntennaPinDiffArea(4, "M2");
716     CHECK_STATUS(status);
717     status = defwPinAntennaPinPartialCutArea(5, "V1");
718     CHECK_STATUS(status);
719     status = defwPinAntennaModel("OXIDE1");
720     CHECK_STATUS(status);
721     status = defwPinAntennaPinGateArea(3, "M1");
722     CHECK_STATUS(status);
723     status = defwPinAntennaPinMaxAreaCar(6, "M2");
724     CHECK_STATUS(status);
725     status = defwPinAntennaPinMaxSideAreaCar(7, "M2");
726     CHECK_STATUS(status);
727     status = defwPinAntennaPinMaxCutCar(8, "V1");
728     CHECK_STATUS(status);
729     status = defwPinAntennaModel("OXIDE2");
730     CHECK_STATUS(status);
731     status = defwPinAntennaPinGateArea(30, "M1");
732     CHECK_STATUS(status);
733     status = defwPinAntennaPinMaxAreaCar(60, "M2");
734     CHECK_STATUS(status);
735     status = defwPinAntennaPinMaxSideAreaCar(70, "M2");
736     CHECK_STATUS(status);
737     status = defwPinAntennaPinMaxCutCar(80, "V1");
738     CHECK_STATUS(status);
739     status = defwPin("INBUS<0>", "|INBUS<0>", 0, "INPUT", "SIGNAL", "PLACED",
740             -45, 2160, 1, "M2", 0, 0, 30, 134);
741     CHECK_STATUS(status);
742     status = defwPinLayer("M2", 0, 1000, 0, 0, 30, 134);
743     CHECK_STATUS(status);
744     status = defwPin("OUTBUS<1>", "|OUTBUS<1>", 0, "OUTPUT", "SIGNAL", "COVER",
745             2160, 645, 2, "M1", 0, 0, 30, 135);
746     CHECK_STATUS(status);
747     status = defwPinLayer("M1", 0, 0, 0, 0, 30, 134);
748     CHECK_STATUS(status);
749     status = defwPinNetExpr("gnd1 GND");
750     CHECK_STATUS(status);
751     status = defwPin("VDD", "VDD", 1, "INOUT", "POWER", NULL, 0, 0, -1, NULL,
752             0, 0, 0, 0);
753     CHECK_STATUS(status);
754     status = defwPin("BUSA[0]", "BUSA[0]", 0, "INPUT", "SIGNAL", "PLACED",
755             0, 2500, 1, NULL, 0, 0, 0, 0);
756     CHECK_STATUS(status);
757     status = defwPinLayer("M1", 0, 0, -25, 0, 25, 50);
758     CHECK_STATUS(status);
759     status = defwPinLayer("M2", 0, 0, -10, 0, 10, 75);
760     CHECK_STATUS(status);
761     status = defwPinVia("via12", 0, 25);
762     CHECK_STATUS(status);
763     status = defwPin("VDD", "VDD", 1, "INOUT", "POWER", NULL,
764             0, 0, -1, NULL, 0, 0, 0, 0);
765     CHECK_STATUS(status);
766     status = defwPinPort();
767     CHECK_STATUS(status);
768     status = defwPinPortLayer("M2", 0, 0, -25, 0, 25, 50);
769     CHECK_STATUS(status);
770     status = defwPinPortLocation("PLACED", 0, 2500, "S");
771     CHECK_STATUS(status);
772     status = defwPinPort();
773     CHECK_STATUS(status);
774     status = defwPinPortLayer("M1", 0, 0, -25, 0, 25, 50);
775     CHECK_STATUS(status);
776     status = defwPinPortLocation("COVER", 0, 2500, "S");
777     CHECK_STATUS(status);
778     status = defwPinPort();
779     CHECK_STATUS(status);
780     status = defwPinPortLayer("M1", 0, 0, -25, 0, 25, 50, 2);
781     CHECK_STATUS(status);
782     status = defwPinPortLocation("FIXED", 0, 2500, "S");
783     CHECK_STATUS(status);
784     status = defwPinPortPolygon("M1", 0, 2, 6, xP, yP);
785     CHECK_STATUS(status);
786     status = defwPinPortPolygon("M2", 5, 0, 6, xP, yP, 1);
787     CHECK_STATUS(status);
788     status = defwPinPortVia("M2", 5, 4, 112);
789     CHECK_STATUS(status);
790 
791     status = defwEndPins();
792     CHECK_STATUS(status);
793 
794     free((char*)xP);
795     free((char*)yP);
796 
797     // PINPROPERTIES
798     status = defwStartPinProperties(2);
799     CHECK_STATUS(status);
800     status = defwPinProperty("cell1", "PB1");
801     CHECK_STATUS(status);
802     status = defwStringProperty("dpBit", "1");
803     CHECK_STATUS(status);
804     status = defwRealProperty("realProperty", 3.4);
805     CHECK_STATUS(status);
806     status = defwPinProperty("cell2", "vdd");
807     CHECK_STATUS(status);
808     status = defwIntProperty("dpIgnoreTerm", 2);
809     CHECK_STATUS(status);
810     status = defwEndPinProperties();
811     CHECK_STATUS(status);
812 
813     // SPECIALNETS
814     status = defwStartSpecialNets(7);
815     CHECK_STATUS(status);
816     status = defwSpecialNet("net1");
817     CHECK_STATUS(status);
818     status = defwSpecialNetConnection("cell1", "VDD", 0);
819     CHECK_STATUS(status);
820     status = defwSpecialNetConnection("cell2", "VDD", 0);
821     CHECK_STATUS(status);
822     status = defwSpecialNetConnection("cell3", "VDD", 0);
823     CHECK_STATUS(status);
824     status = defwSpecialNetConnection("cell4", "VDD", 0);
825     CHECK_STATUS(status);
826     status = defwSpecialNetWidth("M1", 200);
827     CHECK_STATUS(status);
828     status = defwSpecialNetWidth("M2", 300);
829     CHECK_STATUS(status);
830     status = defwSpecialNetVoltage(3.2);
831     CHECK_STATUS(status);
832     status = defwSpecialNetSpacing("M1", 200, 190, 210);
833     CHECK_STATUS(status);
834     status = defwSpecialNetSource("TIMING");
835     CHECK_STATUS(status);
836     status = defwSpecialNetOriginal("VDD");
837     CHECK_STATUS(status);
838     status = defwSpecialNetUse("POWER");
839     CHECK_STATUS(status);
840     status = defwSpecialNetWeight(30);
841     CHECK_STATUS(status);
842     status = defwStringProperty("contype", "star");
843     CHECK_STATUS(status);
844     status = defwIntProperty("ind", 1);
845     CHECK_STATUS(status);
846     status = defwRealProperty("maxlength", 12.13);
847     CHECK_STATUS(status);
848     status = defwSpecialNetEndOneNet();
849     CHECK_STATUS(status);
850     status = defwSpecialNet("VSS");
851     CHECK_STATUS(status);
852     status = defwSpecialNetConnection("cell1", "GND", 1);
853     CHECK_STATUS(status);
854     status = defwSpecialNetConnection("cell2", "GND", 0);
855     CHECK_STATUS(status);
856     status = defwSpecialNetConnection("cell3", "GND", 1);
857     CHECK_STATUS(status);
858     status = defwSpecialNetConnection("cell4", "GND", 0);
859     CHECK_STATUS(status);
860     status = defwSpecialNetUse("SCAN");
861     CHECK_STATUS(status);
862     status = defwSpecialNetPathStart("ROUTED");
863     CHECK_STATUS(status);
864     status = defwSpecialNetPathLayer("M1");
865     CHECK_STATUS(status);
866     status = defwSpecialNetPathWidth(250);
867     CHECK_STATUS(status);
868     status = defwSpecialNetPathShape("IOWIRE");
869     CHECK_STATUS(status);
870     coorX = (double*)malloc(sizeof(double)*6);
871     coorY = (double*)malloc(sizeof(double)*6);
872     coorValue = (double*)malloc(sizeof(double)*6);
873     coorX[0] = 5.0;
874     coorY[0] = 15.0;
875     coorValue[0] = 0;
876     coorX[1] = 125.0;
877     coorY[1] = 15.0;
878     coorValue[1] = 235.0;
879     coorX[2] = 245.0;
880     coorY[2] = 15.0;
881     coorValue[2] = 255.0;
882     status = defwSpecialNetPathPointWithWireExt(3, coorX, coorY, coorValue);
883     CHECK_STATUS(status);
884     status = defwSpecialNetPathEnd();
885     CHECK_STATUS(status);
886     status = defwSpecialNetShieldStart("my_net");
887     CHECK_STATUS(status);
888     status = defwSpecialNetShieldLayer("M2");
889     CHECK_STATUS(status);
890     status = defwSpecialNetShieldWidth(90);
891     CHECK_STATUS(status);
892     status = defwSpecialNetShieldShape("STRIPE");
893     CHECK_STATUS(status);
894     coorX[0] = 14100.0;
895     coorY[0] = 342440.0;
896     coorX[1] = 13920.0;
897     coorY[1] = 342440.0;
898     status = defwSpecialNetShieldPoint(2, coorX, coorY);
899     CHECK_STATUS(status);
900     status = defwSpecialNetShieldVia("M2_TURN");
901     CHECK_STATUS(status);
902     coorX[0] = 14100.0;
903     coorY[0] = 263200.0;
904     status = defwSpecialNetShieldPoint(1, coorX, coorY);
905     CHECK_STATUS(status);
906     status = defwSpecialNetShieldVia("M1_M2");
907     CHECK_STATUS(status);
908     status = defwSpecialNetShieldViaData(10, 20, 1000, 2000);
909     CHECK_STATUS(status);
910     coorX[0] = 2400.0;
911     coorY[0] = 263200.0;
912     status = defwSpecialNetShieldPoint(1, coorX, coorY);
913     CHECK_STATUS(status);
914     status = defwSpecialNetShieldEnd();
915     CHECK_STATUS(status);
916     status = defwSpecialNetShieldStart("my_net1");
917     CHECK_STATUS(status);
918     status = defwSpecialNetShieldLayer("M2");
919     CHECK_STATUS(status);
920     status = defwSpecialNetShieldWidth(90);
921     CHECK_STATUS(status);
922     coorX[0] = 14100.0;
923     coorY[0] = 342440.0;
924     coorX[1] = 13920.0;
925     coorY[1] = 342440.0;
926     status = defwSpecialNetShieldPoint(2, coorX, coorY);
927     CHECK_STATUS(status);
928     status = defwSpecialNetShieldVia("M2_TURN");
929     CHECK_STATUS(status);
930     coorX[0] = 13920.0;
931     coorY[0] = 263200.0;
932     status = defwSpecialNetShieldPoint(1, coorX, coorY);
933     CHECK_STATUS(status);
934     status = defwSpecialNetShieldVia("M1_M2");
935     CHECK_STATUS(status);
936     coorX[0] = 2400.0;
937     coorY[0] = 263200.0;
938     status = defwSpecialNetShieldPoint(1, coorX, coorY);
939     CHECK_STATUS(status);
940     status = defwSpecialNetShieldEnd();
941     CHECK_STATUS(status);
942     status = defwSpecialNetPattern("STEINER");
943     CHECK_STATUS(status);
944     status = defwSpecialNetEstCap(100);
945     CHECK_STATUS(status);
946     status = defwSpecialNetEndOneNet();
947     CHECK_STATUS(status);
948     status = defwSpecialNet("VDD");
949     CHECK_STATUS(status);
950     status = defwSpecialNetConnection("*", "VDD", 0);
951     CHECK_STATUS(status);
952     status = defwSpecialNetPathStart("ROUTED");
953     CHECK_STATUS(status);
954     status = defwSpecialNetPathLayer("metal2");
955     CHECK_STATUS(status);
956     status = defwSpecialNetPathWidth(100);
957     CHECK_STATUS(status);
958     status = defwSpecialNetPathShape("RING");
959     CHECK_STATUS(status);
960     status = defwSpecialNetPathStyle(1);
961     CHECK_STATUS(status);
962     coorX[0] = 0.0;
963     coorY[0] = 0.0;
964     coorX[1] = 100.0;
965     coorY[1] = 100.0;
966     coorX[2] = 200.0;
967     coorY[2] = 100.0;
968     status = defwSpecialNetPathPoint(3, coorX, coorY);
969     CHECK_STATUS(status);
970     status = defwSpecialNetPathStart("NEW");
971     CHECK_STATUS(status);
972     status = defwSpecialNetPathLayer("M2");
973     CHECK_STATUS(status);
974     status = defwSpecialNetPathWidth(270);
975     CHECK_STATUS(status);
976     status = defwSpecialNetPathShape("PADRING");
977     CHECK_STATUS(status);
978     coorX[0] = -45.0;
979     coorY[0] = 1350.0;
980     coorX[1] = 44865.0;
981     coorY[1] = 1350.0;
982     status = defwSpecialNetPathPoint(2, coorX, coorY);
983     CHECK_STATUS(status);
984     status = defwSpecialNetPathStart("NEW");
985     CHECK_STATUS(status);
986     status = defwSpecialNetPathLayer("M2");
987     CHECK_STATUS(status);
988     status = defwSpecialNetPathWidth(270);
989     CHECK_STATUS(status);
990     coorX[0] = -45.0;
991     coorY[0] = 1350.0;
992     coorX[1] = 44865.0;
993     coorY[1] = 1350.0;
994     status = defwSpecialNetPathPoint(2, coorX, coorY);
995     CHECK_STATUS(status);
996     status = defwSpecialNetPathEnd();
997     CHECK_STATUS(status);
998     status = defwSpecialNetEndOneNet();
999     CHECK_STATUS(status);
1000     status = defwSpecialNet("CLOCK");
1001     CHECK_STATUS(status);
1002     status = defwSpecialNetPathStart("ROUTED");
1003     CHECK_STATUS(status);
1004     status = defwSpecialNetPathLayer("M2");
1005     CHECK_STATUS(status);
1006     status = defwSpecialNetPathWidth(200);
1007     CHECK_STATUS(status);
1008     status = defwSpecialNetPathShape("BLOCKRING");
1009     CHECK_STATUS(status);
1010     coorX[0] = -45.0;
1011     coorY[0] = 1350.0;
1012     coorX[1] = 44865.0;
1013     coorY[1] = 1350.0;
1014     status = defwSpecialNetPathPoint(2, coorX, coorY);
1015     CHECK_STATUS(status);
1016     status = defwSpecialNetPathStart("NEW");
1017     CHECK_STATUS(status);
1018     status = defwSpecialNetPathLayer("M2");
1019     CHECK_STATUS(status);
1020     status = defwSpecialNetPathWidth(270);
1021     CHECK_STATUS(status);
1022     coorX[0] = -45.0;
1023     coorY[0] = 1350.0;
1024     coorX[1] = 44865.0;
1025     coorY[1] = 1350.0;
1026     status = defwSpecialNetPathPoint(2, coorX, coorY);
1027     CHECK_STATUS(status);
1028     status = defwSpecialNetPathEnd();
1029     CHECK_STATUS(status);
1030     status = defwSpecialNetEndOneNet();
1031     CHECK_STATUS(status);
1032     status = defwSpecialNet("VCC");
1033     CHECK_STATUS(status);
1034     /*
1035        status = defwSpecialNetShieldNetName("ShieldName");
1036        */
1037     status = defwSpecialNetPathStart("ROUTED");
1038     CHECK_STATUS(status);
1039     status = defwSpecialNetPathLayer("M2");
1040     CHECK_STATUS(status);
1041     status = defwSpecialNetPathWidth(200);
1042     CHECK_STATUS(status);
1043     status = defwSpecialNetPathShape("DRCFILL");
1044     CHECK_STATUS(status);
1045     coorX[0] = -45.0;
1046     coorY[0] = 1350.0;
1047     coorX[1] = 44865.0;
1048     coorY[1] = 1350.0;
1049     status = defwSpecialNetPathPoint(2, coorX, coorY);
1050     CHECK_STATUS(status);
1051     status = defwSpecialNetPathStart("NEW");
1052     CHECK_STATUS(status);
1053     status = defwSpecialNetPathLayer("M2");
1054     CHECK_STATUS(status);
1055     status = defwSpecialNetPathWidth(270);
1056     CHECK_STATUS(status);
1057     status = defwSpecialNetPathShape("STRIPE");
1058     CHECK_STATUS(status);
1059     coorX[0] = -45.0;
1060     coorY[0] = 1350.0;
1061     coorX[1] = 44865.0;
1062     coorY[1] = 1350.0;
1063     status = defwSpecialNetPathPoint(2, coorX, coorY);
1064     CHECK_STATUS(status);
1065     status = defwSpecialNetPathMask(31);
1066     CHECK_STATUS(status);
1067     status = defwSpecialNetPathVia("VIAGEN21_2");
1068     CHECK_STATUS(status);
1069     status = defwSpecialNetPathViaData(10, 20, 10000, 20000);
1070     CHECK_STATUS(status);
1071     status = defwSpecialNetPathEnd();
1072     CHECK_STATUS(status);
1073     status = defwSpecialNetEndOneNet();
1074     CHECK_STATUS(status);
1075     status = defwSpecialNet("n1");
1076     CHECK_STATUS(status);
1077     status = defwSpecialNetConnection("PIN", "n1", 0);
1078     CHECK_STATUS(status);
1079     status = defwSpecialNetConnection("driver1", "in", 0);
1080     CHECK_STATUS(status);
1081     status = defwSpecialNetConnection("bumpa1", "bumppin", 0);
1082     CHECK_STATUS(status);
1083     status = defwSpecialNetFixedbump();
1084     CHECK_STATUS(status);
1085     status = defwSpecialNetPathStart("ROUTED");
1086     CHECK_STATUS(status);
1087     status = defwSpecialNetPathLayer("M2");
1088     CHECK_STATUS(status);
1089     status = defwSpecialNetPathWidth(200);
1090     CHECK_STATUS(status);
1091     status = defwSpecialNetPathShape("FILLWIREOPC");
1092     CHECK_STATUS(status);
1093     coorX[0] = -45.0;
1094     coorY[0] = 1350.0;
1095     coorX[1] = 44865.0;
1096     coorY[1] = 1350.0;
1097     status = defwSpecialNetPathPoint(2, coorX, coorY);
1098     CHECK_STATUS(status);
1099     status = defwSpecialNetPathEnd();
1100     CHECK_STATUS(status);
1101     status = defwSpecialNetEndOneNet();
1102     CHECK_STATUS(status);
1103     free((char*)coorX);
1104     free((char*)coorY);
1105     free((char*)coorValue);
1106 
1107     status = defwSpecialNet("VSS1");
1108     CHECK_STATUS(status);
1109     status = defwSpecialNetUse("POWER");
1110     CHECK_STATUS(status);
1111     xP = (double*)malloc(sizeof(double)*6);
1112     yP = (double*)malloc(sizeof(double)*6);
1113     xP[0] = 2.1;
1114     yP[0] = 2.1;
1115     xP[1] = 3.1;
1116     yP[1] = 3.1;
1117     xP[2] = 4.1;
1118     yP[2] = 4.1;
1119     xP[3] = 5.1;
1120     yP[3] = 5.1;
1121     xP[4] = 6.1;
1122     yP[4] = 6.1;
1123     xP[5] = 7.1;
1124     yP[5] = 7.1;
1125     status = defwSpecialNetPolygon("metal1", 4, xP, yP);
1126     CHECK_STATUS(status);
1127     status = defwSpecialNetPolygon("metal1", 6, xP, yP);
1128     CHECK_STATUS(status);
1129     status = defwSpecialNetRect("metal1", 0, 0, 100, 200);
1130     CHECK_STATUS(status);
1131     status = defwSpecialNetRect("metal2", 1, 1, 100, 200);
1132     CHECK_STATUS(status);
1133     status = defwSpecialNetVia("metal2");
1134     CHECK_STATUS(status);
1135     status = defwSpecialNetViaPoints(4, xP, yP);
1136     CHECK_STATUS(status);
1137     status = defwSpecialNetEndOneNet();
1138     CHECK_STATUS(status);
1139     free((char*)xP);
1140     free((char*)yP);
1141     status = defwEndSpecialNets();
1142     CHECK_STATUS(status);
1143 
1144     // NETS
1145     status = defwStartNets(13);
1146     CHECK_STATUS(status);
1147     status = defwNet("net1");
1148     CHECK_STATUS(status);
1149     status = defwNetConnection("Z38A01", "Q", 0);
1150     CHECK_STATUS(status);
1151     status = defwNetConnection("Z38A03", "Q", 0);
1152     CHECK_STATUS(status);
1153     status = defwNetConnection("Z38A05", "Q", 0);
1154     CHECK_STATUS(status);
1155     status = defwNetEndOneNet();
1156     CHECK_STATUS(status);
1157 
1158     status = defwNet("net2");
1159     CHECK_STATUS(status);
1160     status = defwNetConnection("cell1", "PB1", 0);
1161     CHECK_STATUS(status);
1162     status = defwNetConnection("cell2", "PB1", 0);
1163     CHECK_STATUS(status);
1164     status = defwNetConnection("cell3", "PB1", 0);
1165     CHECK_STATUS(status);
1166     status = defwNetEstCap(200);
1167     CHECK_STATUS(status);
1168     status = defwNetWeight(2);
1169     CHECK_STATUS(status);
1170     status = defwNetVpin("P1", NULL, 0, 0, 0, 0, "PLACED", 54, 64, 3);
1171     CHECK_STATUS(status);
1172     status = defwNetEndOneNet();
1173     CHECK_STATUS(status);
1174 
1175     status = defwNet("net3");
1176     CHECK_STATUS(status);
1177     status = defwNetConnection("cell4", "PA3", 0);
1178     CHECK_STATUS(status);
1179     status = defwNetConnection("cell2", "P10", 0);
1180     CHECK_STATUS(status);
1181     status = defwNetXtalk(30);
1182     CHECK_STATUS(status);
1183     status = defwNetOriginal("extra_crispy");
1184     CHECK_STATUS(status);
1185     status = defwNetSource("USER");
1186     CHECK_STATUS(status);
1187     status = defwNetUse("SIGNAL");
1188     CHECK_STATUS(status);
1189     status = defwNetFrequency(100);
1190     CHECK_STATUS(status);
1191     status = defwIntProperty("alt", 37);
1192     CHECK_STATUS(status);
1193     status = defwStringProperty("lastName", "Unknown");
1194     CHECK_STATUS(status);
1195     status = defwRealProperty("length", 10.11);
1196     CHECK_STATUS(status);
1197     status = defwNetPattern("BALANCED");
1198     CHECK_STATUS(status);
1199     status = defwNetVpinStr("P2", "L1", 45, 54, 3, 46, "FIXED", 23, 12, "FN");
1200     CHECK_STATUS(status);
1201     status = defwNetEndOneNet();
1202     CHECK_STATUS(status);
1203 
1204     coorX = (double*)malloc(sizeof(double)*3);
1205     coorY = (double*)malloc(sizeof(double)*3);
1206     status = defwNet("my_net");
1207     CHECK_STATUS(status);
1208     status = defwNetConnection("I1", "A", 0);
1209     CHECK_STATUS(status);
1210     status = defwNetConnection("BUF", "Z", 0);
1211     CHECK_STATUS(status);
1212     status = defwNetNondefaultRule("RULE1");
1213     CHECK_STATUS(status);
1214     status = defwNetUse("RESET");
1215     CHECK_STATUS(status);
1216     status = defwNetShieldnet("VSS");
1217     CHECK_STATUS(status);
1218     status = defwNetShieldnet("VDD");
1219     CHECK_STATUS(status);
1220     status = defwNetPathStart("ROUTED");
1221     CHECK_STATUS(status);
1222     status = defwNetPathLayer("M2", 0, NULL);
1223     CHECK_STATUS(status);
1224     status = defwNetPathStyle(2);
1225     CHECK_STATUS(status);
1226     coorX[0] = 14000.0;
1227     coorY[0] = 341440.0;
1228     coorX[1] = 9600.0;
1229     coorY[1] = 341440.0;
1230     coorX[2] = 9600.0;
1231     coorY[2] = 282400.0;
1232     status = defwNetPathPoint(3, coorX, coorY);
1233     CHECK_STATUS(status);
1234     status = defwNetPathVia("nd1VIA12");
1235     CHECK_STATUS(status);
1236     coorX[0] = 2400;
1237     coorY[0] = 2400;
1238     status = defwNetPathPoint(1, coorX, coorY);
1239     CHECK_STATUS(status);
1240     status = defwNetPathStart("NEW");
1241     CHECK_STATUS(status);
1242     status = defwNetPathLayer("M1", 1, NULL);
1243     CHECK_STATUS(status);
1244     status = defwNetPathStyle(4);
1245     CHECK_STATUS(status);
1246     coorX[0] = 2400.0;
1247     coorY[0] = 282400.0;
1248     coorX[1] = 240.0;
1249     coorY[1] = 282400.0;
1250     status = defwNetPathPoint(2, coorX, coorY);
1251     CHECK_STATUS(status);
1252     free((char*)coorX);
1253     free((char*)coorY);
1254     status = defwNetPathEnd();
1255     CHECK_STATUS(status);
1256     status = defwNetNoshieldStart("M2");
1257     CHECK_STATUS(status);
1258     coorXSN = (const char**)malloc(sizeof(char*)*2);
1259     coorYSN = (const char**)malloc(sizeof(char*)*2);
1260     coorXSN[0] = strdup("14100");
1261     coorYSN[0] = strdup("341440");
1262     coorXSN[1] = strdup("14000");
1263     coorYSN[1] = strdup("341440");
1264     status = defwNetNoshieldPoint(2, coorXSN, coorYSN);
1265     CHECK_STATUS(status);
1266     status = defwNetNoshieldVia("VIA4");
1267     CHECK_STATUS(status);
1268     status = defwNetNoshieldEnd();
1269     CHECK_STATUS(status);
1270     status = defwNetEndOneNet();
1271     CHECK_STATUS(status);
1272 
1273     status = defwNet("|INBUS[1]");
1274     CHECK_STATUS(status);
1275     status = defwNetConnection("|i1", "A", 0);
1276     CHECK_STATUS(status);
1277     status = defwNetEndOneNet();
1278     CHECK_STATUS(status);
1279 
1280     status = defwNet("|INBUS<0>");
1281     CHECK_STATUS(status);
1282     status = defwNetConnection("|i0", "A", 0);
1283     CHECK_STATUS(status);
1284     status = defwNetEndOneNet();
1285     CHECK_STATUS(status);
1286 
1287     status = defwNet("|OUTBUS<1>");
1288     CHECK_STATUS(status);
1289     status = defwNetConnection("|i0", "Z", 0);
1290     CHECK_STATUS(status);
1291     status = defwNetEndOneNet();
1292     CHECK_STATUS(status);
1293 
1294     status = defwNet("MUSTJOIN");
1295     CHECK_STATUS(status);
1296     status = defwNetConnection("cell4", "PA1", 0);
1297     CHECK_STATUS(status);
1298     status = defwNetEndOneNet();
1299     CHECK_STATUS(status);
1300 
1301     status = defwNet("XX100");
1302     CHECK_STATUS(status);
1303     status = defwNetConnection("Z38A05", "G", 0);
1304     CHECK_STATUS(status);
1305     status = defwNetConnection("Z38A03", "G", 0);
1306     CHECK_STATUS(status);
1307     status = defwNetConnection("Z38A01", "G", 0);
1308     CHECK_STATUS(status);
1309     status = defwNetVpin("V_SUB3_XX100", NULL, -333, -333, 333, 333, "PLACED",
1310             189560, 27300, 0);
1311     CHECK_STATUS(status);
1312     status = defwNetVpin("V_SUB2_XX100", NULL, -333, -333, 333, 333, "PLACED",
1313             169400, 64500, 0);
1314     CHECK_STATUS(status);
1315     status = defwNetVpin("V_SUB1_XX100", NULL, -333, -333, 333, 333, "PLACED",
1316             55160, 31500, 0);
1317     CHECK_STATUS(status);
1318     status = defwNetSubnetStart("SUB1_XX100");
1319     CHECK_STATUS(status);
1320     status = defwNetSubnetPin("Z38A05", "G");
1321     CHECK_STATUS(status);
1322     status = defwNetSubnetPin("VPIN", "V_SUB1_XX100");
1323     CHECK_STATUS(status);
1324     status = defwNetPathStart("ROUTED");
1325     CHECK_STATUS(status);
1326     status = defwNetPathLayer("M1", 0, "RULE1");
1327     CHECK_STATUS(status);
1328     free((char*)coorXSN[0]);
1329     free((char*)coorYSN[0]);
1330     free((char*)coorXSN[1]);
1331     free((char*)coorYSN[1]);
1332     free((char*)coorXSN);
1333     free((char*)coorYSN);
1334     coorX = (double*)malloc(sizeof(double)*5);
1335     coorY = (double*)malloc(sizeof(double)*5);
1336     coorValue = (double*)malloc(sizeof(double)*5);
1337     coorX[0] = 54040.0;
1338     coorY[0] = 30300.0;
1339     coorX[1] = 54040.0;
1340     coorY[1] = 30900.0;
1341     status = defwNetPathPoint(2, coorX, coorY);
1342     CHECK_STATUS(status);
1343     status = defwNetPathVia("nd1VIA12");
1344     CHECK_STATUS(status);
1345     coorX[0] = 54040.0;
1346     coorY[0] = 30900.0;
1347     coorX[1] = 56280.0;
1348     coorY[1] = 30900.0;
1349     status = defwNetPathPoint(2, coorX, coorY);
1350     CHECK_STATUS(status);
1351     status = defwNetPathViaWithOrient("nd1VIA23", 6);
1352     CHECK_STATUS(status);
1353     coorX[0] = 56280.0;
1354     coorY[0] = 31500.0;
1355     coorX[1] = 55160.0;
1356     coorY[1] = 31500.0;
1357     status = defwNetPathPoint(2, coorX, coorY);
1358     CHECK_STATUS(status);
1359     status = defwNetPathEnd();
1360     CHECK_STATUS(status);
1361     status = defwNetSubnetEnd();
1362     CHECK_STATUS(status);
1363     status = defwNetSubnetStart("SUB2_XX100");
1364     CHECK_STATUS(status);
1365     status = defwNetSubnetPin("Z38A03", "G");
1366     CHECK_STATUS(status);
1367     status = defwNetSubnetPin("VPIN", "V_SUB2_XX100");
1368     CHECK_STATUS(status);
1369     status = defwNetPathStart("ROUTED");
1370     CHECK_STATUS(status);
1371     status = defwNetPathLayer("M1", 0, NULL);
1372     CHECK_STATUS(status);
1373     coorX[0] = 168280.0;
1374     coorY[0] = 63300.0;
1375     coorValue[0] = 7.0;
1376     coorX[1] = 168280.0;
1377     coorY[1] = 64500.0;
1378     coorValue[1] = 0;
1379     status = defwNetPathPointWithExt(2, coorX, coorY, coorValue);
1380     CHECK_STATUS(status);
1381     status = defwNetPathVia("M1_M2");
1382     CHECK_STATUS(status);
1383     coorX[0] = 169400.0;
1384     coorY[0] = 64500.0;
1385     coorValue[0] = 8.0;
1386     status = defwNetPathPointWithExt(1, coorX, coorY, coorValue);
1387     CHECK_STATUS(status);
1388     status = defwNetPathViaWithOrientStr("M2_M3", "SE");
1389     CHECK_STATUS(status);
1390     status = defwNetPathEnd();
1391     CHECK_STATUS(status);
1392     status = defwNetSubnetEnd();
1393     CHECK_STATUS(status);
1394     status = defwNetSubnetStart("SUB3_XX100");
1395     CHECK_STATUS(status);
1396     status = defwNetSubnetPin("Z38A01", "G");
1397     CHECK_STATUS(status);
1398     status = defwNetSubnetPin("VPIN", "V_SUB3_XX100");
1399     CHECK_STATUS(status);
1400     status = defwNetPathStart("ROUTED");
1401     CHECK_STATUS(status);
1402     status = defwNetPathLayer("M1", 0, NULL);
1403     CHECK_STATUS(status);
1404     coorX[0] = 188400.0;
1405     coorY[0] = 26100.0;
1406     coorX[1] = 188400.0;
1407     coorY[1] = 27300.0;
1408     status = defwNetPathPoint(2, coorX, coorY);
1409     CHECK_STATUS(status);
1410     status = defwNetPathVia("M1_M2");
1411     CHECK_STATUS(status);
1412     coorX[0] = 189560.0;
1413     coorY[0] = 27300.0;
1414     status = defwNetPathPoint(1, coorX, coorY);
1415     CHECK_STATUS(status);
1416     status = defwNetPathVia("M1_M2");
1417     CHECK_STATUS(status);
1418     status = defwNetPathEnd();
1419     CHECK_STATUS(status);
1420     status = defwNetSubnetEnd();
1421     CHECK_STATUS(status);
1422     status = defwNetSubnetStart("SUB0_XX100");
1423     CHECK_STATUS(status);
1424     status = defwNetSubnetPin("VPIN", "V_SUB1_XX100");
1425     CHECK_STATUS(status);
1426     status = defwNetSubnetPin("VPIN", "V_SUB2_XX100");
1427     CHECK_STATUS(status);
1428     status = defwNetSubnetPin("VPIN", "V_SUB3_XX100");
1429     CHECK_STATUS(status);
1430     status = defwNetNondefaultRule("RULE1");
1431     CHECK_STATUS(status);
1432     status = defwNetPathStart("ROUTED");
1433     CHECK_STATUS(status);
1434     status = defwNetPathLayer("M3", 0, NULL);
1435     CHECK_STATUS(status);
1436     coorX[0] = 269400.0;
1437     coorY[0] = 64500.0;
1438     coorX[1] = 269400.0;
1439     coorY[1] = 54900.0;
1440     coorX[2] = 170520.0;
1441     coorY[2] = 54900.0;
1442     coorX[3] = 170520.0;
1443     coorY[3] = 37500.0;
1444     coorX[4] = 170520.0;
1445     coorY[4] = 30300.0;
1446     status = defwNetPathPoint(5, coorX, coorY);
1447     CHECK_STATUS(status);
1448     status = defwNetPathVia("nd1VIA23");
1449     CHECK_STATUS(status);
1450     coorX[0] = 171080.0;
1451     coorY[0] = 30300.0;
1452     coorX[1] = 17440.0;
1453     coorY[1] = 0.0;
1454     status = defwNetPathPoint(2, coorX, coorY);
1455     CHECK_STATUS(status);
1456     status = defwNetPathVia("nd1VIA23");
1457     CHECK_STATUS(status);
1458     coorX[0] = 17440.0;
1459     coorY[0] = 0.0;
1460     coorValue[0] = 0;
1461     coorX[1] = 17440.0;
1462     coorY[1] = 26700.0;
1463     coorValue[1] = 8.0;
1464     status = defwNetPathPointWithExt(2, coorX, coorY, coorValue);
1465     CHECK_STATUS(status);
1466     status = defwNetPathVia("nd1VIA23");
1467     CHECK_STATUS(status);
1468     coorX[0] = 177800.0;
1469     coorY[0] = 26700.0;
1470     status = defwNetPathPoint(1, coorX, coorY);
1471     CHECK_STATUS(status);
1472     status = defwNetPathVia("nd1VIA23");
1473     CHECK_STATUS(status);
1474     coorX[0] = 177800.0;
1475     coorY[0] = 26700.0;
1476     coorValue[0] = 8.0;
1477     coorX[1] = 177800.0;
1478     coorY[1] = 30300.0;
1479     coorValue[1] = 8.0;
1480     status = defwNetPathPointWithExt(2, coorX, coorY, coorValue);
1481     CHECK_STATUS(status);
1482     status = defwNetPathVia("nd1VIA23");
1483     CHECK_STATUS(status);
1484     status = defwNetPathVia("nd1VIA23");
1485     CHECK_STATUS(status);
1486     coorX[0] = 189560.0;
1487     coorY[0] = 30300.0;;
1488     coorValue[0] = 8.0;
1489     status = defwNetPathPointWithExt(1, coorX, coorY, coorValue);
1490     CHECK_STATUS(status);
1491     status = defwNetPathVia("nd1VIA12");
1492     CHECK_STATUS(status);
1493     coorX[0] = 189560.0;
1494     coorY[0] = 27300.0;
1495     status = defwNetPathPoint(1, coorX, coorY);
1496     CHECK_STATUS(status);
1497     status = defwNetPathStart("NEW");
1498     CHECK_STATUS(status);
1499     status = defwNetPathLayer("M3", 1, NULL);
1500     CHECK_STATUS(status);
1501     coorX[0] = 55160.0;
1502     coorY[0] = 31500.0;
1503     coorValue[0] = 8.0;
1504     coorX[1] = 55160.0;
1505     coorY[1] = 34500.0;
1506     coorValue[1] = 0.0;
1507     status = defwNetPathPointWithExt(2, coorX, coorY, coorValue);
1508     CHECK_STATUS(status);
1509     status = defwNetPathVia("M2_M3");
1510     CHECK_STATUS(status);
1511     coorX[0] = 149800.0;
1512     coorY[0] = 34500.0;
1513     coorValue[0] = 8.0;
1514     status = defwNetPathPointWithExt(1, coorX, coorY, coorValue);
1515     CHECK_STATUS(status);
1516     status = defwNetPathVia("M2_M3");
1517     CHECK_STATUS(status);
1518     coorX[0] = 149800.0;
1519     coorY[0] = 35700.0;
1520     coorX[1] = 149800.0;
1521     coorY[1] = 35700.0;
1522     status = defwNetPathPoint(2, coorX, coorY);
1523     CHECK_STATUS(status);
1524     status = defwNetPathVia("M2_M3");
1525     CHECK_STATUS(status);
1526     coorX[0] = 149800.0;
1527     coorY[0] = 37500.0;
1528     coorValue[0] = 8.0;;
1529     coorX[1] = 170520.0;
1530     coorY[1] = 37500.0;
1531     coorValue[1] = 0.0;
1532     status = defwNetPathPointWithExt(2, coorX, coorY, coorValue);
1533     CHECK_STATUS(status);
1534     status = defwNetPathVia("M2_M3");
1535     CHECK_STATUS(status);
1536     status = defwNetPathEnd();
1537     CHECK_STATUS(status);
1538     status = defwNetEndOneNet();
1539     CHECK_STATUS(status);
1540 
1541     status = defwNet("SCAN");
1542     CHECK_STATUS(status);
1543     status = defwNetConnection("scancell1", "P10", 1);
1544     CHECK_STATUS(status);
1545     status = defwNetConnection("scancell2", "PA0", 1);
1546     CHECK_STATUS(status);
1547     status = defwNetSource("TEST");
1548     CHECK_STATUS(status);
1549     status = defwNetEndOneNet();
1550     CHECK_STATUS(status);
1551 
1552     status = defwNet("testBug");
1553     CHECK_STATUS(status);
1554     status = defwNetConnection("Z38A05", "G", 0);
1555     CHECK_STATUS(status);
1556     status = defwNetConnection("Z38A03", "G", 0);
1557     CHECK_STATUS(status);
1558     status = defwNetConnection("Z38A01", "G", 0);
1559     CHECK_STATUS(status);
1560     status = defwNetPathStart("ROUTED");
1561     CHECK_STATUS(status);
1562     status = defwNetPathLayer("M2", 0, NULL);
1563     CHECK_STATUS(status);
1564     coorX[0] = 100.0;
1565     coorY[0] = 100.0;
1566     status = defwNetPathPoint(1, coorX, coorY);
1567     CHECK_STATUS(status);
1568     coorX[0] = 500.0;
1569     coorY[0] = 100.0;
1570     status = defwNetPathPoint(1, coorX, coorY);
1571     CHECK_STATUS(status);
1572     status = defwNetPathVirtual(700, 100);
1573     CHECK_STATUS(status);
1574     status = defwNetPathMask(2);
1575     CHECK_STATUS(status);
1576     status = defwNetPathRect(-300, 100, -100, 300);
1577     CHECK_STATUS(status);
1578     coorX[0] = 700.0;
1579     coorY[0] = 700.0;
1580     status = defwNetPathPoint(1, coorX, coorY);
1581     CHECK_STATUS(status);
1582     status = defwNetPathEnd();
1583     CHECK_STATUS(status);
1584     status = defwNetPathStart("ROUTED");
1585     CHECK_STATUS(status);
1586     status = defwNetPathLayer("M1", 0, NULL);
1587     CHECK_STATUS(status);
1588     coorX[0] = 1288210.0;
1589     coorY[0] = 580930.0;
1590     status = defwNetPathPoint(1, coorX, coorY);
1591     CHECK_STATUS(status);
1592     status = defwNetPathMask(31);
1593     CHECK_STATUS(status);
1594     status = defwNetPathVia("GETH1W1W1");
1595     CHECK_STATUS(status);
1596     coorX[0] = 1288210.0;
1597     coorY[0] = 582820.0;
1598     status = defwNetPathPoint(1, coorX, coorY);
1599     CHECK_STATUS(status);
1600     status = defwNetPathVia("GETH2W1W1");
1601     CHECK_STATUS(status);
1602     status = defwNetPathStart("NEW");
1603     CHECK_STATUS(status);
1604     status = defwNetPathLayer("M3", 0, NULL);
1605     CHECK_STATUS(status);
1606     coorX[0] = 1141350.0;
1607     coorY[0] = 582820.0;
1608     status = defwNetPathPoint(1, coorX, coorY);
1609     CHECK_STATUS(status);
1610     status = defwNetPathMask(3);
1611     CHECK_STATUS(status);
1612     status = defwNetPathVia("GETH2W1W1");
1613     CHECK_STATUS(status);
1614     coorX[0] = 1141350.0;
1615     coorY[0] = 580930.0;
1616     status = defwNetPathPoint(1, coorX, coorY);
1617     CHECK_STATUS(status);
1618     status = defwNetPathVia("GETH1W1W1");
1619     CHECK_STATUS(status);
1620     status = defwNetPathStart("NEW");
1621     CHECK_STATUS(status);
1622     status = defwNetPathLayer("M1", 0, NULL);
1623     CHECK_STATUS(status);
1624     coorX[0] = 1278410.0;
1625     coorY[0] = 275170.0;
1626     status = defwNetPathPoint(1, coorX, coorY);
1627     CHECK_STATUS(status);
1628     status = defwNetPathStart("NEW");
1629     CHECK_STATUS(status);
1630     status = defwNetPathLayer("M1", 0, NULL);
1631     CHECK_STATUS(status);
1632     coorX[0] = 1141210.0;
1633     coorY[0] = 271250.0;
1634     status = defwNetPathPoint(1, coorX, coorY);
1635     CHECK_STATUS(status);
1636     status = defwNetPathVia("GETH1W1W1");
1637     CHECK_STATUS(status);
1638     coorX[0] = 1141210.0;
1639     coorY[0] = 271460.0;
1640     status = defwNetPathPoint(1, coorX, coorY);
1641     CHECK_STATUS(status);
1642     status = defwNetPathVia("GETH2W1W1");
1643     CHECK_STATUS(status);
1644     coorX[0] = 1142820.0;
1645     coorY[0] = 271460.0;
1646     status = defwNetPathPoint(1, coorX, coorY);
1647     CHECK_STATUS(status);
1648     status = defwNetPathVia("GETH3W1W1");
1649     CHECK_STATUS(status);
1650     status = defwNetPathEnd();
1651     CHECK_STATUS(status);
1652     status = defwNetEndOneNet();
1653     CHECK_STATUS(status);
1654     free((char*)coorX);
1655     free((char*)coorY);
1656     free((char*)coorValue);
1657 
1658     status = defwNet("n1");
1659     CHECK_STATUS(status);
1660     status = defwNetConnection("PIN", "n1", 0);
1661     CHECK_STATUS(status);
1662     status = defwNetConnection("driver1", "in", 0);
1663     CHECK_STATUS(status);
1664     status = defwNetConnection("bumpa1", "bumppin", 0);
1665     CHECK_STATUS(status);
1666     status = defwNetFixedbump();
1667     CHECK_STATUS(status);
1668     status = defwNetEndOneNet();
1669     CHECK_STATUS(status);
1670 
1671     status = defwNetMustjoinConnection("PIN2", "n2");
1672     CHECK_STATUS(status);
1673     status = defwNetEndOneNet();
1674     CHECK_STATUS(status);
1675 
1676     status = defwEndNets();
1677     CHECK_STATUS(status);
1678 
1679     // IOTIMINGS
1680     /* obsolete in 5.4
1681        status = defwStartIOTimings(3);
1682        CHECK_STATUS(status);
1683        status = defwIOTiming("PIN", "INBUS<0>");
1684        CHECK_STATUS(status);
1685        status = defwIOTimingVariable("RISE", 6100000, 7100000);
1686        CHECK_STATUS(status);
1687        status = defwIOTimingVariable("FALL", 3100000, 3100000);
1688        CHECK_STATUS(status);
1689        status = defwIOTimingSlewrate("RISE", 110, 110);
1690        CHECK_STATUS(status);
1691        status = defwIOTimingSlewrate("FALL", 290, 290);
1692        CHECK_STATUS(status);
1693        status = defwIOTimingCapacitance(0);
1694        CHECK_STATUS(status);
1695        status = defwIOTiming("PIN", "INBUS[1]");
1696        CHECK_STATUS(status);
1697        status = defwIOTimingDrivecell("INV", "A", "Z", 2);
1698        CHECK_STATUS(status);
1699        status = defwIOTimingSlewrate("RISE", 110, 110);
1700        CHECK_STATUS(status);
1701        status = defwIOTimingSlewrate("FALL", 290, 290);
1702        CHECK_STATUS(status);
1703        status = defwIOTimingCapacitance(0);
1704        CHECK_STATUS(status);
1705        status = defwIOTiming("PIN", "OUTPUS<1>");
1706        CHECK_STATUS(status);
1707        status = defwIOTimingCapacitance(120000);
1708        CHECK_STATUS(status);
1709        status = defwEndIOTimings();
1710        CHECK_STATUS(status);
1711        */
1712 
1713     // SCANCHAIN
1714     status = defwStartScanchains(4);
1715     CHECK_STATUS(status);
1716     status = defwScanchain("the_chain");
1717     CHECK_STATUS(status);
1718     status = defwScanchainCommonscanpins("IN", "PA1", "OUT", "PA2");
1719     CHECK_STATUS(status);
1720     status = defwScanchainStart("PIN", "scanpin");
1721     CHECK_STATUS(status);
1722     status = defwScanchainStop("cell4", "PA2");
1723     CHECK_STATUS(status);
1724     status = defwScanchainOrdered("cell2", "IN", "PA0", NULL, NULL,
1725             "cell1", "OUT", "P10", NULL, NULL);
1726     CHECK_STATUS(status);
1727     status = defwScanchainFloating("scancell1", "IN", "PA0", NULL, NULL);
1728     CHECK_STATUS(status);
1729     status = defwScanchainFloating("scancell2", "OUT", "P10", NULL, NULL);
1730     CHECK_STATUS(status);
1731     status = defwScanchain("chain1_clock1");
1732     CHECK_STATUS(status);
1733     status = defwScanchainPartition("clock1", -1);
1734     CHECK_STATUS(status);
1735     status = defwScanchainStart("block1/current_state_reg_0_QZ", NULL);
1736     CHECK_STATUS(status);
1737     status = defwScanchainFloating("block1/pgm_cgm_en_reg", "IN", "SD", "OUT", "QZ");
1738     CHECK_STATUS(status);
1739     status = defwScanchainFloating("block1/start_reset_dd_reg", "IN", "SD", "OUT", "QZ");
1740     CHECK_STATUS(status);
1741     status = defwScanchainStop("block1/start_reset_d_reg", NULL);
1742     CHECK_STATUS(status);
1743     status = defwScanchain("chain2_clock2");
1744     CHECK_STATUS(status);
1745     status = defwScanchainPartition("clock2", 1000);
1746     CHECK_STATUS(status);
1747     status = defwScanchainStart("block1/current_state_reg_0_QZ", NULL);
1748     CHECK_STATUS(status);
1749     status = defwScanchainFloating("block1/port2_phy_addr_reg_0_", "IN", "SD", "OUT", "QZ ");
1750     CHECK_STATUS(status);
1751     status = defwScanchainFloating("block1/port2_phy_addr_reg_4_", "IN", "SD", "OUT", "QZ");
1752     CHECK_STATUS(status);
1753     status = defwScanchainFloatingBits("block1/port3_intfc", "IN", "SD", "OUT", "QZ", 4);
1754     CHECK_STATUS(status);
1755     status = defwScanchainOrderedBits("block1/mux1", "IN", "A", "OUT", "X", 0,
1756             "block1/ff2", "IN", "SD", "OUT", "Q", -1);
1757     CHECK_STATUS(status);
1758     status = defwScanchain("chain4_clock3");
1759     CHECK_STATUS(status);
1760     status = defwScanchainPartition("clock3", -1);
1761     CHECK_STATUS(status);
1762     status = defwScanchainStart("block1/prescaler_IO/lfsr_reg1", NULL);
1763     CHECK_STATUS(status);
1764     status = defwScanchainFloating("block1/dp1_timers", NULL, NULL, NULL, NULL);
1765     CHECK_STATUS(status);
1766     status = defwScanchainFloatingBits("block1/bus8", NULL, NULL, NULL, NULL, 8);
1767     CHECK_STATUS(status);
1768     status = defwScanchainOrderedBits("block1/dsl/ffl", "IN", "SD", "OUT", "Q",
1769             -1, "block1/dsl/mux1", "IN", "B", "OUT", "Y", 0);
1770     CHECK_STATUS(status);
1771     status = defwScanchainOrderedBits("block1/dsl/ff2", "IN", "SD", "OUT", "Q",
1772             -1, "block1/dsl/mux2", "IN", "B", "OUT", "Y", 0);
1773     CHECK_STATUS(status);
1774     status = defwScanchainStop("block1/start_reset_d_reg", NULL);
1775     CHECK_STATUS(status);
1776 
1777     status = defwEndScanchain();
1778     CHECK_STATUS(status);
1779 
1780     // CONSTRAINTS
1781     /* obsolete in 5.4
1782        status = defwStartConstraints(3);
1783        CHECK_STATUS(status);
1784        status = defwConstraintOperand();  // the following are operand
1785        CHECK_STATUS(status);
1786        status = defwConstraintOperandPath("cell1", "VDD", "cell2", "VDD");
1787        CHECK_STATUS(status);
1788        status = defwConstraintOperandTime("RISEMAX", 6000);
1789        CHECK_STATUS(status);
1790        status = defwConstraintOperandTime("FALLMIN", 9000);
1791        CHECK_STATUS(status);
1792        status = defwConstraintOperandEnd();
1793        CHECK_STATUS(status);
1794        status = defwConstraintOperand();
1795        CHECK_STATUS(status);
1796        status = defwConstraintOperandSum();
1797        CHECK_STATUS(status);
1798        status = defwConstraintOperandNet("net2");
1799        CHECK_STATUS(status);
1800        status = defwConstraintOperandNet("net3");
1801        CHECK_STATUS(status);
1802        status = defwConstraintOperandSumEnd();
1803        CHECK_STATUS(status);
1804        status = defwConstraintOperandTime("RISEMAX", 2000);
1805        CHECK_STATUS(status);
1806        status = defwConstraintOperandTime("FALLMIN", 5000);
1807        CHECK_STATUS(status);
1808        status = defwConstraintOperandEnd();
1809        CHECK_STATUS(status);
1810        status = defwConstraintWiredlogic("net1", 1000);
1811        CHECK_STATUS(status);
1812        status = defwEndConstraints();
1813        CHECK_STATUS(status);
1814        */
1815 
1816     // GROUPS
1817     groupExpr = (const char**)malloc(sizeof(char*)*2);
1818     status = defwStartGroups(2);
1819     CHECK_STATUS(status);
1820     groupExpr[0] = strdup("cell2");
1821     groupExpr[1] = strdup("cell3");
1822     status = defwGroup("group1", 2, groupExpr);
1823     CHECK_STATUS(status);
1824     free((char*)groupExpr[0]);
1825     free((char*)groupExpr[1]);
1826     status = defwGroupRegion(0, 0, 0, 0, "region1");
1827     CHECK_STATUS(status);
1828     status = defwStringProperty("ggrp", "xx");
1829     CHECK_STATUS(status);
1830     status = defwIntProperty("side", 2);
1831     CHECK_STATUS(status);
1832     status = defwRealProperty("maxarea", 5.6);
1833     CHECK_STATUS(status);
1834     groupExpr[0] = strdup("cell1");
1835     status = defwGroup("group2", 1, groupExpr);
1836     CHECK_STATUS(status);
1837     free((char*)groupExpr[0]);
1838     status = defwGroupRegion(0, 10, 1000, 1010, NULL);
1839     CHECK_STATUS(status);
1840     status = defwStringProperty("ggrp", "after the fall");
1841     CHECK_STATUS(status);
1842     status = defwGroupSoft("MAXHALFPERIMETER", 4000, "MAXX", 10000, 0, 0);
1843     CHECK_STATUS(status);
1844     status = defwEndGroups();
1845     CHECK_STATUS(status);
1846     free((char*)groupExpr);
1847     status = defwNewLine();
1848     CHECK_STATUS(status);
1849 
1850     // BLOCKAGES
1851     int *xPB, *yPB;
1852     xPB = (int*)malloc(sizeof(int)*7);
1853     yPB = (int*)malloc(sizeof(int)*7);
1854     xPB[0] = 2;
1855     yPB[0] = 2;
1856     xPB[1] = 3;
1857     yPB[1] = 3;
1858     xPB[2] = 4;
1859     yPB[2] = 4;
1860     xPB[3] = 5;
1861     yPB[3] = 5;
1862     xPB[4] = 6;
1863     yPB[4] = 6;
1864     xPB[5] = 7;
1865     yPB[5] = 7;
1866     xPB[6] = 8;
1867     yPB[6] = 8;
1868 
1869     status = defwStartBlockages(13);
1870     CHECK_STATUS(status);
1871     status = defwBlockagesLayer("m1");
1872     CHECK_STATUS(status);
1873     status = defwBlockagesLayerComponent("comp1");
1874     CHECK_STATUS(status);
1875     status = defwBlockagesRect(3456, 4535, 3000, 4000);
1876     CHECK_STATUS(status);
1877     status = defwBlockagesRect(4500, 6500, 5500, 6000);
1878     CHECK_STATUS(status);
1879     status = defwBlockagesPolygon(7, xPB, yPB);
1880     CHECK_STATUS(status);
1881     status = defwBlockagesPolygon(6, xPB, yPB);
1882     CHECK_STATUS(status);
1883     status = defwBlockagesRect(5000, 6000, 4000, 5000);
1884     CHECK_STATUS(status);
1885     status = defwBlockagesPlacement();
1886     CHECK_STATUS(status);
1887     status = defwBlockagesPlacementComponent("m2");
1888     CHECK_STATUS(status);
1889     status = defwBlockagesRect(4000, 6000, 8000, 4000);
1890     CHECK_STATUS(status);
1891     status = defwBlockagesRect(8000, 400, 600, 800);
1892     CHECK_STATUS(status);
1893     status = defwBlockagesLayer("m3");
1894     CHECK_STATUS(status);
1895     status = defwBlockagesLayerSpacing(1000);
1896     CHECK_STATUS(status);
1897     status = defwBlockagesRect(3000, 4000, 6000, 5000);
1898     CHECK_STATUS(status);
1899     status = defwBlockagesLayer("m4");
1900     CHECK_STATUS(status);
1901     status = defwBlockagesLayerSpacing(100);
1902     CHECK_STATUS(status);
1903     status = defwBlockagesLayerExceptpgnet();
1904     CHECK_STATUS(status);
1905     status = defwBlockagesLayerComponent("U2726");
1906     CHECK_STATUS(status);
1907     status = defwBlockagesLayerPushdown();
1908     CHECK_STATUS(status);
1909     status = defwBlockagesLayerMask(3);
1910     CHECK_STATUS(status);
1911     status = defwBlockagesRect(3000, 4000, 6000, 5000);
1912     CHECK_STATUS(status);
1913     status = defwBlockagesLayer("m4");
1914     CHECK_STATUS(status);
1915     status = defwBlockagesLayerComponent("U2726");
1916     CHECK_STATUS(status);
1917     status = defwBlockagesLayerPushdown();
1918     CHECK_STATUS(status);
1919     status = defwBlockagesLayerDesignRuleWidth(1000);
1920     CHECK_STATUS(status);
1921     status = defwBlockagesRect(3000, 4000, 6000, 5000);
1922     CHECK_STATUS(status);
1923     status = defwBlockagesLayer("m5");
1924     CHECK_STATUS(status);
1925     status = defwBlockagesLayerFills();
1926     CHECK_STATUS(status);
1927     status = defwBlockagesRect(3000, 4000, 6000, 5000);
1928     CHECK_STATUS(status);
1929     status = defwBlockagesLayer("m6");
1930     CHECK_STATUS(status);
1931     status = defwBlockagesLayerPushdown();
1932     CHECK_STATUS(status);
1933     status = defwBlockagesRect(3000, 4000, 6000, 5000);
1934     CHECK_STATUS(status);
1935     status = defwBlockagesPolygon(7, xPB, yPB);
1936     CHECK_STATUS(status);
1937     status = defwBlockagesPlacement();
1938     CHECK_STATUS(status);
1939     status = defwBlockagesPlacementComponent("m7");
1940     CHECK_STATUS(status);
1941     status = defwBlockagesRect(3000, 4000, 6000, 5000);
1942     CHECK_STATUS(status);
1943     status = defwBlockagesPlacement();
1944     CHECK_STATUS(status);
1945     status = defwBlockagesPlacementPushdown();
1946     CHECK_STATUS(status);
1947     status = defwBlockagesRect(3000, 4000, 6000, 5000);
1948     CHECK_STATUS(status);
1949     status = defwBlockagesPlacement();
1950     CHECK_STATUS(status);
1951     status = defwBlockagesRect(3000, 4000, 6000, 5000);
1952     CHECK_STATUS(status);
1953     status = defwBlockagesPlacement();
1954     CHECK_STATUS(status);
1955     status = defwBlockagesPlacementSoft();
1956     CHECK_STATUS(status);
1957     status = defwBlockagesPlacementComponent("U2729");
1958     CHECK_STATUS(status);
1959     status = defwBlockagesPlacementPushdown();
1960     CHECK_STATUS(status);
1961     status = defwBlockagesRect(4000, 6000, 8000, 4000);
1962     CHECK_STATUS(status);
1963     status = defwBlockagesPlacement();
1964     CHECK_STATUS(status);
1965     status = defwBlockagesPlacementPartial(1.1);
1966     CHECK_STATUS(status);
1967     status = defwBlockagesRect(4000, 6000, 8000, 4000);
1968     CHECK_STATUS(status);
1969     status = defwBlockagesLayer("metal1");
1970     CHECK_STATUS(status);
1971     status =  defwBlockagesLayerExceptpgnet();
1972     CHECK_STATUS(status);
1973     status = defwBlockagesLayerSpacing(4);
1974     CHECK_STATUS(status);
1975     status = defwBlockagesPolygon(3, xPB, yPB);
1976     CHECK_STATUS(status);
1977     status = defwEndBlockages();
1978     CHECK_STATUS(status);
1979     status = defwNewLine();
1980     CHECK_STATUS(status);
1981     free((char*)xPB);
1982     free((char*)yPB);
1983 
1984     // SLOTS
1985     xP = (double*)malloc(sizeof(double)*7);
1986     yP = (double*)malloc(sizeof(double)*7);
1987     xP[0] = 2.1;
1988     yP[0] = 2.1;
1989     xP[1] = 3.1;
1990     yP[1] = 3.1;
1991     xP[2] = 4.1;
1992     yP[2] = 4.1;
1993     xP[3] = 5.1;
1994     yP[3] = 5.1;
1995     xP[4] = 6.1;
1996     yP[4] = 6.1;
1997     xP[5] = 7.1;
1998     yP[5] = 7.1;
1999     xP[6] = 8.1;
2000     yP[6] = 8.1;
2001     status = defwStartSlots(2);
2002     CHECK_STATUS(status);
2003     status = defwSlotLayer("MET1");
2004     CHECK_STATUS(status);
2005     status = defwSlotPolygon(7, xP, yP);
2006     CHECK_STATUS(status);
2007     status = defwSlotPolygon(3, xP, yP);
2008     CHECK_STATUS(status);
2009     status = defwSlotRect(1000, 2000, 1500, 4000);
2010     CHECK_STATUS(status);
2011     status = defwSlotRect(2000, 2000, 2500, 4000);
2012     CHECK_STATUS(status);
2013     status = defwSlotRect(3000, 2000, 3500, 4000);
2014     CHECK_STATUS(status);
2015     status = defwSlotLayer("MET2");
2016     CHECK_STATUS(status);
2017     status = defwSlotRect(1000, 2000, 1500, 4000);
2018     CHECK_STATUS(status);
2019     status = defwSlotPolygon(6, xP, yP);
2020     CHECK_STATUS(status);
2021     status = defwEndSlots();
2022     CHECK_STATUS(status);
2023     status = defwNewLine();
2024     CHECK_STATUS(status);
2025     free((char*)xP);
2026     free((char*)yP);
2027 
2028     // FILLS
2029     xP = (double*)malloc(sizeof(double)*7);
2030     yP = (double*)malloc(sizeof(double)*7);
2031     xP[0] = 2.1;
2032     yP[0] = 2.1;
2033     xP[1] = 3.1;
2034     yP[1] = 3.1;
2035     xP[2] = 4.1;
2036     yP[2] = 4.1;
2037     xP[3] = 5.1;
2038     yP[3] = 5.1;
2039     xP[4] = 6.1;
2040     yP[4] = 6.1;
2041     xP[5] = 7.1;
2042     yP[5] = 7.1;
2043     xP[6] = 8.1;
2044     yP[6] = 8.1;
2045     status = defwStartFills(5);
2046     CHECK_STATUS(status);
2047     status = defwFillLayer("MET1");
2048     CHECK_STATUS(status);
2049     status = defwFillRect(1000, 2000, 1500, 4000);
2050     CHECK_STATUS(status);
2051     status = defwFillPolygon(5, xP, yP);
2052     CHECK_STATUS(status);
2053     status = defwFillRect(2000, 2000, 2500, 4000);
2054     CHECK_STATUS(status);
2055     status = defwFillPolygon(7, xP, yP);
2056     CHECK_STATUS(status);
2057     status = defwFillRect(3000, 2000, 3500, 4000);
2058     CHECK_STATUS(status);
2059     status = defwFillLayer("MET2");
2060     CHECK_STATUS(status);
2061     status = defwFillRect(1000, 2000, 1500, 4000);
2062     CHECK_STATUS(status);
2063     status = defwFillRect(1000, 4500, 1500, 6500);
2064     CHECK_STATUS(status);
2065     status = defwFillRect(1000, 7000, 1500, 9000);
2066     CHECK_STATUS(status);
2067     status = defwFillRect(1000, 9500, 1500, 11500);
2068     CHECK_STATUS(status);
2069     status = defwFillPolygon(7, xP, yP);
2070     CHECK_STATUS(status);
2071     status = defwFillPolygon(6, xP, yP);
2072     CHECK_STATUS(status);
2073     status = defwFillLayer("metal1");
2074     CHECK_STATUS(status);
2075     status = defwFillLayerOPC();
2076     CHECK_STATUS(status);
2077     status = defwFillRect(100, 200, 150, 400);
2078     CHECK_STATUS(status);
2079     status = defwFillRect(300, 200, 350, 400);
2080     CHECK_STATUS(status);
2081     status = defwFillVia("via28");
2082     CHECK_STATUS(status);
2083     status = defwFillViaOPC();
2084     CHECK_STATUS(status);
2085     status = defwFillPoints(1, xP, yP);
2086     CHECK_STATUS(status);
2087     status = defwFillVia("via26");
2088     CHECK_STATUS(status);
2089     status = defwFillPoints(3, xP, yP);
2090     CHECK_STATUS(status);
2091     status = defwEndFills();
2092     CHECK_STATUS(status);
2093     status = defwNewLine();
2094     CHECK_STATUS(status);
2095     free((char*)xP);
2096     free((char*)yP);
2097 
2098     // SLOTS
2099     xP = (double*)malloc(sizeof(double)*7);
2100     yP = (double*)malloc(sizeof(double)*7);
2101     xP[0] = 2.1;
2102     yP[0] = 2.1;
2103     xP[1] = 3.1;
2104     yP[1] = 3.1;
2105     xP[2] = 4.1;
2106     yP[2] = 4.1;
2107     xP[3] = 5.1;
2108     yP[3] = 5.1;
2109     xP[4] = 6.1;
2110     yP[4] = 6.1;
2111     xP[5] = 7.1;
2112     yP[5] = 7.1;
2113     xP[6] = 8.1;
2114     yP[6] = 8.1;
2115     status = defwStartSlots(2);
2116     CHECK_STATUS(status);
2117     status = defwSlotLayer("MET1");
2118     CHECK_STATUS(status);
2119     status = defwSlotRect(1000, 2000, 1500, 4000);
2120     CHECK_STATUS(status);
2121     status = defwSlotPolygon(5, xP, yP);
2122     CHECK_STATUS(status);
2123     status = defwSlotRect(2000, 2000, 2500, 4000);
2124     CHECK_STATUS(status);
2125     status = defwSlotPolygon(7, xP, yP);
2126     CHECK_STATUS(status);
2127     status = defwSlotRect(3000, 2000, 3500, 4000);
2128     CHECK_STATUS(status);
2129     status = defwSlotLayer("MET2");
2130     CHECK_STATUS(status);
2131     status = defwSlotRect(1000, 2000, 1500, 4000);
2132     CHECK_STATUS(status);
2133     status = defwSlotRect(1000, 4500, 1500, 6500);
2134     CHECK_STATUS(status);
2135     status = defwSlotRect(1000, 7000, 1500, 9000);
2136     CHECK_STATUS(status);
2137     status = defwSlotRect(1000, 9500, 1500, 11500);
2138     CHECK_STATUS(status);
2139     status = defwSlotPolygon(7, xP, yP);
2140     CHECK_STATUS(status);
2141     status = defwSlotPolygon(6, xP, yP);
2142     CHECK_STATUS(status);
2143     status = defwEndSlots();
2144     CHECK_STATUS(status);
2145     status = defwNewLine();
2146     CHECK_STATUS(status);
2147     free((char*)xP);
2148     free((char*)yP);
2149 
2150     // NONDEFAULTRULES
2151     status = defwStartNonDefaultRules(4);
2152     CHECK_STATUS(status);
2153     status = defwNonDefaultRule("doubleSpaceRule", 1);
2154     CHECK_STATUS(status);
2155     status = defwNonDefaultRuleLayer("metal1", 2, 0, 1, 0);
2156     CHECK_STATUS(status);
2157     status = defwNonDefaultRuleLayer("metal2", 2, 0, 1, 0);
2158     CHECK_STATUS(status);
2159     status = defwNonDefaultRuleLayer("metal3", 2, 0, 1, 0);
2160     CHECK_STATUS(status);
2161     status = defwNonDefaultRule("lowerResistance", 0);
2162     CHECK_STATUS(status);
2163     status = defwNonDefaultRuleLayer("metal1", 6, 0, 0, 5);
2164     CHECK_STATUS(status);
2165     status = defwNonDefaultRuleLayer("metal2", 5, 1, 6, 4);
2166     CHECK_STATUS(status);
2167     status = defwNonDefaultRuleLayer("metal3", 5, 0, 0, 0);
2168     CHECK_STATUS(status);
2169     status = defwNonDefaultRuleMinCuts("cut12", 2);
2170     CHECK_STATUS(status);
2171     status = defwNonDefaultRuleMinCuts("cut23", 2);
2172     CHECK_STATUS(status);
2173     status = defwNonDefaultRule("myRule", 0);
2174     CHECK_STATUS(status);
2175     status = defwNonDefaultRuleLayer("metal1", 2, 0, 0, 0);
2176     CHECK_STATUS(status);
2177     status = defwNonDefaultRuleLayer("metal2", 2, 0, 0, 0);
2178     CHECK_STATUS(status);
2179     status = defwNonDefaultRuleLayer("metal3", 2, 0, 0, 0);
2180     CHECK_STATUS(status);
2181     status = defwNonDefaultRuleViaRule("myvia12rule");
2182     CHECK_STATUS(status);
2183     status = defwNonDefaultRuleViaRule("myvia23rule");
2184     CHECK_STATUS(status);
2185     status = defwRealProperty("minlength", 50.5);
2186     CHECK_STATUS(status);
2187     status = defwStringProperty("firstName", "Only");
2188     CHECK_STATUS(status);
2189     status = defwIntProperty("idx", 1);
2190     CHECK_STATUS(status);
2191     status = defwNonDefaultRule("myCustomRule", 0);
2192     CHECK_STATUS(status);
2193     status = defwNonDefaultRuleLayer("metal1", 5, 0, 1, 0);
2194     CHECK_STATUS(status);
2195     status = defwNonDefaultRuleLayer("metal2", 5, 0, 1, 0);
2196     CHECK_STATUS(status);
2197     status = defwNonDefaultRuleLayer("metal3", 5, 0, 1, 0);
2198     CHECK_STATUS(status);
2199     status = defwNonDefaultRuleVia("myvia12_custom1");
2200     CHECK_STATUS(status);
2201     status = defwNonDefaultRuleVia("myvia12_custom2");
2202     CHECK_STATUS(status);
2203     status = defwNonDefaultRuleVia("myvia23_custom1");
2204     CHECK_STATUS(status);
2205     status = defwNonDefaultRuleVia("myvia23_custom2");
2206     CHECK_STATUS(status);
2207     status = defwEndNonDefaultRules();
2208     CHECK_STATUS(status);
2209     status = defwNewLine();
2210     CHECK_STATUS(status);
2211 
2212     // STYLES
2213     status = defwStartStyles(3);
2214     CHECK_STATUS(status);
2215     xP = (double*)malloc(sizeof(double)*6);
2216     yP = (double*)malloc(sizeof(double)*6);
2217     xP[0] = 30;
2218     yP[0] = 10;
2219     xP[1] = 10;
2220     yP[1] = 30;
2221     xP[2] = -10;
2222     yP[2] = 30;
2223     xP[3] = -30;
2224     yP[3] = 10;
2225     xP[4] = -30;
2226     yP[4] = -10;
2227     xP[5] = -10;
2228     yP[5] = -30;
2229     status = defwStyles(1, 6, xP, yP);
2230     CHECK_STATUS(status);
2231     status = defwStyles(2, 5, xP, yP);
2232     CHECK_STATUS(status);
2233     free((char*)xP);
2234     free((char*)yP);
2235     xP = (double*)malloc(sizeof(double)*8);
2236     yP = (double*)malloc(sizeof(double)*8);
2237     xP[0] = 30;
2238     yP[0] = 10;
2239     xP[1] = 10;
2240     yP[1] = 30;
2241     xP[2] = -10;
2242     yP[2] = 30;
2243     xP[3] = -30;
2244     yP[3] = 10;
2245     xP[4] = -30;
2246     yP[4] = -10;
2247     xP[5] = -10;
2248     yP[5] = -30;
2249     xP[6] = 10;
2250     yP[6] = -30;
2251     xP[7] = 30;
2252     yP[7] = -10;
2253     status = defwStyles(3, 8, xP, yP);
2254     CHECK_STATUS(status);
2255     status = defwEndStyles();
2256     CHECK_STATUS(status);
2257     free((char*)xP);
2258     free((char*)yP);
2259     status = defwNewLine();
2260     CHECK_STATUS(status);
2261 
2262     // BEGINEXT
2263     status = defwStartBeginext("tag");
2264     CHECK_STATUS(status);
2265     defwAddIndent();
2266     status = defwBeginextCreator("CADENCE");
2267     CHECK_STATUS(status);
2268     // since the date is different each time,
2269     // it will cause the quick test to fail
2270     // status = defwBeginextDate();
2271     // CHECK_STATUS(status);
2272     status = defwBeginextRevision(5, 7);
2273     CHECK_STATUS(status);
2274     status = defwBeginextSyntax("OTTER", "furry");
2275     CHECK_STATUS(status);
2276     status = defwStringProperty("arrg", "later");
2277     CHECK_STATUS(status);
2278     status = defwBeginextSyntax("SEAL", "cousin to WALRUS");
2279     CHECK_STATUS(status);
2280     status = defwEndBeginext();
2281     CHECK_STATUS(status);
2282 
2283 
2284     status = defwEnd();
2285     CHECK_STATUS(status);
2286 
2287     lineNumber = defwCurrentLineNumber();
2288     if (lineNumber == 0)
2289         fprintf(stderr, "ERROR: nothing has been read.\n");
2290 
2291     fclose(fout);
2292 
2293     return 0;
2294 }
2295