/********************************************************************************/ /* input: A file containing sizes of length and width of pfets and nfets */ /* within a specified range */ /* */ /* output: Max files of inverter sized in a input file */ /* */ /* Date: Feb.25, 2001 */ /* By: Daegyu Lee */ /* The Pennsylvania State University */ /* Department of Computer Science and Engineering */ /* Copyright Daegyu Lee 2001 */ /* Revision 0.2 */ /********************************************************************************/ #include #include typedef struct myRect { int LBX, LBY, RTX, RTY; } CTPos; CTPos contactP[500]; CTPos contactN[500]; WriteInFile( char* fileName, int howManyPCT, int howManyNCT, int ndif1LBX, int ndif1LBY, int ndif1RTX, int ndif1RTY, int ndif2LBX, int ndif2LBY, int ndif2RTX, int ndif2RTY, int ndif3LBX, int ndif3LBY, int ndif3RTX, int ndif3RTY, int pdif1LBX, int pdif1LBY, int pdif1RTX, int pdif1RTY, int pdif2LBX, int pdif2LBY, int pdif2RTX, int pdif2RTY, int pdif3LBX, int pdif3LBY, int pdif3RTX, int pdif3RTY, int poly1LBX, int poly1LBY, int poly1RTX, int poly1RTY, int poly2LBX, int poly2LBY, int poly2RTX, int poly2RTY, int poly3LBX, int poly3LBY, int poly3RTX, int poly3RTY, int poly4LBX, int poly4LBY, int poly4RTX, int poly4RTY, int poly5LBX, int poly5LBY, int poly5RTX, int poly5RTY, int poly6LBX, int poly6LBY, int poly6RTX, int poly6RTY, int poly7LBX, int poly7LBY, int poly7RTX, int poly7RTY, int poly8LBX, int poly8LBY, int poly8RTX, int poly8RTY, int poly9LBX, int poly9LBY, int poly9RTX, int poly9RTY, int poly10LBX, int poly10LBY, int poly10RTX, int poly10RTY, int poly11LBX, int poly11LBY, int poly11RTX, int poly11RTY, int nfet1LBX, int nfet1LBY, int nfet1RTX, int nfet1RTY, int nfet2LBX, int nfet2LBY, int nfet2RTX, int nfet2RTY, int pfet1LBX, int pfet1LBY, int pfet1RTX, int pfet1RTY, int pfet2LBX, int pfet2LBY, int pfet2RTX, int pfet2RTY, int mt1_1LBX, int mt1_1LBY, int mt1_1RTX, int mt1_1RTY, int mt1_2LBX, int mt1_2LBY, int mt1_2RTX, int mt1_2RTY, int mt1_3LBX, int mt1_3LBY, int mt1_3RTX, int mt1_3RTY, int mt1_4LBX, int mt1_4LBY, int mt1_4RTX, int mt1_4RTY, int mt1_5LBX, int mt1_5LBY, int mt1_5RTX, int mt1_5RTY, int mt1_6LBX, int mt1_6LBY, int mt1_6RTX, int mt1_6RTY, int mt1_7LBX, int mt1_7LBY, int mt1_7RTX, int mt1_7RTY, int mt1_8LBX, int mt1_8LBY, int mt1_8RTX, int mt1_8RTY, int mt1_9LBX, int mt1_9LBY, int mt1_9RTX, int mt1_9RTY, int mt1_10LBX, int mt1_10LBY, int mt1_10RTX, int mt1_10RTY, int mt1_11LBX, int mt1_11LBY, int mt1_11RTX, int mt1_11RTY, int mt1_12LBX, int mt1_12LBY, int mt1_12RTX, int mt1_12RTY, int mt1_13LBX, int mt1_13LBY, int mt1_13RTX, int mt1_13RTY ) { FILE *fp; int i; fp = fopen( fileName, "w" ); fprintf( fp, "max 3\n" ); fprintf( fp, "tech mmi25\n" ); fprintf( fp, "resolution 0.001\n" ); fprintf( fp, "\n\n" ); fprintf( fp, "DEF\n" ); fprintf( fp, "\n" ); fprintf( fp, "SECTION VERSIONS {\n" ); fprintf( fp, "vMAIN 975961442 23\n" ); fprintf( fp, "vDRC 975961442 23\n" ); fprintf( fp, "vBBox 1 60\n" ); fprintf( fp, "} SECTION VERSIONS\n" ); fprintf( fp, "\n" ); fprintf( fp, "SECTION RECTS {\n" ); fprintf( fp, "layer ndif\n" ); fprintf( fp, "%d %d %d %d\n", ndif1LBX, ndif1LBY, ndif1RTX, ndif1RTY ); fprintf( fp, "%d %d %d %d\n", ndif2LBX, ndif2LBY, ndif2RTX, ndif2RTY ); fprintf( fp, "%d %d %d %d\n", ndif3LBX, ndif3LBY, ndif3RTX, ndif3RTY ); fprintf( fp, "layer pdif\n" ); fprintf( fp, "%d %d %d %d\n", pdif1LBX, pdif1LBY, pdif1RTX, pdif1RTY ); fprintf( fp, "%d %d %d %d\n", pdif2LBX, pdif2LBY, pdif2RTX, pdif2RTY ); fprintf( fp, "%d %d %d %d\n", pdif3LBX, pdif3LBY, pdif3RTX, pdif3RTY ); fprintf( fp, "layer poly\n" ); fprintf( fp, "%d %d %d %d\n", poly1LBX, poly1LBY, poly1RTX, poly1RTY ); fprintf( fp, "%d %d %d %d\n", poly2LBX, poly2LBY, poly2RTX, poly2RTY ); fprintf( fp, "%d %d %d %d\n", poly3LBX, poly3LBY, poly3RTX, poly3RTY ); fprintf( fp, "%d %d %d %d\n", poly4LBX, poly4LBY, poly4RTX, poly4RTY ); fprintf( fp, "%d %d %d %d\n", poly5LBX, poly5LBY, poly5RTX, poly5RTY ); fprintf( fp, "%d %d %d %d\n", poly6LBX, poly6LBY, poly6RTX, poly6RTY ); fprintf( fp, "%d %d %d %d\n", poly7LBX, poly7LBY, poly7RTX, poly7RTY ); fprintf( fp, "%d %d %d %d\n", poly8LBX, poly8LBY, poly8RTX, poly8RTY ); fprintf( fp, "%d %d %d %d\n", poly9LBX, poly9LBY, poly9RTX, poly9RTY ); fprintf( fp, "%d %d %d %d\n", poly10LBX,poly10LBY,poly10RTX,poly10RTY); fprintf( fp, "%d %d %d %d\n", poly11LBX,poly11LBY,poly11RTX,poly11RTY); fprintf( fp, "layer nfet\n" ); fprintf( fp, "%d %d %d %d\n", nfet1LBX, nfet1LBY, nfet1RTX, nfet1RTY ); fprintf( fp, "%d %d %d %d\n", nfet2LBX, nfet2LBY, nfet2RTX, nfet2RTY ); fprintf( fp, "layer pfet\n" ); fprintf( fp, "%d %d %d %d\n", pfet1LBX, pfet1LBY, pfet1RTX, pfet1RTY ); fprintf( fp, "%d %d %d %d\n", pfet2LBX, pfet2LBY, pfet2RTX, pfet2RTY ); fprintf( fp, "layer m1\n" ); fprintf( fp, "%d %d %d %d\n", mt1_1LBX, mt1_1LBY, mt1_1RTX, mt1_1RTY ); fprintf( fp, "%d %d %d %d\n", mt1_2LBX, mt1_2LBY, mt1_2RTX, mt1_2RTY ); fprintf( fp, "%d %d %d %d\n", mt1_3LBX, mt1_3LBY, mt1_3RTX, mt1_3RTY ); fprintf( fp, "%d %d %d %d\n", mt1_4LBX, mt1_4LBY, mt1_4RTX, mt1_4RTY ); fprintf( fp, "%d %d %d %d\n", mt1_5LBX, mt1_5LBY, mt1_5RTX, mt1_5RTY ); fprintf( fp, "%d %d %d %d\n", mt1_6LBX, mt1_6LBY, mt1_6RTX, mt1_6RTY ); fprintf( fp, "%d %d %d %d\n", mt1_7LBX, mt1_7LBY, mt1_7RTX, mt1_7RTY ); fprintf( fp, "%d %d %d %d\n", mt1_8LBX, mt1_8LBY, mt1_8RTX, mt1_8RTY ); fprintf( fp, "%d %d %d %d\n", mt1_9LBX, mt1_9LBY, mt1_9RTX, mt1_9RTY ); fprintf( fp, "%d %d %d %d\n", mt1_10LBX, mt1_10LBY, mt1_10RTX, mt1_10RTY ); fprintf( fp, "%d %d %d %d\n", mt1_11LBX, mt1_11LBY, mt1_11RTX, mt1_11RTY ); fprintf( fp, "%d %d %d %d\n", mt1_12LBX, mt1_12LBY, mt1_12RTX, mt1_12RTY ); fprintf( fp, "%d %d %d %d\n", mt1_13LBX, mt1_13LBY, mt1_13RTX, mt1_13RTY ); fprintf( fp, "layer ct\n" ); fprintf( fp, "%d %d %d %d\n", mt1_13LBX+90, mt1_13LBY+90, mt1_13RTX-90, mt1_13RTY-90 ); for( i=0; i path.out" ); fp3 = fopen( "path.out", "r" ); fscanf( fp3, "%s", pathName ); fclose( fp3 ); fp = fopen( argv[1], "r" ); fp2 = fopen( "extAll.bat", "w" ); fp4 = fopen( argv[2], "r" ); fscanf( fp4, "%f", &vdd ); fscanf( fp4, "%f", &minV ); fscanf( fp4, "%f", &maxV ); fclose( fp4 ); fprintf( fp2, "max -batch 1 " ); while( fscanf(fp, "%d %d %d %d", &length_P, &width_P, &length_N, &width_N) != EOF ) { strcpy( outFileName, "inv_LP" ); sprintf( numString, "%d", length_P ); strcat( outFileName, numString ); strcat( outFileName, "_WP" ); sprintf( numString, "%d", width_P ); strcat( outFileName, numString ); strcat( outFileName, "_LN" ); sprintf( numString, "%d", length_N ); strcat( outFileName, numString ); strcat( outFileName, "_WN" ); sprintf( numString, "%d", width_N ); strcat( outFileName, numString ); strcat( outFileName, ".max" ); /* fprintf( fp2, "max -batch 1 -command extract_it -command cell_save -command exit %s\n", outFileName ); */ fprintf( fp2, "-command cell_load %s/%s ", pathName, outFileName ); fprintf( fp2, "-command extract_it " ); fprintf( fp2, "-command cell_save " ); fprintf( fp2, "-command db_cell_delete " ); strcpy( hspFileName, "inv_LP" ); sprintf( numString, "%d", length_P ); strcat( hspFileName, numString ); strcat( hspFileName, "_WP" ); sprintf( numString, "%d", width_P ); strcat( hspFileName, numString ); strcat( hspFileName, "_LN" ); sprintf( numString, "%d", length_N ); strcat( hspFileName, numString ); strcat( hspFileName, "_WN" ); sprintf( numString, "%d", width_N ); strcat( hspFileName, numString ); strcat( hspFileName, ".hsp" ); fp1 = fopen( hspFileName, "w" ); fprintf( fp1, "VDD %3.1f\n", vdd ); fprintf( fp1, "CLK 5\n" ); fprintf( fp1, "RISE 0.5\n" ); fprintf( fp1, "FALL 0.5\n" ); fprintf( fp1, "in 0110\n" ); fprintf( fp1, ".DC Vin %4.2f %4.2f 0.0005\n", minV, maxV ); fclose( fp1 ); pdif3LBX = -(width_P*10); pdif3LBY = 0; pdif3RTX = 0; pdif3RTY = 660; /* pdif3 */ pfet2LBX = -(width_P*10); pfet2LBY = pdif3RTY; pfet2RTX = 0; pfet2RTY = (pdif3RTY+length_P); /* pfet2 */ pdif2LBX = -(width_P*10); pdif2LBY = pfet2RTY; pdif2RTX = 0; pdif2RTY = (pfet2RTY+740); /* pdif2 */ pfet1LBX = -(width_P*10); pfet1LBY = pdif2RTY; pfet1RTX = 0; pfet1RTY = (pdif2RTY+length_P); /* pfet1 */ pdif1LBX = -(width_P*10); pdif1LBY = pfet1RTY; pdif1RTX = 0; pdif1RTY = (pfet1RTY+660); /* pdif2 */ ndif3LBX = 1200; ndif3LBY = 0; ndif3RTX = (ndif3LBX+width_N*10); ndif3RTY = 660; /* ndif3 */ nfet2LBX = 1200; nfet2LBY = ndif3RTY; nfet2RTX = (nfet2LBX+width_N*10); nfet2RTY = (ndif3RTY+length_N); /* nfet2 */ ndif2LBX = 1200; ndif2LBY = nfet2RTY; ndif2RTX = (ndif2LBX+width_N*10); ndif2RTY = (nfet2RTY+740); /* ndif2 */ nfet1LBX = 1200; nfet1LBY = ndif2RTY; nfet1RTX = (nfet1LBX+width_N*10); nfet1RTY = (ndif2RTY+length_N); /* nfet1 */ ndif1LBX = 1200; ndif1LBY = nfet1RTY; ndif1RTX = (ndif1LBX+width_N*10); ndif1RTY = (nfet1RTY+660); /* ndif2 */ poly1LBX = pfet1LBX-360; poly1LBY = pfet1LBY; poly1RTX = pfet1LBX; poly1RTY = pfet1RTY; /* poly1 */ poly2LBX = pfet1RTX; poly2LBY = pfet1LBY; poly2RTX = poly2LBX+360; poly2RTY = pfet1RTY; /* poly2 */ poly3LBX = nfet1LBX-360; poly3LBY = nfet1LBY; poly3RTX = nfet1LBX; poly3RTY = nfet1RTY; /* poly3 */ poly4LBX = ndif2RTX; poly4LBY = nfet1LBY; poly4RTX = poly4LBX+360; poly4RTY = nfet1RTY; /* poly4 */ poly5LBX = pfet1RTX; poly5LBY = pfet1LBY; poly5RTX = nfet1LBX; poly5RTY = nfet1RTY; /* poly5 */ poly6LBX = pfet2LBX-360; poly6LBY = pfet2LBY; poly6RTX = pfet2LBX; poly6RTY = pfet2RTY; /* poly6 */ poly7LBX = pfet2RTX; poly7LBY = pfet2LBY; poly7RTX = poly7LBX+360; poly7RTY = pfet2RTY; /* poly7 */ poly8LBX = nfet2LBX-360; poly8LBY = nfet2LBY; poly8RTX = nfet2LBX; poly8RTY = nfet2RTY; /* poly8 */ poly9LBX = ndif3RTX; poly9LBY = nfet2LBY; poly9RTX = poly9LBX+360; poly9RTY = nfet2RTY; /* poly9 */ poly10LBX = pfet2RTX; poly10LBY = pfet2LBY; poly10RTX = nfet2LBX; poly10RTY = nfet2RTY; /* poly10 */ poly11LBX = poly10LBX+310; poly11LBY = poly10LBY+30; poly11RTX = poly11LBX+580; poly11RTY = poly11LBY+580;/* poly11 */ mt1_1LBX = pdif1LBX+50; mt1_1LBY = pdif1LBY+130; mt1_1RTX = pdif1RTX-50; mt1_1RTY = pdif1RTY-50; /* metal1 */ mt1_2LBX = pdif2LBX+50; mt1_2LBY = pdif2LBY+130; mt1_2RTX = pdif2RTX-50; mt1_2RTY = pdif2RTY-130; /* metal2 */ mt1_3LBX = pdif3LBX+50; mt1_3LBY = pdif3LBY+50; mt1_3RTX = pdif3RTX-50; mt1_3RTY = pdif3RTY-130; /* metal3 */ mt1_4LBX = ndif1LBX+50; mt1_4LBY = ndif1LBY+130; mt1_4RTX = ndif1RTX-50; mt1_4RTY = ndif1RTY-50; /* metal4 */ mt1_5LBX = ndif2LBX+50; mt1_5LBY = ndif2LBY+130; mt1_5RTX = ndif2RTX-50; mt1_5RTY = ndif2RTY-130; /* metal5 */ mt1_6LBX = ndif3LBX+50; mt1_6LBY = ndif3LBY+50; mt1_6RTX = ndif3RTX-50; mt1_6RTY = ndif3RTY-130; /* metal6 */ mt1_7LBX = mt1_2LBX-1200; mt1_7LBY = mt1_2LBY+80; mt1_7RTX = mt1_2LBX; mt1_7RTY = mt1_7LBY+320; /* metal7 */ mt1_8LBX = mt1_1RTX; mt1_8LBY = mt1_1LBY+80; mt1_8RTX = mt1_4LBX; mt1_8RTY = mt1_8LBY+320; /* metal8 */ mt1_9LBX = poly10LBX+440; mt1_9LBY = poly10LBY+110; mt1_9RTX = mt1_9LBX+320; mt1_9RTY = mt1_8LBY; /* metal9 */ mt1_10LBX = mt1_3RTX; mt1_10LBY = mt1_3LBY+50; mt1_10RTX = mt1_6LBX; mt1_10RTY = mt1_10LBY+320; /* metal10 */ mt1_11LBX = mt1_5RTX; mt1_11LBY = mt1_5LBY+80; mt1_11RTX = mt1_11LBX+1200; mt1_11RTY = mt1_11LBY+320; /* metal11 */ mt1_12LBX = mt1_6RTX; mt1_12LBY = mt1_6LBY+80; mt1_12RTX = mt1_12LBX+1200; mt1_12RTY = mt1_12LBY+320; /* metal12 */ mt1_13LBX = poly11LBX+50; mt1_13LBY = poly11LBY+50; mt1_13RTX = poly11RTX-50; mt1_13RTY = poly11RTY-50; /* metal13 */ numOfPCT = 0; startCTPX = mt1_1LBX+100; do { contactP[numOfPCT].LBX = startCTPX; contactP[numOfPCT].RTX = contactP[numOfPCT].LBX+300; startCTPX = contactP[numOfPCT].RTX + 300; numOfPCT++; if( startCTPX >= mt1_1RTX-100 ) { numOfPCT--; break; } } while(1); numOfNCT = 0; startCTNX = mt1_4LBX+100; do { contactN[numOfNCT].LBX = startCTNX; contactN[numOfNCT].RTX = contactN[numOfNCT].LBX+300; startCTNX = contactN[numOfNCT].RTX + 300; numOfNCT++; if( startCTNX >= mt1_4RTX-100 ) { numOfNCT--; break; } } while(1); WriteInFile( outFileName, numOfPCT, numOfNCT, ndif1LBX, ndif1LBY, ndif1RTX, ndif1RTY, ndif2LBX, ndif2LBY, ndif2RTX, ndif2RTY, ndif3LBX, ndif3LBY, ndif3RTX, ndif3RTY, pdif1LBX, pdif1LBY, pdif1RTX, pdif1RTY, pdif2LBX, pdif2LBY, pdif2RTX, pdif2RTY, pdif3LBX, pdif3LBY, pdif3RTX, pdif3RTY, poly1LBX, poly1LBY, poly1RTX, poly1RTY, poly2LBX, poly2LBY, poly2RTX, poly2RTY, poly3LBX, poly3LBY, poly3RTX, poly3RTY, poly4LBX, poly4LBY, poly4RTX, poly4RTY, poly5LBX, poly5LBY, poly5RTX, poly5RTY, poly6LBX, poly6LBY, poly6RTX, poly6RTY, poly7LBX, poly7LBY, poly7RTX, poly7RTY, poly8LBX, poly8LBY, poly8RTX, poly8RTY, poly9LBX, poly9LBY, poly9RTX, poly9RTY, poly10LBX, poly10LBY, poly10RTX, poly10RTY, poly11LBX, poly11LBY, poly11RTX, poly11RTY, nfet1LBX, nfet1LBY, nfet1RTX, nfet1RTY, nfet2LBX, nfet2LBY, nfet2RTX, nfet2RTY, pfet1LBX, pfet1LBY, pfet1RTX, pfet1RTY, pfet2LBX, pfet2LBY, pfet2RTX, pfet2RTY, mt1_1LBX, mt1_1LBY, mt1_1RTX, mt1_1RTY, mt1_2LBX, mt1_2LBY, mt1_2RTX, mt1_2RTY, mt1_3LBX, mt1_3LBY, mt1_3RTX, mt1_3RTY, mt1_4LBX, mt1_4LBY, mt1_4RTX, mt1_4RTY, mt1_5LBX, mt1_5LBY, mt1_5RTX, mt1_5RTY, mt1_6LBX, mt1_6LBY, mt1_6RTX, mt1_6RTY, mt1_7LBX, mt1_7LBY, mt1_7RTX, mt1_7RTY, mt1_8LBX, mt1_8LBY, mt1_8RTX, mt1_8RTY, mt1_9LBX, mt1_9LBY, mt1_9RTX, mt1_9RTY, mt1_10LBX, mt1_10LBY, mt1_10RTX, mt1_10RTY, mt1_11LBX, mt1_11LBY, mt1_11RTX, mt1_11RTY, mt1_12LBX, mt1_12LBY, mt1_12RTX, mt1_12RTY, mt1_13LBX, mt1_13LBY, mt1_13RTX, mt1_13RTY ); } fprintf( fp2, "-command exit\n" ); fclose( fp2 ); fclose( fp ); system( "chmod u+x extAll.bat" ); }