@@ -32,6 +32,8 @@ static int If_CommandReadLut ( Abc_Frame_t * pAbc, int argc, char **argv );
3232static int If_CommandPrintLut ( Abc_Frame_t * pAbc , int argc , char * * argv );
3333static int If_CommandReadBox ( Abc_Frame_t * pAbc , int argc , char * * argv );
3434static int If_CommandPrintBox ( Abc_Frame_t * pAbc , int argc , char * * argv );
35+ static int If_CommandWriteBox ( Abc_Frame_t * pAbc , int argc , char * * argv );
36+ static int If_CommandPrintTim ( Abc_Frame_t * pAbc , int argc , char * * argv );
3537
3638////////////////////////////////////////////////////////////////////////
3739/// FUNCTION DEFINITIONS ///
@@ -59,6 +61,8 @@ void If_Init( Abc_Frame_t * pAbc )
5961
6062 Cmd_CommandAdd ( pAbc , "FPGA mapping" , "read_box" , If_CommandReadBox , 0 );
6163 Cmd_CommandAdd ( pAbc , "FPGA mapping" , "print_box" , If_CommandPrintBox , 0 );
64+ Cmd_CommandAdd ( pAbc , "FPGA mapping" , "write_box" , If_CommandWriteBox , 0 );
65+ Cmd_CommandAdd ( pAbc , "FPGA mapping" , "print_tim" , If_CommandPrintTim , 0 );
6266}
6367
6468/**Function*************************************************************
@@ -362,6 +366,113 @@ int If_CommandPrintBox( Abc_Frame_t * pAbc, int argc, char **argv )
362366 return 1 ; /* error exit */
363367}
364368
369+ /**Function*************************************************************
370+
371+ Synopsis [Command procedure to read LUT libraries.]
372+
373+ Description []
374+
375+ SideEffects []
376+
377+ SeeAlso []
378+
379+ ***********************************************************************/
380+ int If_CommandWriteBox ( Abc_Frame_t * pAbc , int argc , char * * argv )
381+ {
382+ FILE * pOut , * pErr ;
383+ Abc_Ntk_t * pNet ;
384+ int fVerbose ;
385+ int c ;
386+
387+ pNet = Abc_FrameReadNtk (pAbc );
388+ pOut = Abc_FrameReadOut (pAbc );
389+ pErr = Abc_FrameReadErr (pAbc );
390+
391+ fVerbose = 1 ;
392+ Extra_UtilGetoptReset ();
393+ while ( (c = Extra_UtilGetopt (argc , argv , "vh" )) != EOF )
394+ {
395+ switch (c )
396+ {
397+ case 'v' :
398+ fVerbose ^= 1 ;
399+ break ;
400+ case 'h' :
401+ goto usage ;
402+ break ;
403+ default :
404+ goto usage ;
405+ }
406+ }
407+
408+ if ( argc != globalUtilOptind + 1 )
409+ goto usage ;
410+
411+ If_LibBoxWrite ( argv [globalUtilOptind ], (If_LibBox_t * )Abc_FrameReadLibBox () );
412+ return 0 ;
413+
414+ usage :
415+ fprintf ( pErr , "\nusage: write_box [-vh] <file>\n" );
416+ fprintf ( pErr , "\t write the current box library into a file\n" );
417+ fprintf ( pErr , "\t-v : toggles enabling of verbose output [default = %s]\n" , (fVerbose ? "yes" : "no" ) );
418+ fprintf ( pErr , "\t-h : print the command usage\n" );
419+ fprintf ( pErr , "\t<file> : the output file name\n" );
420+ return 1 ; /* error exit */
421+ }
422+
423+
424+ /**Function*************************************************************
425+
426+ Synopsis [Command procedure to read LUT libraries.]
427+
428+ Description []
429+
430+ SideEffects []
431+
432+ SeeAlso []
433+
434+ ***********************************************************************/
435+ int If_CommandPrintTim ( Abc_Frame_t * pAbc , int argc , char * * argv )
436+ {
437+ Gia_Man_t * pGia = Abc_FrameReadGia (pAbc );
438+ int c , fVerbose = 0 ;
439+ Extra_UtilGetoptReset ();
440+ while ( (c = Extra_UtilGetopt (argc , argv , "vh" )) != EOF )
441+ {
442+ switch (c )
443+ {
444+ case 'v' :
445+ fVerbose ^= 1 ;
446+ break ;
447+ case 'h' :
448+ goto usage ;
449+ break ;
450+ default :
451+ goto usage ;
452+ }
453+ }
454+ if ( pGia == NULL )
455+ {
456+ Abc_Print ( -1 , "There is no AIG in the &-space.\n" );
457+ return 1 ;
458+ }
459+ if ( pGia -> pManTime == NULL )
460+ {
461+ Abc_Print ( -1 , "The current AIG does not have a timing manager.\n" );
462+ return 1 ;
463+ }
464+ Tim_ManPrint ( (Tim_Man_t * )pGia -> pManTime );
465+ if ( fVerbose )
466+ Tim_ManPrintBoxCopy ( (Tim_Man_t * )pGia -> pManTime );
467+ return 0 ;
468+
469+ usage :
470+ Abc_Print ( -2 , "\nusage: print_tim [-vh]\n" );
471+ Abc_Print ( -2 , "\t print the timing manager\n" );
472+ Abc_Print ( -2 , "\t-v : toggles enabling of verbose output [default = %s]\n" , (fVerbose ? "yes" : "no" ) );
473+ Abc_Print ( -2 , "\t-h : print the command usage\n" );
474+ return 1 ; /* error exit */
475+ }
365476
366477////////////////////////////////////////////////////////////////////////
367478/// END OF FILE ///
0 commit comments