ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
scl.c
Go to the documentation of this file.
1
20
21#include "sclSize.h"
22#include "base/main/mainInt.h"
23
24#include "misc/util/utilNam.h"
25#include "sclCon.h"
26
27#include "map/mio/mio.h"
28
30
31
35
36static int Scl_CommandReadLib ( Abc_Frame_t * pAbc, int argc, char ** argv );
37static int Scl_CommandWriteLib ( Abc_Frame_t * pAbc, int argc, char ** argv );
38static int Scl_CommandReadScl ( Abc_Frame_t * pAbc, int argc, char ** argv );
39static int Scl_CommandWriteScl ( Abc_Frame_t * pAbc, int argc, char ** argv );
40static int Scl_CommandPrintLib ( Abc_Frame_t * pAbc, int argc, char ** argv );
41static int Scl_CommandLeak2Area ( Abc_Frame_t * pAbc, int argc, char ** argv );
42static int Scl_CommandDumpGen ( Abc_Frame_t * pAbc, int argc, char ** argv );
43static int Scl_CommandPrintGS ( Abc_Frame_t * pAbc, int argc, char ** argv );
44static int Scl_CommandStime ( Abc_Frame_t * pAbc, int argc, char ** argv );
45static int Scl_CommandTopo ( Abc_Frame_t * pAbc, int argc, char ** argv );
46static int Scl_CommandUnBuffer ( Abc_Frame_t * pAbc, int argc, char ** argv );
47static int Scl_CommandBuffer ( Abc_Frame_t * pAbc, int argc, char ** argv );
48static int Scl_CommandBufferOld ( Abc_Frame_t * pAbc, int argc, char ** argv );
49static int Scl_CommandMinsize ( Abc_Frame_t * pAbc, int argc, char ** argv );
50static int Scl_CommandMaxsize ( Abc_Frame_t * pAbc, int argc, char ** argv );
51static int Scl_CommandUpsize ( Abc_Frame_t * pAbc, int argc, char ** argv );
52static int Scl_CommandDnsize ( Abc_Frame_t * pAbc, int argc, char ** argv );
53static int Scl_CommandPrintBuf ( Abc_Frame_t * pAbc, int argc, char ** argv );
54static int Scl_CommandReadConstr ( Abc_Frame_t * pAbc, int argc, char ** argv );
55static int Scl_CommandWriteConstr( Abc_Frame_t * pAbc, int argc, char ** argv );
56static int Scl_CommandPrintConstr( Abc_Frame_t * pAbc, int argc, char ** argv );
57static int Scl_CommandResetConstr( Abc_Frame_t * pAbc, int argc, char ** argv );
58
59static inline Scl_Con_t * Scl_ConGetMan( Abc_Frame_t * pAbc ) { return (Scl_Con_t *)pAbc->pAbcCon; }
60static inline void Scl_ConFreeMan( Abc_Frame_t * pAbc ) { if ( pAbc->pAbcCon ) Scl_ConFree(Scl_ConGetMan(pAbc)); }
61static inline void Scl_ConUpdateMan( Abc_Frame_t * pAbc, Scl_Con_t * p ) { Scl_ConFreeMan(pAbc); pAbc->pAbcCon = p; }
62 Scl_Con_t * Scl_ConReadMan() { return Scl_ConGetMan( Abc_FrameGetGlobalFrame() ); }
63
67
79void Abc_SclLoad( SC_Lib * pLib, SC_Lib ** ppScl )
80{
81 if ( *ppScl )
82 {
83 Abc_SclLibFree( *ppScl );
84 *ppScl = NULL;
85 }
86 assert( *ppScl == NULL );
87 if ( pLib )
88 *(SC_Lib **)ppScl = pLib;
89}
90
102void Scl_Init( Abc_Frame_t * pAbc )
103{
104 Cmd_CommandAdd( pAbc, "SCL mapping", "read_lib", Scl_CommandReadLib, 0 );
105 Cmd_CommandAdd( pAbc, "SCL mapping", "write_lib", Scl_CommandWriteLib, 0 );
106 Cmd_CommandAdd( pAbc, "SCL mapping", "print_lib", Scl_CommandPrintLib, 0 );
107 Cmd_CommandAdd( pAbc, "SCL mapping", "leak2area", Scl_CommandLeak2Area, 0 );
108 Cmd_CommandAdd( pAbc, "SCL mapping", "read_scl", Scl_CommandReadScl, 0 );
109 Cmd_CommandAdd( pAbc, "SCL mapping", "write_scl", Scl_CommandWriteScl, 0 );
110 Cmd_CommandAdd( pAbc, "SCL mapping", "dump_genlib", Scl_CommandDumpGen, 0 );
111 Cmd_CommandAdd( pAbc, "SCL mapping", "print_gs", Scl_CommandPrintGS, 0 );
112 Cmd_CommandAdd( pAbc, "SCL mapping", "stime", Scl_CommandStime, 0 );
113 Cmd_CommandAdd( pAbc, "SCL mapping", "topo", Scl_CommandTopo, 1 );
114 Cmd_CommandAdd( pAbc, "SCL mapping", "unbuffer", Scl_CommandUnBuffer, 1 );
115 Cmd_CommandAdd( pAbc, "SCL mapping", "buffer", Scl_CommandBuffer, 1 );
116// Cmd_CommandAdd( pAbc, "SCL mapping", "_buffer", Scl_CommandBufferOld, 1 );
117 Cmd_CommandAdd( pAbc, "SCL mapping", "minsize", Scl_CommandMinsize, 1 );
118 Cmd_CommandAdd( pAbc, "SCL mapping", "maxsize", Scl_CommandMaxsize, 1 );
119 Cmd_CommandAdd( pAbc, "SCL mapping", "upsize", Scl_CommandUpsize, 1 );
120 Cmd_CommandAdd( pAbc, "SCL mapping", "dnsize", Scl_CommandDnsize, 1 );
121 Cmd_CommandAdd( pAbc, "SCL mapping", "print_buf", Scl_CommandPrintBuf, 0 );
122 Cmd_CommandAdd( pAbc, "SCL mapping", "read_constr", Scl_CommandReadConstr, 0 );
123 Cmd_CommandAdd( pAbc, "SCL mapping", "write_constr", Scl_CommandWriteConstr, 0 );
124 Cmd_CommandAdd( pAbc, "SCL mapping", "print_constr", Scl_CommandPrintConstr, 0 );
125 Cmd_CommandAdd( pAbc, "SCL mapping", "reset_constr", Scl_CommandResetConstr, 0 );
126}
127void Scl_End( Abc_Frame_t * pAbc )
128{
129 Abc_SclLoad( NULL, (SC_Lib **)&pAbc->pLibScl );
130 Scl_ConUpdateMan( pAbc, NULL );
131}
132
144SC_Lib * Scl_ReadLibraryFile( Abc_Frame_t * pAbc, char * pFileName, int fVerbose, int fVeryVerbose, SC_DontUse dont_use, int fSkipMultiOuts )
145{
146 SC_Lib * pLib;
147 FILE * pFile;
148 if ( (pFile = fopen( pFileName, "rb" )) == NULL )
149 {
150 fprintf( pAbc->Err, "Cannot open input file \"%s\". \n", pFileName );
151 return NULL;
152 }
153 fclose( pFile );
154 // read new library
155 pLib = Abc_SclReadLiberty( pFileName, fVerbose, fVeryVerbose, dont_use, fSkipMultiOuts);
156 if ( pLib == NULL )
157 {
158 fprintf( pAbc->Err, "Reading SCL library from file \"%s\" has failed. \n", pFileName );
159 return NULL;
160 }
161 return pLib;
162}
163
175int Scl_CommandReadLib( Abc_Frame_t * pAbc, int argc, char ** argv )
176{
177 SC_Lib * pLib;
178 int c, fDump = 0;
179 float Slew = 0;
180 float Gain = 0;
181 int nGatesMin = 0;
182 int fShortNames = 0;
183 int fUnit = 0;
184 int fVerbose = 1;
185 int fVeryVerbose = 0;
186 int fMerge = 0;
187 int fUsePrefix = 0;
188 int fUseAll = 0;
189 int fSkipMultiOuts = 0;
190
191 SC_DontUse dont_use = {0};
192 dont_use.dont_use_list = ABC_ALLOC(char *, argc);
193 dont_use.size = 0;
194
196 while ( ( c = Extra_UtilGetopt( argc, argv, "SGMXdnuvwmpash" ) ) != EOF )
197 {
198 switch ( c )
199 {
200 case 'S':
201 if ( globalUtilOptind >= argc )
202 {
203 Abc_Print( -1, "Command line switch \"-S\" should be followed by a floating point number.\n" );
204 goto usage;
205 }
206 Slew = (float)atof(argv[globalUtilOptind]);
208 if ( Slew <= 0.0 )
209 goto usage;
210 break;
211 case 'G':
212 if ( globalUtilOptind >= argc )
213 {
214 Abc_Print( -1, "Command line switch \"-G\" should be followed by a floating point number.\n" );
215 goto usage;
216 }
217 Gain = (float)atof(argv[globalUtilOptind]);
219 if ( Gain <= 0.0 )
220 goto usage;
221 break;
222 case 'M':
223 if ( globalUtilOptind >= argc )
224 {
225 Abc_Print( -1, "Command line switch \"-M\" should be followed by a positive integer.\n" );
226 goto usage;
227 }
228 nGatesMin = atoi(argv[globalUtilOptind]);
230 if ( nGatesMin < 0 )
231 goto usage;
232 break;
233 case 'X':
234 if ( globalUtilOptind >= argc )
235 {
236 Abc_Print( -1, "Command line switch \"-X\" should be followed by a string.\n" );
237 goto usage;
238 }
239 dont_use.dont_use_list[dont_use.size] = argv[globalUtilOptind];
240 dont_use.size++;
242 break;
243 case 'd':
244 fDump ^= 1;
245 break;
246 case 'n':
247 fShortNames ^= 1;
248 break;
249 case 'u':
250 fUnit ^= 1;
251 break;
252 case 'v':
253 fVerbose ^= 1;
254 break;
255 case 'w':
256 fVeryVerbose ^= 1;
257 break;
258 case 'm':
259 fMerge ^= 1;
260 break;
261 case 'p':
262 fUsePrefix ^= 1;
263 break;
264 case 'a':
265 fUseAll ^= 1;
266 break;
267 case 's':
268 fSkipMultiOuts ^= 1;
269 break;
270 case 'h':
271 goto usage;
272 default:
273 goto usage;
274 }
275 }
276 if ( argc == globalUtilOptind + 2 ) { // expecting two files
277 SC_Lib * pLib1 = Scl_ReadLibraryFile( pAbc, argv[globalUtilOptind], fVerbose, fVeryVerbose, dont_use, fSkipMultiOuts );
278 SC_Lib * pLib2 = Scl_ReadLibraryFile( pAbc, argv[globalUtilOptind+1], fVerbose, fVeryVerbose, dont_use, fSkipMultiOuts );
279 ABC_FREE(dont_use.dont_use_list);
280 if ( pLib1 == NULL || pLib2 == NULL ) {
281 if (pLib1) Abc_SclLibFree(pLib1);
282 if (pLib2) Abc_SclLibFree(pLib2);
283 return 1;
284 }
285 pLib = Abc_SclMergeLibraries( pLib1, pLib2, fUsePrefix );
286 Abc_SclLibFree(pLib1);
287 Abc_SclLibFree(pLib2);
288 }
289 else if ( argc == globalUtilOptind + 1 ) { // expecting one file
290 SC_Lib * pLib1 = Scl_ReadLibraryFile( pAbc, argv[globalUtilOptind], fVerbose, fVeryVerbose, dont_use, fSkipMultiOuts );
291
292 SC_Lib * pLib_ext = (SC_Lib *)pAbc->pLibScl;
293 if ( fMerge && pLib_ext != NULL && pLib1 != NULL ) {
294 pLib = Abc_SclMergeLibraries( pLib_ext, pLib1, fUsePrefix );
295 if (pLib1) Abc_SclLibFree(pLib1);
296 } else {
297 pLib = pLib1;
298 }
299 ABC_FREE(dont_use.dont_use_list);
300 }
301 else {
302 ABC_FREE(dont_use.dont_use_list);
303 goto usage;
304 }
305 if ( pLib == NULL )
306 return 1;
307 if ( Abc_SclLibClassNum(pLib) < 3 )
308 {
309 fprintf( pAbc->Err, "Library with only %d cell classes cannot be used.\n", Abc_SclLibClassNum(pLib) );
310 Abc_SclLibFree(pLib);
311 return 0;
312 }
313 Abc_SclLoad( pLib, (SC_Lib **)&pAbc->pLibScl );
314 // convert the library if needed
315 if ( fShortNames )
316 Abc_SclShortNames( pLib );
317 // dump the resulting library
318 if ( fDump && pAbc->pLibScl )
319 Abc_SclWriteLiberty( Extra_FileNameGenericAppend(argv[globalUtilOptind], "_temp.lib"), (SC_Lib *)pAbc->pLibScl );
320 if ( fUnit )
321 {
322 SC_Cell * pCell; int i;
323 SC_LibForEachCell( pLib, pCell, i )
324 pCell->area = 1;
325 }
326 // extract genlib library
327 if ( pAbc->pLibScl )
328 {
329 Abc_SclInstallGenlib( pAbc->pLibScl, Slew, Gain, fUseAll, nGatesMin );
331 }
332 return 0;
333
334usage:
335 fprintf( pAbc->Err, "usage: read_lib [-SG float] [-M num] [-dnuvwmpash] [-X cell_name] <file> <file2>\n" );
336 fprintf( pAbc->Err, "\t reads Liberty library from file\n" );
337 fprintf( pAbc->Err, "\t-S float : the slew parameter used to generate the library [default = %.2f]\n", Slew );
338 fprintf( pAbc->Err, "\t-G float : the gain parameter used to generate the library [default = %.2f]\n", Gain );
339 fprintf( pAbc->Err, "\t-M num : skip gate classes whose size is less than this [default = %d]\n", nGatesMin );
340 fprintf( pAbc->Err, "\t-X name : adds name to the list of cells ABC shouldn't use. Flag can be passed multiple times\n");
341 fprintf( pAbc->Err, "\t-d : toggle dumping the parsed library into file \"*_temp.lib\" [default = %s]\n", fDump? "yes": "no" );
342 fprintf( pAbc->Err, "\t-n : toggle replacing gate/pin names by short strings [default = %s]\n", fShortNames? "yes": "no" );
343 fprintf( pAbc->Err, "\t-u : toggle setting unit area for all cells [default = %s]\n", fUnit? "yes": "no" );
344 fprintf( pAbc->Err, "\t-v : toggle writing verbose information [default = %s]\n", fVerbose? "yes": "no" );
345 fprintf( pAbc->Err, "\t-w : toggle writing information about skipped gates [default = %s]\n", fVeryVerbose? "yes": "no" );
346 fprintf( pAbc->Err, "\t-m : toggle merging library with exisiting library [default = %s]\n", fMerge? "yes": "no" );
347 fprintf( pAbc->Err, "\t-p : toggle using prefix for the cell names [default = %s]\n", fUsePrefix? "yes": "no" );
348 fprintf( pAbc->Err, "\t-a : toggle reading all cells when using gain-based modeling [default = %s]\n", fUseAll? "yes": "no" );
349 fprintf( pAbc->Err, "\t-s : toggle skipping cells with two outputs [default = %s]\n", fSkipMultiOuts? "yes": "no" );
350 fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
351 fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
352 fprintf( pAbc->Err, "\t<file2> : the name of a file to read (optional)\n" );
353 return 1;
354}
355
367int Scl_CommandWriteLib( Abc_Frame_t * pAbc, int argc, char **argv )
368{
369 FILE * pFile;
370 char * pFileName;
371 int c;
372
374 while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
375 {
376 switch ( c )
377 {
378 case 'h':
379 goto usage;
380 default:
381 goto usage;
382 }
383 }
384 if ( argc != globalUtilOptind + 1 )
385 goto usage;
386 if ( pAbc->pLibScl == NULL )
387 {
388 fprintf( pAbc->Err, "There is no Liberty library available.\n" );
389 return 1;
390 }
391 // get the input file name
392 pFileName = argv[globalUtilOptind];
393 if ( (pFile = fopen( pFileName, "wb" )) == NULL )
394 {
395 fprintf( pAbc->Err, "Cannot open output file \"%s\". \n", pFileName );
396 return 1;
397 }
398 fclose( pFile );
399
400 // save current library
401 Abc_SclWriteLiberty( pFileName, (SC_Lib *)pAbc->pLibScl );
402 return 0;
403
404usage:
405 fprintf( pAbc->Err, "usage: write_lib [-h] <file>\n" );
406 fprintf( pAbc->Err, "\t write current Liberty library into file\n" );
407 fprintf( pAbc->Err, "\t-h : print the help massage\n" );
408 fprintf( pAbc->Err, "\t<file> : the name of the file to write\n" );
409 return 1;
410}
411
423int Scl_CommandPrintLib( Abc_Frame_t * pAbc, int argc, char **argv )
424{
425 float Slew = 0; // use library
426 float Gain = 100;
427 int fInvOnly = 0;
428 int fShort = 0;
429 int c;
431 while ( ( c = Extra_UtilGetopt( argc, argv, "SGish" ) ) != EOF )
432 {
433 switch ( c )
434 {
435 case 'S':
436 if ( globalUtilOptind >= argc )
437 {
438 Abc_Print( -1, "Command line switch \"-S\" should be followed by a floating point number.\n" );
439 goto usage;
440 }
441 Slew = (float)atof(argv[globalUtilOptind]);
443 if ( Slew <= 0.0 )
444 goto usage;
445 break;
446 case 'G':
447 if ( globalUtilOptind >= argc )
448 {
449 Abc_Print( -1, "Command line switch \"-G\" should be followed by a floating point number.\n" );
450 goto usage;
451 }
452 Gain = (float)atof(argv[globalUtilOptind]);
454 if ( Gain <= 0.0 )
455 goto usage;
456 break;
457 case 'i':
458 fInvOnly ^= 1;
459 break;
460 case 's':
461 fShort ^= 1;
462 break;
463 case 'h':
464 goto usage;
465 default:
466 goto usage;
467 }
468 }
469 if ( pAbc->pLibScl == NULL )
470 {
471 fprintf( pAbc->Err, "There is no Liberty library available.\n" );
472 return 1;
473 }
474
475 // save current library
476 Abc_SclPrintCells( (SC_Lib *)pAbc->pLibScl, Slew, Gain, fInvOnly, fShort );
477 return 0;
478
479usage:
480 fprintf( pAbc->Err, "usage: print_lib [-SG float] [-ish]\n" );
481 fprintf( pAbc->Err, "\t prints statistics of Liberty library\n" );
482 fprintf( pAbc->Err, "\t-S float : the slew parameter used to generate the library [default = %.2f]\n", Slew );
483 fprintf( pAbc->Err, "\t-G float : the gain parameter used to generate the library [default = %.2f]\n", Gain );
484 fprintf( pAbc->Err, "\t-i : toggle printing invs/bufs only [default = %s]\n", fInvOnly? "yes": "no" );
485 fprintf( pAbc->Err, "\t-s : toggle printing in short format [default = %s]\n", fShort? "yes": "no" );
486 fprintf( pAbc->Err, "\t-h : print the help massage\n" );
487 return 1;
488}
489
501int Scl_CommandLeak2Area( Abc_Frame_t * pAbc, int argc, char **argv )
502{
503 float A = 1, B = 1;
504 int c, fVerbose = 0;
506 while ( ( c = Extra_UtilGetopt( argc, argv, "ABvh" ) ) != EOF )
507 {
508 switch ( c )
509 {
510 case 'A':
511 if ( globalUtilOptind >= argc )
512 {
513 Abc_Print( -1, "Command line switch \"-A\" should be followed by a floating point number.\n" );
514 goto usage;
515 }
516 A = (float)atof(argv[globalUtilOptind]);
518 if ( A <= 0.0 )
519 goto usage;
520 break;
521 case 'B':
522 if ( globalUtilOptind >= argc )
523 {
524 Abc_Print( -1, "Command line switch \"-B\" should be followed by a floating point number.\n" );
525 goto usage;
526 }
527 B = (float)atof(argv[globalUtilOptind]);
529 if ( B <= 0.0 )
530 goto usage;
531 break;
532 case 'v':
533 fVerbose ^= 1;
534 break;
535 case 'h':
536 goto usage;
537 default:
538 goto usage;
539 }
540 }
541 if ( pAbc->pLibScl == NULL )
542 {
543 fprintf( pAbc->Err, "There is no Liberty library available.\n" );
544 return 1;
545 }
546 // update the current library
547 Abc_SclConvertLeakageIntoArea( (SC_Lib *)pAbc->pLibScl, A, B );
548 return 0;
549
550usage:
551 fprintf( pAbc->Err, "usage: leak2area [-AB float] [-v]\n" );
552 fprintf( pAbc->Err, "\t converts leakage into area: Area = A * Area + B * Leakage\n" );
553 fprintf( pAbc->Err, "\t-A float : the multiplicative coefficient to transform area [default = %.2f]\n", A );
554 fprintf( pAbc->Err, "\t-B float : the multiplicative coefficient to transform leakage [default = %.2f]\n", B );
555 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
556 fprintf( pAbc->Err, "\t-h : print the help massage\n" );
557 return 1;
558}
559
560
561
573int Scl_CommandReadScl( Abc_Frame_t * pAbc, int argc, char ** argv )
574{
575 FILE * pFile;
576 SC_Lib * pLib;
577 char * pFileName;
578 int c, fDump = 0;
579
581 while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF )
582 {
583 switch ( c )
584 {
585 case 'd':
586 fDump ^= 1;
587 break;
588 case 'h':
589 goto usage;
590 default:
591 goto usage;
592 }
593 }
594 if ( argc != globalUtilOptind + 1 )
595 goto usage;
596
597 // get the input file name
598 pFileName = argv[globalUtilOptind];
599 if ( (pFile = fopen( pFileName, "rb" )) == NULL )
600 {
601 fprintf( pAbc->Err, "Cannot open input file \"%s\". \n", pFileName );
602 return 1;
603 }
604 fclose( pFile );
605
606 // read new library
607 pLib = Abc_SclReadFromFile( pFileName );
608 if ( pLib == NULL )
609 {
610 fprintf( pAbc->Err, "Reading SCL library from file \"%s\" has failed. \n", pFileName );
611 return 1;
612 }
613 Abc_SclLoad( pLib, (SC_Lib **)&pAbc->pLibScl );
614 if ( fDump )
615 Abc_SclWriteLiberty( Extra_FileNameGenericAppend(pFileName, "_temp.lib"), (SC_Lib *)pAbc->pLibScl );
616 // extract genlib library
617 if ( pAbc->pLibScl )
618 {
619 Abc_SclInstallGenlib( pAbc->pLibScl, 0, 0, 0, 0 );
621 }
622 return 0;
623
624usage:
625 fprintf( pAbc->Err, "usage: read_scl [-dh] <file>\n" );
626 fprintf( pAbc->Err, "\t reads extracted Liberty library from file\n" );
627 fprintf( pAbc->Err, "\t-d : toggle dumping the parsed library into file \"*_temp.lib\" [default = %s]\n", fDump? "yes": "no" );
628 fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
629 fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
630 return 1;
631}
632
644int Scl_CommandWriteScl( Abc_Frame_t * pAbc, int argc, char **argv )
645{
646 FILE * pFile;
647 char * pFileName;
648 int c;
649
651 while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
652 {
653 switch ( c )
654 {
655 case 'h':
656 goto usage;
657 default:
658 goto usage;
659 }
660 }
661 if ( argc != globalUtilOptind + 1 )
662 goto usage;
663 if ( pAbc->pLibScl == NULL )
664 {
665 fprintf( pAbc->Err, "There is no Liberty library available.\n" );
666 return 1;
667 }
668 // get the input file name
669 pFileName = argv[globalUtilOptind];
670 if ( (pFile = fopen( pFileName, "wb" )) == NULL )
671 {
672 fprintf( pAbc->Err, "Cannot open output file \"%s\". \n", pFileName );
673 return 1;
674 }
675 fclose( pFile );
676
677 // save current library
678 Abc_SclWriteScl( pFileName, (SC_Lib *)pAbc->pLibScl );
679 return 0;
680
681usage:
682 fprintf( pAbc->Err, "usage: write_scl [-h] <file>\n" );
683 fprintf( pAbc->Err, "\t write extracted Liberty library into file\n" );
684 fprintf( pAbc->Err, "\t-h : print the help massage\n" );
685 fprintf( pAbc->Err, "\t<file> : the name of the file to write\n" );
686 return 1;
687}
688
700int Scl_CommandDumpGen( Abc_Frame_t * pAbc, int argc, char **argv )
701{
702 char * pFileName = NULL;
703 float Slew = 0; // use the library
704 float Gain = 200;
705 int nGatesMin = 4;
706 int c, fVerbose = 0;
708 while ( ( c = Extra_UtilGetopt( argc, argv, "SGMvh" ) ) != EOF )
709 {
710 switch ( c )
711 {
712 case 'S':
713 if ( globalUtilOptind >= argc )
714 {
715 Abc_Print( -1, "Command line switch \"-S\" should be followed by a floating point number.\n" );
716 goto usage;
717 }
718 Slew = (float)atof(argv[globalUtilOptind]);
720 if ( Slew <= 0.0 )
721 goto usage;
722 break;
723 case 'G':
724 if ( globalUtilOptind >= argc )
725 {
726 Abc_Print( -1, "Command line switch \"-G\" should be followed by a floating point number.\n" );
727 goto usage;
728 }
729 Gain = (float)atof(argv[globalUtilOptind]);
731 if ( Gain <= 0.0 )
732 goto usage;
733 break;
734 case 'M':
735 if ( globalUtilOptind >= argc )
736 {
737 Abc_Print( -1, "Command line switch \"-M\" should be followed by a positive integer.\n" );
738 goto usage;
739 }
740 nGatesMin = atoi(argv[globalUtilOptind]);
742 if ( nGatesMin < 0 )
743 goto usage;
744 break;
745 case 'v':
746 fVerbose ^= 1;
747 break;
748 case 'h':
749 goto usage;
750 default:
751 goto usage;
752 }
753 }
754 if ( pAbc->pLibScl == NULL )
755 {
756 fprintf( pAbc->Err, "There is no Liberty library available.\n" );
757 goto usage;
758 }
759 if ( argc == globalUtilOptind + 1 )
760 pFileName = argv[globalUtilOptind];
761 Abc_SclDumpGenlib( pFileName, (SC_Lib *)pAbc->pLibScl, Slew, Gain, nGatesMin );
762 return 0;
763
764usage:
765 fprintf( pAbc->Err, "usage: dump_genlib [-SG float] [-M num] [-vh] <file>\n" );
766 fprintf( pAbc->Err, "\t writes GENLIB file for SCL library\n" );
767 fprintf( pAbc->Err, "\t-S float : the slew parameter used to generate the library [default = %.2f]\n", Slew );
768 fprintf( pAbc->Err, "\t-G float : the gain parameter used to generate the library [default = %.2f]\n", Gain );
769 fprintf( pAbc->Err, "\t-M num : skip gate classes whose size is less than this [default = %d]\n", nGatesMin );
770 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
771 fprintf( pAbc->Err, "\t-h : print the command usage\n");
772 fprintf( pAbc->Err, "\t<file> : optional GENLIB file name\n");
773 return 1;
774}
775
787int Scl_CommandPrintGS( Abc_Frame_t * pAbc, int argc, char **argv )
788{
789 int c;
790
792 while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF )
793 {
794 switch ( c )
795 {
796 case 'h':
797 goto usage;
798 default:
799 goto usage;
800 }
801 }
802 if ( Abc_FrameReadNtk(pAbc) == NULL )
803 {
804 fprintf( pAbc->Err, "There is no current network.\n" );
805 return 1;
806 }
807 if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
808 {
809 fprintf( pAbc->Err, "The current network is not mapped.\n" );
810 return 1;
811 }
812 if ( pAbc->pLibScl == NULL )
813 {
814 fprintf( pAbc->Err, "There is no Liberty library available.\n" );
815 return 1;
816 }
817
818 // save current library
819 Abc_SclPrintGateSizes( (SC_Lib *)pAbc->pLibScl, Abc_FrameReadNtk(pAbc) );
820 return 0;
821
822usage:
823 fprintf( pAbc->Err, "usage: print_gs [-h]\n" );
824 fprintf( pAbc->Err, "\t prints gate sizes in the current mapping\n" );
825 fprintf( pAbc->Err, "\t-h : print the help massage\n" );
826 return 1;
827}
828
840int Scl_CommandStime( Abc_Frame_t * pAbc, int argc, char **argv )
841{
842 int c;
843 int fShowAll = 0;
844 int fUseWireLoads = 0;
845 int fPrintPath = 0;
846 int fDumpStats = 0;
847 int nTreeCRatio = 0;
848
850 while ( ( c = Extra_UtilGetopt( argc, argv, "Xcapdh" ) ) != EOF )
851 {
852 switch ( c )
853 {
854 case 'X':
855 if ( globalUtilOptind >= argc )
856 {
857 Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" );
858 goto usage;
859 }
860 nTreeCRatio = atoi(argv[globalUtilOptind]);
862 if ( nTreeCRatio < 0 )
863 goto usage;
864 break;
865 case 'c':
866 fUseWireLoads ^= 1;
867 break;
868 case 'a':
869 fShowAll ^= 1;
870 break;
871 case 'p':
872 fPrintPath ^= 1;
873 break;
874 case 'd':
875 fDumpStats ^= 1;
876 break;
877 case 'h':
878 goto usage;
879 default:
880 goto usage;
881 }
882 }
883
884 if ( Abc_FrameReadNtk(pAbc) == NULL )
885 {
886 fprintf( pAbc->Err, "There is no current network.\n" );
887 return 1;
888 }
889 if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
890 {
891 fprintf( pAbc->Err, "The current network is not mapped.\n" );
892 return 1;
893 }
894 if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
895 {
896 fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
897 return 1;
898 }
899 if ( pAbc->pLibScl == NULL )
900 {
901 fprintf( pAbc->Err, "There is no Liberty library available.\n" );
902 return 1;
903 }
904
905 Abc_SclTimePerform( (SC_Lib *)pAbc->pLibScl, Abc_FrameReadNtk(pAbc), nTreeCRatio, fUseWireLoads, fShowAll, fPrintPath, fDumpStats );
906 return 0;
907
908usage:
909 fprintf( pAbc->Err, "usage: stime [-X num] [-capdth]\n" );
910 fprintf( pAbc->Err, "\t performs STA using Liberty library\n" );
911 fprintf( pAbc->Err, "\t-X : min Cout/Cave ratio for tree estimations [default = %d]\n", nTreeCRatio );
912 fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", fUseWireLoads? "yes": "no" );
913 fprintf( pAbc->Err, "\t-a : display timing information for all nodes [default = %s]\n", fShowAll? "yes": "no" );
914 fprintf( pAbc->Err, "\t-p : display timing information for critical path [default = %s]\n", fPrintPath? "yes": "no" );
915 fprintf( pAbc->Err, "\t-d : toggle dumping statistics into a file [default = %s]\n", fDumpStats? "yes": "no" );
916 fprintf( pAbc->Err, "\t-h : print the help massage\n" );
917 return 1;
918}
919
931int Scl_CommandTopo( Abc_Frame_t * pAbc, int argc, char ** argv )
932{
933 Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
934 Abc_Ntk_t * pNtkRes;
935 int c, fVerbose = 0;
937 while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
938 {
939 switch ( c )
940 {
941 case 'v':
942 fVerbose ^= 1;
943 break;
944 case 'h':
945 goto usage;
946 default:
947 goto usage;
948 }
949 }
950
951 if ( pNtk == NULL )
952 {
953 Abc_Print( -1, "Empty network.\n" );
954 return 1;
955 }
956 if ( !Abc_NtkIsLogic(pNtk) )
957 {
958 Abc_Print( -1, "This command can only be applied to a logic network.\n" );
959 return 1;
960 }
961
962 // modify the current network
963 pNtkRes = Abc_NtkDupDfs( pNtk );
964 if ( pNtkRes == NULL )
965 {
966 Abc_Print( -1, "The command has failed.\n" );
967 return 1;
968 }
969 // replace the current network
970 Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
971 return 0;
972
973usage:
974 fprintf( pAbc->Err, "usage: topo [-vh]\n" );
975 fprintf( pAbc->Err, "\t rearranges nodes to be in a topological order\n" );
976 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
977 fprintf( pAbc->Err, "\t-h : print the command usage\n");
978 return 1;
979}
980
992int Scl_CommandUnBuffer( Abc_Frame_t * pAbc, int argc, char **argv )
993{
994 Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc);
995 int c, fRemInv = 0, fVerbose = 0;
997 while ( ( c = Extra_UtilGetopt( argc, argv, "ivh" ) ) != EOF )
998 {
999 switch ( c )
1000 {
1001 case 'i':
1002 fRemInv ^= 1;
1003 break;
1004 case 'v':
1005 fVerbose ^= 1;
1006 break;
1007 case 'h':
1008 goto usage;
1009 default:
1010 goto usage;
1011 }
1012 }
1013
1014 if ( pNtk == NULL )
1015 {
1016 fprintf( pAbc->Err, "There is no current network.\n" );
1017 return 1;
1018 }
1019 if ( !Abc_NtkIsLogic(pNtk) )
1020 {
1021 fprintf( pAbc->Err, "The current network is not a logic network.\n" );
1022 return 1;
1023 }
1024 if ( fRemInv )
1025 pNtkRes = Abc_SclUnBufferPhase( pNtk, fVerbose );
1026 else
1027 pNtkRes = Abc_SclUnBufferPerform( pNtk, fVerbose );
1028 if ( pNtkRes == NULL )
1029 {
1030 Abc_Print( -1, "The command has failed.\n" );
1031 return 1;
1032 }
1033 Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
1034 return 0;
1035
1036usage:
1037 fprintf( pAbc->Err, "usage: unbuffer [-ivh]\n" );
1038 fprintf( pAbc->Err, "\t collapses buffer/inverter trees\n" );
1039 fprintf( pAbc->Err, "\t-i : toggle removing interters [default = %s]\n", fRemInv? "yes": "no" );
1040 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1041 fprintf( pAbc->Err, "\t-h : print the command usage\n");
1042 return 1;
1043}
1044
1056int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
1057{
1058 SC_BusPars Pars, * pPars = &Pars;
1059 Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc);
1060 int c;
1061 memset( pPars, 0, sizeof(SC_BusPars) );
1062 pPars->GainRatio = 300;
1063 pPars->Slew = pAbc->pLibScl ? Abc_SclComputeAverageSlew((SC_Lib *)pAbc->pLibScl) : 100;
1064 pPars->nDegree = 10;
1065 pPars->fSizeOnly = 0;
1066 pPars->fAddBufs = 1;
1067 pPars->fBufPis = 0;
1068 pPars->fUseWireLoads = 0;
1069 pPars->fVerbose = 0;
1070 pPars->fVeryVerbose = 0;
1072 while ( ( c = Extra_UtilGetopt( argc, argv, "GSNsbpcvwh" ) ) != EOF )
1073 {
1074 switch ( c )
1075 {
1076 case 'G':
1077 if ( globalUtilOptind >= argc )
1078 {
1079 Abc_Print( -1, "Command line switch \"-G\" should be followed by a positive integer.\n" );
1080 goto usage;
1081 }
1082 pPars->GainRatio = atoi(argv[globalUtilOptind]);
1084 if ( pPars->GainRatio < 0 )
1085 goto usage;
1086 break;
1087 case 'S':
1088 if ( globalUtilOptind >= argc )
1089 {
1090 Abc_Print( -1, "Command line switch \"-S\" should be followed by a positive integer.\n" );
1091 goto usage;
1092 }
1093 pPars->Slew = atoi(argv[globalUtilOptind]);
1095 if ( pPars->Slew < 0 )
1096 goto usage;
1097 break;
1098 case 'N':
1099 if ( globalUtilOptind >= argc )
1100 {
1101 Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
1102 goto usage;
1103 }
1104 pPars->nDegree = atoi(argv[globalUtilOptind]);
1106 if ( pPars->nDegree < 0 )
1107 goto usage;
1108 break;
1109 case 's':
1110 pPars->fSizeOnly ^= 1;
1111 break;
1112 case 'b':
1113 pPars->fAddBufs ^= 1;
1114 break;
1115 case 'p':
1116 pPars->fBufPis ^= 1;
1117 break;
1118 case 'c':
1119 pPars->fUseWireLoads ^= 1;
1120 break;
1121 case 'v':
1122 pPars->fVerbose ^= 1;
1123 break;
1124 case 'w':
1125 pPars->fVeryVerbose ^= 1;
1126 break;
1127 case 'h':
1128 goto usage;
1129 default:
1130 goto usage;
1131 }
1132 }
1133
1134 if ( pNtk == NULL )
1135 {
1136 Abc_Print( -1, "Empty network.\n" );
1137 return 1;
1138 }
1139 if ( !Abc_NtkIsLogic(pNtk) )
1140 {
1141 Abc_Print( -1, "This command can only be applied to a logic network.\n" );
1142 return 1;
1143 }
1144 if ( !pPars->fSizeOnly && !pPars->fAddBufs && pNtk->vPhases == NULL )
1145 {
1146 Abc_Print( -1, "Fanin phase information is not available.\n" );
1147 return 1;
1148 }
1149 if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
1150 {
1151 Abc_Print( -1, "Library delay info is not available.\n" );
1152 return 1;
1153 }
1154 // modify the current network
1155 pNtkRes = Abc_SclBufferingPerform( pNtk, (SC_Lib *)pAbc->pLibScl, pPars );
1156 if ( pNtkRes == NULL )
1157 {
1158 Abc_Print( -1, "The command has failed.\n" );
1159 return 1;
1160 }
1161 // replace the current network
1162 Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
1163 return 0;
1164
1165usage:
1166 fprintf( pAbc->Err, "usage: buffer [-GSN num] [-sbpcvwh]\n" );
1167 fprintf( pAbc->Err, "\t performs buffering and sizing on mapped network\n" );
1168 fprintf( pAbc->Err, "\t-G <num> : target gain percentage [default = %d]\n", pPars->GainRatio );
1169 fprintf( pAbc->Err, "\t-S <num> : target slew in picoseconds [default = %d]\n", pPars->Slew );
1170 fprintf( pAbc->Err, "\t-N <num> : the maximum fanout count [default = %d]\n", pPars->nDegree );
1171 fprintf( pAbc->Err, "\t-s : toggle performing only sizing [default = %s]\n", pPars->fSizeOnly? "yes": "no" );
1172 fprintf( pAbc->Err, "\t-b : toggle using buffers instead of inverters [default = %s]\n", pPars->fAddBufs? "yes": "no" );
1173 fprintf( pAbc->Err, "\t-p : toggle buffering primary inputs [default = %s]\n", pPars->fBufPis? "yes": "no" );
1174 fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" );
1175 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
1176 fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
1177 fprintf( pAbc->Err, "\t-h : print the command usage\n");
1178 return 1;
1179}
1180
1192int Scl_CommandBufferOld( Abc_Frame_t * pAbc, int argc, char ** argv )
1193{
1194 Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1195 Abc_Ntk_t * pNtkRes;
1196 int FanMin, FanMax, FanMaxR, fAddInvs, fUseInvs, fBufPis, fSkipDup;
1197 int c, fVerbose;
1198 int fOldAlgo = 0;
1199 FanMin = 6;
1200 FanMax = 14;
1201 FanMaxR = 0;
1202 fAddInvs = 0;
1203 fUseInvs = 0;
1204 fBufPis = 0;
1205 fSkipDup = 0;
1206 fVerbose = 0;
1208 while ( ( c = Extra_UtilGetopt( argc, argv, "NMRaixpdvh" ) ) != EOF )
1209 {
1210 switch ( c )
1211 {
1212 case 'N':
1213 if ( globalUtilOptind >= argc )
1214 {
1215 Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
1216 goto usage;
1217 }
1218 FanMin = atoi(argv[globalUtilOptind]);
1220 if ( FanMin < 0 )
1221 goto usage;
1222 break;
1223 case 'M':
1224 if ( globalUtilOptind >= argc )
1225 {
1226 Abc_Print( -1, "Command line switch \"-M\" should be followed by a positive integer.\n" );
1227 goto usage;
1228 }
1229 FanMax = atoi(argv[globalUtilOptind]);
1231 if ( FanMax < 0 )
1232 goto usage;
1233 break;
1234 case 'R':
1235 if ( globalUtilOptind >= argc )
1236 {
1237 Abc_Print( -1, "Command line switch \"-R\" should be followed by a positive integer.\n" );
1238 goto usage;
1239 }
1240 FanMaxR = atoi(argv[globalUtilOptind]);
1242 if ( FanMaxR < 0 )
1243 goto usage;
1244 break;
1245 case 'a':
1246 fOldAlgo ^= 1;
1247 break;
1248 case 'i':
1249 fAddInvs ^= 1;
1250 break;
1251 case 'x':
1252 fUseInvs ^= 1;
1253 break;
1254 case 'p':
1255 fBufPis ^= 1;
1256 break;
1257 case 'd':
1258 fSkipDup ^= 1;
1259 break;
1260 case 'v':
1261 fVerbose ^= 1;
1262 break;
1263 case 'h':
1264 goto usage;
1265 default:
1266 goto usage;
1267 }
1268 }
1269
1270 if ( pNtk == NULL )
1271 {
1272 Abc_Print( -1, "Empty network.\n" );
1273 return 1;
1274 }
1275 if ( !Abc_NtkIsLogic(pNtk) )
1276 {
1277 Abc_Print( -1, "This command can only be applied to a logic network.\n" );
1278 return 1;
1279 }
1280 if ( fAddInvs && pNtk->vPhases == NULL )
1281 {
1282 Abc_Print( -1, "Fanin phase information is not available.\n" );
1283 return 1;
1284 }
1285 if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
1286 {
1287 Abc_Print( -1, "Library delay info is not available.\n" );
1288 return 1;
1289 }
1290
1291 // modify the current network
1292 if ( fAddInvs )
1293 pNtkRes = Abc_SclBufferPhase( pNtk, fVerbose );
1294 else if ( fOldAlgo )
1295 pNtkRes = Abc_SclPerformBuffering( pNtk, FanMaxR, FanMax, fUseInvs, fVerbose );
1296 else
1297 pNtkRes = Abc_SclBufPerform( pNtk, FanMin, FanMax, fBufPis, fSkipDup, fVerbose );
1298 if ( pNtkRes == NULL )
1299 {
1300 Abc_Print( -1, "The command has failed.\n" );
1301 return 1;
1302 }
1303 // replace the current network
1304 Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes );
1305 return 0;
1306
1307usage:
1308 fprintf( pAbc->Err, "usage: _buffer [-NMR num] [-aixpdvh]\n" );
1309 fprintf( pAbc->Err, "\t performs buffering of the mapped network\n" );
1310 fprintf( pAbc->Err, "\t-N <num> : the min fanout considered by the algorithm [default = %d]\n", FanMin );
1311 fprintf( pAbc->Err, "\t-M <num> : the max allowed fanout count of node/buffer [default = %d]\n", FanMax );
1312 fprintf( pAbc->Err, "\t-R <num> : the max allowed fanout count of root node [default = %d]\n", FanMaxR );
1313 fprintf( pAbc->Err, "\t-a : toggle using old algorithm [default = %s]\n", fOldAlgo? "yes": "no" );
1314 fprintf( pAbc->Err, "\t-i : toggle adding interters instead of buffering [default = %s]\n", fAddInvs? "yes": "no" );
1315 fprintf( pAbc->Err, "\t-x : toggle using interters instead of buffers [default = %s]\n", fUseInvs? "yes": "no" );
1316 fprintf( pAbc->Err, "\t-p : toggle buffering primary inputs [default = %s]\n", fBufPis? "yes": "no" );
1317 fprintf( pAbc->Err, "\t-d : toggle disabling gate duplication [default = %s]\n", fSkipDup? "yes": "no" );
1318 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1319 fprintf( pAbc->Err, "\t-h : print the command usage\n");
1320 return 1;
1321}
1322
1334int Scl_CommandMinsize( Abc_Frame_t * pAbc, int argc, char **argv )
1335{
1336 Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1337 int c, fVerbose = 0;
1339 while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
1340 {
1341 switch ( c )
1342 {
1343 case 'v':
1344 fVerbose ^= 1;
1345 break;
1346 case 'h':
1347 goto usage;
1348 default:
1349 goto usage;
1350 }
1351 }
1352
1353 if ( Abc_FrameReadNtk(pAbc) == NULL )
1354 {
1355 fprintf( pAbc->Err, "There is no current network.\n" );
1356 return 1;
1357 }
1358 if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
1359 {
1360 fprintf( pAbc->Err, "The current network is not mapped.\n" );
1361 return 1;
1362 }
1363 if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
1364 {
1365 fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
1366 return 1;
1367 }
1368 if ( pAbc->pLibScl == NULL )
1369 {
1370 fprintf( pAbc->Err, "There is no Liberty library available.\n" );
1371 return 1;
1372 }
1373
1374 Abc_SclMinsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, 0, fVerbose );
1375 return 0;
1376
1377usage:
1378 fprintf( pAbc->Err, "usage: minsize [-vh]\n" );
1379 fprintf( pAbc->Err, "\t downsizes all gates to their minimum size\n" );
1380 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1381 fprintf( pAbc->Err, "\t-h : print the command usage\n");
1382 return 1;
1383}
1384
1396int Scl_CommandMaxsize( Abc_Frame_t * pAbc, int argc, char **argv )
1397{
1398 Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1399 int c, fVerbose = 0;
1401 while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
1402 {
1403 switch ( c )
1404 {
1405 case 'v':
1406 fVerbose ^= 1;
1407 break;
1408 case 'h':
1409 goto usage;
1410 default:
1411 goto usage;
1412 }
1413 }
1414
1415 if ( Abc_FrameReadNtk(pAbc) == NULL )
1416 {
1417 fprintf( pAbc->Err, "There is no current network.\n" );
1418 return 1;
1419 }
1420 if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
1421 {
1422 fprintf( pAbc->Err, "The current network is not mapped.\n" );
1423 return 1;
1424 }
1425 if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
1426 {
1427 fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
1428 return 1;
1429 }
1430 if ( pAbc->pLibScl == NULL )
1431 {
1432 fprintf( pAbc->Err, "There is no Liberty library available.\n" );
1433 return 1;
1434 }
1435
1436 Abc_SclMinsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, 1, fVerbose );
1437 return 0;
1438
1439usage:
1440 fprintf( pAbc->Err, "usage: maxsize [-vh]\n" );
1441 fprintf( pAbc->Err, "\t upsizes all gates to their maximum size\n" );
1442 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1443 fprintf( pAbc->Err, "\t-h : print the command usage\n");
1444 return 1;
1445}
1446
1458int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
1459{
1460 SC_SizePars Pars, * pPars = &Pars;
1461 Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1462 int c;
1463 memset( pPars, 0, sizeof(SC_SizePars) );
1464 pPars->nIters = 1000;
1465 pPars->nIterNoChange = 50;
1466 pPars->Window = 1;
1467 pPars->Ratio = 10;
1468 pPars->Notches = 1000;
1469 pPars->DelayUser = 0;
1470 pPars->DelayGap = 0;
1471 pPars->TimeOut = 0;
1472 pPars->BuffTreeEst = 0;
1473 pPars->BypassFreq = 0;
1474 pPars->fUseDept = 1;
1475 pPars->fUseWireLoads = 0;
1476 pPars->fDumpStats = 0;
1477 pPars->fVerbose = 0;
1478 pPars->fVeryVerbose = 0;
1480 while ( ( c = Extra_UtilGetopt( argc, argv, "IJWRNDGTXBcsdvwh" ) ) != EOF )
1481 {
1482 switch ( c )
1483 {
1484 case 'I':
1485 if ( globalUtilOptind >= argc )
1486 {
1487 Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" );
1488 goto usage;
1489 }
1490 pPars->nIters = atoi(argv[globalUtilOptind]);
1492 if ( pPars->nIters < 0 )
1493 goto usage;
1494 break;
1495 case 'J':
1496 if ( globalUtilOptind >= argc )
1497 {
1498 Abc_Print( -1, "Command line switch \"-J\" should be followed by a positive integer.\n" );
1499 goto usage;
1500 }
1501 pPars->nIterNoChange = atoi(argv[globalUtilOptind]);
1503 if ( pPars->nIterNoChange < 0 )
1504 goto usage;
1505 break;
1506 case 'W':
1507 if ( globalUtilOptind >= argc )
1508 {
1509 Abc_Print( -1, "Command line switch \"-W\" should be followed by a positive integer.\n" );
1510 goto usage;
1511 }
1512 pPars->Window = atoi(argv[globalUtilOptind]);
1514 if ( pPars->Window < 0 )
1515 goto usage;
1516 break;
1517 case 'R':
1518 if ( globalUtilOptind >= argc )
1519 {
1520 Abc_Print( -1, "Command line switch \"-R\" should be followed by a positive integer.\n" );
1521 goto usage;
1522 }
1523 pPars->Ratio = atoi(argv[globalUtilOptind]);
1525 if ( pPars->Ratio < 0 )
1526 goto usage;
1527 break;
1528 case 'N':
1529 if ( globalUtilOptind >= argc )
1530 {
1531 Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
1532 goto usage;
1533 }
1534 pPars->Notches = atoi(argv[globalUtilOptind]);
1536 if ( pPars->Notches < 0 )
1537 goto usage;
1538 break;
1539 case 'D':
1540 if ( globalUtilOptind >= argc )
1541 {
1542 Abc_Print( -1, "Command line switch \"-D\" should be followed by a positive integer.\n" );
1543 goto usage;
1544 }
1545 pPars->DelayUser = atoi(argv[globalUtilOptind]);
1547 if ( pPars->DelayUser < 0 )
1548 goto usage;
1549 break;
1550 case 'G':
1551 if ( globalUtilOptind >= argc )
1552 {
1553 Abc_Print( -1, "Command line switch \"-G\" should be followed by a positive integer.\n" );
1554 goto usage;
1555 }
1556 pPars->DelayGap = atoi(argv[globalUtilOptind]);
1558 break;
1559 case 'T':
1560 if ( globalUtilOptind >= argc )
1561 {
1562 Abc_Print( -1, "Command line switch \"-T\" should be followed by a positive integer.\n" );
1563 goto usage;
1564 }
1565 pPars->TimeOut = atoi(argv[globalUtilOptind]);
1567 if ( pPars->TimeOut < 0 )
1568 goto usage;
1569 break;
1570 case 'X':
1571 if ( globalUtilOptind >= argc )
1572 {
1573 Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" );
1574 goto usage;
1575 }
1576 pPars->BuffTreeEst = atoi(argv[globalUtilOptind]);
1578 if ( pPars->BuffTreeEst < 0 )
1579 goto usage;
1580 break;
1581 case 'B':
1582 if ( globalUtilOptind >= argc )
1583 {
1584 Abc_Print( -1, "Command line switch \"-B\" should be followed by a positive integer.\n" );
1585 goto usage;
1586 }
1587 pPars->BypassFreq = atoi(argv[globalUtilOptind]);
1589 if ( pPars->BypassFreq < 0 )
1590 goto usage;
1591 break;
1592 case 'c':
1593 pPars->fUseWireLoads ^= 1;
1594 break;
1595 case 's':
1596 pPars->fUseDept ^= 1;
1597 break;
1598 case 'd':
1599 pPars->fDumpStats ^= 1;
1600 break;
1601 case 'v':
1602 pPars->fVerbose ^= 1;
1603 break;
1604 case 'w':
1605 pPars->fVeryVerbose ^= 1;
1606 break;
1607 case 'h':
1608 goto usage;
1609 default:
1610 goto usage;
1611 }
1612 }
1613
1614 if ( Abc_FrameReadNtk(pAbc) == NULL )
1615 {
1616 fprintf( pAbc->Err, "There is no current network.\n" );
1617 return 1;
1618 }
1619 if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
1620 {
1621 fprintf( pAbc->Err, "The current network is not mapped.\n" );
1622 return 1;
1623 }
1624 if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
1625 {
1626 fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
1627 return 1;
1628 }
1629 if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
1630 {
1631 Abc_Print( -1, "Library delay info is not available.\n" );
1632 return 1;
1633 }
1634
1635 Abc_SclUpsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, pPars, NULL );
1636 return 0;
1637
1638usage:
1639 fprintf( pAbc->Err, "usage: upsize [-IJWRNDGTXB num] [-csdvwh]\n" );
1640 fprintf( pAbc->Err, "\t selectively increases gate sizes on the critical path\n" );
1641 fprintf( pAbc->Err, "\t-I <num> : the number of upsizing iterations to perform [default = %d]\n", pPars->nIters );
1642 fprintf( pAbc->Err, "\t-J <num> : the number of iterations without improvement to stop [default = %d]\n", pPars->nIterNoChange );
1643 fprintf( pAbc->Err, "\t-W <num> : delay window (in percent) of near-critical COs [default = %d]\n", pPars->Window );
1644 fprintf( pAbc->Err, "\t-R <num> : ratio of critical nodes (in percent) to update [default = %d]\n", pPars->Ratio );
1645 fprintf( pAbc->Err, "\t-N <num> : limit on discrete upsizing steps at a node [default = %d]\n", pPars->Notches );
1646 fprintf( pAbc->Err, "\t-D <num> : delay target set by the user, in picoseconds [default = %d]\n", pPars->DelayUser );
1647 fprintf( pAbc->Err, "\t-G <num> : delay gap during updating, in picoseconds [default = %d]\n", pPars->DelayGap );
1648 fprintf( pAbc->Err, "\t-T <num> : approximate timeout in seconds [default = %d]\n", pPars->TimeOut );
1649 fprintf( pAbc->Err, "\t-X <num> : ratio for buffer tree estimation [default = %d]\n", pPars->BuffTreeEst );
1650 fprintf( pAbc->Err, "\t-B <num> : frequency of bypass transforms [default = %d]\n", pPars->BypassFreq );
1651 fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" );
1652 fprintf( pAbc->Err, "\t-s : toggle using slack based on departure times [default = %s]\n", pPars->fUseDept? "yes": "no" );
1653 fprintf( pAbc->Err, "\t-d : toggle dumping statistics into a file [default = %s]\n", pPars->fDumpStats? "yes": "no" );
1654 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
1655 fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
1656 fprintf( pAbc->Err, "\t-h : print the command usage\n");
1657 return 1;
1658}
1659
1671int Scl_CommandDnsize( Abc_Frame_t * pAbc, int argc, char **argv )
1672{
1673 SC_SizePars Pars, * pPars = &Pars;
1674 Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1675 int c;
1676 memset( pPars, 0, sizeof(SC_SizePars) );
1677 pPars->nIters = 5;
1678 pPars->nIterNoChange = 50;
1679 pPars->Notches = 1000;
1680 pPars->DelayUser = 0;
1681 pPars->DelayGap = 1000;
1682 pPars->TimeOut = 0;
1683 pPars->BuffTreeEst = 0;
1684 pPars->fUseDept = 1;
1685 pPars->fUseWireLoads = 0;
1686 pPars->fDumpStats = 0;
1687 pPars->fVerbose = 0;
1688 pPars->fVeryVerbose = 0;
1690 while ( ( c = Extra_UtilGetopt( argc, argv, "IJNDGTXcsdvwh" ) ) != EOF )
1691 {
1692 switch ( c )
1693 {
1694 case 'I':
1695 if ( globalUtilOptind >= argc )
1696 {
1697 Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" );
1698 goto usage;
1699 }
1700 pPars->nIters = atoi(argv[globalUtilOptind]);
1702 if ( pPars->nIters < 0 )
1703 goto usage;
1704 break;
1705 case 'J':
1706 if ( globalUtilOptind >= argc )
1707 {
1708 Abc_Print( -1, "Command line switch \"-J\" should be followed by a positive integer.\n" );
1709 goto usage;
1710 }
1711 pPars->nIterNoChange = atoi(argv[globalUtilOptind]);
1713 if ( pPars->nIterNoChange < 0 )
1714 goto usage;
1715 break;
1716 case 'N':
1717 if ( globalUtilOptind >= argc )
1718 {
1719 Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" );
1720 goto usage;
1721 }
1722 pPars->Notches = atoi(argv[globalUtilOptind]);
1724 if ( pPars->Notches < 0 )
1725 goto usage;
1726 break;
1727 case 'D':
1728 if ( globalUtilOptind >= argc )
1729 {
1730 Abc_Print( -1, "Command line switch \"-D\" should be followed by a positive integer.\n" );
1731 goto usage;
1732 }
1733 pPars->DelayUser = atoi(argv[globalUtilOptind]);
1735 if ( pPars->DelayUser < 0 )
1736 goto usage;
1737 break;
1738 case 'G':
1739 if ( globalUtilOptind >= argc )
1740 {
1741 Abc_Print( -1, "Command line switch \"-G\" should be followed by a positive integer.\n" );
1742 goto usage;
1743 }
1744 pPars->DelayGap = atoi(argv[globalUtilOptind]);
1746 break;
1747 case 'T':
1748 if ( globalUtilOptind >= argc )
1749 {
1750 Abc_Print( -1, "Command line switch \"-T\" should be followed by a positive integer.\n" );
1751 goto usage;
1752 }
1753 pPars->TimeOut = atoi(argv[globalUtilOptind]);
1755 if ( pPars->TimeOut < 0 )
1756 goto usage;
1757 break;
1758 case 'X':
1759 if ( globalUtilOptind >= argc )
1760 {
1761 Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" );
1762 goto usage;
1763 }
1764 pPars->BuffTreeEst = atoi(argv[globalUtilOptind]);
1766 if ( pPars->BuffTreeEst < 0 )
1767 goto usage;
1768 break;
1769 case 'c':
1770 pPars->fUseWireLoads ^= 1;
1771 break;
1772 case 's':
1773 pPars->fUseDept ^= 1;
1774 break;
1775 case 'd':
1776 pPars->fDumpStats ^= 1;
1777 break;
1778 case 'v':
1779 pPars->fVerbose ^= 1;
1780 break;
1781 case 'w':
1782 pPars->fVeryVerbose ^= 1;
1783 break;
1784 case 'h':
1785 goto usage;
1786 default:
1787 goto usage;
1788 }
1789 }
1790
1791 if ( Abc_FrameReadNtk(pAbc) == NULL )
1792 {
1793 fprintf( pAbc->Err, "There is no current network.\n" );
1794 return 1;
1795 }
1796 if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
1797 {
1798 fprintf( pAbc->Err, "The current network is not mapped.\n" );
1799 return 1;
1800 }
1801 if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
1802 {
1803 fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
1804 return 1;
1805 }
1806 if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
1807 {
1808 Abc_Print( -1, "Library delay info is not available.\n" );
1809 return 1;
1810 }
1811
1812 Abc_SclDnsizePerform( (SC_Lib *)pAbc->pLibScl, pNtk, pPars, NULL );
1813 return 0;
1814
1815usage:
1816 fprintf( pAbc->Err, "usage: dnsize [-IJNDGTX num] [-csdvwh]\n" );
1817 fprintf( pAbc->Err, "\t selectively decreases gate sizes while maintaining delay\n" );
1818 fprintf( pAbc->Err, "\t-I <num> : the number of downsizing iterations to perform [default = %d]\n", pPars->nIters );
1819 fprintf( pAbc->Err, "\t-J <num> : the number of iterations without improvement to stop [default = %d]\n", pPars->nIterNoChange );
1820 fprintf( pAbc->Err, "\t-N <num> : limit on discrete downsizing steps at a node [default = %d]\n", pPars->Notches );
1821 fprintf( pAbc->Err, "\t-D <num> : delay target set by the user, in picoseconds [default = %d]\n", pPars->DelayUser );
1822 fprintf( pAbc->Err, "\t-G <num> : delay gap during updating, in picoseconds [default = %d]\n", pPars->DelayGap );
1823 fprintf( pAbc->Err, "\t-T <num> : approximate timeout in seconds [default = %d]\n", pPars->TimeOut );
1824 fprintf( pAbc->Err, "\t-X <num> : ratio for buffer tree estimation [default = %d]\n", pPars->BuffTreeEst );
1825 fprintf( pAbc->Err, "\t-c : toggle using wire-loads if specified [default = %s]\n", pPars->fUseWireLoads? "yes": "no" );
1826 fprintf( pAbc->Err, "\t-s : toggle using slack based on departure times [default = %s]\n", pPars->fUseDept? "yes": "no" );
1827 fprintf( pAbc->Err, "\t-d : toggle dumping statistics into a file [default = %s]\n", pPars->fDumpStats? "yes": "no" );
1828 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" );
1829 fprintf( pAbc->Err, "\t-w : toggle printing more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" );
1830 fprintf( pAbc->Err, "\t-h : print the command usage\n");
1831 return 1;
1832}
1833
1845int Scl_CommandPrintBuf( Abc_Frame_t * pAbc, int argc, char **argv )
1846{
1847 Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1848 int c, fVerbose = 0;
1850 while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
1851 {
1852 switch ( c )
1853 {
1854 case 'v':
1855 fVerbose ^= 1;
1856 break;
1857 case 'h':
1858 goto usage;
1859 default:
1860 goto usage;
1861 }
1862 }
1863
1864 if ( Abc_FrameReadNtk(pAbc) == NULL )
1865 {
1866 fprintf( pAbc->Err, "There is no current network.\n" );
1867 return 1;
1868 }
1869 if ( !Abc_NtkHasMapping(Abc_FrameReadNtk(pAbc)) )
1870 {
1871 fprintf( pAbc->Err, "The current network is not mapped.\n" );
1872 return 1;
1873 }
1874 if ( !Abc_SclCheckNtk(Abc_FrameReadNtk(pAbc), 0) )
1875 {
1876 fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
1877 return 1;
1878 }
1879 if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
1880 {
1881 Abc_Print( -1, "Library delay info is not available.\n" );
1882 return 1;
1883 }
1884
1885 Abc_SclPrintBuffers( (SC_Lib *)pAbc->pLibScl, pNtk, fVerbose );
1886 return 0;
1887
1888usage:
1889 fprintf( pAbc->Err, "usage: print_buf [-vh]\n" );
1890 fprintf( pAbc->Err, "\t prints buffers trees of the current design\n" );
1891 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1892 fprintf( pAbc->Err, "\t-h : print the command usage\n");
1893 return 1;
1894}
1895
1907int Scl_CommandReadConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
1908{
1909 extern Abc_Nam_t * Abc_NtkNameMan( Abc_Ntk_t * p, int fOuts );
1910 extern void Abc_SclReadTimingConstr( Abc_Frame_t * pAbc, char * pFileName, int fVerbose );
1911 Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
1912 FILE * pFile;
1913 char * pFileName;
1914 int fUseNewFormat = 0;
1915 int c, fVerbose = 0;
1916
1918 while ( ( c = Extra_UtilGetopt( argc, argv, "nvh" ) ) != EOF )
1919 {
1920 switch ( c )
1921 {
1922 case 'n':
1923 fVerbose ^= 1;
1924 break;
1925 case 'v':
1926 fVerbose ^= 1;
1927 break;
1928 case 'h':
1929 goto usage;
1930 default:
1931 goto usage;
1932 }
1933 }
1934 if ( argc != globalUtilOptind + 1 )
1935 goto usage;
1936
1937 // get the input file name
1938 pFileName = argv[globalUtilOptind];
1939 if ( (pFile = fopen( pFileName, "rb" )) == NULL )
1940 {
1941 fprintf( pAbc->Err, "Cannot open input file \"%s\". \n", pFileName );
1942 return 1;
1943 }
1944 fclose( pFile );
1945
1946 if ( !fUseNewFormat )
1947 Abc_SclReadTimingConstr( pAbc, pFileName, fVerbose );
1948 else
1949 {
1950 if ( pNtk == NULL )
1951 {
1952 fprintf( pAbc->Err, "There is no current network.\n" );
1953 return 1;
1954 }
1955 // input constraint manager
1956 if ( pNtk )
1957 {
1958 Scl_Con_t * pCon = Scl_ConRead( pFileName, Abc_NtkNameMan(pNtk, 0), Abc_NtkNameMan(pNtk, 1) );
1959 if ( pCon ) Scl_ConUpdateMan( pAbc, pCon );
1960 }
1961 }
1962 return 0;
1963
1964usage:
1965 fprintf( pAbc->Err, "usage: read_constr [-nvh] <file>\n" );
1966 fprintf( pAbc->Err, "\t read file with timing constraints for standard-cell designs\n" );
1967 fprintf( pAbc->Err, "\t-n : toggle using new constraint file format [default = %s]\n", fUseNewFormat? "yes": "no" );
1968 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
1969 fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
1970 fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
1971 return 1;
1972}
1973
1985int Scl_CommandWriteConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
1986{
1987 Scl_Con_t * pCon = Scl_ConGetMan( pAbc );
1988 char * pFileName = NULL;
1989 int c, fVerbose = 0;
1991 while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
1992 {
1993 switch ( c )
1994 {
1995 case 'v':
1996 fVerbose ^= 1;
1997 break;
1998 case 'h':
1999 goto usage;
2000 default:
2001 goto usage;
2002 }
2003 }
2004 if ( pCon == NULL )
2005 {
2006 Abc_Print( 1, "Scl_CommandWriteConstr(): There is no constraint manager.\n" );
2007 return 0;
2008 }
2009 if ( argc == globalUtilOptind + 1 )
2010 pFileName = argv[globalUtilOptind];
2011 else if ( argc == globalUtilOptind && pCon )
2012 pFileName = Extra_FileNameGenericAppend( pCon->pFileName, "_out.constr" );
2013 else
2014 {
2015 printf( "Output file name should be given on the command line.\n" );
2016 return 0;
2017 }
2018 // perform writing
2019 if ( !strcmp( Extra_FileNameExtension(pFileName), "constr" ) )
2020 Scl_ConWrite( pCon, pFileName );
2021 else
2022 {
2023 printf( "Scl_CommandWriteConstr(): Unrecognized output file extension.\n" );
2024 return 0;
2025 }
2026 return 0;
2027
2028usage:
2029 fprintf( pAbc->Err, "usage: write_constr [-vh] <file>\n" );
2030 fprintf( pAbc->Err, "\t writes current timing constraints into a file\n" );
2031 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
2032 fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
2033 fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
2034 return 1;
2035}
2036
2048int Scl_CommandPrintConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
2049{
2050 Scl_Con_t * pCon = Scl_ConGetMan( pAbc );
2051 int c, fVerbose = 0;
2053 while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
2054 {
2055 switch ( c )
2056 {
2057 case 'v':
2058 fVerbose ^= 1;
2059 break;
2060 case 'h':
2061 goto usage;
2062 default:
2063 goto usage;
2064 }
2065 }
2066 //printf( "Primary input driving cell = %s\n", Abc_FrameReadDrivingCell() );
2067 //printf( "Primary output maximum load = %f\n", Abc_FrameReadMaxLoad() );
2068
2069 if ( pCon ) Scl_ConWrite( pCon, NULL );
2070 return 0;
2071
2072usage:
2073 fprintf( pAbc->Err, "usage: print_constr [-vh] <file>\n" );
2074 fprintf( pAbc->Err, "\t prints current timing constraints\n" );
2075 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
2076 fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
2077 fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
2078 return 1;
2079}
2080
2092int Scl_CommandResetConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
2093{
2094 int c, fVerbose = 0;
2096 while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
2097 {
2098 switch ( c )
2099 {
2100 case 'v':
2101 fVerbose ^= 1;
2102 break;
2103 case 'h':
2104 goto usage;
2105 default:
2106 goto usage;
2107 }
2108 }
2111
2112 Scl_ConUpdateMan( pAbc, NULL );
2113 return 0;
2114
2115usage:
2116 fprintf( pAbc->Err, "usage: reset_constr [-vh] <file>\n" );
2117 fprintf( pAbc->Err, "\t removes current timing constraints\n" );
2118 fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
2119 fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
2120 fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
2121 return 1;
2122}
2123
2127
2128
2130
Abc_Nam_t * Abc_NtkNameMan(Abc_Ntk_t *p, int fOuts)
Definition abcNames.c:373
ABC_DLL Abc_Ntk_t * Abc_NtkDupDfs(Abc_Ntk_t *pNtk)
Definition abcNtk.c:538
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
#define ABC_FREE(obj)
Definition abc_global.h:267
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
Definition abcapis.h:38
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
Definition mainFrame.c:643
ABC_DLL Abc_Ntk_t * Abc_FrameReadNtk(Abc_Frame_t *p)
Definition mainFrame.c:327
ABC_DLL void Abc_FrameSetDrivingCell(char *pName)
Definition mainFrame.c:118
ABC_DLL void Abc_FrameSetMaxLoad(float Load)
Definition mainFrame.c:119
ABC_DLL void Abc_FrameReplaceCurrentNetwork(Abc_Frame_t *p, Abc_Ntk_t *pNet)
Definition mainFrame.c:538
void Cmd_CommandAdd(Abc_Frame_t *pAbc, const char *sGroup, const char *sName, Cmd_CommandFuncType pFunc, int fChanges)
Definition cmdApi.c:63
Cube * p
Definition exorList.c:222
int globalUtilOptind
int Extra_UtilGetopt(int argc, char *argv[], const char *optstring)
ABC_DLL void Extra_UtilGetoptReset()
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
char * Extra_FileNameExtension(char *FileName)
void Mio_LibraryTransferCellIds()
Definition mioUtils.c:1484
usage()
Definition main.c:626
Abc_Ntk_t * Abc_SclBufferingPerform(Abc_Ntk_t *pNtk, SC_Lib *pLib, SC_BusPars *pPars)
Definition sclBufSize.c:491
Abc_Ntk_t * Abc_SclUnBufferPerform(Abc_Ntk_t *pNtk, int fVerbose)
Definition sclBuffer.c:129
Abc_Ntk_t * Abc_SclBufPerform(Abc_Ntk_t *pNtk, int FanMin, int FanMax, int fBufPis, int fSkipDup, int fVerbose)
Definition sclBuffer.c:986
Abc_Ntk_t * Abc_SclUnBufferPhase(Abc_Ntk_t *pNtk, int fVerbose)
Definition sclBuffer.c:239
int Abc_SclCheckNtk(Abc_Ntk_t *p, int fVerbose)
Definition sclBuffer.c:286
Abc_Ntk_t * Abc_SclBufferPhase(Abc_Ntk_t *pNtk, int fVerbose)
Definition sclBuffer.c:198
Abc_Ntk_t * Abc_SclPerformBuffering(Abc_Ntk_t *p, int DegreeR, int Degree, int fUseInvs, int fVerbose)
Definition sclBuffer.c:459
typedefABC_NAMESPACE_HEADER_START struct Scl_Con_t_ Scl_Con_t
DECLARATIONS ///.
Definition sclCon.h:30
void Abc_SclDnsizePerform(SC_Lib *pLib, Abc_Ntk_t *pNtk, SC_SizePars *pPars, void *pFuncFanin)
Definition sclDnsize.c:361
void Abc_SclWriteScl(char *pFileName, SC_Lib *p)
Definition sclLibScl.c:629
struct SC_SizePars_ SC_SizePars
Definition sclLib.h:82
#define SC_LibForEachCell(p, pCell, i)
Definition sclLib.h:269
int Abc_SclLibClassNum(SC_Lib *pLib)
Definition sclLibUtil.c:95
struct SC_DontUse_ SC_DontUse
Definition sclLib.h:62
struct SC_Lib_ SC_Lib
Definition sclLib.h:128
SC_Lib * Abc_SclMergeLibraries(SC_Lib *pLib1, SC_Lib *pLib2, int fUsePrefix)
Definition sclLibScl.c:869
struct SC_BusPars_ SC_BusPars
Definition sclLib.h:102
void Abc_SclWriteLiberty(char *pFileName, SC_Lib *p)
Definition sclLibScl.c:845
void Abc_SclShortNames(SC_Lib *p)
Definition sclLibUtil.c:195
void Abc_SclConvertLeakageIntoArea(SC_Lib *p, float A, float B)
Definition sclLibUtil.c:719
SC_Lib * Abc_SclReadFromFile(char *pFileName)
Definition sclLibScl.c:417
void Abc_SclPrintCells(SC_Lib *p, float Slew, float Gain, int fInvOnly, int fShort)
Definition sclLibUtil.c:638
struct SC_Cell_ SC_Cell
Definition sclLib.h:127
float Abc_SclComputeAverageSlew(SC_Lib *p)
Definition sclLibUtil.c:452
void Abc_SclInstallGenlib(void *pScl, float Slew, float Gain, int fUseAll, int nGatesMin)
int Abc_SclHasDelayInfo(void *pScl)
Definition sclLibUtil.c:427
void Abc_SclDumpGenlib(char *pFileName, SC_Lib *p, float Slew, float Gain, int nGatesMin)
SC_Lib * Abc_SclReadLiberty(char *pFileName, int fVerbose, int fVeryVerbose, SC_DontUse dont_use, int fSkipMultiOuts)
void Abc_SclPrintBuffers(SC_Lib *pLib, Abc_Ntk_t *pNtk, int fVerbose)
Definition sclSize.c:912
void Abc_SclTimePerform(SC_Lib *pLib, Abc_Ntk_t *pNtk, int nTreeCRatio, int fUseWireLoads, int fShowAll, int fPrintPath, int fDumpStats)
Definition sclSize.c:707
void Abc_SclUpsizePerform(SC_Lib *pLib, Abc_Ntk_t *pNtk, SC_SizePars *pPars, void *pFuncFanin)
Definition sclUpsize.c:1028
void Abc_SclPrintGateSizes(SC_Lib *pLib, Abc_Ntk_t *p)
Definition sclUtil.c:156
void Abc_SclMinsizePerform(SC_Lib *pLib, Abc_Ntk_t *p, int fUseMax, int fVerbose)
Definition sclUtil.c:204
void Abc_SclReadTimingConstr(Abc_Frame_t *pAbc, char *pFileName, int fVerbose)
Definition sclUtil.c:248
void Scl_Init(Abc_Frame_t *pAbc)
Definition scl.c:102
Scl_Con_t * Scl_ConReadMan()
Definition scl.c:62
void Abc_SclLoad(SC_Lib *pLib, SC_Lib **ppScl)
FUNCTION DEFINITIONS ///.
Definition scl.c:79
SC_Lib * Scl_ReadLibraryFile(Abc_Frame_t *pAbc, char *pFileName, int fVerbose, int fVeryVerbose, SC_DontUse dont_use, int fSkipMultiOuts)
Definition scl.c:144
void Scl_End(Abc_Frame_t *pAbc)
Definition scl.c:127
Vec_Int_t * vPhases
Definition abc.h:208
int fBufPis
Definition sclLib.h:110
int fUseWireLoads
Definition sclLib.h:111
int nDegree
Definition sclLib.h:107
int fVeryVerbose
Definition sclLib.h:113
int fVerbose
Definition sclLib.h:112
int fAddBufs
Definition sclLib.h:109
int fSizeOnly
Definition sclLib.h:108
int GainRatio
Definition sclLib.h:105
float area
Definition sclLib.h:207
int size
Definition sclLib.h:65
char ** dont_use_list
Definition sclLib.h:66
int BypassFreq
Definition sclLib.h:94
int DelayUser
Definition sclLib.h:90
int fDumpStats
Definition sclLib.h:96
int Notches
Definition sclLib.h:89
int nIterNoChange
Definition sclLib.h:86
int fUseDept
Definition sclLib.h:95
int nIters
Definition sclLib.h:85
int fVerbose
Definition sclLib.h:98
int fVeryVerbose
Definition sclLib.h:99
int DelayGap
Definition sclLib.h:91
int BuffTreeEst
Definition sclLib.h:93
int Ratio
Definition sclLib.h:88
int Window
Definition sclLib.h:87
int TimeOut
Definition sclLib.h:92
int fUseWireLoads
Definition sclLib.h:97
typedefABC_NAMESPACE_HEADER_START struct Abc_Nam_t_ Abc_Nam_t
INCLUDES ///.
Definition utilNam.h:39
#define assert(ex)
Definition util_old.h:213
char * memset()
int strcmp()
double atof()