diff options
Diffstat (limited to 'src/base/abci/abc.c')
-rw-r--r-- | src/base/abci/abc.c | 10887 |
1 files changed, 6266 insertions, 4621 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index f7caad5d..c9623cf6 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -1,6 +1,6 @@ /**CFile**************************************************************** - FileName [abc.c] + FileName [abc.c] SystemName [ABC: Logic synthesis and verification system.] @@ -9,7 +9,7 @@ Synopsis [Command file.] Author [Alan Mishchenko] - + Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] @@ -17,14 +17,16 @@ Revision [$Id: abc.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] ***********************************************************************/ - + #include "abc.h" +#include "main.h" #include "mainInt.h" #include "fraig.h" #include "fxu.h" #include "cut.h" #include "fpga.h" #include "if.h" +#include "sim.h" #include "res.h" #include "lpk.h" #include "giaAig.h" @@ -38,10 +40,32 @@ #include "dch.h" #include "ssw.h" #include "cgt.h" +#include "kit.h" #include "amap.h" +#include "retInt.h" +#include "cnf.h" #include "cec.h" #include "giaAbs.h" +#include "tim.h" +#include "llb.h" +#include "ntlnwk.h" +#include "mfx.h" +#include "bbr.h" +#include "cov.h" + +#include "cmd.h" +#include "extra.h" +//#include "magic.h" + +#ifdef _WIN32 +//#include <io.h> +#else +#include <unistd.h> +#endif + +ABC_NAMESPACE_IMPL_START + //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// @@ -65,6 +89,7 @@ static int Abc_CommandPrintXCut ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandPrintDsd ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintCone ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintMiter ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandPrintStatus ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandShow ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandShowBdd ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -103,6 +128,7 @@ static int Abc_CommandMiter ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandDemiter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandOrPos ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAndPos ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandZeroPo ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAppend ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFrames ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDFrames ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -131,6 +157,7 @@ static int Abc_CommandGen ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandCover ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDouble ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandInter ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandBb2Wb ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTest ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandQuaVar ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -143,7 +170,7 @@ static int Abc_CommandICut ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandIRewrite ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDRewrite ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDRefactor ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandDC2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandDc2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDChoice ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDch ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDrwsat ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -154,7 +181,7 @@ static int Abc_CommandIFraig ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandDFraig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCSweep ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDProve ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandDProve2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); +//static int Abc_CommandDProve2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbSec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSimSec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMatch ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -207,7 +234,8 @@ static int Abc_CommandSeqFpga ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandSeqMap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSeqSweep ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSeqSweep2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandSeqSweepTest ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandTestSeqSweep ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandTestScorr ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandLcorr ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSeqCleanup ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCycle ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -231,12 +259,16 @@ static int Abc_CommandIProve ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandDebug ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBmc ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBmc2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandBmc3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBmcInter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandIndcut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandEnlarge ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandInduction ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandPBAbstraction ( Abc_Frame_t * pAbc, int argc, char ** argv ); - +static int Abc_CommandCegar ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandConstr ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandUnfold ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandFold ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandBm ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTraceStart ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTraceCheck ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -255,7 +287,7 @@ static int Abc_CommandAbc8Pfan ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandAbc8If ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc8DChoice ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc8Dch ( Abc_Frame_t * pAbc, int argc, char ** argv ); -static int Abc_CommandAbc8DC2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc8Dc2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc8Bidec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc8Strash ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc8Mfs ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -278,6 +310,7 @@ static int Abc_CommandAbc8Zero ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandAbc8Cec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc8DSec ( Abc_Frame_t * pAbc, int argc, char ** argv ); + static int Abc_CommandAbc9Get ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Put ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Read ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -296,11 +329,15 @@ static int Abc_CommandAbc9Sim ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandAbc9Resim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SpecI ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Equiv ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Equiv2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Semi ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Times ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Frames ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Retime ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Enable ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Dc2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Bidec ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Shrink ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Miter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Scl ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Lcorr ( Abc_Frame_t * pAbc, int argc, char ** argv ); @@ -314,16 +351,26 @@ static int Abc_CommandAbc9Cec ( Abc_Frame_t * pAbc, int argc, cha static int Abc_CommandAbc9Force ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Embed ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9If ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Trace ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Speedup ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Era ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Dch ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9AbsStart ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9AbsStartNew ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9AbsDerive ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9AbsRefine ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9PbaStart ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Reparam ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Posplit ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Reach ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbc9Undo ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Test ( Abc_Frame_t * pAbc, int argc, char ** argv ); +static int Abc_CommandAbcTestNew ( Abc_Frame_t * pAbc, int argc, char ** argv ); + extern int Abc_CommandAbcLivenessToSafety ( Abc_Frame_t * pAbc, int argc, char ** argv ); extern int Abc_CommandAbcLivenessToSafetySim ( Abc_Frame_t * pAbc, int argc, char ** argv ); - -static int Abc_CommandAbcTestNew ( Abc_Frame_t * pAbc, int argc, char ** argv ); - -extern Aig_Man_t * Ntl_ManExtract( void * p ); +extern int Abc_CommandAbcLivenessToSafetyWithLTL( Abc_Frame_t * pAbc, int argc, char ** argv ); //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// @@ -340,11 +387,26 @@ extern Aig_Man_t * Ntl_ManExtract( void * p ); SeeAlso [] ***********************************************************************/ +void Abc_FrameReplaceCex( Abc_Frame_t * pAbc, Abc_Cex_t ** ppCex ) +{ + ABC_FREE( pAbc->pCex ); + pAbc->pCex = *ppCex; + *ppCex = NULL; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ void Abc_FrameClearDesign() { - extern Abc_Frame_t * Abc_FrameGetGlobalFrame(); - extern void Ntl_ManFree( void * p ); - extern void Nwk_ManFree( void * p ); Abc_Frame_t * pAbc; pAbc = Abc_FrameGetGlobalFrame(); @@ -376,20 +438,33 @@ void Abc_FrameClearDesign() SeeAlso [] ***********************************************************************/ -void Abc_Init( Abc_Frame_t * pAbc ) +void Abc_CommandUpdate9( Abc_Frame_t * pAbc, Gia_Man_t * pNew ) { -/* + if ( pNew == NULL ) { - Aig_Man_t * pAig; - pAig = Ioa_ReadAiger( "i10.aig", 1 ); - Aig_ManStop( pAig ); + Abc_Print( -1, "Abc_CommandUpdate9(): Tranformation has failed.\n" ); + return; } -*/ + if ( pAbc->pGia2 ) + Gia_ManStop( pAbc->pGia2 ); + pAbc->pGia2 = pAbc->pGia; + pAbc->pGia = pNew; +} + -// Amap_LibParseTest( "at\\syn\\libraries\\LIBS\\BRDCM\\tsmc13_5.ff.genlib" ); -// Amap_LibParseTest( "at\\syn\\libraries\\LIBS\\GS60\\GS60_W_30_1.7_CORE.genlib" ); -// Amap_LibParseTest( "at\\syn\\libraries\\LIBS\\TYPICAL\\typical.genlib" ); +/**Function************************************************************* + + Synopsis [] + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Abc_Init( Abc_Frame_t * pAbc ) +{ Cmd_CommandAdd( pAbc, "Printing", "print_stats", Abc_CommandPrintStats, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_exdc", Abc_CommandPrintExdc, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_io", Abc_CommandPrintIo, 0 ); @@ -409,6 +484,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Printing", "print_dsd", Abc_CommandPrintDsd, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_cone", Abc_CommandPrintCone, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_miter", Abc_CommandPrintMiter, 0 ); + Cmd_CommandAdd( pAbc, "Printing", "print_status", Abc_CommandPrintStatus, 0 ); Cmd_CommandAdd( pAbc, "Printing", "show", Abc_CommandShow, 0 ); Cmd_CommandAdd( pAbc, "Printing", "show_bdd", Abc_CommandShowBdd, 0 ); @@ -438,7 +514,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Synthesis", "refactor", Abc_CommandRefactor, 1 ); // Cmd_CommandAdd( pAbc, "Synthesis", "restructure", Abc_CommandRestructure, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "resub", Abc_CommandResubstitute, 1 ); - Cmd_CommandAdd( pAbc, "Synthesis", "rr", Abc_CommandRr, 1 ); +// Cmd_CommandAdd( pAbc, "Synthesis", "rr", Abc_CommandRr, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "cascade", Abc_CommandCascade, 1 ); Cmd_CommandAdd( pAbc, "Various", "logic", Abc_CommandLogic, 1 ); @@ -447,6 +523,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Various", "demiter", Abc_CommandDemiter, 1 ); Cmd_CommandAdd( pAbc, "Various", "orpos", Abc_CommandOrPos, 1 ); Cmd_CommandAdd( pAbc, "Various", "andpos", Abc_CommandAndPos, 1 ); + Cmd_CommandAdd( pAbc, "Various", "zeropo", Abc_CommandZeroPo, 1 ); Cmd_CommandAdd( pAbc, "Various", "append", Abc_CommandAppend, 1 ); Cmd_CommandAdd( pAbc, "Various", "frames", Abc_CommandFrames, 1 ); Cmd_CommandAdd( pAbc, "Various", "dframes", Abc_CommandDFrames, 1 ); @@ -475,7 +552,9 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Various", "cover", Abc_CommandCover, 1 ); Cmd_CommandAdd( pAbc, "Various", "double", Abc_CommandDouble, 1 ); Cmd_CommandAdd( pAbc, "Various", "inter", Abc_CommandInter, 1 ); + Cmd_CommandAdd( pAbc, "Various", "bb2wb", Abc_CommandBb2Wb, 0 ); Cmd_CommandAdd( pAbc, "Various", "test", Abc_CommandTest, 0 ); +// Cmd_CommandAdd( pAbc, "Various", "qbf_solve", Abc_CommandTest, 0 ); Cmd_CommandAdd( pAbc, "Various", "qvar", Abc_CommandQuaVar, 1 ); Cmd_CommandAdd( pAbc, "Various", "qrel", Abc_CommandQuaRel, 1 ); @@ -487,7 +566,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "New AIG", "irw", Abc_CommandIRewrite, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "drw", Abc_CommandDRewrite, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "drf", Abc_CommandDRefactor, 1 ); - Cmd_CommandAdd( pAbc, "New AIG", "dc2", Abc_CommandDC2, 1 ); + Cmd_CommandAdd( pAbc, "New AIG", "dc2", Abc_CommandDc2, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "dchoice", Abc_CommandDChoice, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "dch", Abc_CommandDch, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "drwsat", Abc_CommandDrwsat, 1 ); @@ -544,7 +623,8 @@ void Abc_Init( Abc_Frame_t * pAbc ) // Cmd_CommandAdd( pAbc, "Sequential", "smap", Abc_CommandSeqMap, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "ssweep", Abc_CommandSeqSweep, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "scorr", Abc_CommandSeqSweep2, 1 ); - Cmd_CommandAdd( pAbc, "Sequential", "testssw", Abc_CommandSeqSweepTest, 0 ); + Cmd_CommandAdd( pAbc, "Sequential", "testssw", Abc_CommandTestSeqSweep, 0 ); + Cmd_CommandAdd( pAbc, "Sequential", "testscorr", Abc_CommandTestScorr, 0 ); Cmd_CommandAdd( pAbc, "Sequential", "lcorr", Abc_CommandLcorr, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "scleanup", Abc_CommandSeqCleanup, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "cycle", Abc_CommandCycle, 1 ); @@ -558,10 +638,10 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Verification", "cec", Abc_CommandCec, 0 ); Cmd_CommandAdd( pAbc, "Verification", "dcec", Abc_CommandDCec, 0 ); - Cmd_CommandAdd( pAbc, "Verification", "sec", Abc_CommandSec, 0 ); +// Cmd_CommandAdd( pAbc, "Verification", "sec", Abc_CommandSec, 0 ); Cmd_CommandAdd( pAbc, "Verification", "dsec", Abc_CommandDSec, 0 ); Cmd_CommandAdd( pAbc, "Verification", "dprove", Abc_CommandDProve, 0 ); - Cmd_CommandAdd( pAbc, "Verification", "dprove2", Abc_CommandDProve2, 0 ); +// Cmd_CommandAdd( pAbc, "Verification", "dprove2", Abc_CommandDProve2, 0 ); Cmd_CommandAdd( pAbc, "Verification", "absec", Abc_CommandAbSec, 0 ); Cmd_CommandAdd( pAbc, "Verification", "simsec", Abc_CommandSimSec, 0 ); Cmd_CommandAdd( pAbc, "Verification", "match", Abc_CommandMatch, 0 ); @@ -573,11 +653,16 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "Verification", "debug", Abc_CommandDebug, 0 ); Cmd_CommandAdd( pAbc, "Verification", "bmc", Abc_CommandBmc, 0 ); Cmd_CommandAdd( pAbc, "Verification", "bmc2", Abc_CommandBmc2, 0 ); - Cmd_CommandAdd( pAbc, "Verification", "int", Abc_CommandBmcInter, 0 ); + Cmd_CommandAdd( pAbc, "Verification", "bmc3", Abc_CommandBmc3, 1 ); + Cmd_CommandAdd( pAbc, "Verification", "int", Abc_CommandBmcInter, 1 ); Cmd_CommandAdd( pAbc, "Verification", "indcut", Abc_CommandIndcut, 0 ); Cmd_CommandAdd( pAbc, "Verification", "enlarge", Abc_CommandEnlarge, 1 ); Cmd_CommandAdd( pAbc, "Verification", "ind", Abc_CommandInduction, 0 ); - Cmd_CommandAdd( pAbc, "Verification", "abs", Abc_CommandPBAbstraction, 0 ); + Cmd_CommandAdd( pAbc, "Verification", "abs", Abc_CommandCegar, 1 ); + Cmd_CommandAdd( pAbc, "Verification", "constr", Abc_CommandConstr, 0 ); + Cmd_CommandAdd( pAbc, "Verification", "unfold", Abc_CommandUnfold, 1 ); + Cmd_CommandAdd( pAbc, "Verification", "fold", Abc_CommandFold, 1 ); + Cmd_CommandAdd( pAbc, "Verification", "bm", Abc_CommandBm, 1 ); Cmd_CommandAdd( pAbc, "ABC8", "*r", Abc_CommandAbc8Read, 0 ); @@ -593,7 +678,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "ABC8", "*if", Abc_CommandAbc8If, 0 ); Cmd_CommandAdd( pAbc, "ABC8", "*dchoice", Abc_CommandAbc8DChoice, 0 ); Cmd_CommandAdd( pAbc, "ABC8", "*dch", Abc_CommandAbc8Dch, 0 ); - Cmd_CommandAdd( pAbc, "ABC8", "*dc2", Abc_CommandAbc8DC2, 0 ); + Cmd_CommandAdd( pAbc, "ABC8", "*dc2", Abc_CommandAbc8Dc2, 0 ); Cmd_CommandAdd( pAbc, "ABC8", "*bidec", Abc_CommandAbc8Bidec, 0 ); Cmd_CommandAdd( pAbc, "ABC8", "*st", Abc_CommandAbc8Strash, 0 ); Cmd_CommandAdd( pAbc, "ABC8", "*mfs", Abc_CommandAbc8Mfs, 0 ); @@ -614,49 +699,65 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "ABC8", "*cec", Abc_CommandAbc8Cec, 0 ); Cmd_CommandAdd( pAbc, "ABC8", "*dsec", Abc_CommandAbc8DSec, 0 ); - - Cmd_CommandAdd( pAbc, "AIG", "&get", Abc_CommandAbc9Get, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&put", Abc_CommandAbc9Put, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&r", Abc_CommandAbc9Read, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&w", Abc_CommandAbc9Write, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&ps", Abc_CommandAbc9Ps, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&pfan", Abc_CommandAbc9PFan, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&psig", Abc_CommandAbc9PSig, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&status", Abc_CommandAbc9Status, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&show", Abc_CommandAbc9Show, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&st", Abc_CommandAbc9Hash, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&topand", Abc_CommandAbc9Topand, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&cof", Abc_CommandAbc9Cof, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&trim", Abc_CommandAbc9Trim, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&dfs", Abc_CommandAbc9Dfs, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&sim", Abc_CommandAbc9Sim, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&resim", Abc_CommandAbc9Resim, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&speci", Abc_CommandAbc9SpecI, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&equiv", Abc_CommandAbc9Equiv, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&semi", Abc_CommandAbc9Semi, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "×", Abc_CommandAbc9Times, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&frames", Abc_CommandAbc9Frames, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&retime", Abc_CommandAbc9Retime, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&enable", Abc_CommandAbc9Enable, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&miter", Abc_CommandAbc9Miter, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&scl", Abc_CommandAbc9Scl, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&lcorr", Abc_CommandAbc9Lcorr, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&scorr", Abc_CommandAbc9Scorr, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&choice", Abc_CommandAbc9Choice, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&sat", Abc_CommandAbc9Sat, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&fraig", Abc_CommandAbc9Fraig, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&srm", Abc_CommandAbc9Srm, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&reduce", Abc_CommandAbc9Reduce, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&cec", Abc_CommandAbc9Cec, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&force", Abc_CommandAbc9Force, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&embed", Abc_CommandAbc9Embed, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&if", Abc_CommandAbc9If, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&era", Abc_CommandAbc9Era, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&dch", Abc_CommandAbc9Dch, 0 ); - Cmd_CommandAdd( pAbc, "AIG", "&test", Abc_CommandAbc9Test, 0 ); + + Cmd_CommandAdd( pAbc, "ABC9", "&get", Abc_CommandAbc9Get, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&put", Abc_CommandAbc9Put, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&r", Abc_CommandAbc9Read, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&w", Abc_CommandAbc9Write, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&ps", Abc_CommandAbc9Ps, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&pfan", Abc_CommandAbc9PFan, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&psig", Abc_CommandAbc9PSig, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&status", Abc_CommandAbc9Status, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&show", Abc_CommandAbc9Show, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&st", Abc_CommandAbc9Hash, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&topand", Abc_CommandAbc9Topand, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&cof", Abc_CommandAbc9Cof, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&trim", Abc_CommandAbc9Trim, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&dfs", Abc_CommandAbc9Dfs, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&sim", Abc_CommandAbc9Sim, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&resim", Abc_CommandAbc9Resim, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&speci", Abc_CommandAbc9SpecI, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&equiv", Abc_CommandAbc9Equiv, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&equiv2", Abc_CommandAbc9Equiv2, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&semi", Abc_CommandAbc9Semi, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "×", Abc_CommandAbc9Times, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&frames", Abc_CommandAbc9Frames, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&retime", Abc_CommandAbc9Retime, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&enable", Abc_CommandAbc9Enable, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&dc2", Abc_CommandAbc9Dc2, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&bidec", Abc_CommandAbc9Bidec, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&shrink", Abc_CommandAbc9Shrink, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&miter", Abc_CommandAbc9Miter, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&scl", Abc_CommandAbc9Scl, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&lcorr", Abc_CommandAbc9Lcorr, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&scorr", Abc_CommandAbc9Scorr, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&choice", Abc_CommandAbc9Choice, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&sat", Abc_CommandAbc9Sat, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&fraig", Abc_CommandAbc9Fraig, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&srm", Abc_CommandAbc9Srm, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&reduce", Abc_CommandAbc9Reduce, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&cec", Abc_CommandAbc9Cec, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&force", Abc_CommandAbc9Force, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&embed", Abc_CommandAbc9Embed, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&if", Abc_CommandAbc9If, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&trace", Abc_CommandAbc9Trace, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&speedup", Abc_CommandAbc9Speedup, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&era", Abc_CommandAbc9Era, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&dch", Abc_CommandAbc9Dch, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&abs_start", Abc_CommandAbc9AbsStart, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&abs_newstart", Abc_CommandAbc9AbsStartNew, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&abs_derive", Abc_CommandAbc9AbsDerive, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&abs_refine", Abc_CommandAbc9AbsRefine, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&pba_start", Abc_CommandAbc9PbaStart, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&reparam", Abc_CommandAbc9Reparam, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&posplit", Abc_CommandAbc9Posplit, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&reach", Abc_CommandAbc9Reach, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&undo", Abc_CommandAbc9Undo, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&test", Abc_CommandAbc9Test, 0 ); Cmd_CommandAdd( pAbc, "Liveness", "l2s", Abc_CommandAbcLivenessToSafety, 0 ); Cmd_CommandAdd( pAbc, "Liveness", "l2ssim", Abc_CommandAbcLivenessToSafetySim, 0 ); + Cmd_CommandAdd( pAbc, "Liveness", "l3s", Abc_CommandAbcLivenessToSafetyWithLTL, 0 ); Cmd_CommandAdd( pAbc, "Various", "testnew", Abc_CommandAbcTestNew, 0 ); @@ -697,9 +798,24 @@ void Abc_Init( Abc_Frame_t * pAbc ) void For_ManFileExperiment(); // For_ManFileExperiment(); } +/* { + int i1, i2, i3, i4, i5, i6, N, Counter = 0; + for ( N = 20; N < 40; N++ ) + { + Counter = 0; + for ( i1 = 0; i1 < N; i1++ ) + for ( i2 = i1+1; i2 < N; i2++ ) + for ( i3 = i2; i3 < N; i3++ ) + for ( i4 = i3; i4 < N; i4++ ) +// for ( i5 = i4+1; i5 < N; i5++ ) +// for ( i6 = i5+1; i6 < N; i6++ ) + Counter++; + printf( "%d=%d ", N, Counter ); + } + printf( "\n" ); } - +*/ } /**Function************************************************************* @@ -713,13 +829,15 @@ void Abc_Init( Abc_Frame_t * pAbc ) SeeAlso [] ***********************************************************************/ -void Abc_End() +void Abc_End( Abc_Frame_t * pAbc ) { + extern Abc_Frame_t * Abc_FrameGetGlobalFrame(); Abc_FrameClearDesign(); + { extern void If_LutLibFree( If_Lib_t * pLutLib ); if ( Abc_FrameGetGlobalFrame()->pAbc8Lib ) - If_LutLibFree( Abc_FrameGetGlobalFrame()->pAbc8Lib ); + If_LutLibFree( (If_Lib_t *)Abc_FrameGetGlobalFrame()->pAbc8Lib ); } // Dar_LibDumpPriorities(); @@ -729,7 +847,7 @@ void Abc_End() } { - extern void Cnf_ClearMemory(); +// extern void Cnf_ClearMemory(); Cnf_ClearMemory(); } { @@ -740,12 +858,11 @@ void Abc_End() extern void Aig_RManQuit(); Aig_RManQuit(); } - Abc_NtkFraigStoreClean(); -// Rwt_Man4ExplorePrint(); - - if ( Abc_FrameGetGlobalFrame()->pAig ) - Gia_ManStop( Abc_FrameGetGlobalFrame()->pAig ); + if ( Abc_FrameGetGlobalFrame()->pGia ) + Gia_ManStop( Abc_FrameGetGlobalFrame()->pGia ); + if ( Abc_FrameGetGlobalFrame()->pGia2 ) + Gia_ManStop( Abc_FrameGetGlobalFrame()->pGia2 ); } /**Function************************************************************* @@ -761,8 +878,7 @@ void Abc_End() ***********************************************************************/ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int fFactor; int fSaveBest; int fDumpResult; @@ -774,8 +890,6 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set the defaults fFactor = 0; @@ -824,36 +938,35 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( Abc_FrameReadErr(pAbc), "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) && fUseLutLib ) { - fprintf( Abc_FrameReadErr(pAbc), "Cannot print LUT delay for a non-logic network.\n" ); + Abc_Print( -1, "Cannot print LUT delay for a non-logic network.\n" ); return 1; } - Abc_NtkPrintStats( pOut, pNtk, fFactor, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch ); + Abc_NtkPrintStats( pNtk, fFactor, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch ); if ( fPrintTime ) { pAbc->TimeTotal += pAbc->TimeCommand; - fprintf( pAbc->Out, "elapse: %3.2f seconds, total: %3.2f seconds\n", - pAbc->TimeCommand, pAbc->TimeTotal ); + Abc_Print( 1, "elapse: %3.2f seconds, total: %3.2f seconds\n", pAbc->TimeCommand, pAbc->TimeTotal ); pAbc->TimeCommand = 0.0; } return 0; usage: - fprintf( pErr, "usage: print_stats [-fbdltmpgh]\n" ); - fprintf( pErr, "\t prints the network statistics\n" ); - fprintf( pErr, "\t-f : toggles printing the literal count in the factored forms [default = %s]\n", fFactor? "yes": "no" ); - fprintf( pErr, "\t-b : toggles saving the best logic network in \"best.blif\" [default = %s]\n", fSaveBest? "yes": "no" ); - fprintf( pErr, "\t-d : toggles dumping network into file \"<input_file_name>_dump.blif\" [default = %s]\n", fDumpResult? "yes": "no" ); - fprintf( pErr, "\t-l : toggles printing delay of LUT mapping using LUT library [default = %s]\n", fSaveBest? "yes": "no" ); - fprintf( pErr, "\t-t : toggles printing runtime statistics [default = %s]\n", fPrintTime? "yes": "no" ); - fprintf( pErr, "\t-m : toggles printing MUX statistics [default = %s]\n", fPrintMuxes? "yes": "no" ); - fprintf( pErr, "\t-p : toggles printing power dissipation due to switching [default = %s]\n", fPower? "yes": "no" ); - fprintf( pErr, "\t-q : toggles printing percentage of increased power due to glitching [default = %s]\n", fGlitch? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_stats [-fbdltmpgh]\n" ); + Abc_Print( -2, "\t prints the network statistics\n" ); + Abc_Print( -2, "\t-f : toggles printing the literal count in the factored forms [default = %s]\n", fFactor? "yes": "no" ); + Abc_Print( -2, "\t-b : toggles saving the best logic network in \"best.blif\" [default = %s]\n", fSaveBest? "yes": "no" ); + Abc_Print( -2, "\t-d : toggles dumping network into file \"<input_file_name>_dump.blif\" [default = %s]\n", fDumpResult? "yes": "no" ); + Abc_Print( -2, "\t-l : toggles printing delay of LUT mapping using LUT library [default = %s]\n", fSaveBest? "yes": "no" ); + Abc_Print( -2, "\t-t : toggles printing runtime statistics [default = %s]\n", fPrintTime? "yes": "no" ); + Abc_Print( -2, "\t-m : toggles printing MUX statistics [default = %s]\n", fPrintMuxes? "yes": "no" ); + Abc_Print( -2, "\t-p : toggles printing power dissipation due to switching [default = %s]\n", fPower? "yes": "no" ); + Abc_Print( -2, "\t-q : toggles printing percentage of increased power due to glitching [default = %s]\n", fGlitch? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -870,18 +983,13 @@ usage: ***********************************************************************/ int Abc_CommandPrintExdc( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkTemp; double Percentage; - bool fShort; + int fShort; int c; int fPrintDc; - extern double Abc_NtkSpacePercentage( Abc_Obj_t * pNode ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set the defaults fShort = 1; @@ -906,12 +1014,12 @@ int Abc_CommandPrintExdc( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( Abc_FrameReadErr(pAbc), "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( pNtk->pExdc == NULL ) { - fprintf( Abc_FrameReadErr(pAbc), "Network has no EXDC.\n" ); + Abc_Print( -1, "Network has no EXDC.\n" ); return 1; } @@ -926,26 +1034,26 @@ int Abc_CommandPrintExdc( Abc_Frame_t * pAbc, int argc, char ** argv ) else Percentage = Abc_NtkSpacePercentage( Abc_ObjChild0( Abc_NtkPo(pNtk->pExdc, 0) ) ); - printf( "EXDC network statistics: " ); - printf( "(" ); + Abc_Print( 1, "EXDC network statistics: " ); + Abc_Print( 1, "(" ); if ( Percentage > 0.05 && Percentage < 99.95 ) - printf( "%.2f", Percentage ); + Abc_Print( 1, "%.2f", Percentage ); else if ( Percentage > 0.000005 && Percentage < 99.999995 ) - printf( "%.6f", Percentage ); + Abc_Print( 1, "%.6f", Percentage ); else - printf( "%f", Percentage ); - printf( " %% don't-cares)\n" ); + Abc_Print( 1, "%f", Percentage ); + Abc_Print( 1, " %% don't-cares)\n" ); } else - printf( "EXDC network statistics: \n" ); - Abc_NtkPrintStats( pOut, pNtk->pExdc, 0, 0, 0, 0, 0, 0, 0 ); + Abc_Print( 1, "EXDC network statistics: \n" ); + Abc_NtkPrintStats( pNtk->pExdc, 0, 0, 0, 0, 0, 0, 0 ); return 0; usage: - fprintf( pErr, "usage: print_exdc [-dh]\n" ); - fprintf( pErr, "\t prints the EXDC network statistics\n" ); - fprintf( pErr, "\t-d : toggles printing don't-care percentage [default = %s]\n", fPrintDc? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_exdc [-dh]\n" ); + Abc_Print( -2, "\t prints the EXDC network statistics\n" ); + Abc_Print( -2, "\t-d : toggles printing don't-care percentage [default = %s]\n", fPrintDc? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -962,15 +1070,10 @@ usage: ***********************************************************************/ int Abc_CommandPrintIo( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pNode; int c; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -986,13 +1089,13 @@ int Abc_CommandPrintIo( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { - fprintf( pErr, "Wrong number of auguments.\n" ); + Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } @@ -1001,21 +1104,21 @@ int Abc_CommandPrintIo( Abc_Frame_t * pAbc, int argc, char ** argv ) pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { - fprintf( pErr, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); + Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } - Abc_NodePrintFanio( pOut, pNode ); + Abc_NodePrintFanio( stdout, pNode ); return 0; } // print the nodes - Abc_NtkPrintIo( pOut, pNtk ); + Abc_NtkPrintIo( stdout, pNtk ); return 0; usage: - fprintf( pErr, "usage: print_io [-h] <node>\n" ); - fprintf( pErr, "\t prints the PIs/POs or fanins/fanouts of a node\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tnode : the node to print fanins/fanouts\n"); + Abc_Print( -2, "usage: print_io [-h] <node>\n" ); + Abc_Print( -2, "\t prints the PIs/POs or fanins/fanouts of a node\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tnode : the node to print fanins/fanouts\n"); return 1; } @@ -1032,16 +1135,11 @@ usage: ***********************************************************************/ int Abc_CommandPrintLatch( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fPrintSccs; extern void Abc_NtkPrintSccs( Abc_Ntk_t * pNtk, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fPrintSccs = 0; Extra_UtilGetoptReset(); @@ -1061,20 +1159,20 @@ int Abc_CommandPrintLatch( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // print the nodes - Abc_NtkPrintLatch( pOut, pNtk ); + Abc_NtkPrintLatch( stdout, pNtk ); if ( fPrintSccs ) Abc_NtkPrintSccs( pNtk, 0 ); return 0; usage: - fprintf( pErr, "usage: print_latch [-sh]\n" ); - fprintf( pErr, "\t prints information about latches\n" ); - fprintf( pErr, "\t-s : toggles printing SCCs of registers [default = %s]\n", fPrintSccs? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_latch [-sh]\n" ); + Abc_Print( -2, "\t prints information about latches\n" ); + Abc_Print( -2, "\t-s : toggles printing SCCs of registers [default = %s]\n", fPrintSccs? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1091,15 +1189,10 @@ usage: ***********************************************************************/ int Abc_CommandPrintFanio( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fVerbose; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fVerbose = 0; Extra_UtilGetoptReset(); @@ -1119,22 +1212,22 @@ int Abc_CommandPrintFanio( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // print the nodes if ( fVerbose ) - Abc_NtkPrintFanio( pOut, pNtk ); + Abc_NtkPrintFanio( stdout, pNtk ); else - Abc_NtkPrintFanioNew( pOut, pNtk ); + Abc_NtkPrintFanioNew( stdout, pNtk ); return 0; usage: - fprintf( pErr, "usage: print_fanio [-vh]\n" ); - fprintf( pErr, "\t prints the statistics about fanins/fanouts of all nodes\n" ); - fprintf( pErr, "\t-v : toggles verbose way of printing the stats [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_fanio [-vh]\n" ); + Abc_Print( -2, "\t prints the statistics about fanins/fanouts of all nodes\n" ); + Abc_Print( -2, "\t-v : toggles verbose way of printing the stats [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1151,15 +1244,10 @@ usage: ***********************************************************************/ int Abc_CommandPrintMffc( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; extern void Abc_NtkPrintMffc( FILE * pFile, Abc_Ntk_t * pNtk ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -1175,18 +1263,18 @@ int Abc_CommandPrintMffc( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // print the nodes - Abc_NtkPrintMffc( pOut, pNtk ); + Abc_NtkPrintMffc( stdout, pNtk ); return 0; usage: - fprintf( pErr, "usage: print_mffc [-h]\n" ); - fprintf( pErr, "\t prints the MFFC of each node in the network\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_mffc [-h]\n" ); + Abc_Print( -2, "\t prints the MFFC of each node in the network\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1203,16 +1291,11 @@ usage: ***********************************************************************/ int Abc_CommandPrintFactor( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pNode; int c; int fUseRealNames; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseRealNames = 1; Extra_UtilGetoptReset(); @@ -1232,19 +1315,19 @@ int Abc_CommandPrintFactor( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsSopLogic(pNtk) ) { - fprintf( pErr, "Printing factored forms can be done for SOP networks.\n" ); + Abc_Print( -1, "Printing factored forms can be done for SOP networks.\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { - fprintf( pErr, "Wrong number of auguments.\n" ); + Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } @@ -1253,22 +1336,22 @@ int Abc_CommandPrintFactor( Abc_Frame_t * pAbc, int argc, char ** argv ) pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { - fprintf( pErr, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); + Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } - Abc_NodePrintFactor( pOut, pNode, fUseRealNames ); + Abc_NodePrintFactor( stdout, pNode, fUseRealNames ); return 0; } // print the nodes - Abc_NtkPrintFactor( pOut, pNtk, fUseRealNames ); + Abc_NtkPrintFactor( stdout, pNtk, fUseRealNames ); return 0; usage: - fprintf( pErr, "usage: print_factor [-nh] <node>\n" ); - fprintf( pErr, "\t prints the factored forms of nodes\n" ); - fprintf( pErr, "\t-n : toggles real/dummy fanin names [default = %s]\n", fUseRealNames? "real": "dummy" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tnode : (optional) one node to consider\n"); + Abc_Print( -2, "usage: print_factor [-nh] <node>\n" ); + Abc_Print( -2, "\t prints the factored forms of nodes\n" ); + Abc_Print( -2, "\t-n : toggles real/dummy fanin names [default = %s]\n", fUseRealNames? "real": "dummy" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tnode : (optional) one node to consider\n"); return 1; } @@ -1285,17 +1368,12 @@ usage: ***********************************************************************/ int Abc_CommandPrintLevel( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pNode; int c; int fListNodes; int fProfile; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fListNodes = 0; fProfile = 1; @@ -1319,19 +1397,19 @@ int Abc_CommandPrintLevel( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !fProfile && !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for AIGs (run \"strash\").\n" ); + Abc_Print( -1, "This command works only for AIGs (run \"strash\").\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { - fprintf( pErr, "Wrong number of auguments.\n" ); + Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } @@ -1340,23 +1418,23 @@ int Abc_CommandPrintLevel( Abc_Frame_t * pAbc, int argc, char ** argv ) pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { - fprintf( pErr, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); + Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } - Abc_NodePrintLevel( pOut, pNode ); + Abc_NodePrintLevel( stdout, pNode ); return 0; } // process all COs - Abc_NtkPrintLevel( pOut, pNtk, fProfile, fListNodes ); + Abc_NtkPrintLevel( stdout, pNtk, fProfile, fListNodes ); return 0; usage: - fprintf( pErr, "usage: print_level [-nph] <node>\n" ); - fprintf( pErr, "\t prints information about node level and cone size\n" ); - fprintf( pErr, "\t-n : toggles printing nodes by levels [default = %s]\n", fListNodes? "yes": "no" ); - fprintf( pErr, "\t-p : toggles printing level profile [default = %s]\n", fProfile? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tnode : (optional) one node to consider\n"); + Abc_Print( -2, "usage: print_level [-nph] <node>\n" ); + Abc_Print( -2, "\t prints information about node level and cone size\n" ); + Abc_Print( -2, "\t-n : toggles printing nodes by levels [default = %s]\n", fListNodes? "yes": "no" ); + Abc_Print( -2, "\t-p : toggles printing level profile [default = %s]\n", fProfile? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tnode : (optional) one node to consider\n"); return 1; } @@ -1374,18 +1452,13 @@ usage: int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv ) { Vec_Ptr_t * vSuppFun; - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fStruct; int fVerbose; extern Vec_Ptr_t * Sim_ComputeFunSupp( Abc_Ntk_t * pNtk, int fVerbose ); extern void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fStruct = 1; fVerbose = 0; @@ -1409,7 +1482,7 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -1422,12 +1495,12 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( !Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "This command works only for combinational networks (run \"comb\").\n" ); + Abc_Print( -1, "This command works only for combinational networks (run \"comb\").\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for AIGs (run \"strash\").\n" ); + Abc_Print( -1, "This command works only for AIGs (run \"strash\").\n" ); return 1; } vSuppFun = Sim_ComputeFunSupp( pNtk, fVerbose ); @@ -1436,11 +1509,11 @@ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: print_supp [-svh]\n" ); - fprintf( pErr, "\t prints the supports of the CO nodes\n" ); - fprintf( pErr, "\t-s : toggle printing structural support only [default = %s].\n", fStruct? "yes": "no" ); - fprintf( pErr, "\t-v : enable verbose output [default = %s].\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_supp [-svh]\n" ); + Abc_Print( -2, "\t prints the supports of the CO nodes\n" ); + Abc_Print( -2, "\t-s : toggle printing structural support only [default = %s].\n", fStruct? "yes": "no" ); + Abc_Print( -2, "\t-v : enable verbose output [default = %s].\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1457,8 +1530,7 @@ usage: ***********************************************************************/ int Abc_CommandPrintSymms( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseBdds; int fNaive; @@ -1466,10 +1538,6 @@ int Abc_CommandPrintSymms( Abc_Frame_t * pAbc, int argc, char ** argv ) int fVerbose; extern void Abc_NtkSymmetries( Abc_Ntk_t * pNtk, int fUseBdds, int fNaive, int fReorder, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseBdds = 0; fNaive = 0; @@ -1500,12 +1568,12 @@ int Abc_CommandPrintSymms( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "This command works only for combinational networks (run \"comb\").\n" ); + Abc_Print( -1, "This command works only for combinational networks (run \"comb\").\n" ); return 1; } if ( Abc_NtkIsStrash(pNtk) ) @@ -1519,13 +1587,13 @@ int Abc_CommandPrintSymms( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: print_symm [-bnrvh]\n" ); - fprintf( pErr, "\t computes symmetries of the PO functions\n" ); - fprintf( pErr, "\t-b : toggle BDD-based or SAT-based computations [default = %s].\n", fUseBdds? "BDD": "SAT" ); - fprintf( pErr, "\t-n : enable naive BDD-based computation [default = %s].\n", fNaive? "yes": "no" ); - fprintf( pErr, "\t-r : enable dynamic BDD variable reordering [default = %s].\n", fReorder? "yes": "no" ); - fprintf( pErr, "\t-v : enable verbose output [default = %s].\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_symm [-bnrvh]\n" ); + Abc_Print( -2, "\t computes symmetries of the PO functions\n" ); + Abc_Print( -2, "\t-b : toggle BDD-based or SAT-based computations [default = %s].\n", fUseBdds? "BDD": "SAT" ); + Abc_Print( -2, "\t-n : enable naive BDD-based computation [default = %s].\n", fNaive? "yes": "no" ); + Abc_Print( -2, "\t-r : enable dynamic BDD variable reordering [default = %s].\n", fReorder? "yes": "no" ); + Abc_Print( -2, "\t-v : enable verbose output [default = %s].\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1542,18 +1610,13 @@ usage: ***********************************************************************/ int Abc_CommandPrintUnate( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseBdds; int fUseNaive; int fVerbose; extern void Abc_NtkPrintUnate( Abc_Ntk_t * pNtk, int fUseBdds, int fUseNaive, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseBdds = 1; fUseNaive = 0; @@ -1580,24 +1643,24 @@ int Abc_CommandPrintUnate( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for AIGs (run \"strash\").\n" ); + Abc_Print( -1, "This command works only for AIGs (run \"strash\").\n" ); return 1; } Abc_NtkPrintUnate( pNtk, fUseBdds, fUseNaive, fVerbose ); return 0; usage: - fprintf( pErr, "usage: print_unate [-bnvh]\n" ); - fprintf( pErr, "\t computes unate variables of the PO functions\n" ); - fprintf( pErr, "\t-b : toggle BDD-based or SAT-based computations [default = %s].\n", fUseBdds? "BDD": "SAT" ); - fprintf( pErr, "\t-n : toggle naive BDD-based computation [default = %s].\n", fUseNaive? "yes": "no" ); - fprintf( pErr, "\t-v : enable verbose output [default = %s].\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_unate [-bnvh]\n" ); + Abc_Print( -2, "\t computes unate variables of the PO functions\n" ); + Abc_Print( -2, "\t-b : toggle BDD-based or SAT-based computations [default = %s].\n", fUseBdds? "BDD": "SAT" ); + Abc_Print( -2, "\t-n : toggle naive BDD-based computation [default = %s].\n", fUseNaive? "yes": "no" ); + Abc_Print( -2, "\t-v : enable verbose output [default = %s].\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1614,18 +1677,13 @@ usage: ***********************************************************************/ int Abc_CommandPrintAuto( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int Output; int fNaive; int fVerbose; extern void Abc_NtkAutoPrint( Abc_Ntk_t * pNtk, int Output, int fNaive, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Output = -1; fNaive = 0; @@ -1638,7 +1696,7 @@ int Abc_CommandPrintAuto( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'O': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-O\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-O\" should be followed by an integer.\n" ); goto usage; } Output = atoi(argv[globalUtilOptind]); @@ -1660,12 +1718,12 @@ int Abc_CommandPrintAuto( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for AIGs (run \"strash\").\n" ); + Abc_Print( -1, "This command works only for AIGs (run \"strash\").\n" ); return 1; } @@ -1674,12 +1732,12 @@ int Abc_CommandPrintAuto( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: print_auto [-O num] [-nvh]\n" ); - fprintf( pErr, "\t computes autosymmetries of the PO functions\n" ); - fprintf( pErr, "\t-O num : (optional) the 0-based number of the output [default = all]\n"); - fprintf( pErr, "\t-n : enable naive BDD-based computation [default = %s].\n", fNaive? "yes": "no" ); - fprintf( pErr, "\t-v : enable verbose output [default = %s].\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_auto [-O num] [-nvh]\n" ); + Abc_Print( -2, "\t computes autosymmetries of the PO functions\n" ); + Abc_Print( -2, "\t-O num : (optional) the 0-based number of the output [default = all]\n"); + Abc_Print( -2, "\t-n : enable naive BDD-based computation [default = %s].\n", fNaive? "yes": "no" ); + Abc_Print( -2, "\t-v : enable verbose output [default = %s].\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1696,18 +1754,13 @@ usage: ***********************************************************************/ int Abc_CommandPrintKMap( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pNode; int c; int fUseRealNames; extern void Abc_NodePrintKMap( Abc_Obj_t * pNode, int fUseRealNames ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseRealNames = 1; Extra_UtilGetoptReset(); @@ -1727,18 +1780,18 @@ int Abc_CommandPrintKMap( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "Visualization of Karnaugh maps works for logic networks.\n" ); + Abc_Print( -1, "Visualization of Karnaugh maps works for logic networks.\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { - fprintf( pErr, "Wrong number of auguments.\n" ); + Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } if ( argc == globalUtilOptind ) @@ -1746,7 +1799,7 @@ int Abc_CommandPrintKMap( Abc_Frame_t * pAbc, int argc, char ** argv ) pNode = Abc_ObjFanin0( Abc_NtkPo(pNtk, 0) ); if ( !Abc_ObjIsNode(pNode) ) { - fprintf( pErr, "The driver \"%s\" of the first PO is not an internal node.\n", Abc_ObjName(pNode) ); + Abc_Print( -1, "The driver \"%s\" of the first PO is not an internal node.\n", Abc_ObjName(pNode) ); return 1; } } @@ -1755,7 +1808,7 @@ int Abc_CommandPrintKMap( Abc_Frame_t * pAbc, int argc, char ** argv ) pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { - fprintf( pErr, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); + Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } } @@ -1764,11 +1817,11 @@ int Abc_CommandPrintKMap( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: print_kmap [-nh] <node>\n" ); - fprintf( pErr, " shows the truth table of the node\n" ); - fprintf( pErr, "\t-n : toggles real/dummy fanin names [default = %s]\n", fUseRealNames? "real": "dummy" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tnode : the node to consider (default = the driver of the first PO)\n"); + Abc_Print( -2, "usage: print_kmap [-nh] <node>\n" ); + Abc_Print( -2, "\t shows the truth table of the node\n" ); + Abc_Print( -2, "\t-n : toggles real/dummy fanin names [default = %s]\n", fUseRealNames? "real": "dummy" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tnode : the node to consider (default = the driver of the first PO)\n"); return 1; } @@ -1785,17 +1838,12 @@ usage: ***********************************************************************/ int Abc_CommandPrintGates( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLibrary; extern void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseLibrary = 1; Extra_UtilGetoptReset(); @@ -1815,12 +1863,12 @@ int Abc_CommandPrintGates( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkHasAig(pNtk) ) { - fprintf( pErr, "Printing gates does not work for AIGs and sequential AIGs.\n" ); + Abc_Print( -1, "Printing gates does not work for AIGs and sequential AIGs.\n" ); return 1; } @@ -1828,10 +1876,10 @@ int Abc_CommandPrintGates( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: print_gates [-lh]\n" ); - fprintf( pErr, "\t prints statistics about gates used in the network\n" ); - fprintf( pErr, "\t-l : used library gate names (if mapped) [default = %s]\n", fUseLibrary? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_gates [-lh]\n" ); + Abc_Print( -2, "\t prints statistics about gates used in the network\n" ); + Abc_Print( -2, "\t-l : used library gate names (if mapped) [default = %s]\n", fUseLibrary? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1848,17 +1896,12 @@ usage: ***********************************************************************/ int Abc_CommandPrintSharing( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLibrary; extern void Abc_NtkPrintSharing( Abc_Ntk_t * pNtk ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseLibrary = 1; Extra_UtilGetoptReset(); @@ -1878,17 +1921,17 @@ int Abc_CommandPrintSharing( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } Abc_NtkPrintSharing( pNtk ); return 0; usage: - fprintf( pErr, "usage: print_sharing [-h]\n" ); - fprintf( pErr, "\t prints the number of shared nodes in the TFI cones of the COs\n" ); -// fprintf( pErr, "\t-l : used library gate names (if mapped) [default = %s]\n", fUseLibrary? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_sharing [-h]\n" ); + Abc_Print( -2, "\t prints the number of shared nodes in the TFI cones of the COs\n" ); +// Abc_Print( -2, "\t-l : used library gate names (if mapped) [default = %s]\n", fUseLibrary? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1905,17 +1948,12 @@ usage: ***********************************************************************/ int Abc_CommandPrintXCut( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLibrary; extern int Abc_NtkCrossCut( Abc_Ntk_t * pNtk ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseLibrary = 1; Extra_UtilGetoptReset(); @@ -1935,17 +1973,17 @@ int Abc_CommandPrintXCut( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } Abc_NtkCrossCut( pNtk ); return 0; usage: - fprintf( pErr, "usage: print_xcut [-h]\n" ); - fprintf( pErr, "\t prints the size of the cross cut of the current network\n" ); -// fprintf( pErr, "\t-l : used library gate names (if mapped) [default = %s]\n", fUseLibrary? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_xcut [-h]\n" ); + Abc_Print( -2, "\t prints the size of the cross cut of the current network\n" ); +// Abc_Print( -2, "\t-l : used library gate names (if mapped) [default = %s]\n", fUseLibrary? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -1962,31 +2000,28 @@ usage: ***********************************************************************/ int Abc_CommandPrintDsd( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fCofactor; int nCofLevel; + int fProfile; extern void Kit_DsdTest( unsigned * pTruth, int nVars ); extern void Kit_DsdPrintCofactors( unsigned * pTruth, int nVars, int nCofLevel, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nCofLevel = 1; fCofactor = 0; + fProfile = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Nch" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "Npch" ) ) != EOF ) { switch ( c ) { case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nCofLevel = atoi(argv[globalUtilOptind]); @@ -1997,6 +2032,9 @@ int Abc_CommandPrintDsd( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'c': fCofactor ^= 1; break; + case 'p': + fProfile ^= 1; + break; case 'h': goto usage; default: @@ -2006,13 +2044,13 @@ int Abc_CommandPrintDsd( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // get the truth table of the first output if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "Currently works only for logic networks.\n" ); + Abc_Print( -1, "Currently works only for logic networks.\n" ); return 1; } Abc_NtkToAig( pNtk ); @@ -2023,20 +2061,22 @@ int Abc_CommandPrintDsd( Abc_Frame_t * pAbc, int argc, char ** argv ) unsigned * pTruth; if ( !Abc_ObjIsNode(pObj) ) { - fprintf( pErr, "The fanin of the first PO node does not have a logic function.\n" ); + Abc_Print( -1, "The fanin of the first PO node does not have a logic function.\n" ); return 1; } if ( Abc_ObjFaninNum(pObj) > 16 ) { - fprintf( pErr, "Currently works only for up to 16 inputs.\n" ); + Abc_Print( -1, "Currently works only for up to 16 inputs.\n" ); return 1; } - pTruth = Hop_ManConvertAigToTruth( pNtk->pManFunc, Hop_Regular(pObj->pData), Abc_ObjFaninNum(pObj), vMemory, 0 ); - if ( Hop_IsComplement(pObj->pData) ) + pTruth = Hop_ManConvertAigToTruth( (Hop_Man_t *)pNtk->pManFunc, Hop_Regular((Hop_Obj_t *)pObj->pData), Abc_ObjFaninNum(pObj), vMemory, 0 ); + if ( Hop_IsComplement((Hop_Obj_t *)pObj->pData) ) Extra_TruthNot( pTruth, pTruth, Abc_ObjFaninNum(pObj) ); // Extra_PrintBinary( stdout, pTruth, 1 << Abc_ObjFaninNum(pObj) ); -// printf( "\n" ); - if ( fCofactor ) +// Abc_Print( -1, "\n" ); + if ( fProfile ) + Kit_TruthPrintProfile( pTruth, Abc_ObjFaninNum(pObj) ); + else if ( fCofactor ) Kit_DsdPrintCofactors( pTruth, Abc_ObjFaninNum(pObj), nCofLevel, 1 ); else Kit_DsdTest( pTruth, Abc_ObjFaninNum(pObj) ); @@ -2045,11 +2085,12 @@ int Abc_CommandPrintDsd( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: print_dsd [-ch] [-N num]\n" ); - fprintf( pErr, "\t print DSD formula for a single-output function with less than 16 variables\n" ); - fprintf( pErr, "\t-c : toggle recursive cofactoring [default = %s]\n", fCofactor? "yes": "no" ); - fprintf( pErr, "\t-N num : the number of levels to cofactor [default = %d]\n", nCofLevel ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_dsd [-pch] [-N num]\n" ); + Abc_Print( -2, "\t print DSD formula for a single-output function with less than 16 variables\n" ); + Abc_Print( -2, "\t-p : toggle printing profile [default = %s]\n", fProfile? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle recursive cofactoring [default = %s]\n", fCofactor? "yes": "no" ); + Abc_Print( -2, "\t-N num : the number of levels to cofactor [default = %d]\n", nCofLevel ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2066,17 +2107,10 @@ usage: ***********************************************************************/ int Abc_CommandPrintCone( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLibrary; - extern int Abc_NtkDarPrintCone( Abc_Ntk_t * pNtk ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseLibrary = 1; Extra_UtilGetoptReset(); @@ -2095,22 +2129,22 @@ int Abc_CommandPrintCone( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) == 0 ) { - fprintf( pErr, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 1; } Abc_NtkDarPrintCone( pNtk ); return 0; usage: - fprintf( pErr, "usage: print_cone [-h]\n" ); - fprintf( pErr, "\t prints cones of influence info for each primary output\n" ); -// fprintf( pErr, "\t-l : used library gate names (if mapped) [default = %s]\n", fUseLibrary? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_cone [-h]\n" ); + Abc_Print( -2, "\t prints cones of influence info for each primary output\n" ); +// Abc_Print( -2, "\t-l : used library gate names (if mapped) [default = %s]\n", fUseLibrary? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2128,17 +2162,12 @@ usage: ***********************************************************************/ int Abc_CommandPrintMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLibrary; extern void Abc_NtkPrintMiter( Abc_Ntk_t * pNtk ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseLibrary = 1; Extra_UtilGetoptReset(); @@ -2157,21 +2186,65 @@ int Abc_CommandPrintMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "The network is should be structurally hashed.\n" ); + Abc_Print( -1, "The network is should be structurally hashed.\n" ); return 1; } Abc_NtkPrintMiter( pNtk ); return 0; usage: - fprintf( pErr, "usage: print_miter [-h]\n" ); - fprintf( pErr, "\t prints the status of the miter\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: print_miter [-h]\n" ); + Abc_Print( -2, "\t prints the status of the miter\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandPrintStatus( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); + int c; + // set defaults + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) + { + switch ( c ) + { + case 'h': + goto usage; + default: + goto usage; + } + } + printf( "Status = %d Frames = %d ", pAbc->Status, pAbc->nFrames ); + if ( pAbc->pCex == NULL ) + printf( "Cex is not defined.\n" ); + else + printf( "Cex: PIs = %d Regs = %d PO = %d Frame = %d Bits = %d\n", + pAbc->pCex->nPis, pAbc->pCex->nRegs, + pAbc->pCex->iPo, pAbc->pCex->iFrame, + pAbc->pCex->nBits ); + return 0; + +usage: + Abc_Print( -2, "usage: print_status [-h]\n" ); + Abc_Print( -2, "\t prints verification status\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2188,24 +2261,22 @@ usage: ***********************************************************************/ int Abc_CommandShow( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fSeq; int fGateNames; int fUseReverse; + int fFlopDep; extern void Abc_NtkShow( Abc_Ntk_t * pNtk, int fGateNames, int fSeq, int fUseReverse ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); + extern void Abc_NtkShowFlopDependency( Abc_Ntk_t * pNtk ); // set defaults fSeq = 0; fGateNames = 0; fUseReverse = 1; + fFlopDep = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "rsgh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "rsgfh" ) ) != EOF ) { switch ( c ) { @@ -2218,6 +2289,9 @@ int Abc_CommandShow( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'g': fGateNames ^= 1; break; + case 'f': + fFlopDep ^= 1; + break; default: goto usage; } @@ -2225,24 +2299,28 @@ int Abc_CommandShow( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } - Abc_NtkShow( pNtk, fGateNames, fSeq, fUseReverse ); + if ( fFlopDep ) + Abc_NtkShowFlopDependency( pNtk ); + else + Abc_NtkShow( pNtk, fGateNames, fSeq, fUseReverse ); return 0; usage: - fprintf( pErr, "usage: show [-srgh]\n" ); - fprintf( pErr, " visualizes the network structure using DOT and GSVIEW\n" ); + Abc_Print( -2, "usage: show [-srgfh]\n" ); + Abc_Print( -2, " visualizes the network structure using DOT and GSVIEW\n" ); #ifdef WIN32 - fprintf( pErr, " \"dot.exe\" and \"gsview32.exe\" should be set in the paths\n" ); - fprintf( pErr, " (\"gsview32.exe\" may be in \"C:\\Program Files\\Ghostgum\\gsview\\\")\n" ); + Abc_Print( -2, " \"dot.exe\" and \"gsview32.exe\" should be set in the paths\n" ); + Abc_Print( -2, " (\"gsview32.exe\" may be in \"C:\\Program Files\\Ghostgum\\gsview\\\")\n" ); #endif - fprintf( pErr, "\t-s : toggles visualization of sequential networks [default = %s].\n", fSeq? "yes": "no" ); - fprintf( pErr, "\t-r : toggles ordering nodes in reverse order [default = %s].\n", fUseReverse? "yes": "no" ); - fprintf( pErr, "\t-g : toggles printing gate names for mapped network [default = %s].\n", fGateNames? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t-s : toggles visualization of sequential networks [default = %s].\n", fSeq? "yes": "no" ); + Abc_Print( -2, "\t-r : toggles ordering nodes in reverse order [default = %s].\n", fUseReverse? "yes": "no" ); + Abc_Print( -2, "\t-g : toggles printing gate names for mapped network [default = %s].\n", fGateNames? "yes": "no" ); + Abc_Print( -2, "\t-f : toggles visualizing flop dependency graph [default = %s].\n", fFlopDep? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2259,16 +2337,11 @@ usage: ***********************************************************************/ int Abc_CommandShowBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pNode; int c; extern void Abc_NodeShowBdd( Abc_Obj_t * pNode ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -2284,19 +2357,19 @@ int Abc_CommandShowBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsBddLogic(pNtk) ) { - fprintf( pErr, "Visualizing BDDs can only be done for logic BDD networks (run \"bdd\").\n" ); + Abc_Print( -1, "Visualizing BDDs can only be done for logic BDD networks (run \"bdd\").\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { - fprintf( pErr, "Wrong number of auguments.\n" ); + Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } if ( argc == globalUtilOptind ) @@ -2304,7 +2377,7 @@ int Abc_CommandShowBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) pNode = Abc_ObjFanin0( Abc_NtkPo(pNtk, 0) ); if ( !Abc_ObjIsNode(pNode) ) { - fprintf( pErr, "The driver \"%s\" of the first PO is not an internal node.\n", Abc_ObjName(pNode) ); + Abc_Print( -1, "The driver \"%s\" of the first PO is not an internal node.\n", Abc_ObjName(pNode) ); return 1; } } @@ -2313,7 +2386,7 @@ int Abc_CommandShowBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { - fprintf( pErr, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); + Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } } @@ -2321,14 +2394,14 @@ int Abc_CommandShowBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: show_bdd [-h] <node>\n" ); - fprintf( pErr, " visualizes the BDD of a node using DOT and GSVIEW\n" ); + Abc_Print( -2, "usage: show_bdd [-h] <node>\n" ); + Abc_Print( -2, " visualizes the BDD of a node using DOT and GSVIEW\n" ); #ifdef WIN32 - fprintf( pErr, " \"dot.exe\" and \"gsview32.exe\" should be set in the paths\n" ); - fprintf( pErr, " (\"gsview32.exe\" may be in \"C:\\Program Files\\Ghostgum\\gsview\\\")\n" ); + Abc_Print( -2, " \"dot.exe\" and \"gsview32.exe\" should be set in the paths\n" ); + Abc_Print( -2, " (\"gsview32.exe\" may be in \"C:\\Program Files\\Ghostgum\\gsview\\\")\n" ); #endif - fprintf( pErr, "\tnode : the node to consider [default = the driver of the first PO]\n"); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tnode : the node to consider [default = the driver of the first PO]\n"); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2345,18 +2418,13 @@ usage: ***********************************************************************/ int Abc_CommandShowCut( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pNode; int c; int nNodeSizeMax; int nConeSizeMax; extern void Abc_NodeShowCut( Abc_Obj_t * pNode, int nNodeSizeMax, int nConeSizeMax ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nNodeSizeMax = 10; nConeSizeMax = ABC_INFINITY; @@ -2368,7 +2436,7 @@ int Abc_CommandShowCut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nNodeSizeMax = atoi(argv[globalUtilOptind]); @@ -2379,7 +2447,7 @@ int Abc_CommandShowCut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConeSizeMax = atoi(argv[globalUtilOptind]); @@ -2396,41 +2464,41 @@ int Abc_CommandShowCut( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Visualizing cuts only works for AIGs (run \"strash\").\n" ); + Abc_Print( -1, "Visualizing cuts only works for AIGs (run \"strash\").\n" ); return 1; } if ( argc != globalUtilOptind + 1 ) { - fprintf( pErr, "Wrong number of auguments.\n" ); + Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { - fprintf( pErr, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); + Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } Abc_NodeShowCut( pNode, nNodeSizeMax, nConeSizeMax ); return 0; usage: - fprintf( pErr, "usage: show_cut [-N num] [-C num] [-h] <node>\n" ); - fprintf( pErr, " visualizes the cut of a node using DOT and GSVIEW\n" ); + Abc_Print( -2, "usage: show_cut [-N num] [-C num] [-h] <node>\n" ); + Abc_Print( -2, " visualizes the cut of a node using DOT and GSVIEW\n" ); #ifdef WIN32 - fprintf( pErr, " \"dot.exe\" and \"gsview32.exe\" should be set in the paths\n" ); - fprintf( pErr, " (\"gsview32.exe\" may be in \"C:\\Program Files\\Ghostgum\\gsview\\\")\n" ); + Abc_Print( -2, " \"dot.exe\" and \"gsview32.exe\" should be set in the paths\n" ); + Abc_Print( -2, " (\"gsview32.exe\" may be in \"C:\\Program Files\\Ghostgum\\gsview\\\")\n" ); #endif - fprintf( pErr, "\t-N num : the max size of the cut to be computed [default = %d]\n", nNodeSizeMax ); - fprintf( pErr, "\t-C num : the max support of the containing cone [default = %d]\n", nConeSizeMax ); - fprintf( pErr, "\tnode : the node to consider\n"); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t-N num : the max size of the cut to be computed [default = %d]\n", nNodeSizeMax ); + Abc_Print( -2, "\t-C num : the max support of the containing cone [default = %d]\n", nConeSizeMax ); + Abc_Print( -2, "\tnode : the node to consider\n"); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2448,17 +2516,13 @@ usage: ***********************************************************************/ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int fVerbose; int fBddSizeMax; int fDualRail; int fReorder; int c; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults fVerbose = 1; @@ -2473,7 +2537,7 @@ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'B': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-B\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" ); goto usage; } fBddSizeMax = atoi(argv[globalUtilOptind]); @@ -2499,13 +2563,13 @@ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Can only collapse a logic network or an AIG.\n" ); + Abc_Print( -1, "Can only collapse a logic network or an AIG.\n" ); return 1; } @@ -2520,7 +2584,7 @@ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtkRes == NULL ) { - fprintf( pErr, "Collapsing has failed.\n" ); + Abc_Print( -1, "Collapsing has failed.\n" ); return 1; } // replace the current network @@ -2528,13 +2592,13 @@ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: collapse [-B num] [-rdvh]\n" ); - fprintf( pErr, "\t collapses the network by constructing global BDDs\n" ); - fprintf( pErr, "\t-B num : limit on live BDD nodes during collapsing [default = %d]\n", fBddSizeMax ); - fprintf( pErr, "\t-r : toggles dynamic variable reordering [default = %s]\n", fReorder? "yes": "no" ); - fprintf( pErr, "\t-d : toggles dual-rail collapsing mode [default = %s]\n", fDualRail? "yes": "no" ); - fprintf( pErr, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: collapse [-B num] [-rdvh]\n" ); + Abc_Print( -2, "\t collapses the network by constructing global BDDs\n" ); + Abc_Print( -2, "\t-B num : limit on live BDD nodes during collapsing [default = %d]\n", fBddSizeMax ); + Abc_Print( -2, "\t-r : toggles dynamic variable reordering [default = %s]\n", fReorder? "yes": "no" ); + Abc_Print( -2, "\t-d : toggles dual-rail collapsing mode [default = %s]\n", fDualRail? "yes": "no" ); + Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2552,7 +2616,6 @@ usage: ***********************************************************************/ int Abc_CommandStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; Abc_Obj_t * pObj; int c; @@ -2560,11 +2623,7 @@ int Abc_CommandStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) int fRecord; int fCleanup; int fComplOuts; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fAllNodes = 0; fCleanup = 1; @@ -2596,7 +2655,7 @@ int Abc_CommandStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -2604,7 +2663,7 @@ int Abc_CommandStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkStrash( pNtk, fAllNodes, fCleanup, fRecord ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Strashing has failed.\n" ); + Abc_Print( -1, "Strashing has failed.\n" ); return 1; } if ( fComplOuts ) @@ -2615,13 +2674,13 @@ int Abc_CommandStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: strash [-acrih]\n" ); - fprintf( pErr, "\t transforms combinational logic into an AIG\n" ); - fprintf( pErr, "\t-a : toggles between using all nodes and DFS nodes [default = %s]\n", fAllNodes? "all": "DFS" ); - fprintf( pErr, "\t-c : toggles cleanup to remove the dagling AIG nodes [default = %s]\n", fCleanup? "all": "DFS" ); - fprintf( pErr, "\t-r : toggles using the record of AIG subgraphs [default = %s]\n", fRecord? "yes": "no" ); - fprintf( pErr, "\t-i : toggles complementing the COs of the AIG [default = %s]\n", fComplOuts? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: strash [-acrih]\n" ); + Abc_Print( -2, "\t transforms combinational logic into an AIG\n" ); + Abc_Print( -2, "\t-a : toggles between using all nodes and DFS nodes [default = %s]\n", fAllNodes? "all": "DFS" ); + Abc_Print( -2, "\t-c : toggles cleanup to remove the dagling AIG nodes [default = %s]\n", fCleanup? "all": "DFS" ); + Abc_Print( -2, "\t-r : toggles using the record of AIG subgraphs [default = %s]\n", fRecord? "yes": "no" ); + Abc_Print( -2, "\t-i : toggles complementing the COs of the AIG [default = %s]\n", fComplOuts? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2638,19 +2697,15 @@ usage: ***********************************************************************/ int Abc_CommandBalance( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes, * pNtkTemp; int c; - bool fDuplicate; - bool fSelective; - bool fUpdateLevel; + int fDuplicate; + int fSelective; + int fUpdateLevel; int fExor; int fVerbose; extern Abc_Ntk_t * Abc_NtkBalanceExor( Abc_Ntk_t * pNtk, int fUpdateLevel, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults fDuplicate = 0; @@ -2687,7 +2742,7 @@ int Abc_CommandBalance( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network @@ -2703,7 +2758,7 @@ int Abc_CommandBalance( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkTemp = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtkTemp == NULL ) { - fprintf( pErr, "Strashing before balancing has failed.\n" ); + Abc_Print( -1, "Strashing before balancing has failed.\n" ); return 1; } if ( fExor ) @@ -2716,7 +2771,7 @@ int Abc_CommandBalance( Abc_Frame_t * pAbc, int argc, char ** argv ) // check if balancing worked if ( pNtkRes == NULL ) { - fprintf( pErr, "Balancing has failed.\n" ); + Abc_Print( -1, "Balancing has failed.\n" ); return 1; } // replace the current network @@ -2724,14 +2779,14 @@ int Abc_CommandBalance( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: balance [-ldsxvh]\n" ); - fprintf( pErr, "\t transforms the current network into a well-balanced AIG\n" ); - fprintf( pErr, "\t-l : toggle minimizing the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" ); - fprintf( pErr, "\t-s : toggle duplication on the critical paths [default = %s]\n", fSelective? "yes": "no" ); - fprintf( pErr, "\t-x : toggle balancing multi-input EXORs [default = %s]\n", fExor? "yes": "no" ); - fprintf( pErr, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: balance [-ldsxvh]\n" ); + Abc_Print( -2, "\t transforms the current network into a well-balanced AIG\n" ); + Abc_Print( -2, "\t-l : toggle minimizing the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle duplication on the critical paths [default = %s]\n", fSelective? "yes": "no" ); + Abc_Print( -2, "\t-x : toggle balancing multi-input EXORs [default = %s]\n", fExor? "yes": "no" ); + Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2748,16 +2803,12 @@ usage: ***********************************************************************/ int Abc_CommandMuxStruct( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fVerbose; extern Abc_Ntk_t * Abc_NtkMuxRestructure( Abc_Ntk_t * pNtk, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults fVerbose = 0; @@ -2778,13 +2829,13 @@ int Abc_CommandMuxStruct( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Does not work for a logic network.\n" ); + Abc_Print( -1, "Does not work for a logic network.\n" ); return 1; } // check if balancing worked @@ -2792,7 +2843,7 @@ int Abc_CommandMuxStruct( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = NULL; if ( pNtkRes == NULL ) { - fprintf( pErr, "MUX restructuring has failed.\n" ); + Abc_Print( -1, "MUX restructuring has failed.\n" ); return 1; } // replace the current network @@ -2800,10 +2851,10 @@ int Abc_CommandMuxStruct( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: mux_struct [-vh]\n" ); - fprintf( pErr, "\t performs MUX restructuring of the current network\n" ); - fprintf( pErr, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: mux_struct [-vh]\n" ); + Abc_Print( -2, "\t performs MUX restructuring of the current network\n" ); + Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2820,7 +2871,6 @@ usage: ***********************************************************************/ int Abc_CommandMulti( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int nThresh, nFaninMax, c; int fCnf; @@ -2830,8 +2880,6 @@ int Abc_CommandMulti( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkMulti( Abc_Ntk_t * pNtk, int nThresh, int nFaninMax, int fCnf, int fMulti, int fSimple, int fFactor ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults nThresh = 1; @@ -2848,7 +2896,7 @@ int Abc_CommandMulti( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } nThresh = atoi(argv[globalUtilOptind]); @@ -2859,7 +2907,7 @@ int Abc_CommandMulti( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFaninMax = atoi(argv[globalUtilOptind]); @@ -2888,12 +2936,12 @@ int Abc_CommandMulti( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Cannot renode a network that is not an AIG (run \"strash\").\n" ); + Abc_Print( -1, "Cannot renode a network that is not an AIG (run \"strash\").\n" ); return 1; } @@ -2901,7 +2949,7 @@ int Abc_CommandMulti( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkMulti( pNtk, nThresh, nFaninMax, fCnf, fMulti, fSimple, fFactor ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Renoding has failed.\n" ); + Abc_Print( -1, "Renoding has failed.\n" ); return 1; } // replace the current network @@ -2909,18 +2957,18 @@ int Abc_CommandMulti( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: multi [-T num] [-F num] [-msfch]\n" ); - fprintf( pErr, "\t transforms an AIG into a logic network by creating larger nodes\n" ); - fprintf( pErr, "\t-F num : the maximum fanin size after renoding [default = %d]\n", nFaninMax ); - fprintf( pErr, "\t-T num : the threshold for AIG node duplication [default = %d]\n", nThresh ); - fprintf( pErr, "\t (an AIG node is the root of a new node after renoding\n" ); - fprintf( pErr, "\t if this leads to duplication of no more than %d AIG nodes,\n", nThresh ); - fprintf( pErr, "\t that is, if [(numFanouts(Node)-1) * size(MFFC(Node))] <= %d)\n", nThresh ); - fprintf( pErr, "\t-m : creates multi-input AND graph [default = %s]\n", fMulti? "yes": "no" ); - fprintf( pErr, "\t-s : creates a simple AIG (no renoding) [default = %s]\n", fSimple? "yes": "no" ); - fprintf( pErr, "\t-f : creates a factor-cut network [default = %s]\n", fFactor? "yes": "no" ); - fprintf( pErr, "\t-c : performs renoding to derive the CNF [default = %s]\n", fCnf? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: multi [-T num] [-F num] [-msfch]\n" ); + Abc_Print( -2, "\t transforms an AIG into a logic network by creating larger nodes\n" ); + Abc_Print( -2, "\t-F num : the maximum fanin size after renoding [default = %d]\n", nFaninMax ); + Abc_Print( -2, "\t-T num : the threshold for AIG node duplication [default = %d]\n", nThresh ); + Abc_Print( -2, "\t (an AIG node is the root of a new node after renoding\n" ); + Abc_Print( -2, "\t if this leads to duplication of no more than %d AIG nodes,\n", nThresh ); + Abc_Print( -2, "\t that is, if [(numFanouts(Node)-1) * size(MFFC(Node))] <= %d)\n", nThresh ); + Abc_Print( -2, "\t-m : creates multi-input AND graph [default = %s]\n", fMulti? "yes": "no" ); + Abc_Print( -2, "\t-s : creates a simple AIG (no renoding) [default = %s]\n", fSimple? "yes": "no" ); + Abc_Print( -2, "\t-f : creates a factor-cut network [default = %s]\n", fFactor? "yes": "no" ); + Abc_Print( -2, "\t-c : performs renoding to derive the CNF [default = %s]\n", fCnf? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -2937,7 +2985,6 @@ usage: ***********************************************************************/ int Abc_CommandRenode( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int nLutSize, nCutsMax, c; int nFlowIters, nAreaIters; @@ -2950,8 +2997,6 @@ int Abc_CommandRenode( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkRenode( Abc_Ntk_t * pNtk, int nLutSize, int nCutsMax, int nFlowIters, int nAreaIters, int fArea, int fUseBdds, int fUseSops, int fUseCnfs, int fUseMv, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults nLutSize = 8; @@ -2972,7 +3017,7 @@ int Abc_CommandRenode( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); @@ -2983,7 +3028,7 @@ int Abc_CommandRenode( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nCutsMax = atoi(argv[globalUtilOptind]); @@ -2994,7 +3039,7 @@ int Abc_CommandRenode( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by a positive integer.\n" ); goto usage; } nFlowIters = atoi(argv[globalUtilOptind]); @@ -3005,7 +3050,7 @@ int Abc_CommandRenode( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'A': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-A\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-A\" should be followed by a positive integer.\n" ); goto usage; } nAreaIters = atoi(argv[globalUtilOptind]); @@ -3040,30 +3085,30 @@ int Abc_CommandRenode( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( fUseBdds + fUseSops + fUseCnfs + fUseMv > 1 ) { - fprintf( pErr, "Cannot optimize two parameters at the same time.\n" ); + Abc_Print( -1, "Cannot optimize two parameters at the same time.\n" ); return 1; } if ( nLutSize < 3 || nLutSize > IF_MAX_FUNC_LUTSIZE ) { - fprintf( pErr, "Incorrect LUT size (%d).\n", nLutSize ); + Abc_Print( -1, "Incorrect LUT size (%d).\n", nLutSize ); return 1; } if ( nCutsMax < 1 || nCutsMax >= (1<<12) ) { - fprintf( pErr, "Incorrect number of cuts.\n" ); + Abc_Print( -1, "Incorrect number of cuts.\n" ); return 1; } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Cannot renode a network that is not an AIG (run \"strash\").\n" ); + Abc_Print( -1, "Cannot renode a network that is not an AIG (run \"strash\").\n" ); return 1; } @@ -3071,7 +3116,7 @@ int Abc_CommandRenode( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkRenode( pNtk, nLutSize, nCutsMax, nFlowIters, nAreaIters, fArea, fUseBdds, fUseSops, fUseCnfs, fUseMv, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Renoding has failed.\n" ); + Abc_Print( -1, "Renoding has failed.\n" ); return 1; } // replace the current network @@ -3079,20 +3124,20 @@ int Abc_CommandRenode( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: renode [-K num] [-C num] [-F num] [-A num] [-sbciav]\n" ); - fprintf( pErr, "\t transforms the AIG into a logic network with larger nodes\n" ); - fprintf( pErr, "\t while minimizing the number of FF literals of the node SOPs\n" ); - fprintf( pErr, "\t-K num : the max cut size for renoding (2 < num < %d) [default = %d]\n", IF_MAX_FUNC_LUTSIZE+1, nLutSize ); - fprintf( pErr, "\t-C num : the max number of cuts used at a node (0 < num < 2^12) [default = %d]\n", nCutsMax ); - fprintf( pErr, "\t-F num : the number of area flow recovery iterations (num >= 0) [default = %d]\n", nFlowIters ); - fprintf( pErr, "\t-A num : the number of exact area recovery iterations (num >= 0) [default = %d]\n", nAreaIters ); - fprintf( pErr, "\t-s : toggles minimizing SOP cubes instead of FF lits [default = %s]\n", fUseSops? "yes": "no" ); - fprintf( pErr, "\t-b : toggles minimizing BDD nodes instead of FF lits [default = %s]\n", fUseBdds? "yes": "no" ); - fprintf( pErr, "\t-c : toggles minimizing CNF clauses instead of FF lits [default = %s]\n", fUseCnfs? "yes": "no" ); - fprintf( pErr, "\t-i : toggles minimizing MV-SOP instead of FF lits [default = %s]\n", fUseMv? "yes": "no" ); - fprintf( pErr, "\t-a : toggles area-oriented mapping [default = %s]\n", fArea? "yes": "no" ); - fprintf( pErr, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: renode [-K num] [-C num] [-F num] [-A num] [-sbciav]\n" ); + Abc_Print( -2, "\t transforms the AIG into a logic network with larger nodes\n" ); + Abc_Print( -2, "\t while minimizing the number of FF literals of the node SOPs\n" ); + Abc_Print( -2, "\t-K num : the max cut size for renoding (2 < num < %d) [default = %d]\n", IF_MAX_FUNC_LUTSIZE+1, nLutSize ); + Abc_Print( -2, "\t-C num : the max number of cuts used at a node (0 < num < 2^12) [default = %d]\n", nCutsMax ); + Abc_Print( -2, "\t-F num : the number of area flow recovery iterations (num >= 0) [default = %d]\n", nFlowIters ); + Abc_Print( -2, "\t-A num : the number of exact area recovery iterations (num >= 0) [default = %d]\n", nAreaIters ); + Abc_Print( -2, "\t-s : toggles minimizing SOP cubes instead of FF lits [default = %s]\n", fUseSops? "yes": "no" ); + Abc_Print( -2, "\t-b : toggles minimizing BDD nodes instead of FF lits [default = %s]\n", fUseBdds? "yes": "no" ); + Abc_Print( -2, "\t-c : toggles minimizing CNF clauses instead of FF lits [default = %s]\n", fUseCnfs? "yes": "no" ); + Abc_Print( -2, "\t-i : toggles minimizing MV-SOP instead of FF lits [default = %s]\n", fUseMv? "yes": "no" ); + Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", fArea? "yes": "no" ); + Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -3109,7 +3154,6 @@ usage: ***********************************************************************/ int Abc_CommandCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fCleanupPis; @@ -3119,8 +3163,6 @@ int Abc_CommandCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarCleanupAig( Abc_Ntk_t * pNtk, int fCleanupPis, int fCleanupPos, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults fCleanupPis = 1; @@ -3149,14 +3191,14 @@ int Abc_CommandCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsStrash(pNtk) ) { if ( !fCleanupPos && !fCleanupPos ) { - printf( "Cleanup for PIs and POs is not enabled.\n" ); + Abc_Print( -1, "Cleanup for PIs and POs is not enabled.\n" ); pNtkRes = Abc_NtkDup( pNtk ); } else @@ -3169,7 +3211,7 @@ int Abc_CommandCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtkRes == NULL ) { - fprintf( pErr, "Cleanup has failed.\n" ); + Abc_Print( -1, "Cleanup has failed.\n" ); return 1; } // replace the current network @@ -3177,13 +3219,13 @@ int Abc_CommandCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: cleanup [-iovh]\n" ); - fprintf( pErr, "\t for logic networks, removes dangling combinatinal logic\n" ); - fprintf( pErr, "\t for AIGs, removes PIs w/o fanout and POs driven by const-0\n" ); - fprintf( pErr, "\t-i : toggles removing PIs without fanout [default = %s]\n", fCleanupPis? "yes": "no" ); - fprintf( pErr, "\t-o : toggles removing POs with const-0 drivers [default = %s]\n", fCleanupPos? "yes": "no" ); - fprintf( pErr, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: cleanup [-iovh]\n" ); + Abc_Print( -2, "\t for logic networks, removes dangling combinatinal logic\n" ); + Abc_Print( -2, "\t for AIGs, removes PIs w/o fanout and POs driven by const-0\n" ); + Abc_Print( -2, "\t-i : toggles removing PIs without fanout [default = %s]\n", fCleanupPis? "yes": "no" ); + Abc_Print( -2, "\t-o : toggles removing POs with const-0 drivers [default = %s]\n", fCleanupPos? "yes": "no" ); + Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -3200,14 +3242,9 @@ usage: ***********************************************************************/ int Abc_CommandSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -3223,12 +3260,12 @@ int Abc_CommandSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "The classical (SIS-like) sweep can only be performed on a logic network.\n" ); + Abc_Print( -1, "The classical (SIS-like) sweep can only be performed on a logic network.\n" ); return 1; } // modify the current network @@ -3236,9 +3273,9 @@ int Abc_CommandSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: sweep [-h]\n" ); - fprintf( pErr, "\t removes dangling nodes; propagates constant, buffers, inverters\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: sweep [-h]\n" ); + Abc_Print( -2, "\t removes dangling nodes; propagates constant, buffers, inverters\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -3256,17 +3293,12 @@ usage: ***********************************************************************/ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) { - Abc_Ntk_t * pNtk; - FILE * pOut, * pErr; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Fxu_Data_t * p = NULL; int c; - extern bool Abc_NtkFastExtract( Abc_Ntk_t * pNtk, Fxu_Data_t * p ); + extern int Abc_NtkFastExtract( Abc_Ntk_t * pNtk, Fxu_Data_t * p ); extern void Abc_NtkFxuFreeInfo( Fxu_Data_t * p ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // allocate the structure p = ABC_ALLOC( Fxu_Data_t, 1 ); memset( p, 0, sizeof(Fxu_Data_t) ); @@ -3287,7 +3319,7 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } p->nSingleMax = atoi(argv[globalUtilOptind]); @@ -3298,7 +3330,7 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } p->nPairsMax = atoi(argv[globalUtilOptind]); @@ -3309,7 +3341,7 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } p->nNodesExt = atoi(argv[globalUtilOptind]); @@ -3342,21 +3374,21 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); Abc_NtkFxuFreeInfo( p ); return 1; } if ( Abc_NtkNodeNum(pNtk) == 0 ) { - fprintf( pErr, "The network does not have internal nodes.\n" ); + Abc_Print( -1, "The network does not have internal nodes.\n" ); Abc_NtkFxuFreeInfo( p ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "Fast extract can only be applied to a logic network (run \"renode\").\n" ); + Abc_Print( -1, "Fast extract can only be applied to a logic network (run \"renode\").\n" ); Abc_NtkFxuFreeInfo( p ); return 1; } @@ -3368,17 +3400,17 @@ int Abc_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: fx [-SDN num] [-sdzcvh]\n"); - fprintf( pErr, "\t performs unate fast extract on the current network\n"); - fprintf( pErr, "\t-S num : max number of single-cube divisors to consider [default = %d]\n", p->nSingleMax ); - fprintf( pErr, "\t-D num : max number of double-cube divisors to consider [default = %d]\n", p->nPairsMax ); - fprintf( pErr, "\t-N num : the maximum number of divisors to extract [default = %d]\n", p->nNodesExt ); - fprintf( pErr, "\t-s : use only single-cube divisors [default = %s]\n", p->fOnlyS? "yes": "no" ); - fprintf( pErr, "\t-d : use only double-cube divisors [default = %s]\n", p->fOnlyD? "yes": "no" ); - fprintf( pErr, "\t-z : use zero-weight divisors [default = %s]\n", p->fUse0? "yes": "no" ); - fprintf( pErr, "\t-c : use complement in the binary case [default = %s]\n", p->fUseCompl? "yes": "no" ); - fprintf( pErr, "\t-v : print verbose information [default = %s]\n", p->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: fx [-SDN num] [-sdzcvh]\n"); + Abc_Print( -2, "\t performs unate fast extract on the current network\n"); + Abc_Print( -2, "\t-S num : max number of single-cube divisors to consider [default = %d]\n", p->nSingleMax ); + Abc_Print( -2, "\t-D num : max number of double-cube divisors to consider [default = %d]\n", p->nPairsMax ); + Abc_Print( -2, "\t-N num : the maximum number of divisors to extract [default = %d]\n", p->nNodesExt ); + Abc_Print( -2, "\t-s : use only single-cube divisors [default = %s]\n", p->fOnlyS? "yes": "no" ); + Abc_Print( -2, "\t-d : use only double-cube divisors [default = %s]\n", p->fOnlyD? "yes": "no" ); + Abc_Print( -2, "\t-z : use zero-weight divisors [default = %s]\n", p->fUse0? "yes": "no" ); + Abc_Print( -2, "\t-c : use complement in the binary case [default = %s]\n", p->fUseCompl? "yes": "no" ); + Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", p->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); Abc_NtkFxuFreeInfo( p ); return 1; } @@ -3396,18 +3428,13 @@ usage: ***********************************************************************/ int Abc_CommandEliminate( Abc_Frame_t * pAbc, int argc, char ** argv ) { - Abc_Ntk_t * pNtk; - FILE * pOut, * pErr; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int nMaxSize; int fReverse; int fVerbose; int c; extern int Abc_NtkEliminate( Abc_Ntk_t * pNtk, int nMaxSize, int fReverse, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set the defaults nMaxSize = 8; fReverse = 0; @@ -3420,7 +3447,7 @@ int Abc_CommandEliminate( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" ); goto usage; } nMaxSize = atoi(argv[globalUtilOptind]); @@ -3444,19 +3471,19 @@ int Abc_CommandEliminate( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkNodeNum(pNtk) == 0 ) { - fprintf( pErr, "The network does not have internal nodes.\n" ); + Abc_Print( -1, "The network does not have internal nodes.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "This command can only be applied to a logic network (run \"renode\" or \"if\").\n" ); + Abc_Print( -1, "This command can only be applied to a logic network (run \"renode\" or \"if\").\n" ); return 1; } @@ -3465,12 +3492,12 @@ int Abc_CommandEliminate( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: eliminate [-N num] [-rvh]\n"); - fprintf( pErr, "\t greedily eliminates nodes by collapsing them into fanouts\n"); - fprintf( pErr, "\t-N num : the maximum support size after collapsing [default = %d]\n", nMaxSize ); - fprintf( pErr, "\t-r : use the reverse topological order [default = %s]\n", fReverse? "yes": "no" ); - fprintf( pErr, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: eliminate [-N num] [-rvh]\n"); + Abc_Print( -2, "\t greedily eliminates nodes by collapsing them into fanouts\n"); + Abc_Print( -2, "\t-N num : the maximum support size after collapsing [default = %d]\n", nMaxSize ); + Abc_Print( -2, "\t-r : use the reverse topological order [default = %s]\n", fReverse? "yes": "no" ); + Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -3487,17 +3514,13 @@ usage: ***********************************************************************/ int Abc_CommandDisjoint( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes, * pNtkNew; int fGlobal, fRecursive, fVerbose, fPrint, fShort, c; - extern Abc_Ntk_t * Abc_NtkDsdGlobal( Abc_Ntk_t * pNtk, bool fVerbose, bool fPrint, bool fShort ); - extern int Abc_NtkDsdLocal( Abc_Ntk_t * pNtk, bool fVerbose, bool fRecursive ); + extern Abc_Ntk_t * Abc_NtkDsdGlobal( Abc_Ntk_t * pNtk, int fVerbose, int fPrint, int fShort ); + extern int Abc_NtkDsdLocal( Abc_Ntk_t * pNtk, int fVerbose, int fRecursive ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fGlobal = 1; fRecursive = 0; @@ -3534,13 +3557,13 @@ int Abc_CommandDisjoint( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( fGlobal ) { -// fprintf( stdout, "Performing DSD of global functions of the network.\n" ); +// Abc_Print( -1, "Performing DSD of global functions of the network.\n" ); // get the new network if ( !Abc_NtkIsStrash(pNtk) ) { @@ -3554,7 +3577,7 @@ int Abc_CommandDisjoint( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtkRes == NULL ) { - fprintf( pErr, "Global DSD has failed.\n" ); + Abc_Print( -1, "Global DSD has failed.\n" ); return 1; } // replace the current network @@ -3564,35 +3587,35 @@ int Abc_CommandDisjoint( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( !Abc_NtkIsBddLogic( pNtk ) ) { - fprintf( pErr, "This command is only applicable to logic BDD networks.\n" ); + Abc_Print( -1, "This command is only applicable to logic BDD networks.\n" ); return 1; } - fprintf( stdout, "Performing recursive DSD and MUX decomposition of local functions.\n" ); + Abc_Print( -1, "Performing recursive DSD and MUX decomposition of local functions.\n" ); if ( !Abc_NtkDsdLocal( pNtk, fVerbose, fRecursive ) ) - fprintf( pErr, "Recursive DSD has failed.\n" ); + Abc_Print( -1, "Recursive DSD has failed.\n" ); } else { if ( !Abc_NtkIsBddLogic( pNtk ) ) { - fprintf( pErr, "This command is only applicable to logic BDD networks (run \"bdd\").\n" ); + Abc_Print( -1, "This command is only applicable to logic BDD networks (run \"bdd\").\n" ); return 1; } - fprintf( stdout, "Performing simple non-recursive DSD of local functions.\n" ); + Abc_Print( -1, "Performing simple non-recursive DSD of local functions.\n" ); if ( !Abc_NtkDsdLocal( pNtk, fVerbose, fRecursive ) ) - fprintf( pErr, "Simple DSD of local functions has failed.\n" ); + Abc_Print( -1, "Simple DSD of local functions has failed.\n" ); } return 0; usage: - fprintf( pErr, "usage: dsd [-grvpsh]\n" ); - fprintf( pErr, "\t decomposes the network using disjoint-support decomposition\n" ); - fprintf( pErr, "\t-g : toggle DSD of global and local functions [default = %s]\n", fGlobal? "global": "local" ); - fprintf( pErr, "\t-r : toggle recursive DSD/MUX and simple DSD [default = %s]\n", fRecursive? "recursive DSD/MUX": "simple DSD" ); - fprintf( pErr, "\t-v : prints DSD statistics and runtime [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-p : prints DSD structure to the standard output [default = %s]\n", fPrint? "yes": "no" ); - fprintf( pErr, "\t-s : use short PI names when printing DSD structure [default = %s]\n", fShort? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dsd [-grvpsh]\n" ); + Abc_Print( -2, "\t decomposes the network using disjoint-support decomposition\n" ); + Abc_Print( -2, "\t-g : toggle DSD of global and local functions [default = %s]\n", fGlobal? "global": "local" ); + Abc_Print( -2, "\t-r : toggle recursive DSD/MUX and simple DSD [default = %s]\n", fRecursive? "recursive DSD/MUX": "simple DSD" ); + Abc_Print( -2, "\t-v : prints DSD statistics and runtime [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-p : prints DSD structure to the standard output [default = %s]\n", fPrint? "yes": "no" ); + Abc_Print( -2, "\t-s : use short PI names when printing DSD structure [default = %s]\n", fShort? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -3609,15 +3632,11 @@ usage: ***********************************************************************/ int Abc_CommandLutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Lpk_Par_t Pars, * pPars = &Pars; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults memset( pPars, 0, sizeof(Lpk_Par_t) ); pPars->nLutsMax = 4; // (N) the maximum number of LUTs in the structure @@ -3638,7 +3657,7 @@ int Abc_CommandLutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nLutsMax = atoi(argv[globalUtilOptind]); @@ -3649,7 +3668,7 @@ int Abc_CommandLutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'Q': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-Q\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-Q\" should be followed by an integer.\n" ); goto usage; } pPars->nLutsOver = atoi(argv[globalUtilOptind]); @@ -3660,7 +3679,7 @@ int Abc_CommandLutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nVarsShared = atoi(argv[globalUtilOptind]); @@ -3671,7 +3690,7 @@ int Abc_CommandLutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nGrowthLevel = atoi(argv[globalUtilOptind]); @@ -3706,45 +3725,45 @@ int Abc_CommandLutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "This command can only be applied to a logic network.\n" ); + Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } if ( pPars->nVarsShared < 0 || pPars->nVarsShared > 3 ) { - fprintf( pErr, "The number of shared variables (%d) is not in the range 0 <= S <= 3.\n", pPars->nVarsShared ); + Abc_Print( -1, "The number of shared variables (%d) is not in the range 0 <= S <= 3.\n", pPars->nVarsShared ); return 1; } // modify the current network if ( !Lpk_Resynthesize( pNtk, pPars ) ) { - fprintf( pErr, "Resynthesis has failed.\n" ); + Abc_Print( -1, "Resynthesis has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: lutpack [-N <num>] [-Q <num>] [-S <num>] [-L <num>] [-szfovwh]\n" ); - fprintf( pErr, "\t performs \"rewriting\" for LUT network;\n" ); - fprintf( pErr, "\t determines LUT size as the max fanin count of a node;\n" ); - fprintf( pErr, "\t if the network is not LUT-mapped, packs it into 6-LUTs\n" ); - fprintf( pErr, "\t (there is another command for resynthesis after LUT mapping, \"imfs\")\n" ); - fprintf( pErr, "\t-N <num> : the max number of LUTs in the structure (2 <= num) [default = %d]\n", pPars->nLutsMax ); - fprintf( pErr, "\t-Q <num> : the max number of LUTs not in MFFC (0 <= num) [default = %d]\n", pPars->nLutsOver ); - fprintf( pErr, "\t-S <num> : the max number of LUT inputs shared (0 <= num <= 3) [default = %d]\n", pPars->nVarsShared ); - fprintf( pErr, "\t-L <num> : max level increase after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); - fprintf( pErr, "\t-s : toggle iteration till saturation [default = %s]\n", pPars->fSatur? "yes": "no" ); - fprintf( pErr, "\t-z : toggle zero-cost replacements [default = %s]\n", pPars->fZeroCost? "yes": "no" ); - fprintf( pErr, "\t-f : toggle using only first node and first cut [default = %s]\n", pPars->fFirst? "yes": "no" ); - fprintf( pErr, "\t-o : toggle using old implementation [default = %s]\n", pPars->fOldAlgo? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggle detailed printout of decomposed functions [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: lutpack [-N <num>] [-Q <num>] [-S <num>] [-L <num>] [-szfovwh]\n" ); + Abc_Print( -2, "\t performs \"rewriting\" for LUT network;\n" ); + Abc_Print( -2, "\t determines LUT size as the max fanin count of a node;\n" ); + Abc_Print( -2, "\t if the network is not LUT-mapped, packs it into 6-LUTs\n" ); + Abc_Print( -2, "\t (there is another command for resynthesis after LUT mapping, \"imfs\")\n" ); + Abc_Print( -2, "\t-N <num> : the max number of LUTs in the structure (2 <= num) [default = %d]\n", pPars->nLutsMax ); + Abc_Print( -2, "\t-Q <num> : the max number of LUTs not in MFFC (0 <= num) [default = %d]\n", pPars->nLutsOver ); + Abc_Print( -2, "\t-S <num> : the max number of LUT inputs shared (0 <= num <= 3) [default = %d]\n", pPars->nVarsShared ); + Abc_Print( -2, "\t-L <num> : max level increase after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); + Abc_Print( -2, "\t-s : toggle iteration till saturation [default = %s]\n", pPars->fSatur? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle zero-cost replacements [default = %s]\n", pPars->fZeroCost? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle using only first node and first cut [default = %s]\n", pPars->fFirst? "yes": "no" ); + Abc_Print( -2, "\t-o : toggle using old implementation [default = %s]\n", pPars->fOldAlgo? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle detailed printout of decomposed functions [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -3761,7 +3780,6 @@ usage: ***********************************************************************/ int Abc_CommandLutmin( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int nLutSize; @@ -3769,9 +3787,6 @@ int Abc_CommandLutmin( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkLutmin( Abc_Ntk_t * pNtk, int nLutSize, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nLutSize = 4; fVerbose = 0; @@ -3783,7 +3798,7 @@ int Abc_CommandLutmin( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); @@ -3800,14 +3815,14 @@ int Abc_CommandLutmin( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // modify the current network pNtkRes = Abc_NtkLutmin( pNtk, nLutSize, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "The command has failed.\n" ); + Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network @@ -3815,13 +3830,13 @@ int Abc_CommandLutmin( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: lutmin [-K <num>] [-vh]\n" ); - fprintf( pErr, "\t perform FPGA mapping while minimizing the LUT count\n" ); - fprintf( pErr, "\t as described in the paper T. Sasao and A. Mishchenko:\n" ); - fprintf( pErr, "\t \"On the number of LUTs to implement logic functions\".\n" ); - fprintf( pErr, "\t-K <num> : the LUT size to use for the mapping (2 <= num) [default = %d]\n", nLutSize ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: lutmin [-K <num>] [-vh]\n" ); + Abc_Print( -2, "\t perform FPGA mapping while minimizing the LUT count\n" ); + Abc_Print( -2, "\t as described in the paper T. Sasao and A. Mishchenko:\n" ); + Abc_Print( -2, "\t \"On the number of LUTs to implement logic functions\".\n" ); + Abc_Print( -2, "\t-K <num> : the LUT size to use for the mapping (2 <= num) [default = %d]\n", nLutSize ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -3838,18 +3853,10 @@ usage: ***********************************************************************/ int Abc_CommandImfs( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Res_Par_t Pars, * pPars = &Pars; int c; -// printf( "Implementation of this command is not finished.\n" ); -// return 1; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults pPars->nWindow = 62; pPars->nCands = 5; @@ -3866,7 +3873,7 @@ int Abc_CommandImfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nWindow = atoi(argv[globalUtilOptind]); @@ -3877,7 +3884,7 @@ int Abc_CommandImfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nSimWords = atoi(argv[globalUtilOptind]); @@ -3888,7 +3895,7 @@ int Abc_CommandImfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nCands = atoi(argv[globalUtilOptind]); @@ -3899,7 +3906,7 @@ int Abc_CommandImfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nGrowthLevel = atoi(argv[globalUtilOptind]); @@ -3925,35 +3932,35 @@ int Abc_CommandImfs( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "This command can only be applied to a logic network.\n" ); + Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } // modify the current network if ( !Abc_NtkResynthesize( pNtk, pPars ) ) { - fprintf( pErr, "Resynthesis has failed.\n" ); + Abc_Print( -1, "Resynthesis has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: imfs [-W <NM>] [-L <num>] [-C <num>] [-S <num>] [-avwh]\n" ); - fprintf( pErr, "\t performs resubstitution-based resynthesis with interpolation\n" ); - fprintf( pErr, "\t (there is another command for resynthesis after LUT mapping, \"lutpack\")\n" ); - fprintf( pErr, "\t-W <NM> : fanin/fanout levels (NxM) of the window (00 <= NM <= 99) [default = %d%d]\n", pPars->nWindow/10, pPars->nWindow%10 ); - fprintf( pErr, "\t-C <num> : the max number of resub candidates (1 <= n) [default = %d]\n", pPars->nCands ); - fprintf( pErr, "\t-S <num> : the number of simulation words (1 <= n <= 256) [default = %d]\n", pPars->nSimWords ); - fprintf( pErr, "\t-L <num> : the max increase in node level after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); - fprintf( pErr, "\t-a : toggle optimization for area only [default = %s]\n", pPars->fArea? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggle printout subgraph statistics [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: imfs [-W <NM>] [-L <num>] [-C <num>] [-S <num>] [-avwh]\n" ); + Abc_Print( -2, "\t performs resubstitution-based resynthesis with interpolation\n" ); + Abc_Print( -2, "\t (there is another command for resynthesis after LUT mapping, \"lutpack\")\n" ); + Abc_Print( -2, "\t-W <NM> : fanin/fanout levels (NxM) of the window (00 <= NM <= 99) [default = %d%d]\n", pPars->nWindow/10, pPars->nWindow%10 ); + Abc_Print( -2, "\t-C <num> : the max number of resub candidates (1 <= n) [default = %d]\n", pPars->nCands ); + Abc_Print( -2, "\t-S <num> : the number of simulation words (1 <= n <= 256) [default = %d]\n", pPars->nSimWords ); + Abc_Print( -2, "\t-L <num> : the max increase in node level after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); + Abc_Print( -2, "\t-a : toggle optimization for area only [default = %s]\n", pPars->fArea? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printout subgraph statistics [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -3970,18 +3977,9 @@ usage: ***********************************************************************/ int Abc_CommandMfs( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Mfs_Par_t Pars, * pPars = &Pars; int c; - -// printf( "Implementation of this command is not finished.\n" ); -// return 1; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Abc_NtkMfsParsDefault( pPars ); Extra_UtilGetoptReset(); @@ -3992,7 +3990,7 @@ int Abc_CommandMfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nWinTfoLevs = atoi(argv[globalUtilOptind]); @@ -4003,7 +4001,7 @@ int Abc_CommandMfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFanoutsMax = atoi(argv[globalUtilOptind]); @@ -4014,7 +4012,7 @@ int Abc_CommandMfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nDepthMax = atoi(argv[globalUtilOptind]); @@ -4025,7 +4023,7 @@ int Abc_CommandMfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'M': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-M\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nWinSizeMax = atoi(argv[globalUtilOptind]); @@ -4036,7 +4034,7 @@ int Abc_CommandMfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nGrowthLevel = atoi(argv[globalUtilOptind]); @@ -4047,7 +4045,7 @@ int Abc_CommandMfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -4091,42 +4089,42 @@ int Abc_CommandMfs( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "This command can only be applied to a logic network.\n" ); + Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } // modify the current network if ( !Abc_NtkMfs( pNtk, pPars ) ) { - fprintf( pErr, "Resynthesis has failed.\n" ); + Abc_Print( -1, "Resynthesis has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: mfs [-WFDMLC <num>] [-raestpgvh]\n" ); - fprintf( pErr, "\t performs don't-care-based optimization of logic networks\n" ); - fprintf( pErr, "\t-W <num> : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nWinTfoLevs ); - fprintf( pErr, "\t-F <num> : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutsMax ); - fprintf( pErr, "\t-D <num> : the max depth nodes to try (0 = no limit) [default = %d]\n", pPars->nDepthMax ); - fprintf( pErr, "\t-M <num> : the max node count of windows to consider (0 = no limit) [default = %d]\n", pPars->nWinSizeMax ); - fprintf( pErr, "\t-L <num> : the max increase in node level after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); - fprintf( pErr, "\t-C <num> : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit ); - fprintf( pErr, "\t-r : toggle resubstitution and dc-minimization [default = %s]\n", pPars->fResub? "resub": "dc-min" ); - fprintf( pErr, "\t-a : toggle minimizing area or area+edges [default = %s]\n", pPars->fArea? "area": "area+edges" ); - fprintf( pErr, "\t-e : toggle high-effort resubstitution [default = %s]\n", pPars->fMoreEffort? "yes": "no" ); - fprintf( pErr, "\t-s : toggle evaluation of edge swapping [default = %s]\n", pPars->fSwapEdge? "yes": "no" ); - fprintf( pErr, "\t-t : toggle using artificial one-hotness conditions [default = %s]\n", pPars->fOneHotness? "yes": "no" ); - fprintf( pErr, "\t-p : toggle power-aware optimization [default = %s]\n", pPars->fPower? "yes": "no" ); - fprintf( pErr, "\t-g : toggle using new SAT solver [default = %s]\n", pPars->fGiaSat? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: mfs [-WFDMLC <num>] [-raestpgvh]\n" ); + Abc_Print( -2, "\t performs don't-care-based optimization of logic networks\n" ); + Abc_Print( -2, "\t-W <num> : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nWinTfoLevs ); + Abc_Print( -2, "\t-F <num> : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutsMax ); + Abc_Print( -2, "\t-D <num> : the max depth nodes to try (0 = no limit) [default = %d]\n", pPars->nDepthMax ); + Abc_Print( -2, "\t-M <num> : the max node count of windows to consider (0 = no limit) [default = %d]\n", pPars->nWinSizeMax ); + Abc_Print( -2, "\t-L <num> : the max increase in node level after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); + Abc_Print( -2, "\t-C <num> : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-r : toggle resubstitution and dc-minimization [default = %s]\n", pPars->fResub? "resub": "dc-min" ); + Abc_Print( -2, "\t-a : toggle minimizing area or area+edges [default = %s]\n", pPars->fArea? "area": "area+edges" ); + Abc_Print( -2, "\t-e : toggle high-effort resubstitution [default = %s]\n", pPars->fMoreEffort? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle evaluation of edge swapping [default = %s]\n", pPars->fSwapEdge? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle using artificial one-hotness conditions [default = %s]\n", pPars->fOneHotness? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle power-aware optimization [default = %s]\n", pPars->fPower? "yes": "no" ); + Abc_Print( -2, "\t-g : toggle using new SAT solver [default = %s]\n", pPars->fGiaSat? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -4144,17 +4142,12 @@ usage: ***********************************************************************/ int Abc_CommandTrace( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLutLib; int fVerbose; extern void Abc_NtkDelayTracePrint( Abc_Ntk_t * pNtk, int fUseLutLib, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseLutLib = 0; fVerbose = 0; @@ -4178,12 +4171,12 @@ int Abc_CommandTrace( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "This command can only be applied to a logic network.\n" ); + Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } @@ -4192,11 +4185,11 @@ int Abc_CommandTrace( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: trace [-lvh]\n" ); - fprintf( pErr, "\t performs delay trace of LUT-mapped network\n" ); - fprintf( pErr, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib": "unit" ); - fprintf( pErr, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: trace [-lvh]\n" ); + Abc_Print( -2, "\t performs delay trace of LUT-mapped network\n" ); + Abc_Print( -2, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib": "unit" ); + Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -4213,7 +4206,6 @@ usage: ***********************************************************************/ int Abc_CommandSpeedup( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fUseLutLib; @@ -4222,10 +4214,7 @@ int Abc_CommandSpeedup( Abc_Frame_t * pAbc, int argc, char ** argv ) int fVerbose; int fVeryVerbose; extern Abc_Ntk_t * Abc_NtkSpeedup( Abc_Ntk_t * pNtk, int fUseLutLib, int Percentage, int Degree, int fVerbose, int fVeryVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults fUseLutLib = 0; @@ -4241,7 +4230,7 @@ int Abc_CommandSpeedup( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } Percentage = atoi(argv[globalUtilOptind]); @@ -4252,7 +4241,7 @@ int Abc_CommandSpeedup( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } Degree = atoi(argv[globalUtilOptind]); @@ -4278,12 +4267,12 @@ int Abc_CommandSpeedup( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "This command can only be applied to a logic network.\n" ); + Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } @@ -4291,7 +4280,7 @@ int Abc_CommandSpeedup( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkSpeedup( pNtk, fUseLutLib, Percentage, Degree, fVerbose, fVeryVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "The command has failed.\n" ); + Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network @@ -4299,15 +4288,15 @@ int Abc_CommandSpeedup( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: speedup [-P num] [-N num] [-lvwh]\n" ); - fprintf( pErr, "\t transforms LUT-mapped network into an AIG with choices;\n" ); - fprintf( pErr, "\t the choices are added to speedup the next round of mapping\n" ); - fprintf( pErr, "\t-P <num> : delay delta defining critical path for library model [default = %d%%]\n", Percentage ); - fprintf( pErr, "\t-N <num> : the max critical path degree for resynthesis (0 < num < 6) [default = %d]\n", Degree ); - fprintf( pErr, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib" : "unit" ); - fprintf( pErr, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggle printing detailed stats for each node [default = %s]\n", fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: speedup [-P num] [-N num] [-lvwh]\n" ); + Abc_Print( -2, "\t transforms LUT-mapped network into an AIG with choices;\n" ); + Abc_Print( -2, "\t the choices are added to speedup the next round of mapping\n" ); + Abc_Print( -2, "\t-P <num> : delay delta defining critical path for library model [default = %d%%]\n", Percentage ); + Abc_Print( -2, "\t-N <num> : the max critical path degree for resynthesis (0 < num < 6) [default = %d]\n", Degree ); + Abc_Print( -2, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib" : "unit" ); + Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -4324,7 +4313,6 @@ usage: ***********************************************************************/ int Abc_CommandPowerdown( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fUseLutLib; @@ -4335,9 +4323,6 @@ int Abc_CommandPowerdown( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkPowerdown( Abc_Ntk_t * pNtk, int fUseLutLib, int Percentage, int Degree, int fVerbose, int fVeryVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseLutLib = 0; Percentage =10; @@ -4352,7 +4337,7 @@ int Abc_CommandPowerdown( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } Percentage = atoi(argv[globalUtilOptind]); @@ -4363,7 +4348,7 @@ int Abc_CommandPowerdown( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } Degree = atoi(argv[globalUtilOptind]); @@ -4389,12 +4374,12 @@ int Abc_CommandPowerdown( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "This command can only be applied to a logic network.\n" ); + Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } @@ -4402,7 +4387,7 @@ int Abc_CommandPowerdown( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkPowerdown( pNtk, fUseLutLib, Percentage, Degree, fVerbose, fVeryVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "The command has failed.\n" ); + Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network @@ -4410,16 +4395,16 @@ int Abc_CommandPowerdown( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: powerdown [-P num] [-N num] [-vwh]\n" ); - fprintf( pErr, "\t transforms LUT-mapped network into an AIG with choices;\n" ); - fprintf( pErr, "\t the choices are added to power down the next round of mapping\n" ); - fprintf( pErr, "\t-P <num> : switching propability delta defining power critical edges [default = %d%%]\n", Percentage ); - fprintf( pErr, "\t (e.g. 5% means hot wires switch with probability: 0.45 <= p <= 0.50 (max)\n" ); - fprintf( pErr, "\t-N <num> : the max critical path degree for resynthesis (0 < num < 6) [default = %d]\n", Degree ); -// fprintf( pErr, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib" : "unit" ); - fprintf( pErr, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggle printing detailed stats for each node [default = %s]\n", fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: powerdown [-P num] [-N num] [-vwh]\n" ); + Abc_Print( -2, "\t transforms LUT-mapped network into an AIG with choices;\n" ); + Abc_Print( -2, "\t the choices are added to power down the next round of mapping\n" ); + Abc_Print( -2, "\t-P <num> : switching propability delta defining power critical edges [default = %d%%]\n", Percentage ); + Abc_Print( -2, "\t (e.g. 5% means hot wires switch with probability: 0.45 <= p <= 0.50 (max)\n" ); + Abc_Print( -2, "\t-N <num> : the max critical path degree for resynthesis (0 < num < 6) [default = %d]\n", Degree ); +// Abc_Print( -2, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib" : "unit" ); + Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -4436,13 +4421,11 @@ usage: ***********************************************************************/ int Abc_CommandMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) { - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Nwk_LMPars_t Pars, * pPars = &Pars; Vec_Int_t * vResult; int c; extern Vec_Int_t * Abc_NtkLutMerge( Abc_Ntk_t * pNtk, Nwk_LMPars_t * pPars ); - pNtk = Abc_FrameReadNtk(pAbc); - // set defaults memset( pPars, 0, sizeof(Nwk_LMPars_t) ); pPars->nMaxLutSize = 5; // the max LUT size for merging (N=5) @@ -4462,7 +4445,7 @@ int Abc_CommandMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLutSize = atoi(argv[globalUtilOptind]); @@ -4473,7 +4456,7 @@ int Abc_CommandMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxSuppSize = atoi(argv[globalUtilOptind]); @@ -4484,7 +4467,7 @@ int Abc_CommandMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxDistance = atoi(argv[globalUtilOptind]); @@ -4495,7 +4478,7 @@ int Abc_CommandMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLevelDiff = atoi(argv[globalUtilOptind]); @@ -4506,7 +4489,7 @@ int Abc_CommandMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxFanout = atoi(argv[globalUtilOptind]); @@ -4534,7 +4517,7 @@ int Abc_CommandMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL || !Abc_NtkIsLogic(pNtk) ) { - printf( "Abc_CommandSpeedup(): There is no mapped network to merge LUTs.\n" ); + Abc_Print( -1, "Abc_CommandMerge(): There is no mapped network to merge LUTs.\n" ); return 1; } @@ -4543,18 +4526,18 @@ int Abc_CommandMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: merge [-NSDLF num] [-scwvh]\n" ); - fprintf( stdout, "\t creates pairs of topologically-related LUTs\n" ); - fprintf( stdout, "\t-N <num> : the max LUT size for merging (1 < num) [default = %d]\n", pPars->nMaxLutSize ); - fprintf( stdout, "\t-S <num> : the max total support size after merging (1 < num) [default = %d]\n", pPars->nMaxSuppSize ); - fprintf( stdout, "\t-D <num> : the max distance in terms of LUTs (0 < num) [default = %d]\n", pPars->nMaxDistance ); - fprintf( stdout, "\t-L <num> : the max difference in levels (0 <= num) [default = %d]\n", pPars->nMaxLevelDiff ); - fprintf( stdout, "\t-F <num> : the max number of fanouts to stop traversal (0 < num) [default = %d]\n", pPars->nMaxFanout ); - fprintf( stdout, "\t-s : toggle the use of nodes without support overlap [default = %s]\n", pPars->fUseDiffSupp? "yes" : "no" ); - fprintf( stdout, "\t-c : toggle the use of TFI/TFO nodes as candidates [default = %s]\n", pPars->fUseTfiTfo? "yes" : "no" ); - fprintf( stdout, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: merge [-NSDLF num] [-scwvh]\n" ); + Abc_Print( -2, "\t creates pairs of topologically-related LUTs\n" ); + Abc_Print( -2, "\t-N <num> : the max LUT size for merging (1 < num) [default = %d]\n", pPars->nMaxLutSize ); + Abc_Print( -2, "\t-S <num> : the max total support size after merging (1 < num) [default = %d]\n", pPars->nMaxSuppSize ); + Abc_Print( -2, "\t-D <num> : the max distance in terms of LUTs (0 < num) [default = %d]\n", pPars->nMaxDistance ); + Abc_Print( -2, "\t-L <num> : the max difference in levels (0 <= num) [default = %d]\n", pPars->nMaxLevelDiff ); + Abc_Print( -2, "\t-F <num> : the max number of fanouts to stop traversal (0 < num) [default = %d]\n", pPars->nMaxFanout ); + Abc_Print( -2, "\t-s : toggle the use of nodes without support overlap [default = %s]\n", pPars->fUseDiffSupp? "yes" : "no" ); + Abc_Print( -2, "\t-c : toggle the use of TFI/TFO nodes as candidates [default = %s]\n", pPars->fUseTfiTfo? "yes" : "no" ); + Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -4571,22 +4554,17 @@ usage: ***********************************************************************/ int Abc_CommandRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - bool fUpdateLevel; - bool fPrecompute; - bool fUseZeros; - bool fVerbose; - bool fVeryVerbose; - bool fPlaceEnable; + int fUpdateLevel; + int fPrecompute; + int fUseZeros; + int fVerbose; + int fVeryVerbose; + int fPlaceEnable; // external functions extern void Rwr_Precompute(); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUpdateLevel = 1; fPrecompute = 0; @@ -4632,37 +4610,37 @@ int Abc_CommandRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command can only be applied to an AIG (run \"strash\").\n" ); + Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { - fprintf( pErr, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); + Abc_Print( -1, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); return 1; } // modify the current network if ( !Abc_NtkRewrite( pNtk, fUpdateLevel, fUseZeros, fVerbose, fVeryVerbose, fPlaceEnable ) ) { - fprintf( pErr, "Rewriting has failed.\n" ); + Abc_Print( -1, "Rewriting has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: rewrite [-lzvwh]\n" ); - fprintf( pErr, "\t performs technology-independent rewriting of the AIG\n" ); - fprintf( pErr, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggle printout subgraph statistics [default = %s]\n", fVeryVerbose? "yes": "no" ); -// fprintf( pErr, "\t-p : toggle placement-aware rewriting [default = %s]\n", fPlaceEnable? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: rewrite [-lzvwh]\n" ); + Abc_Print( -2, "\t performs technology-independent rewriting of the AIG\n" ); + Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printout subgraph statistics [default = %s]\n", fVeryVerbose? "yes": "no" ); +// Abc_Print( -2, "\t-p : toggle placement-aware rewriting [default = %s]\n", fPlaceEnable? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -4679,20 +4657,15 @@ usage: ***********************************************************************/ int Abc_CommandRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nNodeSizeMax; int nConeSizeMax; - bool fUpdateLevel; - bool fUseZeros; - bool fUseDcs; - bool fVerbose; - extern int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, bool fUpdateLevel, bool fUseZeros, bool fUseDcs, bool fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); + int fUpdateLevel; + int fUseZeros; + int fUseDcs; + int fVerbose; + extern int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose ); // set defaults nNodeSizeMax = 10; @@ -4709,7 +4682,7 @@ int Abc_CommandRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nNodeSizeMax = atoi(argv[globalUtilOptind]); @@ -4720,7 +4693,7 @@ int Abc_CommandRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConeSizeMax = atoi(argv[globalUtilOptind]); @@ -4749,44 +4722,44 @@ int Abc_CommandRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command can only be applied to an AIG (run \"strash\").\n" ); + Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { - fprintf( pErr, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); + Abc_Print( -1, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); return 1; } if ( fUseDcs && nNodeSizeMax >= nConeSizeMax ) { - fprintf( pErr, "For don't-care to work, containing cone should be larger than collapsed node.\n" ); + Abc_Print( -1, "For don't-care to work, containing cone should be larger than collapsed node.\n" ); return 1; } // modify the current network if ( !Abc_NtkRefactor( pNtk, nNodeSizeMax, nConeSizeMax, fUpdateLevel, fUseZeros, fUseDcs, fVerbose ) ) { - fprintf( pErr, "Refactoring has failed.\n" ); + Abc_Print( -1, "Refactoring has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: refactor [-N num] [-C num] [-lzdvh]\n" ); - fprintf( pErr, "\t performs technology-independent refactoring of the AIG\n" ); - fprintf( pErr, "\t-N num : the max support of the collapsed node [default = %d]\n", nNodeSizeMax ); - fprintf( pErr, "\t-C num : the max support of the containing cone [default = %d]\n", nConeSizeMax ); - fprintf( pErr, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" ); - fprintf( pErr, "\t-d : toggle using don't-cares [default = %s]\n", fUseDcs? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: refactor [-N num] [-C num] [-lzdvh]\n" ); + Abc_Print( -2, "\t performs technology-independent refactoring of the AIG\n" ); + Abc_Print( -2, "\t-N num : the max support of the collapsed node [default = %d]\n", nNodeSizeMax ); + Abc_Print( -2, "\t-C num : the max support of the containing cone [default = %d]\n", nConeSizeMax ); + Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" ); + Abc_Print( -2, "\t-d : toggle using don't-cares [default = %s]\n", fUseDcs? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -4803,18 +4776,13 @@ usage: ***********************************************************************/ int Abc_CommandRestructure( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nCutsMax; - bool fUpdateLevel; - bool fUseZeros; - bool fVerbose; - extern int Abc_NtkRestructure( Abc_Ntk_t * pNtk, int nCutsMax, bool fUpdateLevel, bool fUseZeros, bool fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); + int fUpdateLevel; + int fUseZeros; + int fVerbose; + extern int Abc_NtkRestructure( Abc_Ntk_t * pNtk, int nCutsMax, int fUpdateLevel, int fUseZeros, int fVerbose ); // set defaults nCutsMax = 5; @@ -4829,7 +4797,7 @@ int Abc_CommandRestructure( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nCutsMax = atoi(argv[globalUtilOptind]); @@ -4855,41 +4823,41 @@ int Abc_CommandRestructure( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( nCutsMax < 4 || nCutsMax > CUT_SIZE_MAX ) { - fprintf( pErr, "Can only compute the cuts for %d <= K <= %d.\n", 4, CUT_SIZE_MAX ); + Abc_Print( -1, "Can only compute the cuts for %d <= K <= %d.\n", 4, CUT_SIZE_MAX ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command can only be applied to an AIG (run \"strash\").\n" ); + Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { - fprintf( pErr, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); + Abc_Print( -1, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); return 1; } // modify the current network if ( !Abc_NtkRestructure( pNtk, nCutsMax, fUpdateLevel, fUseZeros, fVerbose ) ) { - fprintf( pErr, "Refactoring has failed.\n" ); + Abc_Print( -1, "Refactoring has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: restructure [-K num] [-lzvh]\n" ); - fprintf( pErr, "\t performs technology-independent restructuring of the AIG\n" ); - fprintf( pErr, "\t-K num : the max cut size (%d <= num <= %d) [default = %d]\n", CUT_SIZE_MIN, CUT_SIZE_MAX, nCutsMax ); - fprintf( pErr, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: restructure [-K num] [-lzvh]\n" ); + Abc_Print( -2, "\t performs technology-independent restructuring of the AIG\n" ); + Abc_Print( -2, "\t-K num : the max cut size (%d <= num <= %d) [default = %d]\n", CUT_SIZE_MIN, CUT_SIZE_MAX, nCutsMax ); + Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -4906,23 +4874,18 @@ usage: ***********************************************************************/ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int RS_CUT_MIN = 4; int RS_CUT_MAX = 16; int c; int nCutsMax; int nNodesMax; int nLevelsOdc; - bool fUpdateLevel; - bool fUseZeros; - bool fVerbose; - bool fVeryVerbose; - extern int Abc_NtkResubstitute( Abc_Ntk_t * pNtk, int nCutsMax, int nNodesMax, int nLevelsOdc, bool fUpdateLevel, bool fVerbose, bool fVeryVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); + int fUpdateLevel; + int fUseZeros; + int fVerbose; + int fVeryVerbose; + extern int Abc_NtkResubstitute( Abc_Ntk_t * pNtk, int nCutsMax, int nNodesMax, int nLevelsOdc, int fUpdateLevel, int fVerbose, int fVeryVerbose ); // set defaults nCutsMax = 8; @@ -4940,7 +4903,7 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nCutsMax = atoi(argv[globalUtilOptind]); @@ -4951,7 +4914,7 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nNodesMax = atoi(argv[globalUtilOptind]); @@ -4962,7 +4925,7 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nLevelsOdc = atoi(argv[globalUtilOptind]); @@ -4991,49 +4954,49 @@ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( nCutsMax < RS_CUT_MIN || nCutsMax > RS_CUT_MAX ) { - fprintf( pErr, "Can only compute cuts for %d <= K <= %d.\n", RS_CUT_MIN, RS_CUT_MAX ); + Abc_Print( -1, "Can only compute cuts for %d <= K <= %d.\n", RS_CUT_MIN, RS_CUT_MAX ); return 1; } if ( nNodesMax < 0 || nNodesMax > 3 ) { - fprintf( pErr, "Can only resubstitute at most 3 nodes.\n" ); + Abc_Print( -1, "Can only resubstitute at most 3 nodes.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command can only be applied to an AIG (run \"strash\").\n" ); + Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { - fprintf( pErr, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); + Abc_Print( -1, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); return 1; } // modify the current network if ( !Abc_NtkResubstitute( pNtk, nCutsMax, nNodesMax, nLevelsOdc, fUpdateLevel, fVerbose, fVeryVerbose ) ) { - fprintf( pErr, "Refactoring has failed.\n" ); + Abc_Print( -1, "Refactoring has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: resub [-K num] [-N num] [-F num] [-lzvwh]\n" ); - fprintf( pErr, "\t performs technology-independent restructuring of the AIG\n" ); - fprintf( pErr, "\t-K num : the max cut size (%d <= num <= %d) [default = %d]\n", RS_CUT_MIN, RS_CUT_MAX, nCutsMax ); - fprintf( pErr, "\t-N num : the max number of nodes to add (0 <= num <= 3) [default = %d]\n", nNodesMax ); - fprintf( pErr, "\t-F num : the number of fanout levels for ODC computation [default = %d]\n", nLevelsOdc ); - fprintf( pErr, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggle verbose printout of ODC computation [default = %s]\n", fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: resub [-K num] [-N num] [-F num] [-lzvwh]\n" ); + Abc_Print( -2, "\t performs technology-independent restructuring of the AIG\n" ); + Abc_Print( -2, "\t-K num : the max cut size (%d <= num <= %d) [default = %d]\n", RS_CUT_MIN, RS_CUT_MAX, nCutsMax ); + Abc_Print( -2, "\t-N num : the max number of nodes to add (0 <= num <= 3) [default = %d]\n", nNodesMax ); + Abc_Print( -2, "\t-F num : the number of fanout levels for ODC computation [default = %d]\n", nLevelsOdc ); + Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeros? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle verbose printout of ODC computation [default = %s]\n", fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -5050,8 +5013,7 @@ usage: ***********************************************************************/ int Abc_CommandRr( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c, Window; int nFaninLevels; int nFanoutLevels; @@ -5059,10 +5021,6 @@ int Abc_CommandRr( Abc_Frame_t * pAbc, int argc, char ** argv ) int fVerbose; extern int Abc_NtkRR( Abc_Ntk_t * pNtk, int nFaninLevels, int nFanoutLevels, int fUseFanouts, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nFaninLevels = 3; nFanoutLevels = 3; @@ -5076,7 +5034,7 @@ int Abc_CommandRr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } Window = atoi(argv[globalUtilOptind]); @@ -5101,35 +5059,35 @@ int Abc_CommandRr( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command can only be applied to an AIG (run \"strash\").\n" ); + Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { - fprintf( pErr, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); + Abc_Print( -1, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); return 1; } // modify the current network if ( !Abc_NtkRR( pNtk, nFaninLevels, nFanoutLevels, fUseFanouts, fVerbose ) ) { - fprintf( pErr, "Redundancy removal has failed.\n" ); + Abc_Print( -1, "Redundancy removal has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: rr [-W NM] [-fvh]\n" ); - fprintf( pErr, "\t removes combinational redundancies in the current network\n" ); - fprintf( pErr, "\t-W NM : window size: TFI (N) and TFO (M) logic levels [default = %d%d]\n", nFaninLevels, nFanoutLevels ); - fprintf( pErr, "\t-f : toggle RR w.r.t. fanouts [default = %s]\n", fUseFanouts? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: rr [-W NM] [-fvh]\n" ); + Abc_Print( -2, "\t removes combinational redundancies in the current network\n" ); + Abc_Print( -2, "\t-W NM : window size: TFI (N) and TFO (M) logic levels [default = %d%d]\n", nFaninLevels, nFanoutLevels ); + Abc_Print( -2, "\t-f : toggle RR w.r.t. fanouts [default = %s]\n", fUseFanouts? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -5146,16 +5104,12 @@ usage: ***********************************************************************/ int Abc_CommandCascade( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, nLutSize; int fCheck; int fVerbose; extern Abc_Ntk_t * Abc_NtkCascade( Abc_Ntk_t * pNtk, int nLutSize, int fCheck, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults nLutSize = 12; @@ -5169,7 +5123,7 @@ int Abc_CommandCascade( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); @@ -5192,13 +5146,13 @@ int Abc_CommandCascade( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Can only collapse a logic network or an AIG.\n" ); + Abc_Print( -1, "Can only collapse a logic network or an AIG.\n" ); return 1; } @@ -5213,7 +5167,7 @@ int Abc_CommandCascade( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtkRes == NULL ) { - fprintf( pErr, "Cascade synthesis has failed.\n" ); + Abc_Print( -1, "Cascade synthesis has failed.\n" ); return 1; } // replace the current network @@ -5221,18 +5175,18 @@ int Abc_CommandCascade( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: cascade [-K <num>] [-cvh]\n" ); - fprintf( pErr, "\t performs LUT cascade synthesis for the current network\n" ); - fprintf( pErr, "\t-K num : the number of LUT inputs [default = %d]\n", nLutSize ); - fprintf( pErr, "\t-c : check equivalence after synthesis [default = %s]\n", fCheck? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\t \n"); - fprintf( pErr, " A lookup-table cascade is a programmable architecture developed by\n"); - fprintf( pErr, " Professor Tsutomu Sasao (sasao@cse.kyutech.ac.jp) at Kyushu Institute\n"); - fprintf( pErr, " of Technology. This work received Takeda Techno-Entrepreneurship Award:\n"); - fprintf( pErr, " http://www.lsi-cad.com/sasao/photo/takeda.html\n"); - fprintf( pErr, "\t \n"); + Abc_Print( -2, "usage: cascade [-K <num>] [-cvh]\n" ); + Abc_Print( -2, "\t performs LUT cascade synthesis for the current network\n" ); + Abc_Print( -2, "\t-K num : the number of LUT inputs [default = %d]\n", nLutSize ); + Abc_Print( -2, "\t-c : check equivalence after synthesis [default = %s]\n", fCheck? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t \n"); + Abc_Print( -2, " A lookup-table cascade is a programmable architecture developed by\n"); + Abc_Print( -2, " Professor Tsutomu Sasao (sasao@cse.kyutech.ac.jp) at Kyushu Institute\n"); + Abc_Print( -2, " of Technology. This work received Takeda Techno-Entrepreneurship Award:\n"); + Abc_Print( -2, " http://www.lsi-cad.com/sasao/photo/takeda.html\n"); + Abc_Print( -2, "\t \n"); return 1; } @@ -5250,14 +5204,10 @@ usage: ***********************************************************************/ int Abc_CommandLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -5273,13 +5223,13 @@ int Abc_CommandLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash( pNtk ) ) { - fprintf( pErr, "This command is only applicable to strashed networks.\n" ); + Abc_Print( -1, "This command is only applicable to strashed networks.\n" ); return 1; } @@ -5287,7 +5237,7 @@ int Abc_CommandLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkToLogic( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Converting to a logic network has failed.\n" ); + Abc_Print( -1, "Converting to a logic network has failed.\n" ); return 1; } // replace the current network @@ -5295,9 +5245,9 @@ int Abc_CommandLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: logic [-h]\n" ); - fprintf( pErr, "\t transforms an AIG into a logic network with SOPs\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: logic [-h]\n" ); + Abc_Print( -2, "\t transforms an AIG into a logic network with SOPs\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -5314,7 +5264,6 @@ usage: ***********************************************************************/ int Abc_CommandComb( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fRemoveLatches; @@ -5322,9 +5271,6 @@ int Abc_CommandComb( Abc_Frame_t * pAbc, int argc, char ** argv ) extern void Abc_NtkMakeSeq( Abc_Ntk_t * pNtk, int nLatchesToAdd ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fRemoveLatches = 0; nLatchesToAdd = 0; @@ -5336,7 +5282,7 @@ int Abc_CommandComb( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLatchesToAdd = atoi(argv[globalUtilOptind]); @@ -5356,17 +5302,17 @@ int Abc_CommandComb( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) && nLatchesToAdd == 0 ) { - fprintf( pErr, "The network is already combinational.\n" ); + Abc_Print( -1, "The network is already combinational.\n" ); return 0; } if ( !Abc_NtkIsComb(pNtk) && nLatchesToAdd != 0 ) { - fprintf( pErr, "The network is already combinational.\n" ); + Abc_Print( -1, "The network is already combinational.\n" ); return 0; } @@ -5381,11 +5327,11 @@ int Abc_CommandComb( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: comb [-L num] [-lh]\n" ); - fprintf( pErr, "\t converts comb network into seq, and vice versa\n" ); - fprintf( pErr, "\t-L : number of latches to add to comb network (0 = do not add) [default = %d]\n", nLatchesToAdd ); - fprintf( pErr, "\t-l : toggle converting latches to PIs/POs or removing them [default = %s]\n", fRemoveLatches? "remove": "convert" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: comb [-L num] [-lh]\n" ); + Abc_Print( -2, "\t converts comb network into seq, and vice versa\n" ); + Abc_Print( -2, "\t-L : number of latches to add to comb network (0 = do not add) [default = %d]\n", nLatchesToAdd ); + Abc_Print( -2, "\t-l : toggle converting latches to PIs/POs or removing them [default = %s]\n", fRemoveLatches? "remove": "convert" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -5403,7 +5349,6 @@ usage: int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) { char Buffer[32]; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtk1, * pNtk2, * pNtkRes; int fDelete1, fDelete2; char ** pArgvNew; @@ -5416,8 +5361,6 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) int nPartSize; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults fComb = 1; @@ -5433,7 +5376,7 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPartSize = atoi(argv[globalUtilOptind]); @@ -5457,7 +5400,7 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; - if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) return 1; // compute the miter pNtkRes = Abc_NtkMiter( pNtk1, pNtk2, fComb, nPartSize, fImplic, fMulti ); @@ -5467,7 +5410,7 @@ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) // get the new network if ( pNtkRes == NULL ) { - fprintf( pErr, "Miter computation has failed.\n" ); + Abc_Print( -1, "Miter computation has failed.\n" ); return 0; } // replace the current network @@ -5479,17 +5422,17 @@ usage: strcpy( Buffer, "unused" ); else sprintf( Buffer, "%d", nPartSize ); - fprintf( pErr, "usage: miter [-P num] [-cimh] <file1> <file2>\n" ); - fprintf( pErr, "\t computes the miter of the two circuits\n" ); - fprintf( pErr, "\t-P num : output partition size [default = %s]\n", Buffer ); - fprintf( pErr, "\t-c : toggles deriving combinational miter (latches as POs) [default = %s]\n", fComb? "yes": "no" ); - fprintf( pErr, "\t-i : toggles deriving implication miter (file1 => file2) [default = %s]\n", fImplic? "yes": "no" ); - fprintf( pErr, "\t-m : toggles creating multi-output miter [default = %s]\n", fMulti? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tfile1 : (optional) the file with the first network\n"); - fprintf( pErr, "\tfile2 : (optional) the file with the second network\n"); - fprintf( pErr, "\t if no files are given, uses the current network and its spec\n"); - fprintf( pErr, "\t if one file is given, uses the current network and the file\n"); + Abc_Print( -2, "usage: miter [-P num] [-cimh] <file1> <file2>\n" ); + Abc_Print( -2, "\t computes the miter of the two circuits\n" ); + Abc_Print( -2, "\t-P num : output partition size [default = %s]\n", Buffer ); + Abc_Print( -2, "\t-c : toggles deriving combinational miter (latches as POs) [default = %s]\n", fComb? "yes": "no" ); + Abc_Print( -2, "\t-i : toggles deriving implication miter (file1 => file2) [default = %s]\n", fImplic? "yes": "no" ); + Abc_Print( -2, "\t-m : toggles creating multi-output miter [default = %s]\n", fMulti? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tfile1 : (optional) the file with the first network\n"); + Abc_Print( -2, "\tfile2 : (optional) the file with the second network\n"); + Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); + Abc_Print( -2, "\t if one file is given, uses the current network and the file\n"); return 1; } @@ -5506,17 +5449,12 @@ usage: ***********************************************************************/ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk;//, * pNtkRes; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);//, * pNtkRes; int fSeq; int c; extern int Abc_NtkDemiter( Abc_Ntk_t * pNtk ); extern int Abc_NtkDarDemiter( Abc_Ntk_t * pNtk ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fSeq = 1; Extra_UtilGetoptReset(); @@ -5534,7 +5472,7 @@ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "The network is not strashed.\n" ); + Abc_Print( -1, "The network is not strashed.\n" ); return 1; } @@ -5543,7 +5481,7 @@ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( !Abc_NtkDarDemiter( pNtk ) ) { - fprintf( pErr, "Demitering has failed.\n" ); + Abc_Print( -1, "Demitering has failed.\n" ); return 1; } } @@ -5551,17 +5489,17 @@ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( Abc_NtkPoNum(pNtk) != 1 ) { - fprintf( pErr, "The network is not a single-output miter.\n" ); + Abc_Print( -1, "The network is not a single-output miter.\n" ); return 1; } if ( !Abc_NodeIsExorType(Abc_ObjFanin0(Abc_NtkPo(pNtk,0))) ) { - fprintf( pErr, "The miter's PO is not an EXOR.\n" ); + Abc_Print( -1, "The miter's PO is not an EXOR.\n" ); return 1; } if ( !Abc_NtkDemiter( pNtk ) ) { - fprintf( pErr, "Demitering has failed.\n" ); + Abc_Print( -1, "Demitering has failed.\n" ); return 1; } } @@ -5570,10 +5508,10 @@ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: demiter [-sh]\n" ); - fprintf( pErr, "\t removes topmost EXOR from the miter to create two POs\n" ); - fprintf( pErr, "\t-s : applied multi-output algorithm [default = %s]\n", fSeq? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: demiter [-sh]\n" ); + Abc_Print( -2, "\t removes topmost EXOR from the miter to create two POs\n" ); + Abc_Print( -2, "\t-s : applied multi-output algorithm [default = %s]\n", fSeq? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -5590,16 +5528,11 @@ usage: ***********************************************************************/ int Abc_CommandOrPos( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk;//, * pNtkRes; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);//, * pNtkRes; int fComb; int c; extern int Abc_NtkCombinePos( Abc_Ntk_t * pNtk, int fAnd ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF ) @@ -5616,27 +5549,27 @@ int Abc_CommandOrPos( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "The network is not strashed.\n" ); + Abc_Print( -1, "The network is not strashed.\n" ); return 1; } /* if ( Abc_NtkPoNum(pNtk) == 1 ) { - fprintf( pErr, "The network already has one PO.\n" ); + Abc_Print( -1, "The network already has one PO.\n" ); return 1; } */ /* if ( Abc_NtkLatchNum(pNtk) ) { - fprintf( pErr, "The miter has latches. ORing is not performed.\n" ); + Abc_Print( -1, "The miter has latches. ORing is not performed.\n" ); return 1; } */ // get the new network if ( !Abc_NtkCombinePos( pNtk, 0 ) ) { - fprintf( pErr, "ORing the POs has failed.\n" ); + Abc_Print( -1, "ORing the POs has failed.\n" ); return 1; } // replace the current network @@ -5644,10 +5577,10 @@ int Abc_CommandOrPos( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: orpos [-h]\n" ); - fprintf( pErr, "\t creates single-output miter by ORing the POs of the current network\n" ); -// fprintf( pErr, "\t-c : computes combinational miter (latches as POs) [default = %s]\n", fComb? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: orpos [-h]\n" ); + Abc_Print( -2, "\t creates single-output miter by ORing the POs of the current network\n" ); +// Abc_Print( -2, "\t-c : computes combinational miter (latches as POs) [default = %s]\n", fComb? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -5664,15 +5597,9 @@ usage: ***********************************************************************/ int Abc_CommandAndPos( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk;//, * pNtkRes; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);//, * pNtkRes; int fComb; int c; - extern int Abc_NtkCombinePos( Abc_Ntk_t * pNtk, int fAnd ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults Extra_UtilGetoptReset(); @@ -5690,26 +5617,26 @@ int Abc_CommandAndPos( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "The network is not strashed.\n" ); + Abc_Print( -1, "The network is not strashed.\n" ); return 1; } if ( Abc_NtkPoNum(pNtk) == 1 ) { - fprintf( pErr, "The network already has one PO.\n" ); + Abc_Print( -1, "The network already has one PO.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) ) { - fprintf( pErr, "The miter has latches. ORing is not performed.\n" ); + Abc_Print( -1, "The miter has latches. ORing is not performed.\n" ); return 1; } // get the new network if ( !Abc_NtkCombinePos( pNtk, 1 ) ) { - fprintf( pErr, "ANDing the POs has failed.\n" ); + Abc_Print( -1, "ANDing the POs has failed.\n" ); return 1; } // replace the current network @@ -5717,10 +5644,79 @@ int Abc_CommandAndPos( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: andpos [-h]\n" ); - fprintf( pErr, "\t creates single-output miter by ANDing the POs of the current network\n" ); -// fprintf( pErr, "\t-c : computes combinational miter (latches as POs) [default = %s]\n", fComb? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: andpos [-h]\n" ); + Abc_Print( -2, "\t creates single-output miter by ANDing the POs of the current network\n" ); +// Abc_Print( -2, "\t-c : computes combinational miter (latches as POs) [default = %s]\n", fComb? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandZeroPo( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtkRes; + int c, iOutput = -1; + extern void Abc_NtkDropOneOutput( Abc_Ntk_t * pNtk, int iOutput ); + + // set defaults + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "Nh" ) ) != EOF ) + { + switch ( c ) + { + case 'N': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); + goto usage; + } + iOutput = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( iOutput < 0 ) + goto usage; + break; + default: + goto usage; + } + } + + if ( !Abc_NtkIsStrash(pNtk) ) + { + Abc_Print( -1, "The network is not strashed.\n" ); + return 1; + } + if ( iOutput < 0 ) + { + Abc_Print( -1, "The output index is not specified.\n" ); + return 1; + } + if ( iOutput >= Abc_NtkPoNum(pNtk) ) + { + Abc_Print( -1, "The output index is larger than the allowed POs.\n" ); + return 1; + } + + // get the new network + pNtkRes = Abc_NtkDup( pNtk ); + Abc_NtkDropOneOutput( pNtkRes, iOutput ); + Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); + return 0; + +usage: + Abc_Print( -2, "usage: zeropo [-N num] [-h]\n" ); + Abc_Print( -2, "\t replaces the PO driver by constant 0\n" ); + Abc_Print( -2, "\t-F num : the zero-based index of the PO to replace [default = %d]\n", iOutput ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -5737,15 +5733,11 @@ usage: ***********************************************************************/ int Abc_CommandAppend( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtk2; char * FileName; int fComb; int c; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults Extra_UtilGetoptReset(); @@ -5764,13 +5756,13 @@ int Abc_CommandAppend( Abc_Frame_t * pAbc, int argc, char ** argv ) // get the second network if ( argc != globalUtilOptind + 1 ) { - fprintf( pErr, "The network to append is not given.\n" ); + Abc_Print( -1, "The network to append is not given.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "The base network should be strashed for the appending to work.\n" ); + Abc_Print( -1, "The base network should be strashed for the appending to work.\n" ); return 1; } @@ -5783,7 +5775,7 @@ int Abc_CommandAppend( Abc_Frame_t * pAbc, int argc, char ** argv ) // check if the second network is combinational if ( Abc_NtkLatchNum(pNtk2) ) { - fprintf( pErr, "The second network has latches. Appending does not work for such networks.\n" ); + Abc_Print( -1, "The second network has latches. Appending does not work for such networks.\n" ); return 0; } @@ -5791,22 +5783,22 @@ int Abc_CommandAppend( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( !Abc_NtkAppend( pNtk, pNtk2, 1 ) ) { Abc_NtkDelete( pNtk2 ); - fprintf( pErr, "Appending the networks failed.\n" ); + Abc_Print( -1, "Appending the networks failed.\n" ); return 1; } Abc_NtkDelete( pNtk2 ); // sweep dangling logic - Abc_AigCleanup( pNtk->pManFunc ); + Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc ); // replace the current network // Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: - fprintf( pErr, "usage: append [-h] <file>\n" ); - fprintf( pErr, "\t appends a combinational network on top of the current network\n" ); -// fprintf( pErr, "\t-c : computes combinational miter (latches as POs) [default = %s]\n", fComb? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\t<file> : file name with the second network\n"); + Abc_Print( -2, "usage: append [-h] <file>\n" ); + Abc_Print( -2, "\t appends a combinational network on top of the current network\n" ); +// Abc_Print( -2, "\t-c : computes combinational miter (latches as POs) [default = %s]\n", fComb? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : file name with the second network\n"); return 1; } @@ -5823,16 +5815,12 @@ usage: ***********************************************************************/ int Abc_CommandFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkTemp, * pNtkRes; int nFrames; int fInitial; int fVerbose; int c; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults nFrames = 5; @@ -5846,7 +5834,7 @@ int Abc_CommandFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -5869,7 +5857,7 @@ int Abc_CommandFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -5884,7 +5872,7 @@ int Abc_CommandFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkFrames( pNtk, nFrames, fInitial, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Unrolling the network has failed.\n" ); + Abc_Print( -1, "Unrolling the network has failed.\n" ); return 1; } // replace the current network @@ -5892,12 +5880,12 @@ int Abc_CommandFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: frames [-F num] [-ivh]\n" ); - fprintf( pErr, "\t unrolls the network for a number of time frames\n" ); - fprintf( pErr, "\t-F num : the number of frames to unroll [default = %d]\n", nFrames ); - fprintf( pErr, "\t-i : toggles initializing the first frame [default = %s]\n", fInitial? "yes": "no" ); - fprintf( pErr, "\t-v : toggles outputting verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: frames [-F num] [-ivh]\n" ); + Abc_Print( -2, "\t unrolls the network for a number of time frames\n" ); + Abc_Print( -2, "\t-F num : the number of frames to unroll [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-i : toggles initializing the first frame [default = %s]\n", fInitial? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles outputting verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -5914,7 +5902,6 @@ usage: ***********************************************************************/ int Abc_CommandDFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkTemp, * pNtkRes; int nPrefix; int nFrames; @@ -5923,10 +5910,7 @@ int Abc_CommandDFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) int c; extern Abc_Ntk_t * Abc_NtkDarFrames( Abc_Ntk_t * pNtk, int nPrefix, int nFrames, int fInitial, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults nPrefix = 5; @@ -5941,7 +5925,7 @@ int Abc_CommandDFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nPrefix = atoi(argv[globalUtilOptind]); @@ -5952,7 +5936,7 @@ int Abc_CommandDFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -5975,12 +5959,12 @@ int Abc_CommandDFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( nPrefix > nFrames ) { - fprintf( pErr, "Prefix (%d) cannot be more than the number of frames (%d).\n", nPrefix, nFrames ); + Abc_Print( -1, "Prefix (%d) cannot be more than the number of frames (%d).\n", nPrefix, nFrames ); return 1; } @@ -5995,7 +5979,7 @@ int Abc_CommandDFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkDarFrames( pNtk, nPrefix, nFrames, fInitial, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Unrolling the network has failed.\n" ); + Abc_Print( -1, "Unrolling the network has failed.\n" ); return 1; } // replace the current network @@ -6003,13 +5987,13 @@ int Abc_CommandDFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: dframes [-NF num] [-ivh]\n" ); - fprintf( pErr, "\t unrolls the network with simplification\n" ); - fprintf( pErr, "\t-N num : the number of frames to use as prefix [default = %d]\n", nPrefix ); - fprintf( pErr, "\t-F num : the number of frames to unroll [default = %d]\n", nFrames ); - fprintf( pErr, "\t-i : toggles initializing the first frame [default = %s]\n", fInitial? "yes": "no" ); - fprintf( pErr, "\t-v : toggles outputting verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dframes [-NF num] [-ivh]\n" ); + Abc_Print( -2, "\t unrolls the network with simplification\n" ); + Abc_Print( -2, "\t-N num : the number of frames to use as prefix [default = %d]\n", nPrefix ); + Abc_Print( -2, "\t-F num : the number of frames to unroll [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-i : toggles initializing the first frame [default = %s]\n", fInitial? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles outputting verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -6028,15 +6012,10 @@ usage: ***********************************************************************/ int Abc_CommandSop( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int fDirect; int c; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fDirect = 0; Extra_UtilGetoptReset(); @@ -6055,26 +6034,26 @@ int Abc_CommandSop( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "Converting to SOP is possible only for logic networks.\n" ); + Abc_Print( -1, "Converting to SOP is possible only for logic networks.\n" ); return 1; } if ( !Abc_NtkToSop(pNtk, fDirect) ) { - fprintf( pErr, "Converting to SOP has failed.\n" ); + Abc_Print( -1, "Converting to SOP has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: sop [-dh]\n" ); - fprintf( pErr, "\t converts node functions to SOP\n" ); - fprintf( pErr, "\t-d : toggles using both phases or only positive [default = %s]\n", fDirect? "direct": "both" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: sop [-dh]\n" ); + Abc_Print( -2, "\t converts node functions to SOP\n" ); + Abc_Print( -2, "\t-d : toggles using both phases or only positive [default = %s]\n", fDirect? "direct": "both" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -6091,14 +6070,9 @@ usage: ***********************************************************************/ int Abc_CommandBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -6113,30 +6087,30 @@ int Abc_CommandBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "Converting to BDD is possible only for logic networks.\n" ); + Abc_Print( -1, "Converting to BDD is possible only for logic networks.\n" ); return 1; } if ( Abc_NtkIsBddLogic(pNtk) ) { - fprintf( pOut, "The logic network is already in the BDD form.\n" ); + Abc_Print( -1, "The logic network is already in the BDD form.\n" ); return 0; } if ( !Abc_NtkToBdd(pNtk) ) { - fprintf( pErr, "Converting to BDD has failed.\n" ); + Abc_Print( -1, "Converting to BDD has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: bdd [-h]\n" ); - fprintf( pErr, "\t converts node functions to BDD\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: bdd [-h]\n" ); + Abc_Print( -2, "\t converts node functions to BDD\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -6153,14 +6127,9 @@ usage: ***********************************************************************/ int Abc_CommandAig( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -6175,30 +6144,30 @@ int Abc_CommandAig( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "Converting to AIG is possible only for logic networks.\n" ); + Abc_Print( -1, "Converting to AIG is possible only for logic networks.\n" ); return 1; } if ( Abc_NtkIsAigLogic(pNtk) ) { - fprintf( pOut, "The logic network is already in the AIG form.\n" ); + Abc_Print( -1, "The logic network is already in the AIG form.\n" ); return 0; } if ( !Abc_NtkToAig(pNtk) ) { - fprintf( pErr, "Converting to AIG has failed.\n" ); + Abc_Print( -1, "Converting to AIG has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: aig [-h]\n" ); - fprintf( pErr, "\t converts node functions to AIG\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: aig [-h]\n" ); + Abc_Print( -2, "\t converts node functions to AIG\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -6215,16 +6184,11 @@ usage: ***********************************************************************/ int Abc_CommandReorder( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fVerbose; extern void Abc_NtkBddReorder( Abc_Ntk_t * pNtk, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fVerbose = 0; Extra_UtilGetoptReset(); @@ -6244,24 +6208,24 @@ int Abc_CommandReorder( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network if ( !Abc_NtkIsBddLogic(pNtk) ) { - fprintf( pErr, "Variable reordering is possible when node functions are BDDs (run \"bdd\").\n" ); + Abc_Print( -1, "Variable reordering is possible when node functions are BDDs (run \"bdd\").\n" ); return 1; } Abc_NtkBddReorder( pNtk, fVerbose ); return 0; usage: - fprintf( pErr, "usage: reorder [-vh]\n" ); - fprintf( pErr, "\t reorders local functions of the nodes using sifting\n" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: reorder [-vh]\n" ); + Abc_Print( -2, "\t reorders local functions of the nodes using sifting\n" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -6278,16 +6242,11 @@ usage: ***********************************************************************/ int Abc_CommandBidec( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fVerbose; extern void Abc_NtkBidecResyn( Abc_Ntk_t * pNtk, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fVerbose = 0; Extra_UtilGetoptReset(); @@ -6307,24 +6266,24 @@ int Abc_CommandBidec( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network if ( !Abc_NtkIsAigLogic(pNtk) ) { - fprintf( pErr, "Bi-decomposition only works when node functions are AIGs (run \"aig\").\n" ); + Abc_Print( -1, "Bi-decomposition only works when node functions are AIGs (run \"aig\").\n" ); return 1; } Abc_NtkBidecResyn( pNtk, fVerbose ); return 0; usage: - fprintf( pErr, "usage: bidec [-vh]\n" ); - fprintf( pErr, "\t applies bi-decomposition to local functions of the nodes\n" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: bidec [-vh]\n" ); + Abc_Print( -2, "\t applies bi-decomposition to local functions of the nodes\n" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -6341,8 +6300,8 @@ usage: ***********************************************************************/ int Abc_CommandOrder( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr, * pFile; - Abc_Ntk_t * pNtk; + FILE * pFile; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); char * pFileName; int c; int fReverse; @@ -6350,10 +6309,6 @@ int Abc_CommandOrder( Abc_Frame_t * pAbc, int argc, char ** argv ) extern void Abc_NtkImplementCiOrder( Abc_Ntk_t * pNtk, char * pFileName, int fReverse, int fVerbose ); extern void Abc_NtkFindCiOrder( Abc_Ntk_t * pNtk, int fReverse, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fReverse = 0; fVerbose = 0; @@ -6377,12 +6332,12 @@ int Abc_CommandOrder( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // if ( Abc_NtkLatchNum(pNtk) > 0 ) // { -// printf( "Currently this procedure does not work for sequential networks.\n" ); +// Abc_Print( -1, "Currently this procedure does not work for sequential networks.\n" ); // return 1; // } @@ -6394,7 +6349,7 @@ int Abc_CommandOrder( Abc_Frame_t * pAbc, int argc, char ** argv ) pFile = fopen( pFileName, "r" ); if ( pFile == NULL ) { - fprintf( pErr, "Cannot open file \"%s\" with the BDD variable order.\n", pFileName ); + Abc_Print( -1, "Cannot open file \"%s\" with the BDD variable order.\n", pFileName ); return 1; } fclose( pFile ); @@ -6406,12 +6361,12 @@ int Abc_CommandOrder( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: order [-rvh] <file>\n" ); - fprintf( pErr, "\t computes a good static CI variable order\n" ); - fprintf( pErr, "\t-r : toggle reverse ordering [default = %s]\n", fReverse? "yes": "no" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\t<file> : (optional) file with the given variable order\n" ); + Abc_Print( -2, "usage: order [-rvh] <file>\n" ); + Abc_Print( -2, "\t computes a good static CI variable order\n" ); + Abc_Print( -2, "\t-r : toggle reverse ordering [default = %s]\n", fReverse? "yes": "no" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : (optional) file with the given variable order\n" ); return 1; } @@ -6428,14 +6383,10 @@ usage: ***********************************************************************/ int Abc_CommandMuxes( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -6451,13 +6402,13 @@ int Abc_CommandMuxes( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsBddLogic(pNtk) ) { - fprintf( pErr, "Only a BDD logic network can be converted to MUXes.\n" ); + Abc_Print( -1, "Only a BDD logic network can be converted to MUXes.\n" ); return 1; } @@ -6465,7 +6416,7 @@ int Abc_CommandMuxes( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkBddToMuxes( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Converting to MUXes has failed.\n" ); + Abc_Print( -1, "Converting to MUXes has failed.\n" ); return 1; } // replace the current network @@ -6473,10 +6424,10 @@ int Abc_CommandMuxes( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: muxes [-h]\n" ); - fprintf( pErr, "\t converts the current network into a network derived by\n" ); - fprintf( pErr, "\t replacing all nodes by DAGs isomorphic to the local BDDs\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: muxes [-h]\n" ); + Abc_Print( -2, "\t converts the current network into a network derived by\n" ); + Abc_Print( -2, "\t replacing all nodes by DAGs isomorphic to the local BDDs\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -6494,16 +6445,12 @@ usage: ***********************************************************************/ int Abc_CommandExtSeqDcs( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fVerbose; - extern int Abc_NtkExtractSequentialDcs( Abc_Ntk_t * pNet, bool fVerbose ); + extern int Abc_NtkExtractSequentialDcs( Abc_Ntk_t * pNet, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fVerbose = 0; Extra_UtilGetoptReset(); @@ -6523,31 +6470,31 @@ int Abc_CommandExtSeqDcs( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) == 0 ) { - fprintf( stdout, "The current network has no latches.\n" ); + Abc_Print( -1, "The current network has no latches.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Extracting sequential don't-cares works only for AIGs (run \"strash\").\n" ); + Abc_Print( -1, "Extracting sequential don't-cares works only for AIGs (run \"strash\").\n" ); return 0; } if ( !Abc_NtkExtractSequentialDcs( pNtk, fVerbose ) ) { - fprintf( stdout, "Extracting sequential don't-cares has failed.\n" ); + Abc_Print( -1, "Extracting sequential don't-cares has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: ext_seq_dcs [-vh]\n" ); - fprintf( pErr, "\t create EXDC network using unreachable states\n" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: ext_seq_dcs [-vh]\n" ); + Abc_Print( -2, "\t create EXDC network using unreachable states\n" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -6564,66 +6511,76 @@ usage: ***********************************************************************/ int Abc_CommandReach( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; - int nBddMax; - int nIterMax; - int fPartition; - int fReorder; - int fReorderImage; - int fVerbose; + Saig_ParBbr_t Pars, * pPars = &Pars; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - extern void Abc_NtkDarReach( Abc_Ntk_t * pNtk, int nBddMax, int nIterMax, int fPartition, int fReorder, int fReorderImage, int fVerbose ); + char * pLogFileName = NULL; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); + extern int Abc_NtkDarReach( Abc_Ntk_t * pNtk, Saig_ParBbr_t * pPars ); // set defaults - nBddMax = 50000; - nIterMax = 1000; - fPartition = 1; - fReorder = 1; - fReorderImage = 0; - fVerbose = 0; + Bbr_ManSetDefaultParams( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "BFprovh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "TBFLproyvh" ) ) != EOF ) { switch ( c ) { + case 'T': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); + goto usage; + } + pPars->TimeLimit = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->TimeLimit < 0 ) + goto usage; + break; case 'B': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-B\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" ); goto usage; } - nBddMax = atoi(argv[globalUtilOptind]); + pPars->nBddMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; - if ( nBddMax < 0 ) + if ( pPars->nBddMax < 0 ) goto usage; break; case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } - nIterMax = atoi(argv[globalUtilOptind]); + pPars->nIterMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; - if ( nIterMax < 0 ) + if ( pPars->nIterMax < 0 ) goto usage; break; + case 'L': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-L\" should be followed by a file name.\n" ); + goto usage; + } + pLogFileName = argv[globalUtilOptind]; + globalUtilOptind++; + break; case 'p': - fPartition ^= 1; + pPars->fPartition ^= 1; break; case 'r': - fReorder ^= 1; + pPars->fReorder ^= 1; break; case 'o': - fReorderImage ^= 1; + pPars->fReorderImage ^= 1; + break; + case 'y': + pPars->fSkipOutCheck ^= 1; break; case 'v': - fVerbose ^= 1; + pPars->fVerbose ^= 1; break; case 'h': goto usage; @@ -6633,48 +6590,39 @@ int Abc_CommandReach( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) == 0 ) { - fprintf( stdout, "The current network has no latches.\n" ); + Abc_Print( -1, "The current network has no latches.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Reachability analysis works only for AIGs (run \"strash\").\n" ); - return 1; - } -/* - if ( Abc_NtkLatchNum(pNtk) > 60 || Abc_NtkNodeNum(pNtk) > 3000 ) - { - fprintf( stdout, "The number of latches %d and nodes %d. Skippping...\n", Abc_NtkLatchNum(pNtk), Abc_NtkNodeNum(pNtk) ); - return 0; - } -*/ -/* - if ( Abc_NtkPoNum(pNtk) != 1 ) - { - fprintf( stdout, "The sequential miter has more than one output (run \"orpos\").\n" ); + Abc_Print( -1, "Reachability analysis works only for AIGs (run \"strash\").\n" ); return 1; } -*/ -// Abc_NtkVerifyUsingBdds( pNtk, nBddMax, nIterMax, fPartition, fReorder, fVerbose ); - Abc_NtkDarReach( pNtk, nBddMax, nIterMax, fPartition, fReorder, fReorderImage, fVerbose ); - pAbc->pCex = pNtk->pSeqModel; // temporary ??? + pAbc->Status = Abc_NtkDarReach( pNtk, pPars ); + pAbc->nFrames = pPars->iFrame; + Abc_FrameReplaceCex( pAbc, &pNtk->pSeqModel ); + if ( pLogFileName ) + Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, "reach" ); return 0; usage: - fprintf( pErr, "usage: reach [-BF num] [-provh]\n" ); - fprintf( pErr, "\t verifies sequential miter using BDD-based reachability\n" ); - fprintf( pErr, "\t-B num : max number of nodes in the intermediate BDDs [default = %d]\n", nBddMax ); - fprintf( pErr, "\t-F num : max number of reachability iterations [default = %d]\n", nIterMax ); - fprintf( pErr, "\t-p : enable partitioned image computation [default = %s]\n", fPartition? "yes": "no" ); - fprintf( pErr, "\t-r : enable dynamic BDD variable reordering [default = %s]\n", fReorder? "yes": "no" ); - fprintf( pErr, "\t-o : toggles BDD variable reordering during image computation [default = %s]\n", fReorderImage? "yes": "no" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: reach [-TBF num] [-L file] [-proyvh]\n" ); + Abc_Print( -2, "\t verifies sequential miter using BDD-based reachability\n" ); + Abc_Print( -2, "\t-T num : approximate time limit in seconds (0=infinite) [default = %d]\n", pPars->TimeLimit ); + Abc_Print( -2, "\t-B num : max number of nodes in the intermediate BDDs [default = %d]\n", pPars->nBddMax ); + Abc_Print( -2, "\t-F num : max number of reachability iterations [default = %d]\n", pPars->nIterMax ); + Abc_Print( -2, "\t-L file: the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" ); + Abc_Print( -2, "\t-p : enable partitioned image computation [default = %s]\n", pPars->fPartition? "yes": "no" ); + Abc_Print( -2, "\t-r : enable dynamic BDD variable reordering [default = %s]\n", pPars->fReorder? "yes": "no" ); + Abc_Print( -2, "\t-o : toggles BDD variable reordering during image computation [default = %s]\n", pPars->fReorderImage? "yes": "no" ); + Abc_Print( -2, "\t-y : skip checking property outputs [default = %s]\n", pPars->fSkipOutCheck? "yes": "no" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -6691,7 +6639,6 @@ usage: ***********************************************************************/ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; Abc_Obj_t * pNode, * pNodeCo; int c; @@ -6699,27 +6646,26 @@ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv ) int fUseMffc; int fSeq; int Output; + int nRange; - extern void Abc_NtkMakeOnePo( Abc_Ntk_t * pNtk, Abc_Obj_t * pNodePo ); + extern Abc_Ntk_t * Abc_NtkMakeOnePo( Abc_Ntk_t * pNtk, int Output, int nRange ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUseAllCis = 0; fUseMffc = 0; fSeq = 0; Output = -1; + nRange = -1; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Omash" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "ORmash" ) ) != EOF ) { switch ( c ) { case 'O': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-O\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-O\" should be followed by an integer.\n" ); goto usage; } Output = atoi(argv[globalUtilOptind]); @@ -6727,6 +6673,17 @@ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( Output < 0 ) goto usage; break; + case 'R': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); + goto usage; + } + nRange = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nRange < 0 ) + goto usage; + break; case 'm': fUseMffc ^= 1; break; @@ -6745,19 +6702,19 @@ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Currently can only be applied to the logic network or an AIG.\n" ); + Abc_Print( -1, "Currently can only be applied to the logic network or an AIG.\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { - fprintf( pErr, "Wrong number of auguments.\n" ); + Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } @@ -6767,7 +6724,7 @@ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv ) pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { - fprintf( pErr, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); + Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } if ( fUseMffc ) @@ -6779,31 +6736,30 @@ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( Output == -1 ) { - fprintf( pErr, "The node is not specified.\n" ); + Abc_Print( -1, "The node is not specified.\n" ); return 1; } if ( Output >= Abc_NtkCoNum(pNtk) ) { - fprintf( pErr, "The 0-based output number (%d) is larger than the number of outputs (%d).\n", Output, Abc_NtkCoNum(pNtk) ); + Abc_Print( -1, "The 0-based output number (%d) is larger than the number of outputs (%d).\n", Output, Abc_NtkCoNum(pNtk) ); return 1; } pNodeCo = Abc_NtkCo( pNtk, Output ); if ( fSeq ) - { - pNtkRes = Abc_NtkDup( pNtk ); - pNodeCo = Abc_NtkPo( pNtkRes, Output ); - Abc_NtkMakeOnePo( pNtkRes, pNodeCo ); - } + pNtkRes = Abc_NtkMakeOnePo( pNtk, Output, nRange ); else if ( fUseMffc ) pNtkRes = Abc_NtkCreateMffc( pNtk, Abc_ObjFanin0(pNodeCo), Abc_ObjName(pNodeCo) ); else pNtkRes = Abc_NtkCreateCone( pNtk, Abc_ObjFanin0(pNodeCo), Abc_ObjName(pNodeCo), fUseAllCis ); } if ( pNodeCo && Abc_ObjFaninC0(pNodeCo) && !fSeq ) - printf( "The extracted cone represents the complement function of the CO.\n" ); + { + Abc_NtkPo(pNtkRes, 0)->fCompl0 ^= 1; +// Abc_Print( -1, "The extracted cone represents the complement function of the CO.\n" ); + } if ( pNtkRes == NULL ) { - fprintf( pErr, "Writing the logic cone of one node has failed.\n" ); + Abc_Print( -1, "Writing the logic cone of one node has failed.\n" ); return 1; } // replace the current network @@ -6811,14 +6767,15 @@ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: cone [-O num] [-amsh] <name>\n" ); - fprintf( pErr, "\t replaces the current network by one logic cone\n" ); - fprintf( pErr, "\t-a : toggle keeping all CIs or structral support only [default = %s]\n", fUseAllCis? "all": "structural" ); - fprintf( pErr, "\t-m : toggle keeping only MFFC or complete TFI cone [default = %s]\n", fUseMffc? "MFFC": "TFI cone" ); - fprintf( pErr, "\t-s : toggle comb or sequential cone (works with \"-O num\") [default = %s]\n", fSeq? "seq": "comb" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\t-O num : (optional) the 0-based number of the CO to extract\n"); - fprintf( pErr, "\tname : (optional) the name of the node to extract\n"); + Abc_Print( -2, "usage: cone [-OR num] [-amsh] <name>\n" ); + Abc_Print( -2, "\t replaces the current network by one logic cone\n" ); + Abc_Print( -2, "\t-a : toggle keeping all CIs or structral support only [default = %s]\n", fUseAllCis? "all": "structural" ); + Abc_Print( -2, "\t-m : toggle keeping only MFFC or complete TFI cone [default = %s]\n", fUseMffc? "MFFC": "TFI cone" ); + Abc_Print( -2, "\t-s : toggle comb or sequential cone (works with \"-O num\") [default = %s]\n", fSeq? "seq": "comb" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t-O num : (optional) the 0-based number of the CO to extract\n"); + Abc_Print( -2, "\t-R num : (optional) the number of outputs to extract\n"); + Abc_Print( -2, "\tname : (optional) the name of the node to extract\n"); return 1; } @@ -6835,15 +6792,11 @@ usage: ***********************************************************************/ int Abc_CommandNode( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; Abc_Obj_t * pNode; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -6859,26 +6812,26 @@ int Abc_CommandNode( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "Currently can only be applied to a logic network.\n" ); + Abc_Print( -1, "Currently can only be applied to a logic network.\n" ); return 1; } if ( argc != globalUtilOptind + 1 ) { - fprintf( pErr, "Wrong number of auguments.\n" ); + Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { - fprintf( pErr, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); + Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } @@ -6886,7 +6839,7 @@ int Abc_CommandNode( Abc_Frame_t * pAbc, int argc, char ** argv ) // pNtkRes = Abc_NtkDeriveFromBdd( pNtk->pManFunc, pNode->pData, NULL, NULL ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Splitting one node has failed.\n" ); + Abc_Print( -1, "Splitting one node has failed.\n" ); return 1; } // replace the current network @@ -6894,10 +6847,10 @@ int Abc_CommandNode( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: node [-h] <name>\n" ); - fprintf( pErr, "\t replaces the current network by the network composed of one node\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tname : the node name\n"); + Abc_Print( -2, "usage: node [-h] <name>\n" ); + Abc_Print( -2, "\t replaces the current network by the network composed of one node\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tname : the node name\n"); return 1; } @@ -6915,15 +6868,11 @@ usage: ***********************************************************************/ int Abc_CommandTopmost( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, nLevels; extern Abc_Ntk_t * Abc_NtkTopmost( Abc_Ntk_t * pNtk, int nLevels ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nLevels = 10; Extra_UtilGetoptReset(); @@ -6934,7 +6883,7 @@ int Abc_CommandTopmost( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nLevels = atoi(argv[globalUtilOptind]); @@ -6951,31 +6900,31 @@ int Abc_CommandTopmost( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } if ( Abc_NtkLatchNum(pNtk) > 0 ) { - fprintf( stdout, "Currently can only works for combinational circuits.\n" ); + Abc_Print( -1, "Currently can only works for combinational circuits.\n" ); return 0; } if ( Abc_NtkPoNum(pNtk) != 1 ) { - fprintf( stdout, "Currently expects a single-output miter.\n" ); + Abc_Print( -1, "Currently expects a single-output miter.\n" ); return 0; } pNtkRes = Abc_NtkTopmost( pNtk, nLevels ); if ( pNtkRes == NULL ) { - fprintf( pErr, "The command has failed.\n" ); + Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network @@ -6983,11 +6932,11 @@ int Abc_CommandTopmost( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: topmost [-N num] [-h]\n" ); - fprintf( pErr, "\t replaces the current network by several of its topmost levels\n" ); - fprintf( pErr, "\t-N num : max number of levels [default = %d]\n", nLevels ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tname : the node name\n"); + Abc_Print( -2, "usage: topmost [-N num] [-h]\n" ); + Abc_Print( -2, "\t replaces the current network by several of its topmost levels\n" ); + Abc_Print( -2, "\t-N num : max number of levels [default = %d]\n", nLevels ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tname : the node name\n"); return 1; } @@ -7004,15 +6953,11 @@ usage: ***********************************************************************/ int Abc_CommandTopAnd( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; extern Abc_Ntk_t * Abc_NtkTopAnd( Abc_Ntk_t * pNtk ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -7028,40 +6973,40 @@ int Abc_CommandTopAnd( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } if ( Abc_NtkLatchNum(pNtk) > 0 ) { - fprintf( stdout, "Currently can only works for combinational circuits.\n" ); + Abc_Print( -1, "Currently can only works for combinational circuits.\n" ); return 0; } if ( Abc_NtkPoNum(pNtk) != 1 ) { - fprintf( stdout, "Currently expects a single-output miter.\n" ); + Abc_Print( -1, "Currently expects a single-output miter.\n" ); return 0; } if ( Abc_ObjFaninC0(Abc_NtkPo(pNtk, 0)) ) { - fprintf( stdout, "The PO driver is complemented. AND-decomposition is impossible.\n" ); + Abc_Print( -1, "The PO driver is complemented. AND-decomposition is impossible.\n" ); return 0; } if ( !Abc_ObjIsNode(Abc_ObjChild0(Abc_NtkPo(pNtk, 0))) ) { - fprintf( stdout, "The PO driver is not a node. AND-decomposition is impossible.\n" ); + Abc_Print( -1, "The PO driver is not a node. AND-decomposition is impossible.\n" ); return 0; } pNtkRes = Abc_NtkTopAnd( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "The command has failed.\n" ); + Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network @@ -7069,10 +7014,10 @@ int Abc_CommandTopAnd( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: topand [-h]\n" ); - fprintf( pErr, "\t performs AND-decomposition of single-output combinational miter\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tname : the node name\n"); + Abc_Print( -2, "usage: topand [-h]\n" ); + Abc_Print( -2, "\t performs AND-decomposition of single-output combinational miter\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tname : the node name\n"); return 1; } @@ -7089,15 +7034,11 @@ usage: ***********************************************************************/ int Abc_CommandTrim( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, nLevels; extern Abc_Ntk_t * Abc_NtkTrim( Abc_Ntk_t * pNtk ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nLevels = 10; Extra_UtilGetoptReset(); @@ -7109,7 +7050,7 @@ int Abc_CommandTrim( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nLevels = atoi(argv[globalUtilOptind]); @@ -7127,19 +7068,19 @@ int Abc_CommandTrim( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for logic circuits.\n" ); + Abc_Print( -1, "Currently only works for logic circuits.\n" ); return 0; } pNtkRes = Abc_NtkTrim( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "The command has failed.\n" ); + Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network @@ -7147,10 +7088,10 @@ int Abc_CommandTrim( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: trim [-h]\n" ); - fprintf( pErr, "\t removes POs fed by PIs and constants, and PIs w/o fanout\n" ); -// fprintf( pErr, "\t-N num : max number of levels [default = %d]\n", nLevels ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: trim [-h]\n" ); + Abc_Print( -2, "\t removes POs fed by PIs and constants, and PIs w/o fanout\n" ); +// Abc_Print( -2, "\t-N num : max number of levels [default = %d]\n", nLevels ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -7168,14 +7109,8 @@ usage: ***********************************************************************/ int Abc_CommandShortNames( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -7191,16 +7126,16 @@ int Abc_CommandShortNames( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } Abc_NtkShortNames( pNtk ); return 0; usage: - fprintf( pErr, "usage: short_names [-h]\n" ); - fprintf( pErr, "\t replaces PI/PO/latch names by short char strings\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: short_names [-h]\n" ); + Abc_Print( -2, "\t replaces PI/PO/latch names by short char strings\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -7217,14 +7152,10 @@ usage: ***********************************************************************/ int Abc_CommandExdcFree( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -7240,12 +7171,12 @@ int Abc_CommandExdcFree( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( pNtk->pExdc == NULL ) { - fprintf( pErr, "The network has no EXDC.\n" ); + Abc_Print( -1, "The network has no EXDC.\n" ); return 1; } @@ -7258,9 +7189,9 @@ int Abc_CommandExdcFree( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: exdc_free [-h]\n" ); - fprintf( pErr, "\t frees the EXDC network of the current network\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: exdc_free [-h]\n" ); + Abc_Print( -2, "\t frees the EXDC network of the current network\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -7277,14 +7208,10 @@ usage: ***********************************************************************/ int Abc_CommandExdcGet( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -7300,12 +7227,12 @@ int Abc_CommandExdcGet( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( pNtk->pExdc == NULL ) { - fprintf( pErr, "The network has no EXDC.\n" ); + Abc_Print( -1, "The network has no EXDC.\n" ); return 1; } @@ -7315,9 +7242,9 @@ int Abc_CommandExdcGet( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: exdc_get [-h]\n" ); - fprintf( pErr, "\t replaces the current network by the EXDC of the current network\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: exdc_get [-h]\n" ); + Abc_Print( -2, "\t replaces the current network by the EXDC of the current network\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -7334,15 +7261,12 @@ usage: ***********************************************************************/ int Abc_CommandExdcSet( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr, * pFile; + FILE * pFile; Abc_Ntk_t * pNtk, * pNtkNew, * pNtkRes; char * FileName; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -7358,7 +7282,7 @@ int Abc_CommandExdcSet( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -7371,10 +7295,10 @@ int Abc_CommandExdcSet( Abc_Frame_t * pAbc, int argc, char ** argv ) FileName = argv[globalUtilOptind]; if ( (pFile = fopen( FileName, "r" )) == NULL ) { - fprintf( pAbc->Err, "Cannot open input file \"%s\". ", FileName ); + Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); if ( (FileName = Extra_FileGetSimilarName( FileName, ".mv", ".blif", ".pla", ".eqn", ".bench" )) ) - fprintf( pAbc->Err, "Did you mean \"%s\"?", FileName ); - fprintf( pAbc->Err, "\n" ); + Abc_Print( 1, "Did you mean \"%s\"?", FileName ); + Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); @@ -7383,7 +7307,7 @@ int Abc_CommandExdcSet( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkNew = Io_Read( FileName, Io_ReadFileType(FileName), 1 ); if ( pNtkNew == NULL ) { - fprintf( pAbc->Err, "Reading network from file has failed.\n" ); + Abc_Print( -1, "Reading network from file has failed.\n" ); return 1; } @@ -7401,10 +7325,10 @@ int Abc_CommandExdcSet( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: exdc_set [-h] <file>\n" ); - fprintf( pErr, "\t sets the network from file as EXDC for the current network\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\t<file> : file with the new EXDC network\n"); + Abc_Print( -2, "usage: exdc_set [-h] <file>\n" ); + Abc_Print( -2, "\t sets the network from file as EXDC for the current network\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : file with the new EXDC network\n"); return 1; } @@ -7421,15 +7345,12 @@ usage: ***********************************************************************/ int Abc_CommandCareSet( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr, * pFile; + FILE * pFile; Abc_Ntk_t * pNtk, * pNtkNew, * pNtkRes; char * FileName; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -7445,7 +7366,7 @@ int Abc_CommandCareSet( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -7458,10 +7379,10 @@ int Abc_CommandCareSet( Abc_Frame_t * pAbc, int argc, char ** argv ) FileName = argv[globalUtilOptind]; if ( (pFile = fopen( FileName, "r" )) == NULL ) { - fprintf( pAbc->Err, "Cannot open input file \"%s\". ", FileName ); + Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); if ( (FileName = Extra_FileGetSimilarName( FileName, ".mv", ".blif", ".pla", ".eqn", ".bench" )) ) - fprintf( pAbc->Err, "Did you mean \"%s\"?", FileName ); - fprintf( pAbc->Err, "\n" ); + Abc_Print( 1, "Did you mean \"%s\"?", FileName ); + Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); @@ -7470,14 +7391,14 @@ int Abc_CommandCareSet( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkNew = Io_Read( FileName, Io_ReadFileType(FileName), 1 ); if ( pNtkNew == NULL ) { - fprintf( pAbc->Err, "Reading network from file has failed.\n" ); + Abc_Print( -1, "Reading network from file has failed.\n" ); return 1; } // replace the EXDC if ( pNtk->pExcare ) { - Abc_NtkDelete( pNtk->pExcare ); + Abc_NtkDelete( (Abc_Ntk_t *)pNtk->pExcare ); pNtk->pExcare = NULL; } pNtkRes = Abc_NtkDup( pNtk ); @@ -7488,10 +7409,10 @@ int Abc_CommandCareSet( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: care_set [-h] <file>\n" ); - fprintf( pErr, "\t sets the network from file as a care for the current network\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\t<file> : file with the new care network\n"); + Abc_Print( -2, "usage: care_set [-h] <file>\n" ); + Abc_Print( -2, "\t sets the network from file as a care for the current network\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : file with the new care network\n"); return 1; } @@ -7511,17 +7432,12 @@ int Abc_CommandCut( Abc_Frame_t * pAbc, int argc, char ** argv ) Cut_Params_t Params, * pParams = &Params; Cut_Man_t * pCutMan; Cut_Oracle_t * pCutOracle = NULL; - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fOracle; extern Cut_Man_t * Abc_NtkCuts( Abc_Ntk_t * pNtk, Cut_Params_t * pParams ); extern void Abc_NtkCutsOracle( Abc_Ntk_t * pNtk, Cut_Oracle_t * pCutOracle ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fOracle = 0; memset( pParams, 0, sizeof(Cut_Params_t) ); @@ -7547,7 +7463,7 @@ int Abc_CommandCut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } pParams->nVarsMax = atoi(argv[globalUtilOptind]); @@ -7558,7 +7474,7 @@ int Abc_CommandCut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'M': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-M\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pParams->nKeepMax = atoi(argv[globalUtilOptind]); @@ -7614,22 +7530,22 @@ int Abc_CommandCut( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Cut computation is available only for AIGs (run \"strash\").\n" ); + Abc_Print( -1, "Cut computation is available only for AIGs (run \"strash\").\n" ); return 1; } if ( pParams->nVarsMax < CUT_SIZE_MIN || pParams->nVarsMax > CUT_SIZE_MAX ) { - fprintf( pErr, "Can only compute the cuts for %d <= K <= %d.\n", CUT_SIZE_MIN, CUT_SIZE_MAX ); + Abc_Print( -1, "Can only compute the cuts for %d <= K <= %d.\n", CUT_SIZE_MIN, CUT_SIZE_MAX ); return 1; } if ( pParams->fDag && pParams->fTree ) { - fprintf( pErr, "Cannot compute both DAG cuts and tree cuts at the same time.\n" ); + Abc_Print( -1, "Cannot compute both DAG cuts and tree cuts at the same time.\n" ); return 1; } @@ -7648,23 +7564,23 @@ int Abc_CommandCut( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: cut [-K num] [-M num] [-tfdcovamjvh]\n" ); - fprintf( pErr, "\t computes k-feasible cuts for the AIG\n" ); - fprintf( pErr, "\t-K num : max number of leaves (%d <= num <= %d) [default = %d]\n", CUT_SIZE_MIN, CUT_SIZE_MAX, pParams->nVarsMax ); - fprintf( pErr, "\t-M num : max number of cuts stored at a node [default = %d]\n", pParams->nKeepMax ); - fprintf( pErr, "\t-t : toggle truth table computation [default = %s]\n", pParams->fTruth? "yes": "no" ); - fprintf( pErr, "\t-f : toggle filtering of duplicated/dominated [default = %s]\n", pParams->fFilter? "yes": "no" ); - fprintf( pErr, "\t-d : toggle dropping when fanouts are done [default = %s]\n", pParams->fDrop? "yes": "no" ); - fprintf( pErr, "\t-x : toggle computing only DAG cuts [default = %s]\n", pParams->fDag? "yes": "no" ); - fprintf( pErr, "\t-y : toggle computing only tree cuts [default = %s]\n", pParams->fTree? "yes": "no" ); - fprintf( pErr, "\t-g : toggle computing only global cuts [default = %s]\n", pParams->fGlobal? "yes": "no" ); - fprintf( pErr, "\t-l : toggle computing only local cuts [default = %s]\n", pParams->fLocal? "yes": "no" ); - fprintf( pErr, "\t-z : toggle fancy computations [default = %s]\n", pParams->fFancy? "yes": "no" ); - fprintf( pErr, "\t-a : toggle recording cut functions [default = %s]\n", pParams->fRecordAig?"yes": "no" ); - fprintf( pErr, "\t-m : toggle delay-oriented FPGA mapping [default = %s]\n", pParams->fMap? "yes": "no" ); - fprintf( pErr, "\t-j : toggle removing fanouts due to XOR/MUX [default = %s]\n", pParams->fAdjust? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", pParams->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: cut [-K num] [-M num] [-tfdcovamjvh]\n" ); + Abc_Print( -2, "\t computes k-feasible cuts for the AIG\n" ); + Abc_Print( -2, "\t-K num : max number of leaves (%d <= num <= %d) [default = %d]\n", CUT_SIZE_MIN, CUT_SIZE_MAX, pParams->nVarsMax ); + Abc_Print( -2, "\t-M num : max number of cuts stored at a node [default = %d]\n", pParams->nKeepMax ); + Abc_Print( -2, "\t-t : toggle truth table computation [default = %s]\n", pParams->fTruth? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle filtering of duplicated/dominated [default = %s]\n", pParams->fFilter? "yes": "no" ); + Abc_Print( -2, "\t-d : toggle dropping when fanouts are done [default = %s]\n", pParams->fDrop? "yes": "no" ); + Abc_Print( -2, "\t-x : toggle computing only DAG cuts [default = %s]\n", pParams->fDag? "yes": "no" ); + Abc_Print( -2, "\t-y : toggle computing only tree cuts [default = %s]\n", pParams->fTree? "yes": "no" ); + Abc_Print( -2, "\t-g : toggle computing only global cuts [default = %s]\n", pParams->fGlobal? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle computing only local cuts [default = %s]\n", pParams->fLocal? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle fancy computations [default = %s]\n", pParams->fFancy? "yes": "no" ); + Abc_Print( -2, "\t-a : toggle recording cut functions [default = %s]\n", pParams->fRecordAig?"yes": "no" ); + Abc_Print( -2, "\t-m : toggle delay-oriented FPGA mapping [default = %s]\n", pParams->fMap? "yes": "no" ); + Abc_Print( -2, "\t-j : toggle removing fanouts due to XOR/MUX [default = %s]\n", pParams->fAdjust? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pParams->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -7683,15 +7599,10 @@ int Abc_CommandScut( Abc_Frame_t * pAbc, int argc, char ** argv ) { Cut_Params_t Params, * pParams = &Params; Cut_Man_t * pCutMan; - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; extern Cut_Man_t * Abc_NtkSeqCuts( Abc_Ntk_t * pNtk, Cut_Params_t * pParams ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults memset( pParams, 0, sizeof(Cut_Params_t) ); pParams->nVarsMax = 5; // the max cut size ("k" of the k-feasible cuts) @@ -7708,7 +7619,7 @@ int Abc_CommandScut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } pParams->nVarsMax = atoi(argv[globalUtilOptind]); @@ -7719,7 +7630,7 @@ int Abc_CommandScut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'M': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-M\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pParams->nKeepMax = atoi(argv[globalUtilOptind]); @@ -7742,19 +7653,19 @@ int Abc_CommandScut( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } /* if ( !Abc_NtkIsSeq(pNtk) ) { - fprintf( pErr, "Sequential cuts can be computed for sequential AIGs (run \"seq\").\n" ); + Abc_Print( -1, "Sequential cuts can be computed for sequential AIGs (run \"seq\").\n" ); return 1; } */ if ( pParams->nVarsMax < CUT_SIZE_MIN || pParams->nVarsMax > CUT_SIZE_MAX ) { - fprintf( pErr, "Can only compute the cuts for %d <= K <= %d.\n", CUT_SIZE_MIN, CUT_SIZE_MAX ); + Abc_Print( -1, "Can only compute the cuts for %d <= K <= %d.\n", CUT_SIZE_MIN, CUT_SIZE_MAX ); return 1; } @@ -7763,13 +7674,13 @@ int Abc_CommandScut( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: scut [-K num] [-M num] [-tvh]\n" ); - fprintf( pErr, "\t computes k-feasible cuts for the sequential AIG\n" ); - fprintf( pErr, "\t-K num : max number of leaves (%d <= num <= %d) [default = %d]\n", CUT_SIZE_MIN, CUT_SIZE_MAX, pParams->nVarsMax ); - fprintf( pErr, "\t-M num : max number of cuts stored at a node [default = %d]\n", pParams->nKeepMax ); - fprintf( pErr, "\t-t : toggle truth table computation [default = %s]\n", pParams->fTruth? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", pParams->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: scut [-K num] [-M num] [-tvh]\n" ); + Abc_Print( -2, "\t computes k-feasible cuts for the sequential AIG\n" ); + Abc_Print( -2, "\t-K num : max number of leaves (%d <= num <= %d) [default = %d]\n", CUT_SIZE_MIN, CUT_SIZE_MAX, pParams->nVarsMax ); + Abc_Print( -2, "\t-M num : max number of cuts stored at a node [default = %d]\n", pParams->nKeepMax ); + Abc_Print( -2, "\t-t : toggle truth table computation [default = %s]\n", pParams->fTruth? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pParams->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -7786,17 +7697,12 @@ usage: ***********************************************************************/ int Abc_CommandEspresso( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fVerbose; extern void Abc_NtkEspresso( Abc_Ntk_t * pNtk, int fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - - printf( "This command is currently disabled.\n" ); + Abc_Print( -1, "This command is currently disabled.\n" ); return 0; // set defaults @@ -7817,22 +7723,22 @@ int Abc_CommandEspresso( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "SOP minimization is possible for logic networks (run \"renode\").\n" ); + Abc_Print( -1, "SOP minimization is possible for logic networks (run \"renode\").\n" ); return 1; } // Abc_NtkEspresso( pNtk, fVerbose ); return 0; usage: - fprintf( pErr, "usage: espresso [-vh]\n" ); - fprintf( pErr, "\t minimizes SOPs of the local functions using Espresso\n" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: espresso [-vh]\n" ); + Abc_Print( -2, "\t minimizes SOPs of the local functions using Espresso\n" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -7849,8 +7755,7 @@ usage: ***********************************************************************/ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nVars; int fAdder; @@ -7868,10 +7773,6 @@ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv ) extern void Abc_GenOneHot( char * pFileName, int nVars ); extern void Abc_GenRandom( char * pFileName, int nPis ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nVars = 8; fAdder = 0; @@ -7889,7 +7790,7 @@ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nVars = atoi(argv[globalUtilOptind]); @@ -7947,22 +7848,22 @@ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv ) else if ( fRandom ) Abc_GenRandom( FileName, nVars ); else - printf( "Type of circuit is not specified.\n" ); + Abc_Print( -1, "Type of circuit is not specified.\n" ); return 0; usage: - fprintf( pErr, "usage: gen [-N num] [-asmftrvh] <file>\n" ); - fprintf( pErr, "\t generates simple circuits\n" ); - fprintf( pErr, "\t-N num : the number of variables [default = %d]\n", nVars ); - fprintf( pErr, "\t-a : generate ripple-carry adder [default = %s]\n", fAdder? "yes": "no" ); - fprintf( pErr, "\t-s : generate a sorter [default = %s]\n", fSorter? "yes": "no" ); - fprintf( pErr, "\t-m : generate a mesh [default = %s]\n", fMesh? "yes": "no" ); - fprintf( pErr, "\t-f : generate a LUT FPGA structure [default = %s]\n", fFpga? "yes": "no" ); - fprintf( pErr, "\t-t : generate one-hotness conditions [default = %s]\n", fOneHot? "yes": "no" ); - fprintf( pErr, "\t-r : generate random single-output function [default = %s]\n", fRandom? "yes": "no" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\t<file> : output file name\n"); + Abc_Print( -2, "usage: gen [-N num] [-asmftrvh] <file>\n" ); + Abc_Print( -2, "\t generates simple circuits\n" ); + Abc_Print( -2, "\t-N num : the number of variables [default = %d]\n", nVars ); + Abc_Print( -2, "\t-a : generate ripple-carry adder [default = %s]\n", fAdder? "yes": "no" ); + Abc_Print( -2, "\t-s : generate a sorter [default = %s]\n", fSorter? "yes": "no" ); + Abc_Print( -2, "\t-m : generate a mesh [default = %s]\n", fMesh? "yes": "no" ); + Abc_Print( -2, "\t-f : generate a LUT FPGA structure [default = %s]\n", fFpga? "yes": "no" ); + Abc_Print( -2, "\t-t : generate one-hotness conditions [default = %s]\n", fOneHot? "yes": "no" ); + Abc_Print( -2, "\t-r : generate random single-output function [default = %s]\n", fRandom? "yes": "no" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : output file name\n"); return 1; } @@ -7979,7 +7880,6 @@ usage: ***********************************************************************/ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fVerbose; @@ -7987,11 +7887,7 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) int fUseEsop; int fUseInvs; int nFaninMax; - extern Abc_Ntk_t * Abc_NtkSopEsopCover( Abc_Ntk_t * pNtk, int nFaninMax, bool fUseEsop, bool fUseSop, bool fUseInvs, bool fVerbose ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults fUseSop = 1; @@ -8007,7 +7903,7 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nFaninMax = atoi(argv[globalUtilOptind]); @@ -8035,13 +7931,13 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Only works for strashed networks.\n" ); + Abc_Print( -1, "Only works for strashed networks.\n" ); return 1; } @@ -8049,7 +7945,7 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkSopEsopCover( pNtk, nFaninMax, fUseEsop, fUseSop, fUseInvs, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -8057,14 +7953,14 @@ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: cover [-N num] [-sxvh]\n" ); - fprintf( pErr, "\t decomposition into a network of SOP/ESOP PLAs\n" ); - fprintf( pErr, "\t-N num : maximum number of inputs [default = %d]\n", nFaninMax ); - fprintf( pErr, "\t-s : toggle the use of SOPs [default = %s]\n", fUseSop? "yes": "no" ); - fprintf( pErr, "\t-x : toggle the use of ESOPs [default = %s]\n", fUseEsop? "yes": "no" ); -// fprintf( pErr, "\t-i : toggle the use of interters [default = %s]\n", fUseInvs? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: cover [-N num] [-sxvh]\n" ); + Abc_Print( -2, "\t decomposition into a network of SOP/ESOP PLAs\n" ); + Abc_Print( -2, "\t-N num : maximum number of inputs [default = %d]\n", nFaninMax ); + Abc_Print( -2, "\t-s : toggle the use of SOPs [default = %s]\n", fUseSop? "yes": "no" ); + Abc_Print( -2, "\t-x : toggle the use of ESOPs [default = %s]\n", fUseEsop? "yes": "no" ); +// Abc_Print( -2, "\t-i : toggle the use of interters [default = %s]\n", fUseInvs? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -8081,7 +7977,6 @@ usage: ***********************************************************************/ int Abc_CommandInter( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtk1, * pNtk2, * pNtkRes = NULL; char ** pArgvNew; int nArgcNew; @@ -8091,9 +7986,6 @@ int Abc_CommandInter( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkInter( Abc_Ntk_t * pNtkOn, Abc_Ntk_t * pNtkOff, int fRelation, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fRelation = 0; fVerbose = 0; @@ -8117,20 +8009,20 @@ int Abc_CommandInter( Abc_Frame_t * pAbc, int argc, char ** argv ) pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; - if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) return 1; if ( nArgcNew == 0 ) { Abc_Obj_t * pObj; int i; - printf( "Deriving new circuit structure for the current network.\n" ); + Abc_Print( -1, "Deriving new circuit structure for the current network.\n" ); Abc_NtkForEachPo( pNtk2, pObj, i ) Abc_ObjXorFaninC( pObj, 0 ); } if ( fRelation && Abc_NtkCoNum(pNtk1) != 1 ) { - printf( "Computation of interplants as a relation only works for single-output functions.\n" ); - printf( "Use command \"cone\" to extract one output cone from the multi-output network.\n" ); + Abc_Print( -1, "Computation of interplants as a relation only works for single-output functions.\n" ); + Abc_Print( -1, "Use command \"cone\" to extract one output cone from the multi-output network.\n" ); } else pNtkRes = Abc_NtkInter( pNtk1, pNtk2, fRelation, fVerbose ); @@ -8139,33 +8031,33 @@ int Abc_CommandInter( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: - fprintf( pErr, "usage: inter [-rvh] <onset.blif> <offset.blif>\n" ); - fprintf( pErr, "\t derives interpolant of two networks representing onset and offset;\n" ); - fprintf( pErr, "\t-r : toggle computing interpolant as a relation [default = %s]\n", fRelation? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\t \n" ); - fprintf( pErr, "\t Comments:\n" ); - fprintf( pErr, "\t \n" ); - fprintf( pErr, "\t The networks given on the command line should have the same CIs/COs.\n" ); - fprintf( pErr, "\t If only one network is given on the command line, this network\n" ); - fprintf( pErr, "\t is assumed to be the offset, while the current network is the onset.\n" ); - fprintf( pErr, "\t If no network is given on the command line, the current network is\n" ); - fprintf( pErr, "\t assumed to be the onset and its complement is taken to be the offset.\n" ); - fprintf( pErr, "\t The resulting interpolant is stored as the current network.\n" ); - fprintf( pErr, "\t To verify that the interpolant agrees with the onset and the offset,\n" ); - fprintf( pErr, "\t save it in file \"inter.blif\" and run the following:\n" ); - fprintf( pErr, "\t (a) \"miter -i <onset.blif> <inter.blif>; iprove\"\n" ); - fprintf( pErr, "\t (b) \"miter -i <inter.blif> <offset_inv.blif>; iprove\"\n" ); - fprintf( pErr, "\t where <offset_inv.blif> is the network derived by complementing the\n" ); - fprintf( pErr, "\t outputs of <offset.blif>: \"r <onset.blif>; st -i; w <offset_inv.blif>\"\n" ); + Abc_Print( -2, "usage: inter [-rvh] <onset.blif> <offset.blif>\n" ); + Abc_Print( -2, "\t derives interpolant of two networks representing onset and offset;\n" ); + Abc_Print( -2, "\t-r : toggle computing interpolant as a relation [default = %s]\n", fRelation? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t \n" ); + Abc_Print( -2, "\t Comments:\n" ); + Abc_Print( -2, "\t \n" ); + Abc_Print( -2, "\t The networks given on the command line should have the same CIs/COs.\n" ); + Abc_Print( -2, "\t If only one network is given on the command line, this network\n" ); + Abc_Print( -2, "\t is assumed to be the offset, while the current network is the onset.\n" ); + Abc_Print( -2, "\t If no network is given on the command line, the current network is\n" ); + Abc_Print( -2, "\t assumed to be the onset and its complement is taken to be the offset.\n" ); + Abc_Print( -2, "\t The resulting interpolant is stored as the current network.\n" ); + Abc_Print( -2, "\t To verify that the interpolant agrees with the onset and the offset,\n" ); + Abc_Print( -2, "\t save it in file \"inter.blif\" and run the following:\n" ); + Abc_Print( -2, "\t (a) \"miter -i <onset.blif> <inter.blif>; iprove\"\n" ); + Abc_Print( -2, "\t (b) \"miter -i <inter.blif> <offset_inv.blif>; iprove\"\n" ); + Abc_Print( -2, "\t where <offset_inv.blif> is the network derived by complementing the\n" ); + Abc_Print( -2, "\t outputs of <offset.blif>: \"r <onset.blif>; st -i; w <offset_inv.blif>\"\n" ); return 1; } @@ -8182,7 +8074,6 @@ usage: ***********************************************************************/ int Abc_CommandDouble( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int nFrames; @@ -8190,9 +8081,6 @@ int Abc_CommandDouble( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDouble( Abc_Ntk_t * pNtk ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nFrames = 50; fVerbose = 0; @@ -8204,7 +8092,7 @@ int Abc_CommandDouble( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -8223,31 +8111,86 @@ int Abc_CommandDouble( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsSopLogic(pNtk) ) { - fprintf( pErr, "Only works for logic SOP networks.\n" ); + Abc_Print( -1, "Only works for logic SOP networks.\n" ); return 1; } pNtkRes = Abc_NtkDouble( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: - fprintf( pErr, "usage: double [-vh]\n" ); - fprintf( pErr, "\t puts together two parallel copies of the current network\n" ); -// fprintf( pErr, "\t-F num : the number of frames to simulate [default = %d]\n", nFrames ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: double [-vh]\n" ); + Abc_Print( -2, "\t puts together two parallel copies of the current network\n" ); +// Abc_Print( -2, "\t-F num : the number of frames to simulate [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandBb2Wb( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern void Abc_NtkConvertBb2Wb( char * pFileNameIn, char * pFileNameOut, int fSeq, int fVerbose ); + int c; + int fSeq; + int fVerbose; + // set defaults + fSeq = 0; + fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "svh" ) ) != EOF ) + { + switch ( c ) + { + case 's': + fSeq ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + default: + goto usage; + } + } + if ( argc != globalUtilOptind + 2 ) + { + Abc_Print( -1, "Expecting two files names on the command line.\n" ); + goto usage; + } + Abc_NtkConvertBb2Wb( argv[globalUtilOptind], argv[globalUtilOptind+1], fSeq, fVerbose ); + return 0; + +usage: + Abc_Print( -2, "usage: bb2wb [-svh] <file_in> <file_out>\n" ); + Abc_Print( -2, "\t replaces black boxes by white boxes with AND functions\n" ); + Abc_Print( -2, "\t (file names should have standard extensions, e.g. \"blif\")\n" ); + Abc_Print( -2, "\t-s : toggle using sequential white boxes [default = %s]\n", fSeq? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file_in> : input file with design containing black boxes\n"); + Abc_Print( -2, "\t<file_out> : output file with design containing white boxes\n"); return 1; } @@ -8264,8 +8207,7 @@ usage: ***********************************************************************/ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtkRes = NULL; int c; int fBmc; @@ -8302,10 +8244,10 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkCRetime( Abc_Ntk_t * pNtk, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); -// printf( "This command is temporarily disabled.\n" ); + + +// Abc_Print( -1, "This command is temporarily disabled.\n" ); // return 0; // set defaults @@ -8322,7 +8264,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -8333,7 +8275,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nLevels = atoi(argv[globalUtilOptind]); @@ -8359,19 +8301,19 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) /* if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsSeq(pNtk) ) { - fprintf( pErr, "Only works for non-sequential networks.\n" ); + Abc_Print( -1, "Only works for non-sequential networks.\n" ); return 1; } */ // Abc_NtkTestEsop( pNtk ); // Abc_NtkTestSop( pNtk ); -// printf( "This command is currently not used.\n" ); +// Abc_Print( -1, "This command is currently not used.\n" ); // run the command // pNtkRes = Abc_NtkMiterForCofactors( pNtk, 0, 0, -1 ); // pNtkRes = Abc_NtkNewAig( pNtk ); @@ -8380,7 +8322,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = NULL; if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 1; } // replace the current network @@ -8414,7 +8356,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) // pNtkRes = NULL; if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 1; } // replace the current network @@ -8439,21 +8381,21 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) /* if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Network should be strashed. Command has failed.\n" ); + Abc_Print( -1, "Network should be strashed. Command has failed.\n" ); return 1; } */ /* if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } */ /* if ( Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for logic circuits.\n" ); + Abc_Print( -1, "Currently only works for logic circuits.\n" ); return 0; } */ @@ -8467,7 +8409,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) // pNtkRes = NULL; if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 1; } // replace the current network @@ -8480,7 +8422,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) /* if ( globalUtilOptind != 1 ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 1; } Abc_NtkDarTestBlif( argv[globalUtilOptind] ); @@ -8488,13 +8430,15 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) // Abc_NtkDarPartition( pNtk ); //Abc_NtkDarTest( pNtk ); +//Abc_NtkWriteAig( pNtk, NULL ); + /* // pNtkRes = Abc_NtkDarRetimeStep( pNtk, 0 ); pNtkRes = Abc_NtkDarHaigRecord( pNtk, 3, 3000, 0, 0, 0, 0 ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 1; } // replace the current network @@ -8505,7 +8449,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkDarTestNtk( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 1; } // replace the current network @@ -8527,23 +8471,29 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) Aig_ManStop( pAig ); } */ + +/* // Bbl_ManSimpleDemo(); // pNtkRes = Abc_NtkCRetime( pNtk ); pNtkRes = NULL; if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); +*/ + +// Abc_NtkHelloWorld( pNtk ); + return 0; usage: - fprintf( pErr, "usage: test [-h] <file_name>\n" ); - fprintf( pErr, "\t testbench for new procedures\n" ); -// fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); -// fprintf( pErr, "\t-w : toggle printing very verbose information [default = %s]\n", fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: test [-h] <file_name>\n" ); + Abc_Print( -2, "\t testbench for new procedures\n" ); +// Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); +// Abc_Print( -2, "\t-w : toggle printing very verbose information [default = %s]\n", fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -8560,15 +8510,11 @@ usage: ***********************************************************************/ int Abc_CommandQuaVar( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, iVar, fUniv, fVerbose, RetValue; extern int Abc_NtkQuantify( Abc_Ntk_t * pNtk, int fUniv, int iVar, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults iVar = 0; fUniv = 0; @@ -8581,7 +8527,7 @@ int Abc_CommandQuaVar( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } iVar = atoi(argv[globalUtilOptind]); @@ -8603,12 +8549,12 @@ int Abc_CommandQuaVar( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkGetChoiceNum( pNtk ) ) { - fprintf( pErr, "This command cannot be applied to an AIG with choice nodes.\n" ); + Abc_Print( -1, "This command cannot be applied to an AIG with choice nodes.\n" ); return 1; } @@ -8617,11 +8563,11 @@ int Abc_CommandQuaVar( Abc_Frame_t * pAbc, int argc, char ** argv ) RetValue = Abc_NtkQuantify( pNtkRes, fUniv, iVar, fVerbose ); // clean temporary storage for the cofactors Abc_NtkCleanData( pNtkRes ); - Abc_AigCleanup( pNtkRes->pManFunc ); + Abc_AigCleanup( (Abc_Aig_t *)pNtkRes->pManFunc ); // check the result if ( !RetValue ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -8629,12 +8575,12 @@ int Abc_CommandQuaVar( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: qvar [-I num] [-uvh]\n" ); - fprintf( pErr, "\t quantifies one variable using the AIG\n" ); - fprintf( pErr, "\t-I num : the zero-based index of a variable to quantify [default = %d]\n", iVar ); - fprintf( pErr, "\t-u : toggle universal quantification [default = %s]\n", fUniv? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: qvar [-I num] [-uvh]\n" ); + Abc_Print( -2, "\t quantifies one variable using the AIG\n" ); + Abc_Print( -2, "\t-I num : the zero-based index of a variable to quantify [default = %d]\n", iVar ); + Abc_Print( -2, "\t-u : toggle universal quantification [default = %s]\n", fUniv? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -8651,15 +8597,11 @@ usage: ***********************************************************************/ int Abc_CommandQuaRel( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, iVar, fInputs, fVerbose; extern Abc_Ntk_t * Abc_NtkTransRel( Abc_Ntk_t * pNtk, int fInputs, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults iVar = 0; fInputs = 1; @@ -8672,7 +8614,7 @@ int Abc_CommandQuaRel( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } iVar = atoi(argv[globalUtilOptind]); @@ -8694,17 +8636,17 @@ int Abc_CommandQuaRel( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkGetChoiceNum( pNtk ) ) { - fprintf( pErr, "This command cannot be applied to an AIG with choice nodes.\n" ); + Abc_Print( -1, "This command cannot be applied to an AIG with choice nodes.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "This command works only for sequential circuits.\n" ); + Abc_Print( -1, "This command works only for sequential circuits.\n" ); return 1; } @@ -8720,7 +8662,7 @@ int Abc_CommandQuaRel( Abc_Frame_t * pAbc, int argc, char ** argv ) // check if the result is available if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -8728,12 +8670,12 @@ int Abc_CommandQuaRel( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: qrel [-qvh]\n" ); - fprintf( pErr, "\t computes transition relation of the sequential network\n" ); -// fprintf( pErr, "\t-I num : the zero-based index of a variable to quantify [default = %d]\n", iVar ); - fprintf( pErr, "\t-q : perform quantification of inputs [default = %s]\n", fInputs? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: qrel [-qvh]\n" ); + Abc_Print( -2, "\t computes transition relation of the sequential network\n" ); +// Abc_Print( -2, "\t-I num : the zero-based index of a variable to quantify [default = %d]\n", iVar ); + Abc_Print( -2, "\t-q : perform quantification of inputs [default = %s]\n", fInputs? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -8750,15 +8692,11 @@ usage: ***********************************************************************/ int Abc_CommandQuaReach( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, nIters, fVerbose; extern Abc_Ntk_t * Abc_NtkReachability( Abc_Ntk_t * pNtk, int nIters, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nIters = 256; fVerbose = 0; @@ -8770,7 +8708,7 @@ int Abc_CommandQuaReach( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); @@ -8789,39 +8727,39 @@ int Abc_CommandQuaReach( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkGetChoiceNum( pNtk ) ) { - fprintf( pErr, "This command cannot be applied to an AIG with choice nodes.\n" ); + Abc_Print( -1, "This command cannot be applied to an AIG with choice nodes.\n" ); return 1; } if ( !Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "This command works only for combinational transition relations.\n" ); + Abc_Print( -1, "This command works only for combinational transition relations.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } if ( Abc_NtkPoNum(pNtk) > 1 ) { - fprintf( pErr, "The transition relation should have one output.\n" ); + Abc_Print( -1, "The transition relation should have one output.\n" ); return 1; } if ( Abc_NtkPiNum(pNtk) % 2 != 0 ) { - fprintf( pErr, "The transition relation should have an even number of inputs.\n" ); + Abc_Print( -1, "The transition relation should have an even number of inputs.\n" ); return 1; } pNtkRes = Abc_NtkReachability( pNtk, nIters, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -8829,13 +8767,13 @@ int Abc_CommandQuaReach( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: qreach [-I num] [-vh]\n" ); - fprintf( pErr, "\t computes unreachable states using AIG-based quantification\n" ); - fprintf( pErr, "\t assumes that the current network is a transition relation\n" ); - fprintf( pErr, "\t assumes that the initial state is composed of all zeros\n" ); - fprintf( pErr, "\t-I num : the number of image computations to perform [default = %d]\n", nIters ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: qreach [-I num] [-vh]\n" ); + Abc_Print( -2, "\t computes unreachable states using AIG-based quantification\n" ); + Abc_Print( -2, "\t assumes that the current network is a transition relation\n" ); + Abc_Print( -2, "\t assumes that the initial state is composed of all zeros\n" ); + Abc_Print( -2, "\t-I num : the number of image computations to perform [default = %d]\n", nIters ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -8852,17 +8790,11 @@ usage: ***********************************************************************/ int Abc_CommandSenseInput( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Vec_Int_t * vResult; int c, nConfLim, fVerbose; extern Vec_Int_t * Abc_NtkSensitivity( Abc_Ntk_t * pNtk, int nConfLim, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nConfLim = 1000; fVerbose = 1; @@ -8874,7 +8806,7 @@ int Abc_CommandSenseInput( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLim = atoi(argv[globalUtilOptind]); @@ -8893,27 +8825,27 @@ int Abc_CommandSenseInput( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkGetChoiceNum( pNtk ) ) { - fprintf( pErr, "This command cannot be applied to an AIG with choice nodes.\n" ); + Abc_Print( -1, "This command cannot be applied to an AIG with choice nodes.\n" ); return 1; } if ( !Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "This command works only for combinational transition relations.\n" ); + Abc_Print( -1, "This command works only for combinational transition relations.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } if ( Abc_NtkPoNum(pNtk) < 2 ) { - fprintf( pErr, "The network should have at least two outputs.\n" ); + Abc_Print( -1, "The network should have at least two outputs.\n" ); return 1; } @@ -8922,12 +8854,12 @@ int Abc_CommandSenseInput( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: senseinput [-C num] [-vh]\n" ); - fprintf( pErr, "\t computes sensitivity of POs to PIs under constraint\n" ); - fprintf( pErr, "\t constraint should be represented as the last PO" ); - fprintf( pErr, "\t-C num : the max number of conflicts at a node [default = %d]\n", nConfLim ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: senseinput [-C num] [-vh]\n" ); + Abc_Print( -2, "\t computes sensitivity of POs to PIs under constraint\n" ); + Abc_Print( -2, "\t constraint should be represented as the last PO" ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", nConfLim ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -8945,15 +8877,11 @@ usage: ***********************************************************************/ int Abc_CommandIStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes, * pNtkTemp; int c; extern Abc_Ntk_t * Abc_NtkIvyStrash( Abc_Ntk_t * pNtk ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -8968,7 +8896,7 @@ int Abc_CommandIStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) @@ -8981,7 +8909,7 @@ int Abc_CommandIStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkIvyStrash( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -8989,9 +8917,9 @@ int Abc_CommandIStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: istrash [-h]\n" ); - fprintf( pErr, "\t perform sequential structural hashing\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: istrash [-h]\n" ); + Abc_Print( -2, "\t perform sequential structural hashing\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9008,15 +8936,10 @@ usage: ***********************************************************************/ int Abc_CommandICut( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c, nInputs; extern void Abc_NtkIvyCuts( Abc_Ntk_t * pNtk, int nInputs ); - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nInputs = 5; Extra_UtilGetoptReset(); @@ -9027,7 +8950,7 @@ int Abc_CommandICut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nInputs = atoi(argv[globalUtilOptind]); @@ -9043,12 +8966,12 @@ int Abc_CommandICut( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } @@ -9056,10 +8979,10 @@ int Abc_CommandICut( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: icut [-K num] [-h]\n" ); - fprintf( pErr, "\t computes sequential cuts of the given size\n" ); - fprintf( pErr, "\t-K num : the number of cut inputs (2 <= num <= 6) [default = %d]\n", nInputs ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: icut [-K num] [-h]\n" ); + Abc_Print( -2, "\t computes sequential cuts of the given size\n" ); + Abc_Print( -2, "\t-K num : the number of cut inputs (2 <= num <= 6) [default = %d]\n", nInputs ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9076,15 +8999,11 @@ usage: ***********************************************************************/ int Abc_CommandIRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, fUpdateLevel, fUseZeroCost, fVerbose; extern Abc_Ntk_t * Abc_NtkIvyRewrite( Abc_Ntk_t * pNtk, int fUpdateLevel, int fUseZeroCost, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUpdateLevel = 1; fUseZeroCost = 0; @@ -9111,19 +9030,19 @@ int Abc_CommandIRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkIvyRewrite( pNtk, fUpdateLevel, fUseZeroCost, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -9131,12 +9050,12 @@ int Abc_CommandIRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: irw [-lzvh]\n" ); - fprintf( pErr, "\t perform combinational AIG rewriting\n" ); - fprintf( pErr, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeroCost? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: irw [-lzvh]\n" ); + Abc_Print( -2, "\t perform combinational AIG rewriting\n" ); + Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeroCost? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9153,7 +9072,6 @@ usage: ***********************************************************************/ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; Dar_RwrPar_t Pars, * pPars = &Pars; int c; @@ -9161,9 +9079,6 @@ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDRewrite( Abc_Ntk_t * pNtk, Dar_RwrPar_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Dar_ManDefaultRwrParams( pPars ); Extra_UtilGetoptReset(); @@ -9174,7 +9089,7 @@ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nCutsMax = atoi(argv[globalUtilOptind]); @@ -9185,7 +9100,7 @@ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nSubgMax = atoi(argv[globalUtilOptind]); @@ -9219,18 +9134,18 @@ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDRewrite( pNtk, pPars ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -9238,17 +9153,17 @@ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: drw [-C num] [-N num] [-lfzrvwh]\n" ); - fprintf( pErr, "\t performs combinational AIG rewriting\n" ); - fprintf( pErr, "\t-C num : the max number of cuts at a node [default = %d]\n", pPars->nCutsMax ); - fprintf( pErr, "\t-N num : the max number of subgraphs tried [default = %d]\n", pPars->nSubgMax ); - fprintf( pErr, "\t-l : toggle preserving the number of levels [default = %s]\n", pPars->fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-f : toggle representing fanouts [default = %s]\n", pPars->fFanout? "yes": "no" ); - fprintf( pErr, "\t-z : toggle using zero-cost replacements [default = %s]\n", pPars->fUseZeros? "yes": "no" ); - fprintf( pErr, "\t-r : toggle using cut recycling [default = %s]\n", pPars->fRecycle? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggle very verbose printout [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: drw [-C num] [-N num] [-lfzrvwh]\n" ); + Abc_Print( -2, "\t performs combinational AIG rewriting\n" ); + Abc_Print( -2, "\t-C num : the max number of cuts at a node [default = %d]\n", pPars->nCutsMax ); + Abc_Print( -2, "\t-N num : the max number of subgraphs tried [default = %d]\n", pPars->nSubgMax ); + Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", pPars->fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle representing fanouts [default = %s]\n", pPars->fFanout? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", pPars->fUseZeros? "yes": "no" ); + Abc_Print( -2, "\t-r : toggle using cut recycling [default = %s]\n", pPars->fRecycle? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle very verbose printout [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9265,7 +9180,6 @@ usage: ***********************************************************************/ int Abc_CommandDRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; Dar_RefPar_t Pars, * pPars = &Pars; int c; @@ -9273,9 +9187,6 @@ int Abc_CommandDRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDRefactor( Abc_Ntk_t * pNtk, Dar_RefPar_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Dar_ManDefaultRefParams( pPars ); Extra_UtilGetoptReset(); @@ -9286,7 +9197,7 @@ int Abc_CommandDRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'M': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nMffcMin = atoi(argv[globalUtilOptind]); @@ -9297,7 +9208,7 @@ int Abc_CommandDRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nLeafMax = atoi(argv[globalUtilOptind]); @@ -9308,7 +9219,7 @@ int Abc_CommandDRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nCutsMax = atoi(argv[globalUtilOptind]); @@ -9339,23 +9250,23 @@ int Abc_CommandDRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } if ( pPars->nLeafMax < 4 || pPars->nLeafMax > 15 ) { - fprintf( pErr, "This command only works for cut sizes 4 <= K <= 15.\n" ); + Abc_Print( -1, "This command only works for cut sizes 4 <= K <= 15.\n" ); return 1; } pNtkRes = Abc_NtkDRefactor( pNtk, pPars ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -9363,17 +9274,17 @@ int Abc_CommandDRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: drf [-M num] [-K num] [-C num] [-elzvwh]\n" ); - fprintf( pErr, "\t performs combinational AIG refactoring\n" ); - fprintf( pErr, "\t-M num : the min MFFC size to attempt refactoring [default = %d]\n", pPars->nMffcMin ); - fprintf( pErr, "\t-K num : the max number of cuts leaves [default = %d]\n", pPars->nLeafMax ); - fprintf( pErr, "\t-C num : the max number of cuts to try at a node [default = %d]\n", pPars->nCutsMax ); - fprintf( pErr, "\t-e : toggle extending tbe cut below MFFC [default = %s]\n", pPars->fExtend? "yes": "no" ); - fprintf( pErr, "\t-l : toggle preserving the number of levels [default = %s]\n", pPars->fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-z : toggle using zero-cost replacements [default = %s]\n", pPars->fUseZeros? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggle very verbose printout [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: drf [-M num] [-K num] [-C num] [-elzvwh]\n" ); + Abc_Print( -2, "\t performs combinational AIG refactoring\n" ); + Abc_Print( -2, "\t-M num : the min MFFC size to attempt refactoring [default = %d]\n", pPars->nMffcMin ); + Abc_Print( -2, "\t-K num : the max number of cuts leaves [default = %d]\n", pPars->nLeafMax ); + Abc_Print( -2, "\t-C num : the max number of cuts to try at a node [default = %d]\n", pPars->nCutsMax ); + Abc_Print( -2, "\t-e : toggle extending tbe cut below MFFC [default = %s]\n", pPars->fExtend? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", pPars->fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", pPars->fUseZeros? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle very verbose printout [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9388,18 +9299,14 @@ usage: SeeAlso [] ***********************************************************************/ -int Abc_CommandDC2( Abc_Frame_t * pAbc, int argc, char ** argv ) +int Abc_CommandDc2( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int fBalance, fVerbose, fUpdateLevel, fFanout, fPower, c; extern Abc_Ntk_t * Abc_NtkDC2( Abc_Ntk_t * pNtk, int fBalance, int fUpdateLevel, int fFanout, int fPower, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fBalance = 0; fVerbose = 0; @@ -9434,18 +9341,18 @@ int Abc_CommandDC2( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDC2( pNtk, fBalance, fUpdateLevel, fFanout, fPower, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -9453,14 +9360,14 @@ int Abc_CommandDC2( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: dc2 [-blfpvh]\n" ); - fprintf( pErr, "\t performs combinational AIG optimization\n" ); - fprintf( pErr, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); - fprintf( pErr, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-f : toggle representing fanouts [default = %s]\n", fFanout? "yes": "no" ); - fprintf( pErr, "\t-p : toggle power-aware rewriting [default = %s]\n", fPower? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dc2 [-blfpvh]\n" ); + Abc_Print( -2, "\t performs combinational AIG optimization\n" ); + Abc_Print( -2, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle representing fanouts [default = %s]\n", fFanout? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle power-aware rewriting [default = %s]\n", fPower? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9478,7 +9385,6 @@ usage: ***********************************************************************/ int Abc_CommandDChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int fBalance, fVerbose, fUpdateLevel, fConstruct, c; int nConfMax, nLevelMax; @@ -9486,9 +9392,6 @@ int Abc_CommandDChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDChoice( Abc_Ntk_t * pNtk, int fBalance, int fUpdateLevel, int fConstruct, int nConfMax, int nLevelMax, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fBalance = 1; fUpdateLevel = 1; @@ -9504,7 +9407,7 @@ int Abc_CommandDChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfMax = atoi(argv[globalUtilOptind]); @@ -9515,7 +9418,7 @@ int Abc_CommandDChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLevelMax = atoi(argv[globalUtilOptind]); @@ -9543,18 +9446,18 @@ int Abc_CommandDChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDChoice( pNtk, fBalance, fUpdateLevel, fConstruct, nConfMax, nLevelMax, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -9562,15 +9465,15 @@ int Abc_CommandDChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: dchoice [-C num] [-L num] [-blcvh]\n" ); - fprintf( pErr, "\t performs partitioned choicing using new AIG package\n" ); - fprintf( pErr, "\t-C num : the max number of conflicts at a node [default = %d]\n", nConfMax ); - fprintf( pErr, "\t-L num : the max level of nodes to consider (0 = not used) [default = %d]\n", nLevelMax ); - fprintf( pErr, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); - fprintf( pErr, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-c : toggle constructive computation of choices [default = %s]\n", fConstruct? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dchoice [-C num] [-L num] [-blcvh]\n" ); + Abc_Print( -2, "\t performs partitioned choicing using new AIG package\n" ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", nConfMax ); + Abc_Print( -2, "\t-L num : the max level of nodes to consider (0 = not used) [default = %d]\n", nLevelMax ); + Abc_Print( -2, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle constructive computation of choices [default = %s]\n", fConstruct? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9588,15 +9491,11 @@ usage: int Abc_CommandDch( Abc_Frame_t * pAbc, int argc, char ** argv ) { Dch_Pars_t Pars, * pPars = &Pars; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; extern Abc_Ntk_t * Abc_NtkDch( Abc_Ntk_t * pNtk, Dch_Pars_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Dch_ManSetDefaultParams( pPars ); Extra_UtilGetoptReset(); @@ -9607,7 +9506,7 @@ int Abc_CommandDch( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nWords = atoi(argv[globalUtilOptind]); @@ -9618,7 +9517,7 @@ int Abc_CommandDch( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -9629,7 +9528,7 @@ int Abc_CommandDch( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nSatVarMax = atoi(argv[globalUtilOptind]); @@ -9666,18 +9565,18 @@ int Abc_CommandDch( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDch( pNtk, pPars ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -9685,19 +9584,19 @@ int Abc_CommandDch( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: dch [-WCS num] [-sptgcfvh]\n" ); - fprintf( pErr, "\t computes structural choices using a new approach\n" ); - fprintf( pErr, "\t-W num : the max number of simulation words [default = %d]\n", pPars->nWords ); - fprintf( pErr, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); - fprintf( pErr, "\t-S num : the max number of SAT variables [default = %d]\n", pPars->nSatVarMax ); - fprintf( pErr, "\t-s : toggle synthesizing three snapshots [default = %s]\n", pPars->fSynthesis? "yes": "no" ); - fprintf( pErr, "\t-p : toggle power-aware rewriting [default = %s]\n", pPars->fPower? "yes": "no" ); - fprintf( pErr, "\t-t : toggle simulation of the TFO classes [default = %s]\n", pPars->fSimulateTfo? "yes": "no" ); - fprintf( pErr, "\t-g : toggle using GIA to prove equivalences [default = %s]\n", pPars->fUseGia? "yes": "no" ); - fprintf( pErr, "\t-c : toggle using circuit-based SAT vs. MiniSat [default = %s]\n", pPars->fUseCSat? "yes": "no" ); - fprintf( pErr, "\t-f : toggle using faster logic synthesis [default = %s]\n", pPars->fLightSynth? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dch [-WCS num] [-sptgcfvh]\n" ); + Abc_Print( -2, "\t computes structural choices using a new approach\n" ); + Abc_Print( -2, "\t-W num : the max number of simulation words [default = %d]\n", pPars->nWords ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-S num : the max number of SAT variables [default = %d]\n", pPars->nSatVarMax ); + Abc_Print( -2, "\t-s : toggle synthesizing three snapshots [default = %s]\n", pPars->fSynthesis? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle power-aware rewriting [default = %s]\n", pPars->fPower? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle simulation of the TFO classes [default = %s]\n", pPars->fSimulateTfo? "yes": "no" ); + Abc_Print( -2, "\t-g : toggle using GIA to prove equivalences [default = %s]\n", pPars->fUseGia? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle using circuit-based SAT vs. MiniSat [default = %s]\n", pPars->fUseCSat? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle using faster logic synthesis [default = %s]\n", pPars->fLightSynth? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9714,16 +9613,12 @@ usage: ***********************************************************************/ int Abc_CommandDrwsat( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int fBalance, fVerbose, c; extern Abc_Ntk_t * Abc_NtkDrwsat( Abc_Ntk_t * pNtk, int fBalance, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fBalance = 0; fVerbose = 0; @@ -9746,18 +9641,18 @@ int Abc_CommandDrwsat( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDrwsat( pNtk, fBalance, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -9765,11 +9660,11 @@ int Abc_CommandDrwsat( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: drwsat [-bvh]\n" ); - fprintf( pErr, "\t performs combinational AIG optimization for SAT\n" ); - fprintf( pErr, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: drwsat [-bvh]\n" ); + Abc_Print( -2, "\t performs combinational AIG optimization for SAT\n" ); + Abc_Print( -2, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9786,15 +9681,11 @@ usage: ***********************************************************************/ int Abc_CommandIRewriteSeq( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, fUpdateLevel, fUseZeroCost, fVerbose; extern Abc_Ntk_t * Abc_NtkIvyRewriteSeq( Abc_Ntk_t * pNtk, int fUseZeroCost, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUpdateLevel = 0; fUseZeroCost = 0; @@ -9821,19 +9712,19 @@ int Abc_CommandIRewriteSeq( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkIvyRewriteSeq( pNtk, fUseZeroCost, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -9841,12 +9732,12 @@ int Abc_CommandIRewriteSeq( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: irws [-zvh]\n" ); - fprintf( pErr, "\t perform sequential AIG rewriting\n" ); -// fprintf( pErr, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeroCost? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: irws [-zvh]\n" ); + Abc_Print( -2, "\t perform sequential AIG rewriting\n" ); +// Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle using zero-cost replacements [default = %s]\n", fUseZeroCost? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9863,15 +9754,11 @@ usage: ***********************************************************************/ int Abc_CommandIResyn( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, fUpdateLevel, fVerbose; extern Abc_Ntk_t * Abc_NtkIvyResyn( Abc_Ntk_t * pNtk, int fUpdateLevel, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fUpdateLevel = 1; fVerbose = 0; @@ -9894,19 +9781,19 @@ int Abc_CommandIResyn( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkIvyResyn( pNtk, fUpdateLevel, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -9914,11 +9801,11 @@ int Abc_CommandIResyn( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: iresyn [-lvh]\n" ); - fprintf( pErr, "\t performs combinational resynthesis\n" ); - fprintf( pErr, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: iresyn [-lvh]\n" ); + Abc_Print( -2, "\t performs combinational resynthesis\n" ); + Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -9935,7 +9822,6 @@ usage: ***********************************************************************/ int Abc_CommandISat( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, fUpdateLevel, fVerbose; int nConfLimit; @@ -9943,9 +9829,6 @@ int Abc_CommandISat( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkIvySat( Abc_Ntk_t * pNtk, int nConfLimit, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nConfLimit = 100000; fUpdateLevel = 1; @@ -9958,7 +9841,7 @@ int Abc_CommandISat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); @@ -9980,19 +9863,19 @@ int Abc_CommandISat( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkIvySat( pNtk, nConfLimit, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -10000,12 +9883,12 @@ int Abc_CommandISat( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: isat [-C num] [-vh]\n" ); - fprintf( pErr, "\t tries to prove the miter constant 0\n" ); - fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); -// fprintf( pErr, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: isat [-C num] [-vh]\n" ); + Abc_Print( -2, "\t tries to prove the miter constant 0\n" ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); +// Abc_Print( -2, "\t-l : toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -10022,7 +9905,6 @@ usage: ***********************************************************************/ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, fProve, fVerbose, fDoSparse; int nConfLimit; @@ -10033,9 +9915,6 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarFraigPart( Abc_Ntk_t * pNtk, int nPartSize, int nConfLimit, int nLevelMax, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nPartSize = 0; nLevelMax = 0; @@ -10051,7 +9930,7 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPartSize = atoi(argv[globalUtilOptind]); @@ -10062,7 +9941,7 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); @@ -10073,7 +9952,7 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLevelMax = atoi(argv[globalUtilOptind]); @@ -10098,12 +9977,12 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } @@ -10113,7 +9992,7 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkIvyFraig( pNtk, nConfLimit, fDoSparse, fProve, 0, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -10121,15 +10000,15 @@ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: ifraig [-P num] [-C num] [-L num] [-spvh]\n" ); - fprintf( pErr, "\t performs fraiging using a new method\n" ); - fprintf( pErr, "\t-P num : partition size (0 = partitioning is not used) [default = %d]\n", nPartSize ); - fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - fprintf( pErr, "\t-L num : limit on node level to fraig (0 = fraig all nodes) [default = %d]\n", nLevelMax ); - fprintf( pErr, "\t-s : toggle considering sparse functions [default = %s]\n", fDoSparse? "yes": "no" ); - fprintf( pErr, "\t-p : toggle proving the miter outputs [default = %s]\n", fProve? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: ifraig [-P num] [-C num] [-L num] [-spvh]\n" ); + Abc_Print( -2, "\t performs fraiging using a new method\n" ); + Abc_Print( -2, "\t-P num : partition size (0 = partitioning is not used) [default = %d]\n", nPartSize ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); + Abc_Print( -2, "\t-L num : limit on node level to fraig (0 = fraig all nodes) [default = %d]\n", nLevelMax ); + Abc_Print( -2, "\t-s : toggle considering sparse functions [default = %s]\n", fDoSparse? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle proving the miter outputs [default = %s]\n", fProve? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -10146,16 +10025,12 @@ usage: ***********************************************************************/ int Abc_CommandDFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, nConfLimit, fDoSparse, fProve, fSpeculate, fChoicing, fVerbose; extern Abc_Ntk_t * Abc_NtkDarFraig( Abc_Ntk_t * pNtk, int nConfLimit, int fDoSparse, int fProve, int fTransfer, int fSpeculate, int fChoicing, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nConfLimit = 100; fDoSparse = 1; @@ -10171,7 +10046,7 @@ int Abc_CommandDFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); @@ -10202,19 +10077,19 @@ int Abc_CommandDFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDarFraig( pNtk, nConfLimit, fDoSparse, fProve, 0, fSpeculate, fChoicing, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -10222,15 +10097,15 @@ int Abc_CommandDFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: dfraig [-C num] [-sprcvh]\n" ); - fprintf( pErr, "\t performs fraiging using a new method\n" ); - fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - fprintf( pErr, "\t-s : toggle considering sparse functions [default = %s]\n", fDoSparse? "yes": "no" ); - fprintf( pErr, "\t-p : toggle proving the miter outputs [default = %s]\n", fProve? "yes": "no" ); - fprintf( pErr, "\t-r : toggle speculative reduction [default = %s]\n", fSpeculate? "yes": "no" ); - fprintf( pErr, "\t-c : toggle accumulation of choices [default = %s]\n", fChoicing? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dfraig [-C num] [-sprcvh]\n" ); + Abc_Print( -2, "\t performs fraiging using a new method\n" ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); + Abc_Print( -2, "\t-s : toggle considering sparse functions [default = %s]\n", fDoSparse? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle proving the miter outputs [default = %s]\n", fProve? "yes": "no" ); + Abc_Print( -2, "\t-r : toggle speculative reduction [default = %s]\n", fSpeculate? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle accumulation of choices [default = %s]\n", fChoicing? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -10247,16 +10122,12 @@ usage: ***********************************************************************/ int Abc_CommandCSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, nCutsMax, nLeafMax, fVerbose; extern Abc_Ntk_t * Abc_NtkCSweep( Abc_Ntk_t * pNtk, int nCutsMax, int nLeafMax, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nCutsMax = 8; nLeafMax = 6; @@ -10269,7 +10140,7 @@ int Abc_CommandCSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nCutsMax = atoi(argv[globalUtilOptind]); @@ -10280,7 +10151,7 @@ int Abc_CommandCSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLeafMax = atoi(argv[globalUtilOptind]); @@ -10299,31 +10170,31 @@ int Abc_CommandCSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( nCutsMax < 2 ) { - fprintf( pErr, "The number of cuts cannot be less than 2.\n" ); + Abc_Print( -1, "The number of cuts cannot be less than 2.\n" ); return 1; } if ( nLeafMax < 3 || nLeafMax > 16 ) { - fprintf( pErr, "The number of leaves is infeasible.\n" ); + Abc_Print( -1, "The number of leaves is infeasible.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkCSweep( pNtk, nCutsMax, nLeafMax, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -10331,12 +10202,12 @@ int Abc_CommandCSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: csweep [-C num] [-K num] [-vh]\n" ); - fprintf( pErr, "\t performs cut sweeping using a new method\n" ); - fprintf( pErr, "\t-C num : limit on the number of cuts (C >= 2) [default = %d]\n", nCutsMax ); - fprintf( pErr, "\t-K num : limit on the cut size (3 <= K <= 16) [default = %d]\n", nLeafMax ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: csweep [-C num] [-K num] [-vh]\n" ); + Abc_Print( -2, "\t performs cut sweeping using a new method\n" ); + Abc_Print( -2, "\t-C num : limit on the number of cuts (C >= 2) [default = %d]\n", nCutsMax ); + Abc_Print( -2, "\t-K num : limit on the cut size (3 <= K <= 16) [default = %d]\n", nLeafMax ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -10354,16 +10225,12 @@ usage: int Abc_CommandIProve( Abc_Frame_t * pAbc, int argc, char ** argv ) { Prove_Params_t Params, * pParams = &Params; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkTemp; int c, clk, RetValue, iOut = -1; extern int Abc_NtkIvyProve( Abc_Ntk_t ** ppNtk, void * pPars ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Prove_ParamsSetDefault( pParams ); pParams->fUseRewriting = 1; @@ -10387,13 +10254,13 @@ int Abc_CommandIProve( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) > 0 ) { - fprintf( pErr, "The network has registers. Use \"dprove\".\n" ); + Abc_Print( -1, "The network has registers. Use \"dprove\".\n" ); return 1; } @@ -10419,29 +10286,29 @@ int Abc_CommandIProve( Abc_Frame_t * pAbc, int argc, char ** argv ) break; } if ( i == Abc_NtkCoNum(pNtk) ) - printf( "ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" ); + Abc_Print( 1, "ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" ); ABC_FREE( pSimInfo ); } - + pAbc->Status = RetValue; if ( RetValue == -1 ) - printf( "UNDECIDED " ); + Abc_Print( 1, "UNDECIDED " ); else if ( RetValue == 0 ) - printf( "SATISFIABLE (output = %d) ", iOut ); + Abc_Print( 1, "SATISFIABLE (output = %d) ", iOut ); else - printf( "UNSATISFIABLE " ); - //printf( "\n" ); + Abc_Print( 1, "UNSATISFIABLE " ); + //Abc_Print( -1, "\n" ); - ABC_PRT( "Time", clock() - clk ); + Abc_PrintTime( 1, "Time", clock() - clk ); // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkTemp ); return 0; usage: - fprintf( pErr, "usage: iprove [-rvh]\n" ); - fprintf( pErr, "\t performs CEC using a new method\n" ); - fprintf( pErr, "\t-r : toggle AIG rewriting [default = %s]\n", pParams->fUseRewriting? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", pParams->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: iprove [-rvh]\n" ); + Abc_Print( -2, "\t performs CEC using a new method\n" ); + Abc_Print( -2, "\t-r : toggle AIG rewriting [default = %s]\n", pParams->fUseRewriting? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pParams->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -10459,7 +10326,7 @@ usage: /* int Abc_CommandHaig( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; + FILE * stdout, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int nIters; @@ -10472,8 +10339,8 @@ int Abc_CommandHaig( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarHaigRecord( Abc_Ntk_t * pNtk, int nIters, int nSteps, int fRetimingOnly, int fAddBugs, int fUseCnf, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); + + // set defaults nIters = 3; @@ -10490,7 +10357,7 @@ int Abc_CommandHaig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); @@ -10501,7 +10368,7 @@ int Abc_CommandHaig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-S\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by a positive integer.\n" ); goto usage; } nSteps = atoi(argv[globalUtilOptind]); @@ -10529,19 +10396,19 @@ int Abc_CommandHaig( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for strashed networks.\n" ); + Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDarHaigRecord( pNtk, nIters, nSteps, fRetimingOnly, fAddBugs, fUseCnf, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -10549,19 +10416,19 @@ int Abc_CommandHaig( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: haig [-IS num] [-rbcvh]\n" ); - fprintf( pErr, "\t run a few rounds of comb+seq synthesis to test HAIG recording\n" ); - fprintf( pErr, "\t the current network is set to be the result of synthesis performed\n" ); - fprintf( pErr, "\t (this network can be verified using command \"dsec\")\n" ); - fprintf( pErr, "\t HAIG is written out into the file \"haig.blif\"\n" ); - fprintf( pErr, "\t (this HAIG can be proved using \"r haig.blif; st; dprove -abc -F 16\")\n" ); - fprintf( pErr, "\t-I num : the number of rounds of comb+seq synthesis [default = %d]\n", nIters ); - fprintf( pErr, "\t-S num : the number of forward retiming moves performed [default = %d]\n", nSteps ); - fprintf( pErr, "\t-r : toggle the use of retiming only [default = %s]\n", fRetimingOnly? "yes": "no" ); - fprintf( pErr, "\t-b : toggle bug insertion [default = %s]\n", fAddBugs? "yes": "no" ); - fprintf( pErr, "\t-c : enable CNF-based proof (no speculative reduction) [default = %s]\n", fUseCnf? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: haig [-IS num] [-rbcvh]\n" ); + Abc_Print( -2, "\t run a few rounds of comb+seq synthesis to test HAIG recording\n" ); + Abc_Print( -2, "\t the current network is set to be the result of synthesis performed\n" ); + Abc_Print( -2, "\t (this network can be verified using command \"dsec\")\n" ); + Abc_Print( -2, "\t HAIG is written out into the file \"haig.blif\"\n" ); + Abc_Print( -2, "\t (this HAIG can be proved using \"r haig.blif; st; dprove -abc -F 16\")\n" ); + Abc_Print( -2, "\t-I num : the number of rounds of comb+seq synthesis [default = %d]\n", nIters ); + Abc_Print( -2, "\t-S num : the number of forward retiming moves performed [default = %d]\n", nSteps ); + Abc_Print( -2, "\t-r : toggle the use of retiming only [default = %s]\n", fRetimingOnly? "yes": "no" ); + Abc_Print( -2, "\t-b : toggle bug insertion [default = %s]\n", fAddBugs? "yes": "no" ); + Abc_Print( -2, "\t-c : enable CNF-based proof (no speculative reduction) [default = %s]\n", fUseCnf? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } */ @@ -10579,14 +10446,11 @@ usage: ***********************************************************************/ int Abc_CommandMini( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; extern Abc_Ntk_t * Abc_NtkMiniBalance( Abc_Ntk_t * pNtk ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults Extra_UtilGetoptReset(); @@ -10602,19 +10466,19 @@ int Abc_CommandMini( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Only works for combinatinally strashed AIG networks.\n" ); + Abc_Print( -1, "Only works for combinatinally strashed AIG networks.\n" ); return 1; } pNtkRes = Abc_NtkMiniBalance( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Command has failed.\n" ); + Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network @@ -10622,9 +10486,9 @@ int Abc_CommandMini( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: mini [-h]\n" ); - fprintf( pErr, "\t perform balancing using new package\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: mini [-h]\n" ); + Abc_Print( -2, "\t perform balancing using new package\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -10641,18 +10505,12 @@ usage: ***********************************************************************/ int Abc_CommandQbf( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nPars; int fVerbose; extern void Abc_NtkQbf( Abc_Ntk_t * pNtk, int nPars, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nPars = -1; fVerbose = 1; @@ -10664,7 +10522,7 @@ int Abc_CommandQbf( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPars = atoi(argv[globalUtilOptind]); @@ -10683,22 +10541,22 @@ int Abc_CommandQbf( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "Works only for combinational networks.\n" ); + Abc_Print( -1, "Works only for combinational networks.\n" ); return 1; } if ( Abc_NtkPoNum(pNtk) != 1 ) { - fprintf( pErr, "The miter should have one primary output.\n" ); + Abc_Print( -1, "The miter should have one primary output.\n" ); return 1; } if ( !(nPars > 0 && nPars < Abc_NtkPiNum(pNtk)) ) { - fprintf( pErr, "The number of paramter variables is invalid (should be > 0 and < PI num).\n" ); + Abc_Print( -1, "The number of paramter variables is invalid (should be > 0 and < PI num).\n" ); return 1; } if ( Abc_NtkIsStrash(pNtk) ) @@ -10712,11 +10570,11 @@ int Abc_CommandQbf( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: qbf [-P num] [-vh]\n" ); - fprintf( pErr, "\t solves a quantified boolean formula problem EpVxM(p,x)\n" ); - fprintf( pErr, "\t-P num : number of paramters (should be the first PIs) [default = %d]\n", nPars ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: qbf [-P num] [-vh]\n" ); + Abc_Print( -2, "\t solves a quantified intean formula problem EpVxM(p,x)\n" ); + Abc_Print( -2, "\t-P num : number of paramters (should be the first PIs) [default = %d]\n", nPars ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -10736,7 +10594,6 @@ int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) { char Buffer[100]; Fraig_Params_t Params, * pParams = &Params; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int fAllNodes; int fExdc; @@ -10745,9 +10602,6 @@ int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) extern void Abc_NtkFraigPartitionedTime( Abc_Ntk_t * pNtk, void * pParams ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fExdc = 0; fAllNodes = 0; @@ -10771,7 +10625,7 @@ int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'R': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-R\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } pParams->nPatsRand = atoi(argv[globalUtilOptind]); @@ -10782,7 +10636,7 @@ int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pParams->nPatsDyna = atoi(argv[globalUtilOptind]); @@ -10793,7 +10647,7 @@ int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pParams->nBTLimit = atoi(argv[globalUtilOptind]); @@ -10835,12 +10689,12 @@ int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Can only fraig a logic network or an AIG.\n" ); + Abc_Print( -1, "Can only fraig a logic network or an AIG.\n" ); return 1; } @@ -10873,7 +10727,7 @@ int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtkRes == NULL ) { - fprintf( pErr, "Fraiging has failed.\n" ); + Abc_Print( -1, "Fraiging has failed.\n" ); return 1; } @@ -10886,21 +10740,21 @@ int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) usage: sprintf( Buffer, "%d", pParams->nBTLimit ); - fprintf( pErr, "usage: fraig [-R num] [-D num] [-C num] [-rscpvtah]\n" ); - fprintf( pErr, "\t transforms a logic network into a functionally reduced AIG\n" ); - fprintf( pErr, "\t (there are also newer fraiging commands, \"ifraig\" and \"dfraig\")\n" ); - fprintf( pErr, "\t-R num : number of random patterns (127 < num < 32769) [default = %d]\n", pParams->nPatsRand ); - fprintf( pErr, "\t-D num : number of systematic patterns (127 < num < 32769) [default = %d]\n", pParams->nPatsDyna ); - fprintf( pErr, "\t-C num : number of backtracks for one SAT problem [default = %s]\n", pParams->nBTLimit==-1? "infinity" : Buffer ); - fprintf( pErr, "\t-r : toggle functional reduction [default = %s]\n", pParams->fFuncRed? "yes": "no" ); - fprintf( pErr, "\t-s : toggle considering sparse functions [default = %s]\n", pParams->fDoSparse? "yes": "no" ); - fprintf( pErr, "\t-c : toggle accumulation of choices [default = %s]\n", pParams->fChoicing? "yes": "no" ); - fprintf( pErr, "\t-p : toggle proving the miter outputs [default = %s]\n", pParams->fTryProve? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", pParams->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-e : toggle functional sweeping using EXDC [default = %s]\n", fExdc? "yes": "no" ); - fprintf( pErr, "\t-a : toggle between all nodes and DFS nodes [default = %s]\n", fAllNodes? "all": "dfs" ); - fprintf( pErr, "\t-t : toggle using partitioned representation [default = %s]\n", fPartition? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: fraig [-R num] [-D num] [-C num] [-rscpvtah]\n" ); + Abc_Print( -2, "\t transforms a logic network into a functionally reduced AIG\n" ); + Abc_Print( -2, "\t (there are also newer fraiging commands, \"ifraig\" and \"dfraig\")\n" ); + Abc_Print( -2, "\t-R num : number of random patterns (127 < num < 32769) [default = %d]\n", pParams->nPatsRand ); + Abc_Print( -2, "\t-D num : number of systematic patterns (127 < num < 32769) [default = %d]\n", pParams->nPatsDyna ); + Abc_Print( -2, "\t-C num : number of backtracks for one SAT problem [default = %s]\n", pParams->nBTLimit==-1? "infinity" : Buffer ); + Abc_Print( -2, "\t-r : toggle functional reduction [default = %s]\n", pParams->fFuncRed? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle considering sparse functions [default = %s]\n", pParams->fDoSparse? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle accumulation of choices [default = %s]\n", pParams->fChoicing? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle proving the miter outputs [default = %s]\n", pParams->fTryProve? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pParams->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-e : toggle functional sweeping using EXDC [default = %s]\n", fExdc? "yes": "no" ); + Abc_Print( -2, "\t-a : toggle between all nodes and DFS nodes [default = %s]\n", fAllNodes? "all": "dfs" ); + Abc_Print( -2, "\t-t : toggle using partitioned representation [default = %s]\n", fPartition? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -10917,15 +10771,11 @@ usage: ***********************************************************************/ int Abc_CommandFraigTrust( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fDuplicate; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fDuplicate = 0; Extra_UtilGetoptReset(); @@ -10945,7 +10795,7 @@ int Abc_CommandFraigTrust( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -10953,7 +10803,7 @@ int Abc_CommandFraigTrust( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkFraigTrust( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Fraiging in the trust mode has failed.\n" ); + Abc_Print( -1, "Fraiging in the trust mode has failed.\n" ); return 1; } // replace the current network @@ -10961,10 +10811,10 @@ int Abc_CommandFraigTrust( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: fraig_trust [-h]\n" ); - fprintf( pErr, "\t transforms the current network into an AIG assuming it is FRAIG with choices\n" ); -// fprintf( pErr, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: fraig_trust [-h]\n" ); + Abc_Print( -2, "\t transforms the current network into an AIG assuming it is FRAIG with choices\n" ); +// Abc_Print( -2, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -10981,15 +10831,10 @@ usage: ***********************************************************************/ int Abc_CommandFraigStore( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fDuplicate; - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fDuplicate = 0; Extra_UtilGetoptReset(); @@ -11009,23 +10854,23 @@ int Abc_CommandFraigStore( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network if ( !Abc_NtkFraigStore( pNtk ) ) { - fprintf( pErr, "Fraig storing has failed.\n" ); + Abc_Print( -1, "Fraig storing has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: fraig_store [-h]\n" ); - fprintf( pErr, "\t saves the current network in the AIG database\n" ); -// fprintf( pErr, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: fraig_store [-h]\n" ); + Abc_Print( -2, "\t saves the current network in the AIG database\n" ); +// Abc_Print( -2, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11042,15 +10887,11 @@ usage: ***********************************************************************/ int Abc_CommandFraigRestore( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fDuplicate; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fDuplicate = 0; Extra_UtilGetoptReset(); @@ -11070,7 +10911,7 @@ int Abc_CommandFraigRestore( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -11078,7 +10919,7 @@ int Abc_CommandFraigRestore( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkFraigRestore(); if ( pNtkRes == NULL ) { - fprintf( pErr, "Fraig restoring has failed.\n" ); + Abc_Print( -1, "Fraig restoring has failed.\n" ); return 1; } // replace the current network @@ -11086,10 +10927,10 @@ int Abc_CommandFraigRestore( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: fraig_restore [-h]\n" ); - fprintf( pErr, "\t makes the current network by fraiging the AIG database\n" ); -// fprintf( pErr, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: fraig_restore [-h]\n" ); + Abc_Print( -2, "\t makes the current network by fraiging the AIG database\n" ); +// Abc_Print( -2, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11106,15 +10947,9 @@ usage: ***********************************************************************/ int Abc_CommandFraigClean( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fDuplicate; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fDuplicate = 0; Extra_UtilGetoptReset(); @@ -11135,10 +10970,10 @@ int Abc_CommandFraigClean( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: fraig_clean [-h]\n" ); - fprintf( pErr, "\t cleans the internal FRAIG storage\n" ); -// fprintf( pErr, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: fraig_clean [-h]\n" ); + Abc_Print( -2, "\t cleans the internal FRAIG storage\n" ); +// Abc_Print( -2, "\t-d : toggle duplication of logic [default = %s]\n", fDuplicate? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11155,19 +10990,13 @@ usage: ***********************************************************************/ int Abc_CommandFraigSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseInv; int fExdc; int fVerbose; int fVeryVerbose; - extern bool Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - + extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); // set defaults fUseInv = 1; fExdc = 0; @@ -11199,34 +11028,34 @@ int Abc_CommandFraigSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Cannot sweep AIGs (use \"fraig\").\n" ); + Abc_Print( -1, "Cannot sweep AIGs (use \"fraig\").\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "Transform the current network into a logic network.\n" ); + Abc_Print( -1, "Transform the current network into a logic network.\n" ); return 1; } // modify the current network if ( !Abc_NtkFraigSweep( pNtk, fUseInv, fExdc, fVerbose, fVeryVerbose ) ) { - fprintf( pErr, "Sweeping has failed.\n" ); + Abc_Print( -1, "Sweeping has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: fraig_sweep [-evwh]\n" ); - fprintf( pErr, "\t performs technology-dependent sweep\n" ); - fprintf( pErr, "\t-e : toggle functional sweeping using EXDC [default = %s]\n", fExdc? "yes": "no" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : prints equivalence class information [default = %s]\n", fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: fraig_sweep [-evwh]\n" ); + Abc_Print( -2, "\t performs technology-dependent sweep\n" ); + Abc_Print( -2, "\t-e : toggle functional sweeping using EXDC [default = %s]\n", fExdc? "yes": "no" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : prints equivalence class information [default = %s]\n", fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11243,24 +11072,32 @@ usage: ***********************************************************************/ int Abc_CommandFraigDress( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + extern void Abc_NtkDress( Abc_Ntk_t * pNtk, char * pFileName, int fVerbose ); + extern void Abc_NtkDress2( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConflictLimit, int fVerbose ); + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtk2; char * pFileName; int c; + int nConfs; int fVerbose; - extern void Abc_NtkDress( Abc_Ntk_t * pNtk, char * pFileName, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults - fVerbose = 0; + nConfs = 1000; + fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "Cvh" ) ) != EOF ) { switch ( c ) { + case 'C': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); + goto usage; + } + nConfs = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nConfs < 0 ) + goto usage; + break; case 'v': fVerbose ^= 1; break; @@ -11272,33 +11109,37 @@ int Abc_CommandFraigDress( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for logic networks.\n" ); + Abc_Print( -1, "This command works only for logic networks.\n" ); return 1; } if ( argc != globalUtilOptind && argc != globalUtilOptind + 1 ) goto usage; if ( argc == globalUtilOptind && Abc_NtkSpec(pNtk) == NULL ) { - fprintf( pErr, "The current network has no spec.\n" ); + Abc_Print( -1, "The current network has no spec.\n" ); return 1; } // get the input file name pFileName = (argc == globalUtilOptind + 1) ? argv[globalUtilOptind] : Abc_NtkSpec(pNtk); // modify the current network - Abc_NtkDress( pNtk, pFileName, fVerbose ); +// Abc_NtkDress( pNtk, pFileName, fVerbose ); + pNtk2 = Io_Read( pFileName, Io_ReadFileType(pFileName), 1 ); + Abc_NtkDress2( pNtk, pNtk2, nConfs, fVerbose ); + Abc_NtkDelete( pNtk2 ); return 0; usage: - fprintf( pErr, "usage: dress [-vh] <file>\n" ); - fprintf( pErr, "\t transfers internal node names from file to the current network\n" ); - fprintf( pErr, "\t<file> : network with names (if not given, the current network spec is used)\n" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dress [-C num] [-vh] <file>\n" ); + Abc_Print( -2, "\t transfers internal node names from file to the current network\n" ); + Abc_Print( -2, "\t<file> : network with names (if not given, the current network spec is used)\n" ); + Abc_Print( -2, "\t-C num : the maximum number of conflicts at each node [default = %d]\n", nConfs ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11317,14 +11158,8 @@ usage: ***********************************************************************/ int Abc_CommandHaigStart( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) @@ -11339,16 +11174,16 @@ int Abc_CommandHaigStart( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for AIGs; run strashing (\"st\").\n" ); + Abc_Print( -1, "This command works only for AIGs; run strashing (\"st\").\n" ); return 0; } Abc_NtkHaigStart( pNtk ); return 0; usage: - fprintf( pErr, "usage: haig_start [-h]\n" ); - fprintf( pErr, "\t starts constructive accumulation of combinational choices\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: haig_start [-h]\n" ); + Abc_Print( -2, "\t starts constructive accumulation of combinational choices\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11365,14 +11200,8 @@ usage: ***********************************************************************/ int Abc_CommandHaigStop( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) @@ -11387,16 +11216,16 @@ int Abc_CommandHaigStop( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for AIGs; run strashing (\"st\").\n" ); + Abc_Print( -1, "This command works only for AIGs; run strashing (\"st\").\n" ); return 0; } Abc_NtkHaigStop( pNtk ); return 0; usage: - fprintf( pErr, "usage: haig_stop [-h]\n" ); - fprintf( pErr, "\t cleans the internal storage for combinational choices\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: haig_stop [-h]\n" ); + Abc_Print( -2, "\t cleans the internal storage for combinational choices\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11413,14 +11242,10 @@ usage: ***********************************************************************/ int Abc_CommandHaigUse( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) @@ -11435,14 +11260,14 @@ int Abc_CommandHaigUse( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for AIGs; run strashing (\"st\").\n" ); + Abc_Print( -1, "This command works only for AIGs; run strashing (\"st\").\n" ); return 0; } // get the new network pNtkRes = Abc_NtkHaigUse( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Transforming internal storage into AIG with choices has failed.\n" ); + Abc_Print( -1, "Transforming internal storage into AIG with choices has failed.\n" ); return 1; } // replace the current network @@ -11450,9 +11275,9 @@ int Abc_CommandHaigUse( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: haig_use [-h]\n" ); - fprintf( pErr, "\t transforms internal storage into an AIG with choices\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: haig_use [-h]\n" ); + Abc_Print( -2, "\t transforms internal storage into an AIG with choices\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11471,16 +11296,12 @@ usage: ***********************************************************************/ int Abc_CommandRecStart( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nVars; int nCuts; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nVars = 4; nCuts = 8; @@ -11492,7 +11313,7 @@ int Abc_CommandRecStart( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nVars = atoi(argv[globalUtilOptind]); @@ -11503,7 +11324,7 @@ int Abc_CommandRecStart( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nCuts = atoi(argv[globalUtilOptind]); @@ -11519,29 +11340,29 @@ int Abc_CommandRecStart( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( !(nVars >= 3 && nVars <= 16) ) { - fprintf( pErr, "The range of allowed values is 3 <= K <= 16.\n" ); + Abc_Print( -1, "The range of allowed values is 3 <= K <= 16.\n" ); return 0; } if ( Abc_NtkRecIsRunning() ) { - fprintf( pErr, "The AIG subgraph recording is already started.\n" ); + Abc_Print( -1, "The AIG subgraph recording is already started.\n" ); return 0; } if ( pNtk && !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for AIGs; run strashing (\"st\").\n" ); + Abc_Print( -1, "This command works only for AIGs; run strashing (\"st\").\n" ); return 0; } Abc_NtkRecStart( pNtk, nVars, nCuts ); return 0; usage: - fprintf( pErr, "usage: rec_start [-K num] [-C num] [-h]\n" ); - fprintf( pErr, "\t starts recording AIG subgraphs (should be called for\n" ); - fprintf( pErr, "\t an empty network or after reading in a previous record)\n" ); - fprintf( pErr, "\t-K num : the largest number of inputs [default = %d]\n", nVars ); - fprintf( pErr, "\t-C num : the max number of cuts used at a node (0 < num < 2^12) [default = %d]\n", nCuts ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: rec_start [-K num] [-C num] [-h]\n" ); + Abc_Print( -2, "\t starts recording AIG subgraphs (should be called for\n" ); + Abc_Print( -2, "\t an empty network or after reading in a previous record)\n" ); + Abc_Print( -2, "\t-K num : the largest number of inputs [default = %d]\n", nVars ); + Abc_Print( -2, "\t-C num : the max number of cuts used at a node (0 < num < 2^12) [default = %d]\n", nCuts ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11558,14 +11379,8 @@ usage: ***********************************************************************/ int Abc_CommandRecStop( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) @@ -11580,16 +11395,16 @@ int Abc_CommandRecStop( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( !Abc_NtkRecIsRunning() ) { - fprintf( pErr, "This command works only after calling \"rec_start\".\n" ); + Abc_Print( -1, "This command works only after calling \"rec_start\".\n" ); return 0; } Abc_NtkRecStop(); return 0; usage: - fprintf( pErr, "usage: rec_stop [-h]\n" ); - fprintf( pErr, "\t cleans the internal storage for AIG subgraphs\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: rec_stop [-h]\n" ); + Abc_Print( -2, "\t cleans the internal storage for AIG subgraphs\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11606,14 +11421,8 @@ usage: ***********************************************************************/ int Abc_CommandRecAdd( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) @@ -11628,21 +11437,21 @@ int Abc_CommandRecAdd( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works for AIGs.\n" ); + Abc_Print( -1, "This command works for AIGs.\n" ); return 0; } if ( !Abc_NtkRecIsRunning() ) { - fprintf( pErr, "This command works for AIGs after calling \"rec_start\".\n" ); + Abc_Print( -1, "This command works for AIGs after calling \"rec_start\".\n" ); return 0; } Abc_NtkRecAdd( pNtk ); return 0; usage: - fprintf( pErr, "usage: rec_add [-h]\n" ); - fprintf( pErr, "\t adds subgraphs from the current network to the set\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: rec_add [-h]\n" ); + Abc_Print( -2, "\t adds subgraphs from the current network to the set\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11659,14 +11468,8 @@ usage: ***********************************************************************/ int Abc_CommandRecPs( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) @@ -11681,16 +11484,16 @@ int Abc_CommandRecPs( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( !Abc_NtkRecIsRunning() ) { - fprintf( pErr, "This command works for AIGs only after calling \"rec_start\".\n" ); + Abc_Print( -1, "This command works for AIGs only after calling \"rec_start\".\n" ); return 0; } Abc_NtkRecPs(); return 0; usage: - fprintf( pErr, "usage: rec_ps [-h]\n" ); - fprintf( pErr, "\t prints statistics about the recorded AIG subgraphs\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: rec_ps [-h]\n" ); + Abc_Print( -2, "\t prints statistics about the recorded AIG subgraphs\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11707,14 +11510,10 @@ usage: ***********************************************************************/ int Abc_CommandRecUse( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) @@ -11729,14 +11528,14 @@ int Abc_CommandRecUse( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( !Abc_NtkRecIsRunning() ) { - fprintf( pErr, "This command works for AIGs only after calling \"rec_start\".\n" ); + Abc_Print( -1, "This command works for AIGs only after calling \"rec_start\".\n" ); return 0; } // get the new network pNtkRes = Abc_NtkRecUse(); if ( pNtkRes == NULL ) { - fprintf( pErr, "Transforming internal AIG subgraphs into an AIG with choices has failed.\n" ); + Abc_Print( -1, "Transforming internal AIG subgraphs into an AIG with choices has failed.\n" ); return 1; } // replace the current network @@ -11744,9 +11543,9 @@ int Abc_CommandRecUse( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: rec_use [-h]\n" ); - fprintf( pErr, "\t transforms internal storage into an AIG with choices\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: rec_use [-h]\n" ); + Abc_Print( -2, "\t transforms internal storage into an AIG with choices\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11765,7 +11564,6 @@ usage: ***********************************************************************/ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; char Buffer[100]; double DelayTarget; @@ -11776,12 +11574,9 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) int fVerbose; int c; extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, int fRecovery, int fSwitching, int fVerbose ); - extern bool Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); + extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults DelayTarget =-1; fAreaOnly = 0; @@ -11797,7 +11592,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by a floating point number.\n" ); goto usage; } DelayTarget = (float)atof(argv[globalUtilOptind]); @@ -11829,7 +11624,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -11841,23 +11636,23 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtk == NULL ) { - fprintf( pErr, "Strashing before mapping has failed.\n" ); + Abc_Print( -1, "Strashing before mapping has failed.\n" ); return 1; } pNtk = Abc_NtkBalance( pNtkRes = pNtk, 0, 0, 1 ); Abc_NtkDelete( pNtkRes ); if ( pNtk == NULL ) { - fprintf( pErr, "Balancing before mapping has failed.\n" ); + Abc_Print( -1, "Balancing before mapping has failed.\n" ); return 1; } - fprintf( pOut, "The network was strashed and balanced before mapping.\n" ); + Abc_Print( 0, "The network was strashed and balanced before mapping.\n" ); // get the new network pNtkRes = Abc_NtkMap( pNtk, DelayTarget, fRecovery, fSwitching, fVerbose ); if ( pNtkRes == NULL ) { Abc_NtkDelete( pNtk ); - fprintf( pErr, "Mapping has failed.\n" ); + Abc_Print( -1, "Mapping has failed.\n" ); return 1; } Abc_NtkDelete( pNtk ); @@ -11868,7 +11663,7 @@ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkMap( pNtk, DelayTarget, fRecovery, fSwitching, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Mapping has failed.\n" ); + Abc_Print( -1, "Mapping has failed.\n" ); return 1; } } @@ -11885,15 +11680,15 @@ usage: sprintf( Buffer, "not used" ); else sprintf( Buffer, "%.3f", DelayTarget ); - fprintf( pErr, "usage: map [-D float] [-arspvh]\n" ); - fprintf( pErr, "\t performs standard cell mapping of the current network\n" ); - fprintf( pErr, "\t-D float : sets the global required times [default = %s]\n", Buffer ); - fprintf( pErr, "\t-a : toggles area-only mapping [default = %s]\n", fAreaOnly? "yes": "no" ); - fprintf( pErr, "\t-r : toggles area recovery [default = %s]\n", fRecovery? "yes": "no" ); - fprintf( pErr, "\t-s : toggles sweep after mapping [default = %s]\n", fSweep? "yes": "no" ); - fprintf( pErr, "\t-p : optimizes power by minimizing switching [default = %s]\n", fSwitching? "yes": "no" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: map [-D float] [-arspvh]\n" ); + Abc_Print( -2, "\t performs standard cell mapping of the current network\n" ); + Abc_Print( -2, "\t-D float : sets the global required times [default = %s]\n", Buffer ); + Abc_Print( -2, "\t-a : toggles area-only mapping [default = %s]\n", fAreaOnly? "yes": "no" ); + Abc_Print( -2, "\t-r : toggles area recovery [default = %s]\n", fRecovery? "yes": "no" ); + Abc_Print( -2, "\t-s : toggles sweep after mapping [default = %s]\n", fSweep? "yes": "no" ); + Abc_Print( -2, "\t-p : optimizes power by minimizing switching [default = %s]\n", fSwitching? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -11911,17 +11706,13 @@ usage: int Abc_CommandAmap( Abc_Frame_t * pAbc, int argc, char ** argv ) { Amap_Par_t Pars, * pPars = &Pars; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int fSweep; int c; extern Abc_Ntk_t * Abc_NtkDarAmap( Abc_Ntk_t * pNtk, Amap_Par_t * pPars ); - extern bool Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); + extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fSweep = 0; Amap_ManSetDefaultParams( pPars ); @@ -11933,7 +11724,7 @@ int Abc_CommandAmap( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by a floating point number.\n" ); goto usage; } pPars->nIterFlow = atoi(argv[globalUtilOptind]); @@ -11944,7 +11735,7 @@ int Abc_CommandAmap( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'A': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-A\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-A\" should be followed by a floating point number.\n" ); goto usage; } pPars->nIterArea = atoi(argv[globalUtilOptind]); @@ -11955,7 +11746,7 @@ int Abc_CommandAmap( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'E': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-E\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-E\" should be followed by a floating point number.\n" ); goto usage; } pPars->fEpsilon = (float)atof(argv[globalUtilOptind]); @@ -11987,7 +11778,7 @@ int Abc_CommandAmap( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -11996,23 +11787,23 @@ int Abc_CommandAmap( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtk == NULL ) { - fprintf( pErr, "Strashing before mapping has failed.\n" ); + Abc_Print( -1, "Strashing before mapping has failed.\n" ); return 1; } pNtk = Abc_NtkBalance( pNtkRes = pNtk, 0, 0, 1 ); Abc_NtkDelete( pNtkRes ); if ( pNtk == NULL ) { - fprintf( pErr, "Balancing before mapping has failed.\n" ); + Abc_Print( -1, "Balancing before mapping has failed.\n" ); return 1; } - fprintf( pOut, "The network was strashed and balanced before mapping.\n" ); + Abc_Print( 0, "The network was strashed and balanced before mapping.\n" ); // get the new network pNtkRes = Abc_NtkDarAmap( pNtk, pPars ); if ( pNtkRes == NULL ) { Abc_NtkDelete( pNtk ); - fprintf( pErr, "Mapping has failed.\n" ); + Abc_Print( -1, "Mapping has failed.\n" ); return 1; } Abc_NtkDelete( pNtk ); @@ -12023,7 +11814,7 @@ int Abc_CommandAmap( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkDarAmap( pNtk, pPars ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Mapping has failed.\n" ); + Abc_Print( -1, "Mapping has failed.\n" ); return 1; } } @@ -12036,17 +11827,17 @@ int Abc_CommandAmap( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: amap [-FA <num>] [-E <float>] [-mxisvh]\n" ); - fprintf( pErr, "\t performs standard cell mapping of the current network\n" ); - fprintf( pErr, "\t-F num : the number of iterations of area flow [default = %d]\n", pPars->nIterFlow ); - fprintf( pErr, "\t-A num : the number of iterations of exact area [default = %d]\n", pPars->nIterArea ); - fprintf( pErr, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->fEpsilon ); - fprintf( pErr, "\t-m : toggles using MUX matching [default = %s]\n", pPars->fUseMuxes? "yes": "no" ); - fprintf( pErr, "\t-x : toggles using XOR matching [default = %s]\n", pPars->fUseXors? "yes": "no" ); - fprintf( pErr, "\t-i : toggles assuming inverters are free [default = %s]\n", pPars->fFreeInvs? "yes": "no" ); - fprintf( pErr, "\t-s : toggles sweep after mapping [default = %s]\n", fSweep? "yes": "no" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: amap [-FA <num>] [-E <float>] [-mxisvh]\n" ); + Abc_Print( -2, "\t performs standard cell mapping of the current network\n" ); + Abc_Print( -2, "\t-F num : the number of iterations of area flow [default = %d]\n", pPars->nIterFlow ); + Abc_Print( -2, "\t-A num : the number of iterations of exact area [default = %d]\n", pPars->nIterArea ); + Abc_Print( -2, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->fEpsilon ); + Abc_Print( -2, "\t-m : toggles using MUX matching [default = %s]\n", pPars->fUseMuxes? "yes": "no" ); + Abc_Print( -2, "\t-x : toggles using XOR matching [default = %s]\n", pPars->fUseXors? "yes": "no" ); + Abc_Print( -2, "\t-i : toggles assuming inverters are free [default = %s]\n", pPars->fFreeInvs? "yes": "no" ); + Abc_Print( -2, "\t-s : toggles sweep after mapping [default = %s]\n", fSweep? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -12064,14 +11855,8 @@ usage: ***********************************************************************/ int Abc_CommandUnmap( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -12087,27 +11872,27 @@ int Abc_CommandUnmap( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkHasMapping(pNtk) ) { - fprintf( pErr, "Cannot unmap the network that is not mapped.\n" ); + Abc_Print( -1, "Cannot unmap the network that is not mapped.\n" ); return 1; } // get the new network if ( !Abc_NtkMapToSop( pNtk ) ) { - fprintf( pErr, "Unmapping has failed.\n" ); + Abc_Print( -1, "Unmapping has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: unmap [-h]\n" ); - fprintf( pErr, "\t replaces the library gates by the logic nodes represented using SOPs\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: unmap [-h]\n" ); + Abc_Print( -2, "\t replaces the library gates by the logic nodes represented using SOPs\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -12124,14 +11909,8 @@ usage: ***********************************************************************/ int Abc_CommandAttach( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -12147,28 +11926,28 @@ int Abc_CommandAttach( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsSopLogic(pNtk) ) { - fprintf( pErr, "Can only attach gates if the nodes have SOP representations.\n" ); + Abc_Print( -1, "Can only attach gates if the nodes have SOP representations.\n" ); return 1; } // get the new network if ( !Abc_NtkAttach( pNtk ) ) { - fprintf( pErr, "Attaching gates has failed.\n" ); + Abc_Print( -1, "Attaching gates has failed.\n" ); return 1; } return 0; usage: - fprintf( pErr, "usage: attach [-h]\n" ); - fprintf( pErr, "\t replaces the SOP functions by the gates from the library\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: attach [-h]\n" ); + Abc_Print( -2, "\t replaces the SOP functions by the gates from the library\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -12186,15 +11965,11 @@ usage: ***********************************************************************/ int Abc_CommandSuperChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; extern Abc_Ntk_t * Abc_NtkSuperChoice( Abc_Ntk_t * pNtk ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -12210,13 +11985,13 @@ int Abc_CommandSuperChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Superchoicing works only for the AIG representation (run \"strash\").\n" ); + Abc_Print( -1, "Superchoicing works only for the AIG representation (run \"strash\").\n" ); return 1; } @@ -12224,7 +11999,7 @@ int Abc_CommandSuperChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkSuperChoice( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Superchoicing has failed.\n" ); + Abc_Print( -1, "Superchoicing has failed.\n" ); return 1; } // replace the current network @@ -12232,11 +12007,11 @@ int Abc_CommandSuperChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: sc [-h]\n" ); - fprintf( pErr, "\t performs superchoicing\n" ); - fprintf( pErr, "\t (accumulate: \"r file.blif; rsup; b; sc; f -ac; wb file_sc.blif\")\n" ); - fprintf( pErr, "\t (map without supergate library: \"r file_sc.blif; ft; map\")\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: sc [-h]\n" ); + Abc_Print( -2, "\t performs superchoicing\n" ); + Abc_Print( -2, "\t (accumulate: \"r file.blif; rsup; b; sc; f -ac; wb file_sc.blif\")\n" ); + Abc_Print( -2, "\t (map without supergate library: \"r file_sc.blif; ft; map\")\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -12253,7 +12028,6 @@ usage: ***********************************************************************/ int Abc_CommandSuperChoiceLut( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int nLutSize; @@ -12262,9 +12036,6 @@ int Abc_CommandSuperChoiceLut( Abc_Frame_t * pAbc, int argc, char ** argv ) extern int Abc_NtkSuperChoiceLut( Abc_Ntk_t * pNtk, int nLutSize, int nCutSizeMax, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fVerbose = 1; nLutSize = 4; @@ -12277,7 +12048,7 @@ int Abc_CommandSuperChoiceLut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by a positive integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); @@ -12288,7 +12059,7 @@ int Abc_CommandSuperChoiceLut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" ); goto usage; } nCutSizeMax = atoi(argv[globalUtilOptind]); @@ -12308,13 +12079,13 @@ int Abc_CommandSuperChoiceLut( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Superchoicing works only for the AIG representation (run \"strash\").\n" ); + Abc_Print( -1, "Superchoicing works only for the AIG representation (run \"strash\").\n" ); return 1; } @@ -12325,7 +12096,7 @@ int Abc_CommandSuperChoiceLut( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( !Abc_NtkSuperChoiceLut( pNtkRes, nLutSize, nCutSizeMax, fVerbose ) ) { Abc_NtkDelete( pNtkRes ); - fprintf( pErr, "Superchoicing has failed.\n" ); + Abc_Print( -1, "Superchoicing has failed.\n" ); return 1; } // replace the current network @@ -12333,14 +12104,14 @@ int Abc_CommandSuperChoiceLut( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: scl [-K num] [-N num] [-vh]\n" ); - fprintf( pErr, "\t performs superchoicing for K-LUTs\n" ); - fprintf( pErr, "\t (accumulate: \"r file.blif; b; scl; f -ac; wb file_sc.blif\")\n" ); - fprintf( pErr, "\t (FPGA map: \"r file_sc.blif; ft; read_lut lutlibK; fpga\")\n" ); - fprintf( pErr, "\t-K num : the number of LUT inputs [default = %d]\n", nLutSize ); - fprintf( pErr, "\t-N num : the max size of the cut [default = %d]\n", nCutSizeMax ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: scl [-K num] [-N num] [-vh]\n" ); + Abc_Print( -2, "\t performs superchoicing for K-LUTs\n" ); + Abc_Print( -2, "\t (accumulate: \"r file.blif; b; scl; f -ac; wb file_sc.blif\")\n" ); + Abc_Print( -2, "\t (FPGA map: \"r file_sc.blif; ft; read_lut lutlibK; fpga\")\n" ); + Abc_Print( -2, "\t-K num : the number of LUT inputs [default = %d]\n", nLutSize ); + Abc_Print( -2, "\t-N num : the max size of the cut [default = %d]\n", nCutSizeMax ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -12359,7 +12130,6 @@ int Abc_CommandFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) { char Buffer[100]; char LutSize[100]; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fRecovery; @@ -12372,9 +12142,6 @@ int Abc_CommandFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkFpga( Abc_Ntk_t * pNtk, float DelayTarget, int fRecovery, int fSwitching, int fLatchPaths, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fRecovery = 1; fSwitching = 0; @@ -12404,7 +12171,7 @@ int Abc_CommandFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by a floating point number.\n" ); goto usage; } DelayTarget = (float)atof(argv[globalUtilOptind]); @@ -12415,7 +12182,7 @@ int Abc_CommandFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by a positive integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); @@ -12430,7 +12197,7 @@ int Abc_CommandFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -12440,7 +12207,7 @@ int Abc_CommandFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) /* else { - fprintf( pErr, "Cannot perform FPGA mapping with LUT size %d.\n", nLutSize ); + Abc_Print( -1, "Cannot perform FPGA mapping with LUT size %d.\n", nLutSize ); return 1; } */ @@ -12450,23 +12217,23 @@ int Abc_CommandFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtk == NULL ) { - fprintf( pErr, "Strashing before FPGA mapping has failed.\n" ); + Abc_Print( -1, "Strashing before FPGA mapping has failed.\n" ); return 1; } pNtk = Abc_NtkBalance( pNtkRes = pNtk, 0, 0, 1 ); Abc_NtkDelete( pNtkRes ); if ( pNtk == NULL ) { - fprintf( pErr, "Balancing before FPGA mapping has failed.\n" ); + Abc_Print( -1, "Balancing before FPGA mapping has failed.\n" ); return 1; } - fprintf( pOut, "The network was strashed and balanced before FPGA mapping.\n" ); + Abc_Print( 1, "The network was strashed and balanced before FPGA mapping.\n" ); // get the new network pNtkRes = Abc_NtkFpga( pNtk, DelayTarget, fRecovery, fSwitching, fLatchPaths, fVerbose ); if ( pNtkRes == NULL ) { Abc_NtkDelete( pNtk ); - fprintf( pErr, "FPGA mapping has failed.\n" ); + Abc_Print( -1, "FPGA mapping has failed.\n" ); return 1; } Abc_NtkDelete( pNtk ); @@ -12477,7 +12244,7 @@ int Abc_CommandFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkFpga( pNtk, DelayTarget, fRecovery, fSwitching, fLatchPaths, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "FPGA mapping has failed.\n" ); + Abc_Print( -1, "FPGA mapping has failed.\n" ); return 1; } } @@ -12494,15 +12261,15 @@ usage: sprintf( LutSize, "library" ); else sprintf( LutSize, "%d", nLutSize ); - fprintf( pErr, "usage: fpga [-D float] [-K num] [-aplvh]\n" ); - fprintf( pErr, "\t performs FPGA mapping of the current network\n" ); - fprintf( pErr, "\t-a : toggles area recovery [default = %s]\n", fRecovery? "yes": "no" ); - fprintf( pErr, "\t-p : optimizes power by minimizing switching activity [default = %s]\n", fSwitching? "yes": "no" ); - fprintf( pErr, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", fLatchPaths? "yes": "no" ); - fprintf( pErr, "\t-D float : sets the required time for the mapping [default = %s]\n", Buffer ); - fprintf( pErr, "\t-K num : the number of LUT inputs (2 < num < 11) [default = %s]%s\n", LutSize, (nLutSize == -1 ? " (type \"print_lut\")" : "") ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : prints the command usage\n"); + Abc_Print( -2, "usage: fpga [-D float] [-K num] [-aplvh]\n" ); + Abc_Print( -2, "\t performs FPGA mapping of the current network\n" ); + Abc_Print( -2, "\t-a : toggles area recovery [default = %s]\n", fRecovery? "yes": "no" ); + Abc_Print( -2, "\t-p : optimizes power by minimizing switching activity [default = %s]\n", fSwitching? "yes": "no" ); + Abc_Print( -2, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", fLatchPaths? "yes": "no" ); + Abc_Print( -2, "\t-D float : sets the required time for the mapping [default = %s]\n", Buffer ); + Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < 11) [default = %s]%s\n", LutSize, (nLutSize == -1 ? " (type \"print_lut\")" : "") ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : prints the command usage\n"); return 1; } @@ -12520,7 +12287,6 @@ usage: int Abc_CommandFpgaFast( Abc_Frame_t * pAbc, int argc, char ** argv ) { char Buffer[100]; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fRecovery; @@ -12531,9 +12297,6 @@ int Abc_CommandFpgaFast( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkFpgaFast( Abc_Ntk_t * pNtk, int nLutSize, int fRecovery, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fRecovery = 1; fVerbose = 0; @@ -12555,7 +12318,7 @@ int Abc_CommandFpgaFast( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by a floating point number.\n" ); goto usage; } DelayTarget = (float)atof(argv[globalUtilOptind]); @@ -12566,7 +12329,7 @@ int Abc_CommandFpgaFast( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by a positive integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); @@ -12581,7 +12344,7 @@ int Abc_CommandFpgaFast( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -12591,23 +12354,23 @@ int Abc_CommandFpgaFast( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtk == NULL ) { - fprintf( pErr, "Strashing before FPGA mapping has failed.\n" ); + Abc_Print( -1, "Strashing before FPGA mapping has failed.\n" ); return 1; } pNtk = Abc_NtkBalance( pNtkRes = pNtk, 0, 0, 1 ); Abc_NtkDelete( pNtkRes ); if ( pNtk == NULL ) { - fprintf( pErr, "Balancing before FPGA mapping has failed.\n" ); + Abc_Print( -1, "Balancing before FPGA mapping has failed.\n" ); return 1; } - fprintf( pOut, "The network was strashed and balanced before FPGA mapping.\n" ); + Abc_Print( 1, "The network was strashed and balanced before FPGA mapping.\n" ); // get the new network pNtkRes = Abc_NtkFpgaFast( pNtk, nLutSize, fRecovery, fVerbose ); if ( pNtkRes == NULL ) { Abc_NtkDelete( pNtk ); - fprintf( pErr, "FPGA mapping has failed.\n" ); + Abc_Print( -1, "FPGA mapping has failed.\n" ); return 1; } Abc_NtkDelete( pNtk ); @@ -12618,7 +12381,7 @@ int Abc_CommandFpgaFast( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkFpgaFast( pNtk, nLutSize, fRecovery, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "FPGA mapping has failed.\n" ); + Abc_Print( -1, "FPGA mapping has failed.\n" ); return 1; } } @@ -12631,13 +12394,13 @@ usage: sprintf( Buffer, "not used" ); else sprintf( Buffer, "%.2f", DelayTarget ); - fprintf( pErr, "usage: ffpga [-K num] [-avh]\n" ); - fprintf( pErr, "\t performs fast FPGA mapping of the current network\n" ); - fprintf( pErr, "\t-a : toggles area recovery [default = %s]\n", fRecovery? "yes": "no" ); -// fprintf( pErr, "\t-D float : sets the required time for the mapping [default = %s]\n", Buffer ); - fprintf( pErr, "\t-K num : the number of LUT inputs (2 < num < 32) [default = %d]\n", nLutSize ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : prints the command usage\n"); + Abc_Print( -2, "usage: ffpga [-K num] [-avh]\n" ); + Abc_Print( -2, "\t performs fast FPGA mapping of the current network\n" ); + Abc_Print( -2, "\t-a : toggles area recovery [default = %s]\n", fRecovery? "yes": "no" ); +// Abc_Print( -2, "\t-D float : sets the required time for the mapping [default = %s]\n", Buffer ); + Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < 32) [default = %d]\n", nLutSize ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : prints the command usage\n"); return 1; } @@ -12656,16 +12419,12 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) { char Buffer[100]; char LutSize[100]; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; If_Par_t Pars, * pPars = &Pars; - int c; + int c, fLutMux; extern Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults memset( pPars, 0, sizeof(If_Par_t) ); // user-controlable paramters @@ -12690,20 +12449,21 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) pPars->fTruth = 0; pPars->nLatches = pNtk? Abc_NtkLatchNum(pNtk) : 0; pPars->fLiftLeaves = 0; - pPars->pLutLib = Abc_FrameReadLibLut(); + pPars->pLutLib = (If_Lib_t *)Abc_FrameReadLibLut(); pPars->pTimesArr = NULL; pPars->pTimesArr = NULL; pPars->pFuncCost = NULL; + fLutMux = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "KCFADEqaflepmrstbvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "KCFADEqaflepmrsdbugvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by a positive integer.\n" ); goto usage; } pPars->nLutSize = atoi(argv[globalUtilOptind]); @@ -12716,7 +12476,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by a positive integer.\n" ); goto usage; } pPars->nCutsMax = atoi(argv[globalUtilOptind]); @@ -12727,7 +12487,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by a positive integer.\n" ); goto usage; } pPars->nFlowIters = atoi(argv[globalUtilOptind]); @@ -12738,7 +12498,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'A': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-A\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-A\" should be followed by a positive integer.\n" ); goto usage; } pPars->nAreaIters = atoi(argv[globalUtilOptind]); @@ -12749,7 +12509,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by a floating point number.\n" ); goto usage; } pPars->DelayTarget = (float)atof(argv[globalUtilOptind]); @@ -12760,7 +12520,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'E': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-E\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-E\" should be followed by a floating point number.\n" ); goto usage; } pPars->Epsilon = (float)atof(argv[globalUtilOptind]); @@ -12795,11 +12555,17 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) case 's': pPars->fSeqMap ^= 1; break; - case 't': - pPars->fLiftLeaves ^= 1; + case 'd': + pPars->fBidec ^= 1; break; case 'b': - pPars->fBidec ^= 1; + pPars->fUseBat ^= 1; + break; + case 'u': + fLutMux ^= 1; + break; + case 'g': + pPars->fDelayOpt ^= 1; break; case 'v': pPars->fVerbose ^= 1; @@ -12812,20 +12578,20 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } /* if ( pPars->fSeqMap ) { - fprintf( pErr, "Sequential mapping is currently disabled.\n" ); + Abc_Print( -1, "Sequential mapping is currently disabled.\n" ); return 1; } */ if ( pPars->fSeqMap && pPars->nLatches == 0 ) { - fprintf( pErr, "The network has no latches. Use combinational mapping instead of sequential.\n" ); + Abc_Print( -1, "The network has no latches. Use combinational mapping instead of sequential.\n" ); return 1; } @@ -12833,7 +12599,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( pPars->pLutLib == NULL ) { - fprintf( pErr, "The LUT library is not given.\n" ); + Abc_Print( -1, "The LUT library is not given.\n" ); return 1; } // get LUT size from the library @@ -12845,23 +12611,41 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->nLutSize < 3 || pPars->nLutSize > IF_MAX_LUTSIZE ) { - fprintf( pErr, "Incorrect LUT size (%d).\n", pPars->nLutSize ); + Abc_Print( -1, "Incorrect LUT size (%d).\n", pPars->nLutSize ); return 1; } if ( pPars->nCutsMax < 1 || pPars->nCutsMax >= (1<<12) ) { - fprintf( pErr, "Incorrect number of cuts.\n" ); + Abc_Print( -1, "Incorrect number of cuts.\n" ); return 1; } + if ( fLutMux ) + { + extern int Abc_NtkCutCostMux( If_Cut_t * pCut ); + pPars->fCutMin = 1; + pPars->fTruth = 1; + pPars->pFuncCost = Abc_NtkCutCostMux; + } + // enable truth table computation if choices are selected if ( (c = Abc_NtkGetChoiceNum( pNtk )) ) { - printf( "Performing LUT mapping with %d choices.\n", c ); -// pPars->fTruth = 1; + Abc_Print( 0, "Performing LUT mapping with %d choices.\n", c ); pPars->fExpRed = 0; } + + if ( pPars->fUseBat ) + { + if ( pPars->nLutSize < 4 || pPars->nLutSize > 6 ) + { + Abc_Print( -1, "This feature only works for {4,5,6}-LUTs.\n" ); + return 1; + } + pPars->fCutMin = 1; + } + // enable truth table computation if cut minimization is selected if ( pPars->fCutMin ) { @@ -12869,10 +12653,19 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) pPars->fExpRed = 0; } + // modify for global delay optimization + if ( pPars->fDelayOpt ) + { + pPars->fTruth = 1; + pPars->fExpRed = 0; + pPars->fUsePerm = 1; + pPars->pLutLib = NULL; + } + // complain if truth tables are requested but the cut size is too large if ( pPars->fTruth && pPars->nLutSize > IF_MAX_FUNC_LUTSIZE ) { - fprintf( pErr, "Truth tables cannot be computed for LUT larger than %d inputs.\n", IF_MAX_FUNC_LUTSIZE ); + Abc_Print( -1, "Truth tables cannot be computed for LUT larger than %d inputs.\n", IF_MAX_FUNC_LUTSIZE ); return 1; } @@ -12886,23 +12679,23 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtk == NULL ) { - fprintf( pErr, "Strashing before FPGA mapping has failed.\n" ); + Abc_Print( -1, "Strashing before FPGA mapping has failed.\n" ); return 1; } pNtk = Abc_NtkBalance( pNtkRes = pNtk, 0, 0, 1 ); Abc_NtkDelete( pNtkRes ); if ( pNtk == NULL ) { - fprintf( pErr, "Balancing before FPGA mapping has failed.\n" ); + Abc_Print( -1, "Balancing before FPGA mapping has failed.\n" ); return 1; } - fprintf( pOut, "The network was strashed and balanced before FPGA mapping.\n" ); + Abc_Print( 1, "The network was strashed and balanced before FPGA mapping.\n" ); // get the new network pNtkRes = Abc_NtkIf( pNtk, pPars ); if ( pNtkRes == NULL ) { Abc_NtkDelete( pNtk ); - fprintf( pErr, "FPGA mapping has failed.\n" ); + Abc_Print( -1, "FPGA mapping has failed.\n" ); return 0; } Abc_NtkDelete( pNtk ); @@ -12913,7 +12706,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkIf( pNtk, pPars ); if ( pNtkRes == NULL ) { - fprintf( pErr, "FPGA mapping has failed.\n" ); + Abc_Print( -1, "FPGA mapping has failed.\n" ); return 0; } } @@ -12930,27 +12723,29 @@ usage: sprintf( LutSize, "library" ); else sprintf( LutSize, "%d", pPars->nLutSize ); - fprintf( pErr, "usage: if [-KCFA num] [-DE float] [-qarlepmsbvh]\n" ); - fprintf( pErr, "\t performs FPGA technology mapping of the network\n" ); - fprintf( pErr, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); - fprintf( pErr, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); - fprintf( pErr, "\t-F num : the number of area flow recovery iterations (num >= 0) [default = %d]\n", pPars->nFlowIters ); - fprintf( pErr, "\t-A num : the number of exact area recovery iterations (num >= 0) [default = %d]\n", pPars->nAreaIters ); - fprintf( pErr, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer ); - fprintf( pErr, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->Epsilon ); - fprintf( pErr, "\t-q : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" ); - fprintf( pErr, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" ); -// fprintf( pErr, "\t-f : toggles one fancy feature [default = %s]\n", pPars->fFancy? "yes": "no" ); - fprintf( pErr, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" ); - fprintf( pErr, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" ); - fprintf( pErr, "\t-e : uses edge-based cut selection heuristics [default = %s]\n", pPars->fEdge? "yes": "no" ); - fprintf( pErr, "\t-p : uses power-aware cut selection heuristics [default = %s]\n", pPars->fPower? "yes": "no" ); - fprintf( pErr, "\t-m : enables cut minimization by removing vacuous variables [default = %s]\n", pPars->fCutMin? "yes": "no" ); - fprintf( pErr, "\t-s : toggles sequential mapping [default = %s]\n", pPars->fSeqMap? "yes": "no" ); -// fprintf( pErr, "\t-t : toggles the use of true sequential cuts [default = %s]\n", pPars->fLiftLeaves? "yes": "no" ); - fprintf( pErr, "\t-b : toggles deriving local AIGs using bi-decomposition [default = %s]\n", pPars->fBidec? "yes": "no" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : prints the command usage\n"); + Abc_Print( -2, "usage: if [-KCFA num] [-DE float] [-qarlepmsdbugvh]\n" ); + Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" ); + Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); + Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); + Abc_Print( -2, "\t-F num : the number of area flow recovery iterations (num >= 0) [default = %d]\n", pPars->nFlowIters ); + Abc_Print( -2, "\t-A num : the number of exact area recovery iterations (num >= 0) [default = %d]\n", pPars->nAreaIters ); + Abc_Print( -2, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer ); + Abc_Print( -2, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->Epsilon ); + Abc_Print( -2, "\t-q : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" ); + Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" ); +// Abc_Print( -2, "\t-f : toggles one fancy feature [default = %s]\n", pPars->fFancy? "yes": "no" ); + Abc_Print( -2, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" ); + Abc_Print( -2, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" ); + Abc_Print( -2, "\t-e : uses edge-based cut selection heuristics [default = %s]\n", pPars->fEdge? "yes": "no" ); + Abc_Print( -2, "\t-p : uses power-aware cut selection heuristics [default = %s]\n", pPars->fPower? "yes": "no" ); + Abc_Print( -2, "\t-m : enables cut minimization by removing vacuous variables [default = %s]\n", pPars->fCutMin? "yes": "no" ); + Abc_Print( -2, "\t-s : toggles sequential mapping [default = %s]\n", pPars->fSeqMap? "yes": "no" ); + Abc_Print( -2, "\t-d : toggles deriving local AIGs using bi-decomposition [default = %s]\n", pPars->fBidec? "yes": "no" ); + Abc_Print( -2, "\t-b : toggles the use of one special feature [default = %s]\n", pPars->fUseBat? "yes": "no" ); + Abc_Print( -2, "\t-u : toggles the use of MUXes along with LUTs [default = %s]\n", fLutMux? "yes": "no" ); + Abc_Print( -2, "\t-g : toggles global delay optimization [default = %s]\n", pPars->fDelayOpt? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : prints the command usage\n"); return 1; } @@ -12969,19 +12764,13 @@ usage: ***********************************************************************/ int Abc_CommandInit( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pObj; int c, i; int fZeros; int fOnes; int fRandom; int fDontCare; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fZeros = 0; fOnes = 0; @@ -13013,13 +12802,13 @@ int Abc_CommandInit( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The current network is combinational.\n" ); + Abc_Print( -1, "The current network is combinational.\n" ); return 0; } @@ -13048,17 +12837,17 @@ int Abc_CommandInit( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_LatchSetInitDc( pObj ); } else - printf( "The initial states remain unchanged.\n" ); + Abc_Print( -1, "The initial states remain unchanged.\n" ); return 0; usage: - fprintf( pErr, "usage: init [-zordh]\n" ); - fprintf( pErr, "\t resets initial states of all latches\n" ); - fprintf( pErr, "\t-z : set zeros initial states [default = %s]\n", fZeros? "yes": "no" ); - fprintf( pErr, "\t-o : set ones initial states [default = %s]\n", fOnes? "yes": "no" ); - fprintf( pErr, "\t-d : set don't-care initial states [default = %s]\n", fDontCare? "yes": "no" ); - fprintf( pErr, "\t-r : set random initial states [default = %s]\n", fRandom? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: init [-zordh]\n" ); + Abc_Print( -2, "\t resets initial states of all latches\n" ); + Abc_Print( -2, "\t-z : set zeros initial states [default = %s]\n", fZeros? "yes": "no" ); + Abc_Print( -2, "\t-o : set ones initial states [default = %s]\n", fOnes? "yes": "no" ); + Abc_Print( -2, "\t-d : set don't-care initial states [default = %s]\n", fDontCare? "yes": "no" ); + Abc_Print( -2, "\t-r : set random initial states [default = %s]\n", fRandom? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -13075,16 +12864,12 @@ usage: ***********************************************************************/ int Abc_CommandZero( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; - extern Abc_Ntk_t * Abc_NtkRestrashZero( Abc_Ntk_t * pNtk, bool fCleanup ); + extern Abc_Ntk_t * Abc_NtkRestrashZero( Abc_Ntk_t * pNtk, int fCleanup ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -13100,19 +12885,19 @@ int Abc_CommandZero( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The current network is combinational.\n" ); + Abc_Print( -1, "The current network is combinational.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command works only for AIGs.\n" ); + Abc_Print( -1, "This command works only for AIGs.\n" ); return 0; } @@ -13120,7 +12905,7 @@ int Abc_CommandZero( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkRestrashZero( pNtk, 0 ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Converting to sequential AIG has failed.\n" ); + Abc_Print( -1, "Converting to sequential AIG has failed.\n" ); return 1; } // replace the current network @@ -13128,9 +12913,9 @@ int Abc_CommandZero( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: zero [-h]\n" ); - fprintf( pErr, "\t converts latches to have const-0 initial value\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: zero [-h]\n" ); + Abc_Print( -2, "\t converts latches to have const-0 initial value\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -13147,14 +12932,8 @@ usage: ***********************************************************************/ int Abc_CommandUndc( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -13170,19 +12949,19 @@ int Abc_CommandUndc( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The current network is combinational.\n" ); + Abc_Print( -1, "The current network is combinational.\n" ); return 0; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "This command works only for logic networks.\n" ); + Abc_Print( -1, "This command works only for logic networks.\n" ); return 0; } @@ -13191,9 +12970,9 @@ int Abc_CommandUndc( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: undc [-h]\n" ); - fprintf( pErr, "\t converts latches with DC init values into free PIs\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: undc [-h]\n" ); + Abc_Print( -2, "\t converts latches with DC init values into free PIs\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -13210,15 +12989,11 @@ usage: ***********************************************************************/ int Abc_CommandOneHot( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; extern Abc_Ntk_t * Abc_NtkConvertOnehot( Abc_Ntk_t * pNtk ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -13233,24 +13008,24 @@ int Abc_CommandOneHot( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The current network is combinational.\n" ); + Abc_Print( -1, "The current network is combinational.\n" ); return 0; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "This command works only for logic networks.\n" ); + Abc_Print( -1, "This command works only for logic networks.\n" ); return 0; } // get the new network pNtkRes = Abc_NtkConvertOnehot( pNtk ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Converting to one-hot encoding has failed.\n" ); + Abc_Print( -1, "Converting to one-hot encoding has failed.\n" ); return 1; } // replace the current network @@ -13258,9 +13033,9 @@ int Abc_CommandOneHot( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: onehot [-h]\n" ); - fprintf( pErr, "\t converts natural encoding into one-hot encoding\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: onehot [-h]\n" ); + Abc_Print( -2, "\t converts natural encoding into one-hot encoding\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -13277,16 +13052,10 @@ usage: ***********************************************************************/ int Abc_CommandPipe( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nLatches; extern void Abc_NtkLatchPipe( Abc_Ntk_t * pNtk, int nLatches ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nLatches = 5; Extra_UtilGetoptReset(); @@ -13297,7 +13066,7 @@ int Abc_CommandPipe( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by a positive integer.\n" ); goto usage; } nLatches = atoi(argv[globalUtilOptind]); @@ -13314,13 +13083,13 @@ int Abc_CommandPipe( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The current network is combinational.\n" ); + Abc_Print( -1, "The current network is combinational.\n" ); return 0; } @@ -13329,10 +13098,10 @@ int Abc_CommandPipe( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: pipe [-L num] [-h]\n" ); - fprintf( pErr, "\t inserts the given number of latches at each PI for pipelining\n" ); - fprintf( pErr, "\t-L num : the number of latches to insert [default = %d]\n", nLatches ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: pipe [-L num] [-h]\n" ); + Abc_Print( -2, "\t inserts the given number of latches at each PI for pipelining\n" ); + Abc_Print( -2, "\t-L num : the number of latches to insert [default = %d]\n", nLatches ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -13349,14 +13118,10 @@ usage: ***********************************************************************/ int Abc_CommandSeq( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -13372,19 +13137,19 @@ int Abc_CommandSeq( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) == 0 ) { - fprintf( pErr, "The network has no latches.\n" ); + Abc_Print( -1, "The network has no latches.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Conversion to sequential AIG works only for combinational AIGs (run \"strash\").\n" ); + Abc_Print( -1, "Conversion to sequential AIG works only for combinational AIGs (run \"strash\").\n" ); return 1; } @@ -13393,7 +13158,7 @@ int Abc_CommandSeq( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = NULL; if ( pNtkRes == NULL ) { - fprintf( pErr, "Converting to sequential AIG has failed.\n" ); + Abc_Print( -1, "Converting to sequential AIG has failed.\n" ); return 1; } // replace the current network @@ -13401,9 +13166,9 @@ int Abc_CommandSeq( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: seq [-h]\n" ); - fprintf( pErr, "\t converts AIG into sequential AIG\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: seq [-h]\n" ); + Abc_Print( -2, "\t converts AIG into sequential AIG\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -13420,15 +13185,11 @@ usage: ***********************************************************************/ int Abc_CommandUnseq( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fShare; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fShare = 1; Extra_UtilGetoptReset(); @@ -13448,13 +13209,13 @@ int Abc_CommandUnseq( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } /* if ( !Abc_NtkIsSeq(pNtk) ) { - fprintf( pErr, "Conversion to combinational AIG works only for sequential AIG (run \"seq\").\n" ); + Abc_Print( -1, "Conversion to combinational AIG works only for sequential AIG (run \"seq\").\n" ); return 1; } */ @@ -13467,7 +13228,7 @@ int Abc_CommandUnseq( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = NULL; if ( pNtkRes == NULL ) { - fprintf( pErr, "Converting sequential AIG into an SOP logic network has failed.\n" ); + Abc_Print( -1, "Converting sequential AIG into an SOP logic network has failed.\n" ); return 1; } // replace the current network @@ -13475,10 +13236,10 @@ int Abc_CommandUnseq( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: unseq [-sh]\n" ); - fprintf( pErr, "\t converts sequential AIG into an SOP logic network\n" ); - fprintf( pErr, "\t-s : toggle sharing latches [default = %s]\n", fShare? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: unseq [-sh]\n" ); + Abc_Print( -2, "\t converts sequential AIG into an SOP logic network\n" ); + Abc_Print( -2, "\t-s : toggle sharing latches [default = %s]\n", fShare? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -13495,7 +13256,6 @@ usage: ***********************************************************************/ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, nMaxIters; int fForward; @@ -13503,28 +13263,26 @@ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) int fOneStep; int fVerbose; int Mode; - extern int Abc_NtkRetime( Abc_Ntk_t * pNtk, int Mode, int fForwardOnly, int fBackwardOnly, int fOneStep, int fVerbose ); + int nDelayLim; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Mode = 5; + nDelayLim = 0; fForward = 0; fBackward = 0; fOneStep = 0; fVerbose = 0; nMaxIters = 15; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Mfbsvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "MDfbsvh" ) ) != EOF ) { switch ( c ) { case 'M': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-M\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-M\" should be followed by a positive integer.\n" ); goto usage; } Mode = atoi(argv[globalUtilOptind]); @@ -13532,6 +13290,17 @@ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( Mode < 0 ) goto usage; break; + case 'D': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-D\" should be followed by a positive integer.\n" ); + goto usage; + } + nDelayLim = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nDelayLim < 0 ) + goto usage; + break; case 'f': fForward ^= 1; break; @@ -13553,25 +13322,25 @@ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( fForward && fBackward ) { - fprintf( pErr, "Only one switch \"-f\" or \"-b\" can be selected at a time.\n" ); + Abc_Print( -1, "Only one switch \"-f\" or \"-b\" can be selected at a time.\n" ); return 1; } if ( !Abc_NtkLatchNum(pNtk) ) { - fprintf( pErr, "The network has no latches. Retiming is not performed.\n" ); + Abc_Print( -1, "The network has no latches. Retiming is not performed.\n" ); return 0; } if ( Mode < 0 || Mode > 6 ) { - fprintf( pErr, "The mode (%d) is incorrect. Retiming is not performed.\n", Mode ); + Abc_Print( -1, "The mode (%d) is incorrect. Retiming is not performed.\n", Mode ); return 0; } @@ -13579,13 +13348,13 @@ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( Abc_NtkGetChoiceNum(pNtk) ) { - fprintf( pErr, "Retiming with choice nodes is not implemented.\n" ); + Abc_Print( -1, "Retiming with choice nodes is not implemented.\n" ); return 0; } // convert the network into an SOP network pNtkRes = Abc_NtkToLogic( pNtk ); // perform the retiming - Abc_NtkRetime( pNtkRes, Mode, fForward, fBackward, fOneStep, fVerbose ); + Abc_NtkRetime( pNtkRes, Mode, nDelayLim, fForward, fBackward, fOneStep, fVerbose ); // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; @@ -13594,40 +13363,41 @@ int Abc_CommandRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) // get the network in the SOP form if ( !Abc_NtkToSop(pNtk, 0) ) { - printf( "Converting to SOPs has failed.\n" ); + Abc_Print( -1, "Converting to SOPs has failed.\n" ); return 0; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "The network is not a logic network. Retiming is not performed.\n" ); + Abc_Print( -1, "The network is not a logic network. Retiming is not performed.\n" ); return 0; } // perform the retiming - Abc_NtkRetime( pNtk, Mode, fForward, fBackward, fOneStep, fVerbose ); + Abc_NtkRetime( pNtk, Mode, nDelayLim, fForward, fBackward, fOneStep, fVerbose ); return 0; usage: - fprintf( pErr, "usage: retime [-M num] [-fbvh]\n" ); - fprintf( pErr, "\t retimes the current network using one of the algorithms:\n" ); - fprintf( pErr, "\t 1: most forward retiming\n" ); - fprintf( pErr, "\t 2: most backward retiming\n" ); - fprintf( pErr, "\t 3: forward and backward min-area retiming\n" ); - fprintf( pErr, "\t 4: forward and backward min-delay retiming\n" ); - fprintf( pErr, "\t 5: mode 3 followed by mode 4\n" ); - fprintf( pErr, "\t 6: Pan's optimum-delay retiming using binary search\n" ); - fprintf( pErr, "\t-M num : the retiming algorithm to use [default = %d]\n", Mode ); - fprintf( pErr, "\t-f : enables forward-only retiming in modes 3,4,5 [default = %s]\n", fForward? "yes": "no" ); - fprintf( pErr, "\t-b : enables backward-only retiming in modes 3,4,5 [default = %s]\n", fBackward? "yes": "no" ); - fprintf( pErr, "\t-s : enables retiming one step only in mode 4 [default = %s]\n", fOneStep? "yes": "no" ); - fprintf( pErr, "\t-v : enables verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: retime [-MD num] [-fbvh]\n" ); + Abc_Print( -2, "\t retimes the current network using one of the algorithms:\n" ); + Abc_Print( -2, "\t 1: most forward retiming\n" ); + Abc_Print( -2, "\t 2: most backward retiming\n" ); + Abc_Print( -2, "\t 3: forward and backward min-area retiming\n" ); + Abc_Print( -2, "\t 4: forward and backward min-delay retiming\n" ); + Abc_Print( -2, "\t 5: mode 3 followed by mode 4\n" ); + Abc_Print( -2, "\t 6: Pan's optimum-delay retiming using binary search\n" ); + Abc_Print( -2, "\t-M num : the retiming algorithm to use [default = %d]\n", Mode ); + Abc_Print( -2, "\t-D num : the minimum delay target (0=unused) [default = %d]\n", nDelayLim ); + Abc_Print( -2, "\t-f : enables forward-only retiming in modes 3,4,5 [default = %s]\n", fForward? "yes": "no" ); + Abc_Print( -2, "\t-b : enables backward-only retiming in modes 3,4,5 [default = %s]\n", fBackward? "yes": "no" ); + Abc_Print( -2, "\t-s : enables retiming one step only in mode 4 [default = %s]\n", fOneStep? "yes": "no" ); + Abc_Print( -2, "\t-v : enables verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; -// fprintf( pErr, "\t-I num : max number of iterations of l-value computation [default = %d]\n", nMaxIters ); -// fprintf( pErr, "\t-f : toggle forward retiming (for AIGs) [default = %s]\n", fForward? "yes": "no" ); -// fprintf( pErr, "\t-b : toggle backward retiming (for AIGs) [default = %s]\n", fBackward? "yes": "no" ); -// fprintf( pErr, "\t-i : toggle computation of initial state [default = %s]\n", fInitial? "yes": "no" ); +// Abc_Print( -2, "\t-I num : max number of iterations of l-value computation [default = %d]\n", nMaxIters ); +// Abc_Print( -2, "\t-f : toggle forward retiming (for AIGs) [default = %s]\n", fForward? "yes": "no" ); +// Abc_Print( -2, "\t-b : toggle backward retiming (for AIGs) [default = %s]\n", fBackward? "yes": "no" ); +// Abc_Print( -2, "\t-i : toggle computation of initial state [default = %s]\n", fInitial? "yes": "no" ); } /**Function************************************************************* @@ -13643,7 +13413,6 @@ usage: ***********************************************************************/ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int fMinArea; int fForwardOnly; @@ -13659,9 +13428,6 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarRetimeMostFwd( Abc_Ntk_t * pNtk, int nMaxIters, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fMinArea = 1; fForwardOnly = 0; @@ -13679,7 +13445,7 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" ); goto usage; } nMaxIters = atoi(argv[globalUtilOptind]); @@ -13690,7 +13456,7 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-S\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by a positive integer.\n" ); goto usage; } nStepsMax = atoi(argv[globalUtilOptind]); @@ -13725,19 +13491,19 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkLatchNum(pNtk) ) { - fprintf( pErr, "The network has no latches. Retiming is not performed.\n" ); + Abc_Print( -1, "The network has no latches. Retiming is not performed.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - printf( "This command works only for structrally hashed networks. Run \"st\".\n" ); + Abc_Print( -1, "This command works only for structrally hashed networks. Run \"st\".\n" ); return 0; } @@ -13751,7 +13517,7 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkDarRetimeMostFwd( pNtk, nMaxIters, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Retiming has failed.\n" ); + Abc_Print( -1, "Retiming has failed.\n" ); return 1; } // replace the current network @@ -13759,17 +13525,17 @@ int Abc_CommandDRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: dretime [-NS num] [-mfbiavh]\n" ); - fprintf( pErr, "\t new implementation of min-area (or most-forward) retiming\n" ); - fprintf( pErr, "\t-m : toggle min-area retiming and most-forward retiming [default = %s]\n", fMinArea? "min-area": "most-fwd" ); - fprintf( pErr, "\t-f : enables forward-only retiming [default = %s]\n", fForwardOnly? "yes": "no" ); - fprintf( pErr, "\t-b : enables backward-only retiming [default = %s]\n", fBackwardOnly? "yes": "no" ); - fprintf( pErr, "\t-i : enables init state computation [default = %s]\n", fInitial? "yes": "no" ); - fprintf( pErr, "\t-N num : the max number of one-frame iterations to perform [default = %d]\n", nMaxIters ); - fprintf( pErr, "\t-S num : the max number of forward retiming steps to perform [default = %d]\n", nStepsMax ); - fprintf( pErr, "\t-a : enables a fast most-forward algorithm [default = %s]\n", fFastAlgo? "yes": "no" ); - fprintf( pErr, "\t-v : enables verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dretime [-NS num] [-mfbiavh]\n" ); + Abc_Print( -2, "\t new implementation of min-area (or most-forward) retiming\n" ); + Abc_Print( -2, "\t-m : toggle min-area retiming and most-forward retiming [default = %s]\n", fMinArea? "min-area": "most-fwd" ); + Abc_Print( -2, "\t-f : enables forward-only retiming [default = %s]\n", fForwardOnly? "yes": "no" ); + Abc_Print( -2, "\t-b : enables backward-only retiming [default = %s]\n", fBackwardOnly? "yes": "no" ); + Abc_Print( -2, "\t-i : enables init state computation [default = %s]\n", fInitial? "yes": "no" ); + Abc_Print( -2, "\t-N num : the max number of one-frame iterations to perform [default = %d]\n", nMaxIters ); + Abc_Print( -2, "\t-S num : the max number of forward retiming steps to perform [default = %d]\n", nStepsMax ); + Abc_Print( -2, "\t-a : enables a fast most-forward algorithm [default = %s]\n", fFastAlgo? "yes": "no" ); + Abc_Print( -2, "\t-v : enables verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -13786,7 +13552,6 @@ usage: ***********************************************************************/ int Abc_CommandFlowRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c, nMaxIters; int fForward; @@ -13796,7 +13561,7 @@ int Abc_CommandFlowRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) int fFastButConservative; int maxDelay; - printf( "This command is temporarily disabled.\n" ); + Abc_Print( -1, "This command is temporarily disabled.\n" ); return 0; // extern Abc_Ntk_t* Abc_FlowRetime_MinReg( Abc_Ntk_t * pNtk, int fVerbose, // int fComputeInit, int fGuaranteeInit, int fBlockConst, @@ -13804,9 +13569,6 @@ int Abc_CommandFlowRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) // int maxDelay, int fFastButConservative); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fForward = 0; fFastButConservative = 0; @@ -13825,7 +13587,7 @@ int Abc_CommandFlowRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'M': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-M\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-M\" should be followed by a positive integer.\n" ); goto usage; } nMaxIters = atoi(argv[globalUtilOptind]); @@ -13836,7 +13598,7 @@ int Abc_CommandFlowRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by a positive integer.\n" ); goto usage; } maxDelay = atoi(argv[globalUtilOptind]); @@ -13874,31 +13636,31 @@ int Abc_CommandFlowRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( fForward && fBackward ) { - fprintf( pErr, "Only one switch \"-f\" or \"-b\" can be selected at a time.\n" ); + Abc_Print( -1, "Only one switch \"-f\" or \"-b\" can be selected at a time.\n" ); return 1; } if ( fGuaranteeInit && !fComputeInit ) { - fprintf( pErr, "Initial state guarantee (-g) requires initial state computation (-i).\n" ); + Abc_Print( -1, "Initial state guarantee (-g) requires initial state computation (-i).\n" ); return 1; } if ( !Abc_NtkLatchNum(pNtk) ) { - fprintf( pErr, "The network has no latches. Retiming is not performed.\n" ); + Abc_Print( -1, "The network has no latches. Retiming is not performed.\n" ); return 0; } if ( Abc_NtkGetChoiceNum(pNtk) ) { - fprintf( pErr, "Retiming with choice nodes is not implemented.\n" ); + Abc_Print( -1, "Retiming with choice nodes is not implemented.\n" ); return 0; } @@ -13914,18 +13676,18 @@ int Abc_CommandFlowRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: fretime [-M num] [-D num] [-fbvih]\n" ); - fprintf( pErr, "\t retimes the current network using flow-based algorithm\n" ); - fprintf( pErr, "\t-M num : the maximum number of iterations [default = %d]\n", nMaxIters ); - fprintf( pErr, "\t-D num : the maximum delay [default = none]\n" ); - fprintf( pErr, "\t-i : enables init state computation [default = %s]\n", fComputeInit? "yes": "no" ); - fprintf( pErr, "\t-k : blocks retiming over const nodes [default = %s]\n", fBlockConst? "yes": "no" ); - fprintf( pErr, "\t-g : guarantees init state computation [default = %s]\n", fGuaranteeInit? "yes": "no" ); - fprintf( pErr, "\t-c : very fast (but conserv.) delay constraints [default = %s]\n", fFastButConservative? "yes": "no" ); - fprintf( pErr, "\t-f : enables forward-only retiming [default = %s]\n", fForward? "yes": "no" ); - fprintf( pErr, "\t-b : enables backward-only retiming [default = %s]\n", fBackward? "yes": "no" ); - fprintf( pErr, "\t-v : enables verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: fretime [-M num] [-D num] [-fbvih]\n" ); + Abc_Print( -2, "\t retimes the current network using flow-based algorithm\n" ); + Abc_Print( -2, "\t-M num : the maximum number of iterations [default = %d]\n", nMaxIters ); + Abc_Print( -2, "\t-D num : the maximum delay [default = none]\n" ); + Abc_Print( -2, "\t-i : enables init state computation [default = %s]\n", fComputeInit? "yes": "no" ); + Abc_Print( -2, "\t-k : blocks retiming over const nodes [default = %s]\n", fBlockConst? "yes": "no" ); + Abc_Print( -2, "\t-g : guarantees init state computation [default = %s]\n", fGuaranteeInit? "yes": "no" ); + Abc_Print( -2, "\t-c : very fast (but conserv.) delay constraints [default = %s]\n", fFastButConservative? "yes": "no" ); + Abc_Print( -2, "\t-f : enables forward-only retiming [default = %s]\n", fForward? "yes": "no" ); + Abc_Print( -2, "\t-b : enables backward-only retiming [default = %s]\n", fBackward? "yes": "no" ); + Abc_Print( -2, "\t-v : enables verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -13942,16 +13704,12 @@ usage: ***********************************************************************/ int Abc_CommandCRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fVerbose; extern Abc_Ntk_t * Abc_NtkCRetime( Abc_Ntk_t * pNtk, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fVerbose = 0; Extra_UtilGetoptReset(); @@ -13970,24 +13728,24 @@ int Abc_CommandCRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Only works for logic networks.\n" ); + Abc_Print( -1, "Only works for logic networks.\n" ); return 1; } if ( !Abc_NtkLatchNum(pNtk) ) { - fprintf( pErr, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } // modify the current network pNtkRes = Abc_NtkCRetime( pNtk, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Sequential cleanup has failed.\n" ); + Abc_Print( -1, "Sequential cleanup has failed.\n" ); return 1; } // replace the current network @@ -13995,10 +13753,10 @@ int Abc_CommandCRetime( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: cretime [-vh]\n" ); - fprintf( pErr, "\t performs most-forward retiming with equiv classes\n" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: cretime [-vh]\n" ); + Abc_Print( -2, "\t performs most-forward retiming with equiv classes\n" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -14015,15 +13773,11 @@ usage: ***********************************************************************/ int Abc_CommandSeqFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkNew, * pNtkRes; int c, nMaxIters; int fVerbose; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nMaxIters = 15; fVerbose = 0; @@ -14035,7 +13789,7 @@ int Abc_CommandSeqFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" ); goto usage; } nMaxIters = atoi(argv[globalUtilOptind]); @@ -14055,7 +13809,7 @@ int Abc_CommandSeqFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -14065,7 +13819,7 @@ int Abc_CommandSeqFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) // quit if there are choice nodes if ( Abc_NtkGetChoiceNum(pNtk) ) { - fprintf( pErr, "Currently cannot map/retime networks with choice nodes.\n" ); + Abc_Print( -1, "Currently cannot map/retime networks with choice nodes.\n" ); return 0; } */ @@ -14081,7 +13835,7 @@ int Abc_CommandSeqFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkNew = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtkNew == NULL ) { - fprintf( pErr, "Strashing before FPGA mapping/retiming has failed.\n" ); + Abc_Print( -1, "Strashing before FPGA mapping/retiming has failed.\n" ); return 1; } @@ -14089,7 +13843,7 @@ int Abc_CommandSeqFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_NtkDelete( pNtkRes ); if ( pNtkNew == NULL ) { - fprintf( pErr, "Balancing before FPGA mapping has failed.\n" ); + Abc_Print( -1, "Balancing before FPGA mapping has failed.\n" ); return 1; } @@ -14099,11 +13853,11 @@ int Abc_CommandSeqFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_NtkDelete( pNtkRes ); if ( pNtkNew == NULL ) { - fprintf( pErr, "Converting into a seq AIG before FPGA mapping/retiming has failed.\n" ); + Abc_Print( -1, "Converting into a seq AIG before FPGA mapping/retiming has failed.\n" ); return 1; } - fprintf( pOut, "The network was strashed and balanced before FPGA mapping/retiming.\n" ); + Abc_Print( 1, "The network was strashed and balanced before FPGA mapping/retiming.\n" ); } // get the new network @@ -14111,7 +13865,7 @@ int Abc_CommandSeqFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = NULL; if ( pNtkRes == NULL ) { -// fprintf( pErr, "Sequential FPGA mapping has failed.\n" ); +// Abc_Print( -1, "Sequential FPGA mapping has failed.\n" ); Abc_NtkDelete( pNtkNew ); return 0; } @@ -14121,11 +13875,11 @@ int Abc_CommandSeqFpga( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: sfpga [-I num] [-vh]\n" ); - fprintf( pErr, "\t performs integrated sequential FPGA mapping/retiming\n" ); - fprintf( pErr, "\t-I num : max number of iterations of l-value computation [default = %d]\n", nMaxIters ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: sfpga [-I num] [-vh]\n" ); + Abc_Print( -2, "\t performs integrated sequential FPGA mapping/retiming\n" ); + Abc_Print( -2, "\t-I num : max number of iterations of l-value computation [default = %d]\n", nMaxIters ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -14142,15 +13896,11 @@ usage: ***********************************************************************/ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkNew, * pNtkRes; int c, nMaxIters; int fVerbose; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nMaxIters = 15; fVerbose = 0; @@ -14162,7 +13912,7 @@ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" ); goto usage; } nMaxIters = atoi(argv[globalUtilOptind]); @@ -14182,7 +13932,7 @@ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -14192,7 +13942,7 @@ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) // quit if there are choice nodes if ( Abc_NtkGetChoiceNum(pNtk) ) { - fprintf( pErr, "Currently cannot map/retime networks with choice nodes.\n" ); + Abc_Print( -1, "Currently cannot map/retime networks with choice nodes.\n" ); return 0; } */ @@ -14208,7 +13958,7 @@ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkNew = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtkNew == NULL ) { - fprintf( pErr, "Strashing before SC mapping/retiming has failed.\n" ); + Abc_Print( -1, "Strashing before SC mapping/retiming has failed.\n" ); return 1; } @@ -14216,7 +13966,7 @@ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_NtkDelete( pNtkRes ); if ( pNtkNew == NULL ) { - fprintf( pErr, "Balancing before SC mapping/retiming has failed.\n" ); + Abc_Print( -1, "Balancing before SC mapping/retiming has failed.\n" ); return 1; } @@ -14226,11 +13976,11 @@ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_NtkDelete( pNtkRes ); if ( pNtkNew == NULL ) { - fprintf( pErr, "Converting into a seq AIG before SC mapping/retiming has failed.\n" ); + Abc_Print( -1, "Converting into a seq AIG before SC mapping/retiming has failed.\n" ); return 1; } - fprintf( pOut, "The network was strashed and balanced before SC mapping/retiming.\n" ); + Abc_Print( -1, "The network was strashed and balanced before SC mapping/retiming.\n" ); } // get the new network @@ -14238,7 +13988,7 @@ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = NULL; if ( pNtkRes == NULL ) { -// fprintf( pErr, "Sequential FPGA mapping has failed.\n" ); +// Abc_Print( -1, "Sequential FPGA mapping has failed.\n" ); Abc_NtkDelete( pNtkNew ); return 0; } @@ -14249,11 +13999,11 @@ int Abc_CommandSeqMap( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: smap [-I num] [-vh]\n" ); - fprintf( pErr, "\t performs integrated sequential standard-cell mapping/retiming\n" ); - fprintf( pErr, "\t-I num : max number of iterations of l-value computation [default = %d]\n", nMaxIters ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: smap [-I num] [-vh]\n" ); + Abc_Print( -2, "\t performs integrated sequential standard-cell mapping/retiming\n" ); + Abc_Print( -2, "\t-I num : max number of iterations of l-value computation [default = %d]\n", nMaxIters ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -14270,16 +14020,12 @@ usage: ***********************************************************************/ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; Fra_Ssw_t Pars, * pPars = &Pars; int c; extern Abc_Ntk_t * Abc_NtkDarSeqSweep( Abc_Ntk_t * pNtk, Fra_Ssw_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults pPars->nPartSize = 0; pPars->nOverSize = 0; @@ -14303,7 +14049,7 @@ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } pPars->nPartSize = atoi(argv[globalUtilOptind]); @@ -14314,7 +14060,7 @@ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'Q': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-Q\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-Q\" should be followed by an integer.\n" ); goto usage; } pPars->nOverSize = atoi(argv[globalUtilOptind]); @@ -14325,7 +14071,7 @@ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesP = atoi(argv[globalUtilOptind]); @@ -14336,7 +14082,7 @@ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesK = atoi(argv[globalUtilOptind]); @@ -14347,7 +14093,7 @@ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxImps = atoi(argv[globalUtilOptind]); @@ -14358,7 +14104,7 @@ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLevs = atoi(argv[globalUtilOptind]); @@ -14396,31 +14142,31 @@ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The network is combinational (run \"fraig\" or \"fraig_sweep\").\n" ); + Abc_Print( -1, "The network is combinational (run \"fraig\" or \"fraig_sweep\").\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - printf( "This command works only for structrally hashed networks. Run \"st\".\n" ); + Abc_Print( -1, "This command works only for structrally hashed networks. Run \"st\".\n" ); return 0; } if ( pPars->nFramesK > 1 && pPars->fUse1Hot ) { - printf( "Currrently can only use one-hotness for simple induction (K=1).\n" ); + Abc_Print( -1, "Currrently can only use one-hotness for simple induction (K=1).\n" ); return 0; } if ( pPars->nFramesP && pPars->fUse1Hot ) { - printf( "Currrently can only use one-hotness without prefix.\n" ); + Abc_Print( -1, "Currrently can only use one-hotness without prefix.\n" ); return 0; } @@ -14428,7 +14174,7 @@ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkDarSeqSweep( pNtk, pPars ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Sequential sweeping has failed.\n" ); + Abc_Print( -1, "Sequential sweeping has failed.\n" ); return 1; } // replace the current network @@ -14436,22 +14182,22 @@ int Abc_CommandSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: ssweep [-PQNFL <num>] [-lrfetvh]\n" ); - fprintf( pErr, "\t performs sequential sweep using K-step induction\n" ); - fprintf( pErr, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); - fprintf( pErr, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); - fprintf( pErr, "\t-N num : number of time frames to use as the prefix [default = %d]\n", pPars->nFramesP ); - fprintf( pErr, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); - fprintf( pErr, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); -// fprintf( pErr, "\t-I num : max number of implications to consider [default = %d]\n", pPars->nMaxImps ); -// fprintf( pErr, "\t-i : toggle using implications [default = %s]\n", pPars->fUseImps? "yes": "no" ); - fprintf( pErr, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); - fprintf( pErr, "\t-r : toggle AIG rewriting [default = %s]\n", pPars->fRewrite? "yes": "no" ); - fprintf( pErr, "\t-f : toggle fraiging (combinational SAT sweeping) [default = %s]\n", pPars->fFraiging? "yes": "no" ); - fprintf( pErr, "\t-e : toggle writing implications as assertions [default = %s]\n", pPars->fWriteImps? "yes": "no" ); - fprintf( pErr, "\t-t : toggle using one-hotness conditions [default = %s]\n", pPars->fUse1Hot? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: ssweep [-PQNFL <num>] [-lrfetvh]\n" ); + Abc_Print( -2, "\t performs sequential sweep using K-step induction\n" ); + Abc_Print( -2, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); + Abc_Print( -2, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); + Abc_Print( -2, "\t-N num : number of time frames to use as the prefix [default = %d]\n", pPars->nFramesP ); + Abc_Print( -2, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); + Abc_Print( -2, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); +// Abc_Print( -2, "\t-I num : max number of implications to consider [default = %d]\n", pPars->nMaxImps ); +// Abc_Print( -2, "\t-i : toggle using implications [default = %s]\n", pPars->fUseImps? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); + Abc_Print( -2, "\t-r : toggle AIG rewriting [default = %s]\n", pPars->fRewrite? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle fraiging (combinational SAT sweeping) [default = %s]\n", pPars->fFraiging? "yes": "no" ); + Abc_Print( -2, "\t-e : toggle writing implications as assertions [default = %s]\n", pPars->fWriteImps? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle using one-hotness conditions [default = %s]\n", pPars->fUse1Hot? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -14468,27 +14214,24 @@ usage: ***********************************************************************/ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; Ssw_Pars_t Pars, * pPars = &Pars; + int nConstrs = 0; int c; extern Abc_Ntk_t * Abc_NtkDarSeqSweep2( Abc_Ntk_t * pNtk, Ssw_Pars_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Ssw_ManSetDefaultParams( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "PQFCLNSIVMplfudsvwh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "PQFCLSIVMNcmplofdsvwh" ) ) != EOF ) { switch ( c ) { case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } pPars->nPartSize = atoi(argv[globalUtilOptind]); @@ -14499,7 +14242,7 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'Q': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-Q\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-Q\" should be followed by an integer.\n" ); goto usage; } pPars->nOverSize = atoi(argv[globalUtilOptind]); @@ -14510,7 +14253,7 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesK = atoi(argv[globalUtilOptind]); @@ -14521,7 +14264,7 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -14532,7 +14275,7 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLevs = atoi(argv[globalUtilOptind]); @@ -14540,21 +14283,10 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->nMaxLevs <= 0 ) goto usage; break; - case 'N': - if ( globalUtilOptind >= argc ) - { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nConstrs = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nConstrs < 0 ) - goto usage; - break; case 'S': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesAddSim = atoi(argv[globalUtilOptind]); @@ -14565,7 +14297,7 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pPars->nItersStop = atoi(argv[globalUtilOptind]); @@ -14576,7 +14308,7 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'V': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-V\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-V\" should be followed by an integer.\n" ); goto usage; } pPars->nSatVarMax2 = atoi(argv[globalUtilOptind]); @@ -14587,7 +14319,7 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'M': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-M\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nRecycleCalls2 = atoi(argv[globalUtilOptind]); @@ -14595,18 +14327,35 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->nRecycleCalls2 < 0 ) goto usage; break; + case 'N': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); + goto usage; + } + nConstrs = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nConstrs < 0 ) + goto usage; + break; + case 'c': + pPars->fConstrs ^= 1; + break; + case 'm': + pPars->fMergeFull ^= 1; + break; case 'p': pPars->fPolarFlip ^= 1; break; case 'l': pPars->fLatchCorr ^= 1; break; + case 'o': + pPars->fOutputCorr ^= 1; + break; case 'f': pPars->fSemiFormal ^= 1; break; - case 'u': - pPars->fUniqueness ^= 1; - break; case 'd': pPars->fDynamic ^= 1; break; @@ -14628,27 +14377,50 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The network is combinational (run \"fraig\" or \"fraig_sweep\").\n" ); + Abc_Print( -1, "The network is combinational (run \"fraig\" or \"fraig_sweep\").\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - printf( "This command works only for structrally hashed networks. Run \"st\".\n" ); + Abc_Print( -1, "This command works only for structrally hashed networks. Run \"st\".\n" ); return 0; } + // if constraints are to be used, network should have no constraints + if ( nConstrs > 0 ) + { + if ( Abc_NtkConstrNum(pNtk) > 0 ) + { + Abc_Print( -1, "The network already has %d constraints.\n", Abc_NtkConstrNum(pNtk) ); + return 0; + } + else + { + Abc_Print( 0, "Setting the number of constraints to be %d.\n", nConstrs ); + pNtk->nConstrs = nConstrs; + } + } + + if ( pPars->fConstrs ) + { + if ( Abc_NtkConstrNum(pNtk) > 0 ) + Abc_Print( 0, "Performing scorr with %d constraints.\n", Abc_NtkConstrNum(pNtk) ); + else + Abc_Print( 0, "Performing constraint-based scorr without constraints.\n" ); + } + // get the new network pNtkRes = Abc_NtkDarSeqSweep2( pNtk, pPars ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Sequential sweeping has failed.\n" ); + Abc_Print( -1, "Sequential sweeping has failed.\n" ); return 1; } // replace the current network @@ -14656,27 +14428,30 @@ int Abc_CommandSeqSweep2( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: scorr [-PQFCLNSIVM <num>] [-pludsvwh]\n" ); - fprintf( pErr, "\t performs sequential sweep using K-step induction\n" ); - fprintf( pErr, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); - fprintf( pErr, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); - fprintf( pErr, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); - fprintf( pErr, "\t-C num : max number of conflicts at a node (0=inifinite) [default = %d]\n", pPars->nBTLimit ); - fprintf( pErr, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); - fprintf( pErr, "\t-N num : number of last POs treated as constraints (0=none) [default = %d]\n", pPars->nConstrs ); - fprintf( pErr, "\t-S num : additional simulation frames for c-examples (0=none) [default = %d]\n", pPars->nFramesAddSim ); - fprintf( pErr, "\t-I num : iteration number to stop and output SR-model (-1=none) [default = %d]\n", pPars->nItersStop ); - fprintf( pErr, "\t-V num : min var num needed to recycle the SAT solver [default = %d]\n", pPars->nSatVarMax2 ); - fprintf( pErr, "\t-M num : min call num needed to recycle the SAT solver [default = %d]\n", pPars->nRecycleCalls2 ); - fprintf( pErr, "\t-p : toggle alighning polarity of SAT variables [default = %s]\n", pPars->fPolarFlip? "yes": "no" ); - fprintf( pErr, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); -// fprintf( pErr, "\t-f : toggle filtering using iterative BMC [default = %s]\n", pPars->fSemiFormal? "yes": "no" ); - fprintf( pErr, "\t-u : toggle using uniqueness constraints [default = %s]\n", pPars->fUniqueness? "yes": "no" ); - fprintf( pErr, "\t-d : toggle dynamic addition of constraints [default = %s]\n", pPars->fDynamic? "yes": "no" ); - fprintf( pErr, "\t-s : toggle local simulation in the cone of influence [default = %s]\n", pPars->fLocalSim? "yes": "no" ); - fprintf( pErr, "\t-w : toggle printout of flop equivalences [default = %s]\n", pPars->fFlopVerbose? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: scorr [-PQFCLSIVMN <num>] [-cmplodsvwh]\n" ); + Abc_Print( -2, "\t performs sequential sweep using K-step induction\n" ); + Abc_Print( -2, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); + Abc_Print( -2, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); + Abc_Print( -2, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); + Abc_Print( -2, "\t-C num : max number of conflicts at a node (0=inifinite) [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); + Abc_Print( -2, "\t-N num : number of last POs treated as constraints (0=none) [default = %d]\n", pPars->fConstrs ); + Abc_Print( -2, "\t-S num : additional simulation frames for c-examples (0=none) [default = %d]\n", pPars->nFramesAddSim ); + Abc_Print( -2, "\t-I num : iteration number to stop and output SR-model (-1=none) [default = %d]\n", pPars->nItersStop ); + Abc_Print( -2, "\t-V num : min var num needed to recycle the SAT solver [default = %d]\n", pPars->nSatVarMax2 ); + Abc_Print( -2, "\t-M num : min call num needed to recycle the SAT solver [default = %d]\n", pPars->nRecycleCalls2 ); + Abc_Print( -2, "\t-N num : set last <num> POs to be constraints (use with -c) [default = %d]\n", nConstrs ); + Abc_Print( -2, "\t-c : toggle using explicit constraints [default = %s]\n", pPars->fConstrs? "yes": "no" ); + Abc_Print( -2, "\t-m : toggle full merge if constraints are present [default = %s]\n", pPars->fMergeFull? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle alighning polarity of SAT variables [default = %s]\n", pPars->fPolarFlip? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle doing latch correspondence [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); + Abc_Print( -2, "\t-o : toggle doing \'PO correspondence\' [default = %s]\n", pPars->fOutputCorr? "yes": "no" ); +// Abc_Print( -2, "\t-f : toggle filtering using iterative BMC [default = %s]\n", pPars->fSemiFormal? "yes": "no" ); + Abc_Print( -2, "\t-d : toggle dynamic addition of constraints [default = %s]\n", pPars->fDynamic? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle local simulation in the cone of influence [default = %s]\n", pPars->fLocalSim? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printout of flop equivalences [default = %s]\n", pPars->fFlopVerbose? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -14691,7 +14466,7 @@ usage: SeeAlso [] ***********************************************************************/ -int Abc_CommandSeqSweepTest( Abc_Frame_t * pAbc, int argc, char ** argv ) +int Abc_CommandTestSeqSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) { char * pFileName; Fra_Ssw_t Pars, * pPars = &Pars; @@ -14722,7 +14497,7 @@ int Abc_CommandSeqSweepTest( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } pPars->nPartSize = atoi(argv[globalUtilOptind]); @@ -14733,7 +14508,7 @@ int Abc_CommandSeqSweepTest( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'Q': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-Q\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-Q\" should be followed by an integer.\n" ); goto usage; } pPars->nOverSize = atoi(argv[globalUtilOptind]); @@ -14744,7 +14519,7 @@ int Abc_CommandSeqSweepTest( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesP = atoi(argv[globalUtilOptind]); @@ -14755,7 +14530,7 @@ int Abc_CommandSeqSweepTest( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesK = atoi(argv[globalUtilOptind]); @@ -14766,7 +14541,7 @@ int Abc_CommandSeqSweepTest( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxImps = atoi(argv[globalUtilOptind]); @@ -14777,7 +14552,7 @@ int Abc_CommandSeqSweepTest( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLevs = atoi(argv[globalUtilOptind]); @@ -14817,30 +14592,140 @@ int Abc_CommandSeqSweepTest( Abc_Frame_t * pAbc, int argc, char ** argv ) pFileName = argv[globalUtilOptind]; else { - printf( "File name should be given on the command line.\n" ); + Abc_Print( -1, "File name should be given on the command line.\n" ); return 1; } Fra_FraigInductionTest( pFileName, pPars ); return 0; usage: - fprintf( stdout, "usage: testssw [-PQNFL num] [-lrfetvh] <file>\n" ); - fprintf( stdout, "\t performs sequential sweep using K-step induction\n" ); - fprintf( stdout, "\t (outputs a file with a set of pairs of equivalent nodes)\n" ); - fprintf( stdout, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); - fprintf( stdout, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); - fprintf( stdout, "\t-N num : number of time frames to use as the prefix [default = %d]\n", pPars->nFramesP ); - fprintf( stdout, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); - fprintf( stdout, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); -// fprintf( stdout, "\t-I num : max number of implications to consider [default = %d]\n", pPars->nMaxImps ); -// fprintf( stdout, "\t-i : toggle using implications [default = %s]\n", pPars->fUseImps? "yes": "no" ); - fprintf( stdout, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); - fprintf( stdout, "\t-r : toggle AIG rewriting [default = %s]\n", pPars->fRewrite? "yes": "no" ); - fprintf( stdout, "\t-f : toggle fraiging (combinational SAT sweeping) [default = %s]\n", pPars->fFraiging? "yes": "no" ); - fprintf( stdout, "\t-e : toggle writing implications as assertions [default = %s]\n", pPars->fWriteImps? "yes": "no" ); - fprintf( stdout, "\t-t : toggle using one-hotness conditions [default = %s]\n", pPars->fUse1Hot? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: testssw [-PQNFL num] [-lrfetvh] <file>\n" ); + Abc_Print( -2, "\t performs sequential sweep using K-step induction\n" ); + Abc_Print( -2, "\t (outputs a file with a set of pairs of equivalent nodes)\n" ); + Abc_Print( -2, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); + Abc_Print( -2, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); + Abc_Print( -2, "\t-N num : number of time frames to use as the prefix [default = %d]\n", pPars->nFramesP ); + Abc_Print( -2, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); + Abc_Print( -2, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); +// Abc_Print( -2, "\t-I num : max number of implications to consider [default = %d]\n", pPars->nMaxImps ); +// Abc_Print( -2, "\t-i : toggle using implications [default = %s]\n", pPars->fUseImps? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); + Abc_Print( -2, "\t-r : toggle AIG rewriting [default = %s]\n", pPars->fRewrite? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle fraiging (combinational SAT sweeping) [default = %s]\n", pPars->fFraiging? "yes": "no" ); + Abc_Print( -2, "\t-e : toggle writing implications as assertions [default = %s]\n", pPars->fWriteImps? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle using one-hotness conditions [default = %s]\n", pPars->fUse1Hot? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandTestScorr( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern Abc_Ntk_t * Abc_NtkTestScorr( char * pFileNameIn, char * pFileNameOut, int nStepsMax, int nBTLimit, int fNewAlgo, int fFlopOnly, int fFfNdOnly, int fVerbose ); + + Abc_Ntk_t * pNtkRes; + int c; + int nConfMax; + int nStepsMax; + int fNewAlgo; + int fFlopOnly; + int fFfNdOnly; + int fVerbose; + // set defaults + nConfMax = 100; + nStepsMax = -1; + fNewAlgo = 0; + fFlopOnly = 0; + fFfNdOnly = 0; + fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "CSnfsvh" ) ) != EOF ) + { + switch ( c ) + { + case 'C': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); + goto usage; + } + nConfMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nConfMax < 0 ) + goto usage; + break; + case 'S': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); + goto usage; + } + nStepsMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nStepsMax < 0 ) + goto usage; + break; + case 'n': + fNewAlgo ^= 1; + break; + case 'f': + fFlopOnly ^= 1; + break; + case 's': + fFfNdOnly ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + default: + goto usage; + } + } + if ( argc != globalUtilOptind + 2 ) + { + Abc_Print( -1, "Expecting two files names on the command line.\n" ); + goto usage; + } + if ( fFlopOnly && fFfNdOnly ) + { + Abc_Print( -1, "These two options (-f and -s) are incompatible.\n" ); + goto usage; + } + // get the new network + pNtkRes = Abc_NtkTestScorr( argv[globalUtilOptind], argv[globalUtilOptind+1], nStepsMax, nConfMax, fNewAlgo, fFlopOnly, fFfNdOnly, fVerbose ); + if ( pNtkRes == NULL ) + { + Abc_Print( -1, "Sequential sweeping has failed.\n" ); + return 1; + } + // replace the current network + Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); + return 0; + +usage: + Abc_Print( -2, "usage: testscorr [-CS num] [-nfsvh] <file_in> <file_out>\n" ); + Abc_Print( -2, "\t outputs the list of sequential equivalences into a file\n" ); + Abc_Print( -2, "\t (if <file_in> is in BENCH, init state file should be the same directory)\n" ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfMax ); + Abc_Print( -2, "\t-S num : limit on refinement iterations (-1=no limit, 0=after BMC, etc) [default = %d]\n", nStepsMax ); + Abc_Print( -2, "\t-n : toggle between \"scorr\" and \"&scorr\" [default = %s]\n", fNewAlgo? "&scorr": "scorr" ); + Abc_Print( -2, "\t-f : toggle reporting only flop/flop equivs [default = %s]\n", fFlopOnly? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle reporting only flop/flop and flop/node equivs [default = %s]\n", fFfNdOnly? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file_in> : input file with design for sequential equivalence computation\n"); + Abc_Print( -2, "\t<file_out> : output file with the list of pairs of equivalent signals\n"); return 1; } @@ -14857,7 +14742,6 @@ usage: ***********************************************************************/ int Abc_CommandLcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int nFramesP; @@ -14869,8 +14753,8 @@ int Abc_CommandLcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarLcorrNew( Abc_Ntk_t * pNtk, int nVarsMax, int nConfMax, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); + + // set defaults nFramesP = 0; @@ -14886,7 +14770,7 @@ int Abc_CommandLcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nFramesP = atoi(argv[globalUtilOptind]); @@ -14897,7 +14781,7 @@ int Abc_CommandLcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfMax = atoi(argv[globalUtilOptind]); @@ -14908,7 +14792,7 @@ int Abc_CommandLcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } nVarsMax = atoi(argv[globalUtilOptind]); @@ -14931,19 +14815,19 @@ int Abc_CommandLcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The network is combinational (run \"fraig\" or \"fraig_sweep\").\n" ); + Abc_Print( -1, "The network is combinational (run \"fraig\" or \"fraig_sweep\").\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - printf( "This command works only for structrally hashed networks. Run \"st\".\n" ); + Abc_Print( -1, "This command works only for structrally hashed networks. Run \"st\".\n" ); return 0; } @@ -14954,7 +14838,7 @@ int Abc_CommandLcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkDarLcorr( pNtk, nFramesP, nConfMax, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Sequential sweeping has failed.\n" ); + Abc_Print( -1, "Sequential sweeping has failed.\n" ); return 1; } // replace the current network @@ -14962,14 +14846,14 @@ int Abc_CommandLcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: lcorr [-PCS num] [-nvh]\n" ); - fprintf( pErr, "\t computes latch correspondence using 1-step induction\n" ); - fprintf( pErr, "\t-P num : number of time frames to use as the prefix [default = %d]\n", nFramesP ); - fprintf( pErr, "\t-C num : max conflict number when proving latch equivalence [default = %d]\n", nConfMax ); - fprintf( pErr, "\t-S num : the max number of SAT variables [default = %d]\n", nVarsMax ); - fprintf( pErr, "\t-n : toggle using new algorithm [default = %s]\n", fNewAlgor? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: lcorr [-PCS num] [-nvh]\n" ); + Abc_Print( -2, "\t computes latch correspondence using 1-step induction\n" ); + Abc_Print( -2, "\t-P num : number of time frames to use as the prefix [default = %d]\n", nFramesP ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfMax ); + Abc_Print( -2, "\t-S num : the max number of SAT variables [default = %d]\n", nVarsMax ); + Abc_Print( -2, "\t-n : toggle using new algorithm [default = %s]\n", fNewAlgor? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -14986,24 +14870,23 @@ usage: ***********************************************************************/ int Abc_CommandSeqCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int fLatchConst; int fLatchEqual; + int fSaveNames; int fVerbose; - extern Abc_Ntk_t * Abc_NtkDarLatchSweep( Abc_Ntk_t * pNtk, int fLatchConst, int fLatchEqual, int fVerbose ); + extern Abc_Ntk_t * Abc_NtkDarLatchSweep( Abc_Ntk_t * pNtk, int fLatchConst, int fLatchEqual, int fSaveNames, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); // set defaults fLatchConst = 1; fLatchEqual = 1; + fSaveNames = 0; fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "cevh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "cenvh" ) ) != EOF ) { switch ( c ) { @@ -15013,6 +14896,9 @@ int Abc_CommandSeqCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'e': fLatchEqual ^= 1; break; + case 'n': + fSaveNames ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -15024,24 +14910,24 @@ int Abc_CommandSeqCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Only works for structrally hashed networks.\n" ); + Abc_Print( -1, "Only works for structrally hashed networks.\n" ); return 1; } if ( !Abc_NtkLatchNum(pNtk) ) { - fprintf( pErr, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } // modify the current network - pNtkRes = Abc_NtkDarLatchSweep( pNtk, fLatchConst, fLatchEqual, fVerbose ); + pNtkRes = Abc_NtkDarLatchSweep( pNtk, fLatchConst, fLatchEqual, fSaveNames, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Sequential cleanup has failed.\n" ); + Abc_Print( -1, "Sequential cleanup has failed.\n" ); return 1; } // replace the current network @@ -15049,13 +14935,14 @@ int Abc_CommandSeqCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: scleanup [-cevh]\n" ); - fprintf( pErr, "\t performs sequential cleanup of the current network\n" ); - fprintf( pErr, "\t by removing nodes and latches that do not feed into POs\n" ); - fprintf( pErr, "\t-c : sweep stuck-at latches detected by ternary simulation [default = %s]\n", fLatchConst? "yes": "no" ); - fprintf( pErr, "\t-e : merge equal latches (same data inputs and init states) [default = %s]\n", fLatchEqual? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: scleanup [-cenvh]\n" ); + Abc_Print( -2, "\t performs sequential cleanup of the current network\n" ); + Abc_Print( -2, "\t by removing nodes and latches that do not feed into POs\n" ); + Abc_Print( -2, "\t-c : sweep stuck-at latches detected by ternary simulation [default = %s]\n", fLatchConst? "yes": "no" ); + Abc_Print( -2, "\t-e : merge equal latches (same data inputs and init states) [default = %s]\n", fLatchEqual? "yes": "no" ); + Abc_Print( -2, "\t-n : toggle preserving latch names [default = %s]\n", fSaveNames? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -15072,19 +14959,13 @@ usage: ***********************************************************************/ int Abc_CommandCycle( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nFrames; int fUseXval; int fVerbose; extern void Abc_NtkCycleInitState( Abc_Ntk_t * pNtk, int nFrames, int fUseXval, int fVerbose ); extern void Abc_NtkCycleInitStateSop( Abc_Ntk_t * pNtk, int nFrames, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nFrames = 100; fUseXval = 0; @@ -15097,7 +14978,7 @@ int Abc_CommandCycle( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -15119,23 +15000,23 @@ int Abc_CommandCycle( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) && !Abc_NtkIsSopLogic(pNtk) ) { - fprintf( pErr, "Only works for strashed networks or logic SOP networks.\n" ); + Abc_Print( -1, "Only works for strashed networks or logic SOP networks.\n" ); return 1; } if ( !Abc_NtkLatchNum(pNtk) ) { - fprintf( pErr, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } if ( fUseXval && !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "X-valued simulation only works for AIGs. Run \"strash\".\n" ); + Abc_Print( -1, "X-valued simulation only works for AIGs. Run \"strash\".\n" ); return 0; } if ( fUseXval ) @@ -15147,13 +15028,13 @@ int Abc_CommandCycle( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: cycle [-F num] [-xvh]\n" ); - fprintf( pErr, "\t cycles sequential circuit for the given number of timeframes\n" ); - fprintf( pErr, "\t to derive a new initial state (which may be on the envelope)\n" ); - fprintf( pErr, "\t-F num : the number of frames to simulate [default = %d]\n", nFrames ); - fprintf( pErr, "\t-x : use x-valued primary inputs [default = %s]\n", fUseXval? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: cycle [-F num] [-xvh]\n" ); + Abc_Print( -2, "\t cycles sequential circuit for the given number of timeframes\n" ); + Abc_Print( -2, "\t to derive a new initial state (which may be on the envelope)\n" ); + Abc_Print( -2, "\t-F num : the number of frames to simulate [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-x : use x-valued primary inputs [default = %s]\n", fUseXval? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -15170,19 +15051,13 @@ usage: ***********************************************************************/ int Abc_CommandXsim( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nFrames; int fXInputs; int fXState; int fVerbose; extern void Abc_NtkXValueSimulate( Abc_Ntk_t * pNtk, int nFrames, int fXInputs, int fXState, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nFrames = 10; fXInputs = 0; @@ -15196,7 +15071,7 @@ int Abc_CommandXsim( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -15221,31 +15096,31 @@ int Abc_CommandXsim( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Only works for strashed networks.\n" ); + Abc_Print( -1, "Only works for strashed networks.\n" ); return 1; } if ( !Abc_NtkLatchNum(pNtk) ) { - fprintf( pErr, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } Abc_NtkXValueSimulate( pNtk, nFrames, fXInputs, fXState, fVerbose ); return 0; usage: - fprintf( pErr, "usage: xsim [-F num] [-isvh]\n" ); - fprintf( pErr, "\t performs X-valued simulation of the AIG\n" ); - fprintf( pErr, "\t-F num : the number of frames to simulate [default = %d]\n", nFrames ); - fprintf( pErr, "\t-i : toggle X-valued representation of inputs [default = %s]\n", fXInputs? "yes": "no" ); - fprintf( pErr, "\t-s : toggle X-valued representation of state [default = %s]\n", fXState? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: xsim [-F num] [-isvh]\n" ); + Abc_Print( -2, "\t performs X-valued simulation of the AIG\n" ); + Abc_Print( -2, "\t-F num : the number of frames to simulate [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-i : toggle X-valued representation of inputs [default = %s]\n", fXInputs? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle X-valued representation of state [default = %s]\n", fXState? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -15263,8 +15138,7 @@ usage: ***********************************************************************/ int Abc_CommandSim( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fNew; int fComb; @@ -15274,11 +15148,6 @@ int Abc_CommandSim( Abc_Frame_t * pAbc, int argc, char ** argv ) int fMiter; int fVerbose; extern int Abc_NtkDarSeqSim( Abc_Ntk_t * pNtk, int nFrames, int nWords, int TimeOut, int fNew, int fComb, int fMiter, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fNew = 0; fComb = 0; @@ -15295,7 +15164,7 @@ int Abc_CommandSim( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -15306,7 +15175,7 @@ int Abc_CommandSim( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } nWords = atoi(argv[globalUtilOptind]); @@ -15317,7 +15186,7 @@ int Abc_CommandSim( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } TimeOut = atoi(argv[globalUtilOptind]); @@ -15345,29 +15214,30 @@ int Abc_CommandSim( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Only works for strashed networks.\n" ); + Abc_Print( -1, "Only works for strashed networks.\n" ); return 1; } ABC_FREE( pNtk->pSeqModel ); - Abc_NtkDarSeqSim( pNtk, nFrames, nWords, TimeOut, fNew, fComb, fMiter, fVerbose ); + pAbc->Status = Abc_NtkDarSeqSim( pNtk, nFrames, nWords, TimeOut, fNew, fComb, fMiter, fVerbose ); + Abc_FrameReplaceCex( pAbc, &pNtk->pSeqModel ); return 0; usage: - fprintf( pErr, "usage: sim [-FWT num] [-ncmvh]\n" ); - fprintf( pErr, "\t performs random simulation of the sequential miter\n" ); - fprintf( pErr, "\t-F num : the number of frames to simulate [default = %d]\n", nFrames ); - fprintf( pErr, "\t-W num : the number of words to simulate [default = %d]\n", nWords ); - fprintf( pErr, "\t-T num : approximate runtime limit in seconds [default = %d]\n", TimeOut ); - fprintf( pErr, "\t-n : toggle new vs. old implementation [default = %s]\n", fNew? "new": "old" ); - fprintf( pErr, "\t-c : toggle comb vs. seq simulaton [default = %s]\n", fComb? "comb": "seq" ); - fprintf( pErr, "\t-m : toggle miter vs. any circuit [default = %s]\n", fMiter? "miter": "circuit" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: sim [-FWT num] [-ncmvh]\n" ); + Abc_Print( -2, "\t performs random simulation of the sequential miter\n" ); + Abc_Print( -2, "\t-F num : the number of frames to simulate [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-W num : the number of words to simulate [default = %d]\n", nWords ); + Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", TimeOut ); + Abc_Print( -2, "\t-n : toggle new vs. old implementation [default = %s]\n", fNew? "new": "old" ); + Abc_Print( -2, "\t-c : toggle comb vs. seq simulaton [default = %s]\n", fComb? "comb": "seq" ); + Abc_Print( -2, "\t-m : toggle miter vs. any circuit [default = %s]\n", fMiter? "miter": "circuit" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -15384,7 +15254,6 @@ usage: ***********************************************************************/ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int nFrames, nPref; @@ -15394,9 +15263,6 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkPhaseAbstract( Abc_Ntk_t * pNtk, int nFrames, int nPref, int fIgnore, int fPrint, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nFrames = 0; nPref = 0; @@ -15411,7 +15277,7 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -15422,7 +15288,7 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPref = atoi(argv[globalUtilOptind]); @@ -15447,17 +15313,17 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Only works for structrally hashed networks.\n" ); + Abc_Print( -1, "Only works for structrally hashed networks.\n" ); return 1; } if ( !Abc_NtkLatchNum(pNtk) ) { - fprintf( pErr, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } if ( fPrint ) @@ -15469,7 +15335,7 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkPhaseAbstract( pNtk, nFrames, nPref, fIgnore, 0, fVerbose ); if ( pNtkRes == NULL ) { -// fprintf( pErr, "Phase abstraction has failed.\n" ); +// Abc_Print( -1, "Phase abstraction has failed.\n" ); return 0; } // replace the current network @@ -15477,15 +15343,15 @@ int Abc_CommandDarPhase( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: phase [-FP <num>] [-ipvh]\n" ); - fprintf( pErr, "\t performs sequential cleanup of the current network\n" ); - fprintf( pErr, "\t by removing nodes and latches that do not feed into POs\n" ); - fprintf( pErr, "\t-F num : the number of frames to abstract [default = %d]\n", nFrames ); - fprintf( pErr, "\t-P num : the number of prefix frames to skip [default = %d]\n", nPref ); - fprintf( pErr, "\t-i : toggle ignoring the initial state [default = %s]\n", fIgnore? "yes": "no" ); - fprintf( pErr, "\t-p : toggle printing statistics about generators [default = %s]\n", fPrint? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: phase [-FP <num>] [-ipvh]\n" ); + Abc_Print( -2, "\t performs sequential cleanup of the current network\n" ); + Abc_Print( -2, "\t by removing nodes and latches that do not feed into POs\n" ); + Abc_Print( -2, "\t-F num : the number of frames to abstract [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-P num : the number of prefix frames to skip [default = %d]\n", nPref ); + Abc_Print( -2, "\t-i : toggle ignoring the initial state [default = %s]\n", fIgnore? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle printing statistics about generators [default = %s]\n", fPrint? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -15502,7 +15368,6 @@ usage: ***********************************************************************/ int Abc_CommandSynch( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtkRes, * pNtk1, * pNtk2, * pNtk; char ** pArgvNew; int nArgcNew; @@ -15515,9 +15380,6 @@ int Abc_CommandSynch( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarSynchOne( Abc_Ntk_t * pNtk, int nWords, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nWords = 32; fVerbose = 1; @@ -15529,7 +15391,7 @@ int Abc_CommandSynch( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } nWords = atoi(argv[globalUtilOptind]); @@ -15553,20 +15415,20 @@ int Abc_CommandSynch( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } pNtkRes = Abc_NtkDarSynchOne( pNtk, nWords, fVerbose ); } else { - if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) return 1; if ( Abc_NtkLatchNum(pNtk1) == 0 || Abc_NtkLatchNum(pNtk2) == 0 ) { if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); - printf( "The network has no latches..\n" ); + Abc_Print( -1, "The network has no latches..\n" ); return 0; } @@ -15577,7 +15439,7 @@ int Abc_CommandSynch( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtkRes == NULL ) { - fprintf( pErr, "Synchronization has failed.\n" ); + Abc_Print( -1, "Synchronization has failed.\n" ); return 0; } // replace the current network @@ -15585,23 +15447,23 @@ int Abc_CommandSynch( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: synch [-W <num>] [-vh] <file1> <file2>\n" ); - fprintf( pErr, "\t derives and applies synchronization sequence\n" ); - fprintf( pErr, "\t-W num : the number of simulation words [default = %d]\n", nWords ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tfile1 : (optional) the file with the first design\n"); - fprintf( pErr, "\tfile2 : (optional) the file with the second design\n\n"); - fprintf( pErr, "\t If no designs are given on the command line,\n" ); - fprintf( pErr, "\t assumes the current network has no initial state,\n" ); - fprintf( pErr, "\t derives synchronization sequence and applies it.\n\n" ); - fprintf( pErr, "\t If two designs are given on the command line\n" ); - fprintf( pErr, "\t assumes both of them have no initial state,\n" ); - fprintf( pErr, "\t derives sequences for both designs, synchorinizes\n" ); - fprintf( pErr, "\t them, and creates SEC miter comparing two designs.\n\n" ); - fprintf( pErr, "\t If only one design is given on the command line,\n" ); - fprintf( pErr, "\t considers the second design to be the current network,\n" ); - fprintf( pErr, "\t and derives SEC miter for them, as described above.\n" ); + Abc_Print( -2, "usage: synch [-W <num>] [-vh] <file1> <file2>\n" ); + Abc_Print( -2, "\t derives and applies synchronization sequence\n" ); + Abc_Print( -2, "\t-W num : the number of simulation words [default = %d]\n", nWords ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tfile1 : (optional) the file with the first design\n"); + Abc_Print( -2, "\tfile2 : (optional) the file with the second design\n\n"); + Abc_Print( -2, "\t If no designs are given on the command line,\n" ); + Abc_Print( -2, "\t assumes the current network has no initial state,\n" ); + Abc_Print( -2, "\t derives synchronization sequence and applies it.\n\n" ); + Abc_Print( -2, "\t If two designs are given on the command line\n" ); + Abc_Print( -2, "\t assumes both of them have no initial state,\n" ); + Abc_Print( -2, "\t derives sequences for both designs, synchorinizes\n" ); + Abc_Print( -2, "\t them, and creates SEC miter comparing two designs.\n\n" ); + Abc_Print( -2, "\t If only one design is given on the command line,\n" ); + Abc_Print( -2, "\t considers the second design to be the current network,\n" ); + Abc_Print( -2, "\t and derives SEC miter for them, as described above.\n" ); return 1; } @@ -15618,7 +15480,6 @@ usage: ***********************************************************************/ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Cgt_Par_t Pars, * pPars = &Pars; Abc_Ntk_t * pNtkRes, * pNtk, * pNtkCare; int c; @@ -15626,9 +15487,6 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarClockGate( Abc_Ntk_t * pNtk, Abc_Ntk_t * pCare, Cgt_Par_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Cgt_SetDefaultParams( pPars ); Extra_UtilGetoptReset(); @@ -15639,7 +15497,7 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nLevelMax = atoi(argv[globalUtilOptind]); @@ -15650,7 +15508,7 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nCandMax = atoi(argv[globalUtilOptind]); @@ -15661,7 +15519,7 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nOdcMax = atoi(argv[globalUtilOptind]); @@ -15672,7 +15530,7 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nConfMax = atoi(argv[globalUtilOptind]); @@ -15683,7 +15541,7 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'V': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-V\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-V\" should be followed by an integer.\n" ); goto usage; } pPars->nVarsMin = atoi(argv[globalUtilOptind]); @@ -15694,7 +15552,7 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'K': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } pPars->nFlopsMin = atoi(argv[globalUtilOptind]); @@ -15719,7 +15577,7 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } @@ -15728,7 +15586,7 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkCare = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1 ); if ( pNtkCare == NULL ) { - printf( "Reading care network has failed.\n" ); + Abc_Print( -1, "Reading care network has failed.\n" ); return 1; } // modify the current network @@ -15741,12 +15599,12 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) } else { - fprintf( pErr, "Wrong number of arguments.\n" ); + Abc_Print( -1, "Wrong number of arguments.\n" ); return 0; } if ( pNtkRes == NULL ) { - fprintf( pErr, "Clock gating has failed.\n" ); + Abc_Print( -1, "Clock gating has failed.\n" ); return 0; } // replace the current network @@ -15754,19 +15612,19 @@ int Abc_CommandClockGate( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: clockgate [-LNDCVK <num>] [-avwh] <file>\n" ); - fprintf( pErr, "\t sequential clock gating with observability don't-cares\n" ); - fprintf( pErr, "\t-L num : max level number of a clock gate [default = %d]\n", pPars->nLevelMax ); - fprintf( pErr, "\t-N num : max number of candidates for a flop [default = %d]\n", pPars->nCandMax ); - fprintf( pErr, "\t-D num : max number of ODC levels to consider [default = %d]\n", pPars->nOdcMax ); - fprintf( pErr, "\t-C num : max number of conflicts at a node [default = %d]\n", pPars->nConfMax ); - fprintf( pErr, "\t-V num : min number of vars to recycle SAT solver [default = %d]\n", pPars->nVarsMin ); - fprintf( pErr, "\t-K num : min number of flops to recycle SAT solver [default = %d]\n", pPars->nFlopsMin ); - fprintf( pErr, "\t-a : toggle minimizing area-only [default = %s]\n", pPars->fAreaOnly? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggle even more detailed output [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tfile : (optional) constraints for primary inputs and register outputs\n"); + Abc_Print( -2, "usage: clockgate [-LNDCVK <num>] [-avwh] <file>\n" ); + Abc_Print( -2, "\t sequential clock gating with observability don't-cares\n" ); + Abc_Print( -2, "\t-L num : max level number of a clock gate [default = %d]\n", pPars->nLevelMax ); + Abc_Print( -2, "\t-N num : max number of candidates for a flop [default = %d]\n", pPars->nCandMax ); + Abc_Print( -2, "\t-D num : max number of ODC levels to consider [default = %d]\n", pPars->nOdcMax ); + Abc_Print( -2, "\t-C num : max number of conflicts at a node [default = %d]\n", pPars->nConfMax ); + Abc_Print( -2, "\t-V num : min number of vars to recycle SAT solver [default = %d]\n", pPars->nVarsMin ); + Abc_Print( -2, "\t-K num : min number of flops to recycle SAT solver [default = %d]\n", pPars->nFlopsMin ); + Abc_Print( -2, "\t-a : toggle minimizing area-only [default = %s]\n", pPars->fAreaOnly? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle even more detailed output [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tfile : (optional) constraints for primary inputs and register outputs\n"); return 1; } @@ -15783,7 +15641,6 @@ usage: ***********************************************************************/ int Abc_CommandExtWin( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtkRes, * pNtk; int c; int nObjId; @@ -15793,9 +15650,6 @@ int Abc_CommandExtWin( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarExtWin( Abc_Ntk_t * pNtk, int nObjId, int nDist, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nObjId = -1; nDist = 5; @@ -15808,7 +15662,7 @@ int Abc_CommandExtWin( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nObjId = atoi(argv[globalUtilOptind]); @@ -15819,7 +15673,7 @@ int Abc_CommandExtWin( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } nDist = atoi(argv[globalUtilOptind]); @@ -15838,25 +15692,25 @@ int Abc_CommandExtWin( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Only works for structrally hashed networks.\n" ); + Abc_Print( -1, "Only works for structrally hashed networks.\n" ); return 1; } if ( argc != globalUtilOptind ) { - fprintf( pErr, "Not enough command-line arguments.\n" ); + Abc_Print( -1, "Not enough command-line arguments.\n" ); return 1; } // modify the current network pNtkRes = Abc_NtkDarExtWin( pNtk, nObjId, nDist, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Extracting sequential window has failed.\n" ); + Abc_Print( -1, "Extracting sequential window has failed.\n" ); return 0; } // replace the current network @@ -15864,12 +15718,12 @@ int Abc_CommandExtWin( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: extwin [-ND <num>] [-vh]\n" ); - fprintf( pErr, "\t extracts sequential window from the AIG\n" ); - fprintf( pErr, "\t-N num : the ID of the object to use as the center [default = %d]\n", nObjId ); - fprintf( pErr, "\t-D num : the \"radius\" of the window [default = %d]\n", nDist ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: extwin [-ND <num>] [-vh]\n" ); + Abc_Print( -2, "\t extracts sequential window from the AIG\n" ); + Abc_Print( -2, "\t-N num : the ID of the object to use as the center [default = %d]\n", nObjId ); + Abc_Print( -2, "\t-D num : the \"radius\" of the window [default = %d]\n", nDist ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -15886,7 +15740,6 @@ usage: ***********************************************************************/ int Abc_CommandInsWin( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtkRes, * pNtk, * pNtkCare; int c; int nObjId; @@ -15896,9 +15749,6 @@ int Abc_CommandInsWin( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarInsWin( Abc_Ntk_t * pNtk, Abc_Ntk_t * pWnd, int nObjId, int nDist, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nObjId = -1; nDist = 5; @@ -15911,7 +15761,7 @@ int Abc_CommandInsWin( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nObjId = atoi(argv[globalUtilOptind]); @@ -15922,7 +15772,7 @@ int Abc_CommandInsWin( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } nDist = atoi(argv[globalUtilOptind]); @@ -15941,24 +15791,24 @@ int Abc_CommandInsWin( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "Only works for structrally hashed networks.\n" ); + Abc_Print( -1, "Only works for structrally hashed networks.\n" ); return 1; } if ( argc != globalUtilOptind + 1 ) { - fprintf( pErr, "Not enough command-line arguments.\n" ); + Abc_Print( -1, "Not enough command-line arguments.\n" ); return 1; } pNtkCare = Io_Read( argv[globalUtilOptind], Io_ReadFileType(argv[globalUtilOptind]), 1 ); if ( pNtkCare == NULL ) { - printf( "Reading care network has failed.\n" ); + Abc_Print( -1, "Reading care network has failed.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtkCare) ) @@ -15972,7 +15822,7 @@ int Abc_CommandInsWin( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_NtkDelete( pNtkCare ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Inserting sequential window has failed.\n" ); + Abc_Print( -1, "Inserting sequential window has failed.\n" ); return 0; } // replace the current network @@ -15980,13 +15830,13 @@ int Abc_CommandInsWin( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: inswin [-ND <num>] [-vh] <file>\n" ); - fprintf( pErr, "\t inserts sequential window into the AIG\n" ); - fprintf( pErr, "\t-N num : the ID of the object to use as the center [default = %d]\n", nObjId ); - fprintf( pErr, "\t-D num : the \"radius\" of the window [default = %d]\n", nDist ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tfile : file with the AIG to be inserted\n"); + Abc_Print( -2, "usage: inswin [-ND <num>] [-vh] <file>\n" ); + Abc_Print( -2, "\t inserts sequential window into the AIG\n" ); + Abc_Print( -2, "\t-N num : the ID of the object to use as the center [default = %d]\n", nObjId ); + Abc_Print( -2, "\t-D num : the \"radius\" of the window [default = %d]\n", nDist ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tfile : file with the AIG to be inserted\n"); return 1; } @@ -16004,7 +15854,6 @@ usage: int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv ) { char Buffer[16]; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtk1, * pNtk2; int fDelete1, fDelete2; char ** pArgvNew; @@ -16025,9 +15874,6 @@ int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv ) extern void Abc_NtkCecFraigPartAuto( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fSat = 0; fVerbose = 0; @@ -16045,7 +15891,7 @@ int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } nSeconds = atoi(argv[globalUtilOptind]); @@ -16056,7 +15902,7 @@ int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); @@ -16067,7 +15913,7 @@ int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nInsLimit = atoi(argv[globalUtilOptind]); @@ -16078,7 +15924,7 @@ int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPartSize = atoi(argv[globalUtilOptind]); @@ -16105,7 +15951,7 @@ int Abc_CommandCec( Abc_Frame_t * pAbc, int argc, char ** argv ) pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; - if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) return 1; if ( fIgnoreNames ) @@ -16133,21 +15979,21 @@ usage: strcpy( Buffer, "unused" ); else sprintf( Buffer, "%d", nPartSize ); - fprintf( pErr, "usage: cec [-T num] [-C num] [-I num] [-P num] [-psnvh] <file1> <file2>\n" ); - fprintf( pErr, "\t performs combinational equivalence checking\n" ); - fprintf( pErr, "\t-T num : approximate runtime limit in seconds [default = %d]\n", nSeconds ); - fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - fprintf( pErr, "\t-I num : limit on the number of clause inspections [default = %d]\n", nInsLimit ); - fprintf( pErr, "\t-P num : partition size for multi-output networks [default = %s]\n", Buffer ); - fprintf( pErr, "\t-p : toggle automatic partitioning [default = %s]\n", fPartition? "yes": "no" ); - fprintf( pErr, "\t-s : toggle \"SAT only\" and \"FRAIG + SAT\" [default = %s]\n", fSat? "SAT only": "FRAIG + SAT" ); - fprintf( pErr, "\t-n : toggle ignoring names when matching CIs/COs [default = %s]\n", fIgnoreNames? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tfile1 : (optional) the file with the first network\n"); - fprintf( pErr, "\tfile2 : (optional) the file with the second network\n"); - fprintf( pErr, "\t if no files are given, uses the current network and its spec\n"); - fprintf( pErr, "\t if one file is given, uses the current network and the file\n"); + Abc_Print( -2, "usage: cec [-T num] [-C num] [-I num] [-P num] [-psnvh] <file1> <file2>\n" ); + Abc_Print( -2, "\t performs combinational equivalence checking\n" ); + Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", nSeconds ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); + Abc_Print( -2, "\t-I num : limit on the number of clause inspections [default = %d]\n", nInsLimit ); + Abc_Print( -2, "\t-P num : partition size for multi-output networks [default = %s]\n", Buffer ); + Abc_Print( -2, "\t-p : toggle automatic partitioning [default = %s]\n", fPartition? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle \"SAT only\" and \"FRAIG + SAT\" [default = %s]\n", fSat? "SAT only": "FRAIG + SAT" ); + Abc_Print( -2, "\t-n : toggle ignoring names when matching CIs/COs [default = %s]\n", fIgnoreNames? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tfile1 : (optional) the file with the first network\n"); + Abc_Print( -2, "\tfile2 : (optional) the file with the second network\n"); + Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); + Abc_Print( -2, "\t if one file is given, uses the current network and the file\n"); return 1; } @@ -16165,7 +16011,6 @@ usage: ***********************************************************************/ int Abc_CommandDCec( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtk1, * pNtk2; int fDelete1, fDelete2; char ** pArgvNew; @@ -16183,9 +16028,6 @@ int Abc_CommandDCec( Abc_Frame_t * pAbc, int argc, char ** argv ) extern int Abc_NtkDarCec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int fPartition, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fSat = 0; fVerbose = 0; @@ -16202,7 +16044,7 @@ int Abc_CommandDCec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } nSeconds = atoi(argv[globalUtilOptind]); @@ -16213,7 +16055,7 @@ int Abc_CommandDCec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); @@ -16224,7 +16066,7 @@ int Abc_CommandDCec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nInsLimit = atoi(argv[globalUtilOptind]); @@ -16255,7 +16097,7 @@ int Abc_CommandDCec( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsStrash(pNtk) ) @@ -16273,7 +16115,7 @@ int Abc_CommandDCec( Abc_Frame_t * pAbc, int argc, char ** argv ) } else { - if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) return 1; } @@ -16281,7 +16123,7 @@ int Abc_CommandDCec( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); - printf( "Currently this command only works for networks without latches. Run \"comb\".\n" ); + Abc_Print( -1, "Currently this command only works for networks without latches. Run \"comb\".\n" ); return 1; } @@ -16296,20 +16138,20 @@ int Abc_CommandDCec( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: dcec [-T num] [-C num] [-I num] [-mpsvh] <file1> <file2>\n" ); - fprintf( pErr, "\t performs combinational equivalence checking\n" ); - fprintf( pErr, "\t-T num : approximate runtime limit in seconds [default = %d]\n", nSeconds ); - fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - fprintf( pErr, "\t-I num : limit on the number of clause inspections [default = %d]\n", nInsLimit ); - fprintf( pErr, "\t-m : toggle working on two networks or a miter [default = %s]\n", fMiter? "miter": "two networks" ); - fprintf( pErr, "\t-p : toggle automatic partitioning [default = %s]\n", fPartition? "yes": "no" ); - fprintf( pErr, "\t-s : toggle \"SAT only\" (miter) or \"FRAIG + SAT\" [default = %s]\n", fSat? "SAT only": "FRAIG + SAT" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tfile1 : (optional) the file with the first network\n"); - fprintf( pErr, "\tfile2 : (optional) the file with the second network\n"); - fprintf( pErr, "\t if no files are given, uses the current network and its spec\n"); - fprintf( pErr, "\t if one file is given, uses the current network and the file\n"); + Abc_Print( -2, "usage: dcec [-T num] [-C num] [-I num] [-mpsvh] <file1> <file2>\n" ); + Abc_Print( -2, "\t performs combinational equivalence checking\n" ); + Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", nSeconds ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); + Abc_Print( -2, "\t-I num : limit on the number of clause inspections [default = %d]\n", nInsLimit ); + Abc_Print( -2, "\t-m : toggle working on two networks or a miter [default = %s]\n", fMiter? "miter": "two networks" ); + Abc_Print( -2, "\t-p : toggle automatic partitioning [default = %s]\n", fPartition? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle \"SAT only\" (miter) or \"FRAIG + SAT\" [default = %s]\n", fSat? "SAT only": "FRAIG + SAT" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tfile1 : (optional) the file with the first network\n"); + Abc_Print( -2, "\tfile2 : (optional) the file with the second network\n"); + Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); + Abc_Print( -2, "\t if one file is given, uses the current network and the file\n"); return 1; } @@ -16326,7 +16168,6 @@ usage: ***********************************************************************/ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtk1, * pNtk2; int fDelete1, fDelete2; char ** pArgvNew; @@ -16343,11 +16184,10 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv ) extern void Abc_NtkSecSat( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nConfLimit, int nInsLimit, int nFrames ); extern int Abc_NtkSecFraig( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int nFrames, int fVerbose ); + Abc_Print( 0, "This command is no longer used.\n" ); + return 0; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fRetime = 0; // verification after retiming fSat = 0; @@ -16364,7 +16204,7 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -16375,7 +16215,7 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } nSeconds = atoi(argv[globalUtilOptind]); @@ -16386,7 +16226,7 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); @@ -16397,7 +16237,7 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nInsLimit = atoi(argv[globalUtilOptind]); @@ -16421,14 +16261,14 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv ) pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; - if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) return 1; if ( Abc_NtkLatchNum(pNtk1) == 0 || Abc_NtkLatchNum(pNtk2) == 0 ) { if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); - printf( "The network has no latches. Used combinational command \"cec\".\n" ); + Abc_Print( -1, "The network has no latches. Used combinational command \"cec\".\n" ); return 0; } @@ -16443,21 +16283,21 @@ int Abc_CommandSec( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: sec [-F num] [-T num] [-C num] [-I num] [-srvh] <file1> <file2>\n" ); - fprintf( pErr, "\t performs bounded sequential equivalence checking\n" ); - fprintf( pErr, "\t (there is also an unbounded SEC commands, \"dsec\" and \"dprove\")\n" ); - fprintf( pErr, "\t-s : toggle \"SAT only\" and \"FRAIG + SAT\" [default = %s]\n", fSat? "SAT only": "FRAIG + SAT" ); - fprintf( pErr, "\t-r : toggles retiming verification [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\t-F num : the number of time frames to use [default = %d]\n", nFrames ); - fprintf( pErr, "\t-T num : approximate runtime limit in seconds [default = %d]\n", nSeconds ); - fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - fprintf( pErr, "\t-I num : limit on the number of inspections [default = %d]\n", nInsLimit ); - fprintf( pErr, "\tfile1 : (optional) the file with the first network\n"); - fprintf( pErr, "\tfile2 : (optional) the file with the second network\n"); - fprintf( pErr, "\t if no files are given, uses the current network and its spec\n"); - fprintf( pErr, "\t if one file is given, uses the current network and the file\n"); + Abc_Print( -2, "usage: sec [-F num] [-T num] [-C num] [-I num] [-srvh] <file1> <file2>\n" ); + Abc_Print( -2, "\t performs bounded sequential equivalence checking\n" ); + Abc_Print( -2, "\t (there is also an unbounded SEC commands, \"dsec\" and \"dprove\")\n" ); + Abc_Print( -2, "\t-s : toggle \"SAT only\" and \"FRAIG + SAT\" [default = %s]\n", fSat? "SAT only": "FRAIG + SAT" ); + Abc_Print( -2, "\t-r : toggles retiming verification [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t-F num : the number of time frames to use [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", nSeconds ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); + Abc_Print( -2, "\t-I num : limit on the number of inspections [default = %d]\n", nInsLimit ); + Abc_Print( -2, "\tfile1 : (optional) the file with the first network\n"); + Abc_Print( -2, "\tfile2 : (optional) the file with the second network\n"); + Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); + Abc_Print( -2, "\t if one file is given, uses the current network and the file\n"); return 1; } @@ -16475,7 +16315,6 @@ usage: int Abc_CommandDSec( Abc_Frame_t * pAbc, int argc, char ** argv ) { Fra_Sec_t SecPar, * pSecPar = &SecPar; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtk1, * pNtk2; int fDelete1, fDelete2; char ** pArgvNew; @@ -16487,9 +16326,6 @@ int Abc_CommandDSec( Abc_Frame_t * pAbc, int argc, char ** argv ) extern int Abc_NtkDarSec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Fra_Sec_t * p ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Fra_SecSetDefaultParams( pSecPar ); pSecPar->TimeLimit = 0; @@ -16502,7 +16338,7 @@ int Abc_CommandDSec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pSecPar->nFramesMax = atoi(argv[globalUtilOptind]); @@ -16513,7 +16349,7 @@ int Abc_CommandDSec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } pSecPar->TimeLimit = atoi(argv[globalUtilOptind]); @@ -16549,13 +16385,13 @@ int Abc_CommandDSec( Abc_Frame_t * pAbc, int argc, char ** argv ) pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; - if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) return 1; if ( Abc_NtkLatchNum(pNtk1) == 0 || Abc_NtkLatchNum(pNtk2) == 0 ) { if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); - printf( "The network has no latches. Used combinational command \"cec\".\n" ); + Abc_Print( -1, "The network has no latches. Used combinational command \"cec\".\n" ); return 0; } @@ -16573,22 +16409,22 @@ int Abc_CommandDSec( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: dsec [-F num] [-T num] [-armfnwvh] <file1> <file2>\n" ); - fprintf( pErr, "\t performs inductive sequential equivalence checking\n" ); - fprintf( pErr, "\t-F num : the limit on the depth of induction [default = %d]\n", pSecPar->nFramesMax ); - fprintf( pErr, "\t-T num : the approximate runtime limit (in seconds) [default = %d]\n", pSecPar->TimeLimit ); - fprintf( pErr, "\t-a : toggles the use of phase abstraction [default = %s]\n", pSecPar->fPhaseAbstract? "yes": "no" ); - fprintf( pErr, "\t-r : toggles forward retiming at the beginning [default = %s]\n", pSecPar->fRetimeFirst? "yes": "no" ); - fprintf( pErr, "\t-m : toggles min-register retiming [default = %s]\n", pSecPar->fRetimeRegs? "yes": "no" ); - fprintf( pErr, "\t-f : toggles the internal use of fraiging [default = %s]\n", pSecPar->fFraiging? "yes": "no" ); - fprintf( pErr, "\t-n : toggle ignoring names when matching PIs/POs [default = %s]\n", fIgnoreNames? "yes": "no" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", pSecPar->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggles additional verbose output [default = %s]\n", pSecPar->fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); - fprintf( pErr, "\tfile1 : (optional) the file with the first network\n"); - fprintf( pErr, "\tfile2 : (optional) the file with the second network\n"); - fprintf( pErr, "\t if no files are given, uses the current network and its spec\n"); - fprintf( pErr, "\t if one file is given, uses the current network and the file\n"); + Abc_Print( -2, "usage: dsec [-F num] [-T num] [-armfnwvh] <file1> <file2>\n" ); + Abc_Print( -2, "\t performs inductive sequential equivalence checking\n" ); + Abc_Print( -2, "\t-F num : the limit on the depth of induction [default = %d]\n", pSecPar->nFramesMax ); + Abc_Print( -2, "\t-T num : the approximate runtime limit (in seconds) [default = %d]\n", pSecPar->TimeLimit ); + Abc_Print( -2, "\t-a : toggles the use of phase abstraction [default = %s]\n", pSecPar->fPhaseAbstract? "yes": "no" ); + Abc_Print( -2, "\t-r : toggles forward retiming at the beginning [default = %s]\n", pSecPar->fRetimeFirst? "yes": "no" ); + Abc_Print( -2, "\t-m : toggles min-register retiming [default = %s]\n", pSecPar->fRetimeRegs? "yes": "no" ); + Abc_Print( -2, "\t-f : toggles the internal use of fraiging [default = %s]\n", pSecPar->fFraiging? "yes": "no" ); + Abc_Print( -2, "\t-n : toggle ignoring names when matching PIs/POs [default = %s]\n", fIgnoreNames? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pSecPar->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggles additional verbose output [default = %s]\n", pSecPar->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tfile1 : (optional) the file with the first network\n"); + Abc_Print( -2, "\tfile2 : (optional) the file with the second network\n"); + Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); + Abc_Print( -2, "\t if one file is given, uses the current network and the file\n"); return 1; } @@ -16606,22 +16442,17 @@ usage: int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) { Fra_Sec_t SecPar, * pSecPar = &SecPar; - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; + char * pLogFileName = NULL; extern void Fra_SecSetDefaultParams( Fra_Sec_t * p ); extern int Abc_NtkDarProve( Abc_Ntk_t * pNtk, Fra_Sec_t * pSecPar ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Fra_SecSetDefaultParams( pSecPar ); // pSecPar->TimeLimit = 300; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "cbFCGDVBRarmfijkouwvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "cbFCGDVBRLarmfijkouwvh" ) ) != EOF ) { switch ( c ) { @@ -16634,7 +16465,7 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pSecPar->nFramesMax = atoi(argv[globalUtilOptind]); @@ -16645,7 +16476,7 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pSecPar->nBTLimit = atoi(argv[globalUtilOptind]); @@ -16656,7 +16487,7 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'G': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-G\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-G\" should be followed by an integer.\n" ); goto usage; } pSecPar->nBTLimitGlobal = atoi(argv[globalUtilOptind]); @@ -16667,7 +16498,7 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pSecPar->nBTLimitInter = atoi(argv[globalUtilOptind]); @@ -16678,7 +16509,7 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'V': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-V\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-V\" should be followed by an integer.\n" ); goto usage; } pSecPar->nBddVarsMax = atoi(argv[globalUtilOptind]); @@ -16689,7 +16520,7 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'B': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-B\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" ); goto usage; } pSecPar->nBddMax = atoi(argv[globalUtilOptind]); @@ -16700,7 +16531,7 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'R': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-R\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } pSecPar->nBddIterMax = atoi(argv[globalUtilOptind]); @@ -16708,6 +16539,15 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pSecPar->nBddIterMax < 0 ) goto usage; break; + case 'L': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-L\" should be followed by a file name.\n" ); + goto usage; + } + pLogFileName = argv[globalUtilOptind]; + globalUtilOptind++; + break; case 'a': pSecPar->fPhaseAbstract ^= 1; break; @@ -16747,19 +16587,21 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - printf( "This command works only for structrally hashed networks. Run \"st\".\n" ); + Abc_Print( -1, "This command works only for structrally hashed networks. Run \"st\".\n" ); return 0; } // perform verification - Abc_NtkDarProve( pNtk, pSecPar ); - pAbc->pCex = pNtk->pSeqModel; // temporary ??? + pAbc->Status = Abc_NtkDarProve( pNtk, pSecPar ); + Abc_FrameReplaceCex( pAbc, &pNtk->pSeqModel ); + if ( pLogFileName ) + Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, "dprove" ); // read back the resulting unsolved reduced sequential miter if ( pSecPar->fReadUnsolved && pSecPar->nSMnumber >= 0 ) @@ -16768,36 +16610,37 @@ int Abc_CommandDProve( Abc_Frame_t * pAbc, int argc, char ** argv ) sprintf( FileName, "sm%02d.aig", pSecPar->nSMnumber ); pNtk = Io_Read( FileName, Io_ReadFileType(FileName), 1 ); if ( pNtk == NULL ) - printf( "Cannot read back unsolved reduced sequential miter \"%s\",\n", FileName ); + Abc_Print( -1, "Cannot read back unsolved reduced sequential miter \"%s\",\n", FileName ); else Abc_FrameReplaceCurrentNetwork( pAbc, pNtk ); } return 0; usage: - fprintf( pErr, "usage: dprove [-FCGDVBR num] [-cbarmfijouwvh]\n" ); - fprintf( pErr, "\t performs SEC on the sequential miter\n" ); - fprintf( pErr, "\t-F num : the limit on the depth of induction [default = %d]\n", pSecPar->nFramesMax ); - fprintf( pErr, "\t-C num : the conflict limit at a node during induction [default = %d]\n", pSecPar->nBTLimit ); - fprintf( pErr, "\t-G num : the global conflict limit during induction [default = %d]\n", pSecPar->nBTLimitGlobal ); - fprintf( pErr, "\t-D num : the conflict limit during interpolation [default = %d]\n", pSecPar->nBTLimitInter ); - fprintf( pErr, "\t-V num : the flop count limit for BDD-based reachablity [default = %d]\n", pSecPar->nBddVarsMax ); - fprintf( pErr, "\t-B num : the BDD size limit in BDD-based reachablity [default = %d]\n", pSecPar->nBddMax ); - fprintf( pErr, "\t-R num : the max number of reachability iterations [default = %d]\n", pSecPar->nBddIterMax ); - fprintf( pErr, "\t-c : toggles using CEC before attempting SEC [default = %s]\n", pSecPar->fTryComb? "yes": "no" ); - fprintf( pErr, "\t-b : toggles using BMC before attempting SEC [default = %s]\n", pSecPar->fTryBmc? "yes": "no" ); - fprintf( pErr, "\t-a : toggles the use of phase abstraction [default = %s]\n", pSecPar->fPhaseAbstract? "yes": "no" ); - fprintf( pErr, "\t-r : toggles forward retiming at the beginning [default = %s]\n", pSecPar->fRetimeFirst? "yes": "no" ); - fprintf( pErr, "\t-m : toggles min-register retiming [default = %s]\n", pSecPar->fRetimeRegs? "yes": "no" ); - fprintf( pErr, "\t-f : toggles the internal use of fraiging [default = %s]\n", pSecPar->fFraiging? "yes": "no" ); - fprintf( pErr, "\t-i : toggles the use of induction [default = %s]\n", pSecPar->fInduction? "yes": "no" ); - fprintf( pErr, "\t-j : toggles the use of interpolation [default = %s]\n", pSecPar->fInterpolation? "yes": "no" ); - fprintf( pErr, "\t-k : toggles applying interpolation to each output [default = %s]\n", pSecPar->fInterSeparate? "yes": "no" ); - fprintf( pErr, "\t-o : toggles using BDD variable reordering during image computation [default = %s]\n", pSecPar->fReorderImage? "yes": "no" ); - fprintf( pErr, "\t-u : toggles reading back unsolved reduced sequential miter [default = %s]\n", pSecPar->fReadUnsolved? "yes": "no" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", pSecPar->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-w : toggles additional verbose output [default = %s]\n", pSecPar->fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dprove [-FCGDVBR num] [-L file] [-cbarmfijouwvh]\n" ); + Abc_Print( -2, "\t performs SEC on the sequential miter\n" ); + Abc_Print( -2, "\t-F num : the limit on the depth of induction [default = %d]\n", pSecPar->nFramesMax ); + Abc_Print( -2, "\t-C num : the conflict limit at a node during induction [default = %d]\n", pSecPar->nBTLimit ); + Abc_Print( -2, "\t-G num : the global conflict limit during induction [default = %d]\n", pSecPar->nBTLimitGlobal ); + Abc_Print( -2, "\t-D num : the conflict limit during interpolation [default = %d]\n", pSecPar->nBTLimitInter ); + Abc_Print( -2, "\t-V num : the flop count limit for BDD-based reachablity [default = %d]\n", pSecPar->nBddVarsMax ); + Abc_Print( -2, "\t-B num : the BDD size limit in BDD-based reachablity [default = %d]\n", pSecPar->nBddMax ); + Abc_Print( -2, "\t-R num : the max number of reachability iterations [default = %d]\n", pSecPar->nBddIterMax ); + Abc_Print( -2, "\t-L file: the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" ); + Abc_Print( -2, "\t-c : toggles using CEC before attempting SEC [default = %s]\n", pSecPar->fTryComb? "yes": "no" ); + Abc_Print( -2, "\t-b : toggles using BMC before attempting SEC [default = %s]\n", pSecPar->fTryBmc? "yes": "no" ); + Abc_Print( -2, "\t-a : toggles the use of phase abstraction [default = %s]\n", pSecPar->fPhaseAbstract? "yes": "no" ); + Abc_Print( -2, "\t-r : toggles forward retiming at the beginning [default = %s]\n", pSecPar->fRetimeFirst? "yes": "no" ); + Abc_Print( -2, "\t-m : toggles min-register retiming [default = %s]\n", pSecPar->fRetimeRegs? "yes": "no" ); + Abc_Print( -2, "\t-f : toggles the internal use of fraiging [default = %s]\n", pSecPar->fFraiging? "yes": "no" ); + Abc_Print( -2, "\t-i : toggles the use of induction [default = %s]\n", pSecPar->fInduction? "yes": "no" ); + Abc_Print( -2, "\t-j : toggles the use of interpolation [default = %s]\n", pSecPar->fInterpolation? "yes": "no" ); + Abc_Print( -2, "\t-k : toggles applying interpolation to each output [default = %s]\n", pSecPar->fInterSeparate? "yes": "no" ); + Abc_Print( -2, "\t-o : toggles using BDD variable reordering during image computation [default = %s]\n", pSecPar->fReorderImage? "yes": "no" ); + Abc_Print( -2, "\t-u : toggles reading back unsolved reduced sequential miter [default = %s]\n", pSecPar->fReadUnsolved? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pSecPar->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggles additional verbose output [default = %s]\n", pSecPar->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -16815,20 +16658,14 @@ usage: ***********************************************************************/ int Abc_CommandDProve2( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int nConfLast; int fSeparate; int fVeryVerbose; int fVerbose; int c; - extern int Abc_NtkDProve2( Abc_Ntk_t * pNtk, int nConfLast, int fSeparate, int fVeryVerbose, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - +// extern int Abc_NtkDProve2( Abc_Ntk_t * pNtk, int nConfLast, int fSeparate, int fVeryVerbose, int fVerbose ); // set defaults nConfLast = 75000; fSeparate = 0; @@ -16842,7 +16679,7 @@ int Abc_CommandDProve2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLast = atoi(argv[globalUtilOptind]); @@ -16865,31 +16702,31 @@ int Abc_CommandDProve2( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - printf( "This command works only for structrally hashed networks. Run \"st\".\n" ); + Abc_Print( -1, "This command works only for structrally hashed networks. Run \"st\".\n" ); return 0; } if ( Abc_NtkLatchNum(pNtk) == 0 ) { - printf( "This command works only for sequential networks.\n" ); + Abc_Print( -1, "This command works only for sequential networks.\n" ); return 0; } // perform verification - Abc_NtkDProve2( pNtk, nConfLast, fSeparate, fVeryVerbose, fVerbose ); +// Abc_NtkDProve2( pNtk, nConfLast, fSeparate, fVeryVerbose, fVerbose ); return 0; usage: - fprintf( pErr, "usage: dprove2 [-C num] [-kwvh]\n" ); - fprintf( pErr, "\t improved integrated solver of sequential miters\n" ); - fprintf( pErr, "\t-C num : the conflict limit during final BMC [default = %d]\n", nConfLast ); - fprintf( pErr, "\t-k : toggles solving each output separately [default = %s]\n", fSeparate? "yes": "no" ); - fprintf( pErr, "\t-w : toggles very verbose output [default = %s]\n", fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dprove2 [-C num] [-kwvh]\n" ); + Abc_Print( -2, "\t improved integrated solver of sequential miters\n" ); + Abc_Print( -2, "\t-C num : the conflict limit during final BMC [default = %d]\n", nConfLast ); + Abc_Print( -2, "\t-k : toggles solving each output separately [default = %s]\n", fSeparate? "yes": "no" ); + Abc_Print( -2, "\t-w : toggles very verbose output [default = %s]\n", fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -16906,7 +16743,6 @@ usage: ***********************************************************************/ int Abc_CommandAbSec( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtk1, * pNtk2; int fDelete1, fDelete2; char ** pArgvNew; @@ -16916,9 +16752,6 @@ int Abc_CommandAbSec( Abc_Frame_t * pAbc, int argc, char ** argv ) extern int Abc_NtkDarAbSec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nFrames, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fMiter = 1; nFrames = 2; @@ -16931,7 +16764,7 @@ int Abc_CommandAbSec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -16954,7 +16787,7 @@ int Abc_CommandAbSec( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( !Abc_NtkIsStrash(pNtk) ) { - printf( "This command works only for structrally hashed networks. Run \"st\".\n" ); + Abc_Print( -1, "This command works only for structrally hashed networks. Run \"st\".\n" ); return 0; } Abc_NtkDarAbSec( pNtk, NULL, nFrames, fVerbose ); @@ -16963,13 +16796,13 @@ int Abc_CommandAbSec( Abc_Frame_t * pAbc, int argc, char ** argv ) { pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; - if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) return 1; if ( Abc_NtkLatchNum(pNtk1) == 0 || Abc_NtkLatchNum(pNtk2) == 0 ) { if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); - printf( "The network has no latches. Used combinational command \"cec\".\n" ); + Abc_Print( -1, "The network has no latches. Used combinational command \"cec\".\n" ); return 0; } // perform verification @@ -16980,15 +16813,15 @@ int Abc_CommandAbSec( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: absec [-F num] [-mv] <file1> <file2>\n" ); - fprintf( pErr, "\t performs SEC by applying CEC to several timeframes\n" ); - fprintf( pErr, "\t-F num : the total number of timeframes to use [default = %d]\n", nFrames ); - fprintf( pErr, "\t-m : toggles miter vs. two networks [default = %s]\n", fMiter? "miter": "two networks" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\tfile1 : (optional) the file with the first network\n"); - fprintf( pErr, "\tfile2 : (optional) the file with the second network\n"); - fprintf( pErr, "\t if no files are given, uses the current network and its spec\n"); - fprintf( pErr, "\t if one file is given, uses the current network and the file\n"); + Abc_Print( -2, "usage: absec [-F num] [-mv] <file1> <file2>\n" ); + Abc_Print( -2, "\t performs SEC by applying CEC to several timeframes\n" ); + Abc_Print( -2, "\t-F num : the total number of timeframes to use [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-m : toggles miter vs. two networks [default = %s]\n", fMiter? "miter": "two networks" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\tfile1 : (optional) the file with the first network\n"); + Abc_Print( -2, "\tfile2 : (optional) the file with the second network\n"); + Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); + Abc_Print( -2, "\t if one file is given, uses the current network and the file\n"); return 1; } @@ -17006,7 +16839,6 @@ usage: int Abc_CommandSimSec( Abc_Frame_t * pAbc, int argc, char ** argv ) { Ssw_Pars_t Pars, * pPars = &Pars; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtk1, * pNtk2; int fDelete1, fDelete2; char ** pArgvNew; @@ -17016,9 +16848,6 @@ int Abc_CommandSimSec( Abc_Frame_t * pAbc, int argc, char ** argv ) extern int Abc_NtkDarSimSec( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Ssw_Pars_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fMiter = 1; Ssw_ManSetDefaultParams( pPars ); @@ -17032,7 +16861,7 @@ int Abc_CommandSimSec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesK = atoi(argv[globalUtilOptind]); @@ -17043,7 +16872,7 @@ int Abc_CommandSimSec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nIsleDist = atoi(argv[globalUtilOptind]); @@ -17073,7 +16902,7 @@ int Abc_CommandSimSec( Abc_Frame_t * pAbc, int argc, char ** argv ) // Abc_Ntk_t * pNtkA, * pNtkB; if ( !Abc_NtkIsStrash(pNtk) ) { - printf( "This command works only for structrally hashed networks. Run \"st\".\n" ); + Abc_Print( -1, "This command works only for structrally hashed networks. Run \"st\".\n" ); return 0; } Abc_NtkDarSimSec( pNtk, NULL, pPars ); @@ -17089,13 +16918,13 @@ int Abc_CommandSimSec( Abc_Frame_t * pAbc, int argc, char ** argv ) { pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; - if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) return 1; if ( Abc_NtkLatchNum(pNtk1) == 0 || Abc_NtkLatchNum(pNtk2) == 0 ) { if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); - printf( "The network has no latches. Used combinational command \"cec\".\n" ); + Abc_Print( -1, "The network has no latches. Used combinational command \"cec\".\n" ); return 0; } // perform verification @@ -17106,18 +16935,18 @@ int Abc_CommandSimSec( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: simsec [-FD num] [-mcyv] <file1> <file2>\n" ); - fprintf( pErr, "\t performs SEC using structural similarity\n" ); - fprintf( pErr, "\t-F num : the limit on the depth of induction [default = %d]\n", pPars->nFramesK ); - fprintf( pErr, "\t-D num : the distance for extending islands [default = %d]\n", pPars->nIsleDist ); - fprintf( pErr, "\t-m : toggles miter vs. two networks [default = %s]\n", fMiter? "miter": "two networks" ); - fprintf( pErr, "\t-c : uses partial vs. full signal correspondence [default = %s]\n", pPars->fPartSigCorr? "partial": "full" ); - fprintf( pErr, "\t-y : dumps speculatively reduced miter of the classes [default = %s]\n", pPars->fDumpSRInit? "yes": "no" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\tfile1 : (optional) the file with the first network\n"); - fprintf( pErr, "\tfile2 : (optional) the file with the second network\n"); - fprintf( pErr, "\t if no files are given, uses the current network and its spec\n"); - fprintf( pErr, "\t if one file is given, uses the current network and the file\n"); + Abc_Print( -2, "usage: simsec [-FD num] [-mcyv] <file1> <file2>\n" ); + Abc_Print( -2, "\t performs SEC using structural similarity\n" ); + Abc_Print( -2, "\t-F num : the limit on the depth of induction [default = %d]\n", pPars->nFramesK ); + Abc_Print( -2, "\t-D num : the distance for extending islands [default = %d]\n", pPars->nIsleDist ); + Abc_Print( -2, "\t-m : toggles miter vs. two networks [default = %s]\n", fMiter? "miter": "two networks" ); + Abc_Print( -2, "\t-c : uses partial vs. full signal correspondence [default = %s]\n", pPars->fPartSigCorr? "partial": "full" ); + Abc_Print( -2, "\t-y : dumps speculatively reduced miter of the classes [default = %s]\n", pPars->fDumpSRInit? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\tfile1 : (optional) the file with the first network\n"); + Abc_Print( -2, "\tfile2 : (optional) the file with the second network\n"); + Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); + Abc_Print( -2, "\t if one file is given, uses the current network and the file\n"); return 1; } @@ -17134,7 +16963,6 @@ usage: ***********************************************************************/ int Abc_CommandMatch( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtk1, * pNtk2, * pNtkRes; int fDelete1, fDelete2; char ** pArgvNew; @@ -17146,9 +16974,6 @@ int Abc_CommandMatch( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarMatch( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nDist, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fMiter = 0; nDist = 0; @@ -17161,7 +16986,7 @@ int Abc_CommandMatch( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } nDist = atoi(argv[globalUtilOptind]); @@ -17185,7 +17010,7 @@ int Abc_CommandMatch( Abc_Frame_t * pAbc, int argc, char ** argv ) // Abc_Ntk_t * pNtkA, * pNtkB; if ( !Abc_NtkIsStrash(pNtk) ) { - printf( "This command works only for structrally hashed networks. Run \"st\".\n" ); + Abc_Print( -1, "This command works only for structrally hashed networks. Run \"st\".\n" ); return 0; } pNtkRes = Abc_NtkDarMatch( pNtk, NULL, nDist, fVerbose ); @@ -17201,13 +17026,13 @@ int Abc_CommandMatch( Abc_Frame_t * pAbc, int argc, char ** argv ) { pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; - if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) return 1; if ( Abc_NtkLatchNum(pNtk1) == 0 || Abc_NtkLatchNum(pNtk2) == 0 ) { if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); - printf( "The network has no latches. Used combinational command \"cec\".\n" ); + Abc_Print( -1, "The network has no latches. Used combinational command \"cec\".\n" ); return 0; } // perform verification @@ -17217,7 +17042,7 @@ int Abc_CommandMatch( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtkRes == NULL ) { - printf( "Matching has failed.\n" ); + Abc_Print( -1, "Matching has failed.\n" ); return 1; } // replace the current network @@ -17225,16 +17050,16 @@ int Abc_CommandMatch( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: match [-D num] [-mv] <file1> <file2>\n" ); - fprintf( pErr, "\t detects structural similarity using simulation\n" ); - fprintf( pErr, "\t replaces the current network by the miter of differences\n" ); - fprintf( pErr, "\t-D num : the distance for extending differences [default = %d]\n", nDist ); - fprintf( pErr, "\t-m : toggles miter vs. two networks [default = %s]\n", fMiter? "miter": "two networks" ); - fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\tfile1 : (optional) the file with the first network\n"); - fprintf( pErr, "\tfile2 : (optional) the file with the second network\n"); - fprintf( pErr, "\t if no files are given, uses the current network and its spec\n"); - fprintf( pErr, "\t if one file is given, uses the current network and the file\n"); + Abc_Print( -2, "usage: match [-D num] [-mv] <file1> <file2>\n" ); + Abc_Print( -2, "\t detects structural similarity using simulation\n" ); + Abc_Print( -2, "\t replaces the current network by the miter of differences\n" ); + Abc_Print( -2, "\t-D num : the distance for extending differences [default = %d]\n", nDist ); + Abc_Print( -2, "\t-m : toggles miter vs. two networks [default = %s]\n", fMiter? "miter": "two networks" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\tfile1 : (optional) the file with the first network\n"); + Abc_Print( -2, "\tfile2 : (optional) the file with the second network\n"); + Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); + Abc_Print( -2, "\t if one file is given, uses the current network and the file\n"); return 1; } @@ -17251,19 +17076,13 @@ usage: ***********************************************************************/ int Abc_CommandSat( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int RetValue; int fVerbose; int nConfLimit; int nInsLimit; int clk; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fVerbose = 0; nConfLimit = 100000; @@ -17276,7 +17095,7 @@ int Abc_CommandSat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); @@ -17287,7 +17106,7 @@ int Abc_CommandSat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nInsLimit = atoi(argv[globalUtilOptind]); @@ -17307,12 +17126,12 @@ int Abc_CommandSat( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) > 0 ) { - fprintf( stdout, "Currently can only solve the miter for combinational circuits.\n" ); + Abc_Print( -1, "Currently can only solve the miter for combinational circuits.\n" ); return 0; } @@ -17335,39 +17154,39 @@ int Abc_CommandSat( Abc_Frame_t * pAbc, int argc, char ** argv ) //Abc_Obj_t * pObj; int * pSimInfo = Abc_NtkVerifySimulatePattern( pNtk, pNtk->pModel ); if ( pSimInfo[0] != 1 ) - printf( "ERROR in Abc_NtkMiterSat(): Generated counter example is invalid.\n" ); + Abc_Print( 1, "ERROR in Abc_NtkMiterSat(): Generated counter example is invalid.\n" ); ABC_FREE( pSimInfo ); /* // print model Abc_NtkForEachPi( pNtk, pObj, i ) { - printf( "%d", (int)(pNtk->pModel[i] > 0) ); + Abc_Print( -1, "%d", (int)(pNtk->pModel[i] > 0) ); if ( i == 70 ) break; } - printf( "\n" ); + Abc_Print( -1, "\n" ); */ } - + pAbc->Status = RetValue; if ( RetValue == -1 ) - printf( "UNDECIDED " ); + Abc_Print( 1, "UNDECIDED " ); else if ( RetValue == 0 ) - printf( "SATISFIABLE " ); + Abc_Print( 1, "SATISFIABLE " ); else - printf( "UNSATISFIABLE " ); - //printf( "\n" ); - ABC_PRT( "Time", clock() - clk ); + Abc_Print( 1, "UNSATISFIABLE " ); + //Abc_Print( -1, "\n" ); + Abc_PrintTime( 1, "Time", clock() - clk ); return 0; usage: - fprintf( pErr, "usage: sat [-C num] [-I num] [-vh]\n" ); - fprintf( pErr, "\t solves the combinational miter using SAT solver MiniSat-1.14\n" ); - fprintf( pErr, "\t derives CNF from the current network and leave it unchanged\n" ); - fprintf( pErr, "\t (there is also a newer SAT solving command \"dsat\")\n" ); - fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - fprintf( pErr, "\t-I num : limit on the number of inspections [default = %d]\n", nInsLimit ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: sat [-C num] [-I num] [-vh]\n" ); + Abc_Print( -2, "\t solves the combinational miter using SAT solver MiniSat-1.14\n" ); + Abc_Print( -2, "\t derives CNF from the current network and leave it unchanged\n" ); + Abc_Print( -2, "\t (there is also a newer SAT solving command \"dsat\")\n" ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); + Abc_Print( -2, "\t-I num : limit on the number of inspections [default = %d]\n", nInsLimit ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -17384,8 +17203,7 @@ usage: ***********************************************************************/ int Abc_CommandDSat( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int RetValue; int fAlignPol; @@ -17396,12 +17214,6 @@ int Abc_CommandDSat( Abc_Frame_t * pAbc, int argc, char ** argv ) int clk; extern int Abc_NtkDSat( Abc_Ntk_t * pNtk, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int fAlignPol, int fAndOuts, int fVerbose ); - - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults fAlignPol = 0; fAndOuts = 0; @@ -17416,7 +17228,7 @@ int Abc_CommandDSat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); @@ -17427,7 +17239,7 @@ int Abc_CommandDSat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nInsLimit = atoi(argv[globalUtilOptind]); @@ -17453,24 +17265,24 @@ int Abc_CommandDSat( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) > 0 ) { - fprintf( stdout, "Currently can only solve the miter for combinational circuits.\n" ); + Abc_Print( -1, "Currently can only solve the miter for combinational circuits.\n" ); return 0; } /* if ( Abc_NtkPoNum(pNtk) != 1 ) { - fprintf( stdout, "Currently expects a single-output miter.\n" ); + Abc_Print( -1, "Currently expects a single-output miter.\n" ); return 0; } */ if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } @@ -17479,44 +17291,33 @@ int Abc_CommandDSat( Abc_Frame_t * pAbc, int argc, char ** argv ) // verify that the pattern is correct if ( RetValue == 0 && Abc_NtkPoNum(pNtk) == 1 ) { - //int i; - //Abc_Obj_t * pObj; int * pSimInfo = Abc_NtkVerifySimulatePattern( pNtk, pNtk->pModel ); if ( pSimInfo[0] != 1 ) - printf( "ERROR in Abc_NtkMiterSat(): Generated counter example is invalid.\n" ); + Abc_Print( 1, "ERROR in Abc_NtkMiterSat(): Generated counter example is invalid.\n" ); ABC_FREE( pSimInfo ); - /* - // print model - Abc_NtkForEachPi( pNtk, pObj, i ) - { - printf( "%d", (int)(pNtk->pModel[i] > 0) ); - if ( i == 70 ) - break; - } - printf( "\n" ); - */ + pAbc->pCex = Gia_ManCreateFromComb( 0, Abc_NtkPiNum(pNtk), 0, pNtk->pModel ); } - + pAbc->Status = RetValue; if ( RetValue == -1 ) - printf( "UNDECIDED " ); + Abc_Print( 1, "UNDECIDED " ); else if ( RetValue == 0 ) - printf( "SATISFIABLE " ); + Abc_Print( 1, "SATISFIABLE " ); else - printf( "UNSATISFIABLE " ); - //printf( "\n" ); - ABC_PRT( "Time", clock() - clk ); + Abc_Print( 1, "UNSATISFIABLE " ); + //Abc_Print( -1, "\n" ); + Abc_PrintTime( 1, "Time", clock() - clk ); return 0; usage: - fprintf( pErr, "usage: dsat [-C num] [-I num] [-pavh]\n" ); - fprintf( pErr, "\t solves the combinational miter using SAT solver MiniSat-1.14\n" ); - fprintf( pErr, "\t derives CNF from the current network and leave it unchanged\n" ); - fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - fprintf( pErr, "\t-I num : limit on the number of inspections [default = %d]\n", nInsLimit ); - fprintf( pErr, "\t-p : alighn polarity of SAT variables [default = %s]\n", fAlignPol? "yes": "no" ); - fprintf( pErr, "\t-a : toggle ANDing/ORing of miter outputs [default = %s]\n", fAndOuts? "ANDing": "ORing" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: dsat [-C num] [-I num] [-pavh]\n" ); + Abc_Print( -2, "\t solves the combinational miter using SAT solver MiniSat-1.14\n" ); + Abc_Print( -2, "\t derives CNF from the current network and leave it unchanged\n" ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); + Abc_Print( -2, "\t-I num : limit on the number of inspections [default = %d]\n", nInsLimit ); + Abc_Print( -2, "\t-p : alighn polarity of SAT variables [default = %s]\n", fAlignPol? "yes": "no" ); + Abc_Print( -2, "\t-a : toggle ANDing/ORing of miter outputs [default = %s]\n", fAndOuts? "ANDing": "ORing" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -17533,8 +17334,7 @@ usage: ***********************************************************************/ int Abc_CommandPSat( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int RetValue; int c, clk; int nAlgo; @@ -17546,11 +17346,6 @@ int Abc_CommandPSat( Abc_Frame_t * pAbc, int argc, char ** argv ) int fVerbose; extern int Abc_NtkPartitionedSat( Abc_Ntk_t * pNtk, int nAlgo, int nPartSize, int nConfPart, int nConfTotal, int fAlignPol, int fSynthesize, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nAlgo = 0; nPartSize = 10000; @@ -17567,7 +17362,7 @@ int Abc_CommandPSat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'A': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-A\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-A\" should be followed by an integer.\n" ); goto usage; } nAlgo = atoi(argv[globalUtilOptind]); @@ -17578,7 +17373,7 @@ int Abc_CommandPSat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPartSize = atoi(argv[globalUtilOptind]); @@ -17589,7 +17384,7 @@ int Abc_CommandPSat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfTotal = atoi(argv[globalUtilOptind]); @@ -17615,17 +17410,17 @@ int Abc_CommandPSat( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) > 0 ) { - fprintf( stdout, "Currently can only solve the miter for combinational circuits.\n" ); + Abc_Print( -1, "Currently can only solve the miter for combinational circuits.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } @@ -17638,49 +17433,49 @@ int Abc_CommandPSat( Abc_Frame_t * pAbc, int argc, char ** argv ) //Abc_Obj_t * pObj; int * pSimInfo = Abc_NtkVerifySimulatePattern( pNtk, pNtk->pModel ); if ( pSimInfo[0] != 1 ) - printf( "ERROR in Abc_NtkMiterSat(): Generated counter example is invalid.\n" ); + Abc_Print( 1, "ERROR in Abc_NtkMiterSat(): Generated counter example is invalid.\n" ); ABC_FREE( pSimInfo ); /* // print model Abc_NtkForEachPi( pNtk, pObj, i ) { - printf( "%d", (int)(pNtk->pModel[i] > 0) ); + Abc_Print( -1, "%d", (int)(pNtk->pModel[i] > 0) ); if ( i == 70 ) break; } - printf( "\n" ); + Abc_Print( -1, "\n" ); */ } if ( RetValue == -1 ) - printf( "UNDECIDED " ); + Abc_Print( 1, "UNDECIDED " ); else if ( RetValue == 0 ) - printf( "SATISFIABLE " ); + Abc_Print( 1, "SATISFIABLE " ); else - printf( "UNSATISFIABLE " ); - //printf( "\n" ); - ABC_PRT( "Time", clock() - clk ); + Abc_Print( 1, "UNSATISFIABLE " ); + //Abc_Print( -1, "\n" ); + Abc_PrintTime( 1, "Time", clock() - clk ); return 0; usage: - fprintf( pErr, "usage: psat [-APC num] [-psvh]\n" ); - fprintf( pErr, "\t solves the combinational miter using partitioning\n" ); - fprintf( pErr, "\t (derives CNF from the current network and leave it unchanged)\n" ); - fprintf( pErr, "\t for multi-output miters, tries to prove that the AND of POs is always 0\n" ); - fprintf( pErr, "\t (if POs should be ORed instead of ANDed, use command \"orpos\")\n" ); - fprintf( pErr, "\t-A num : partitioning algorithm [default = %d]\n", nAlgo ); - fprintf( pErr, "\t 0 : no partitioning\n" ); - fprintf( pErr, "\t 1 : partitioning by level\n" ); - fprintf( pErr, "\t 2 : DFS post-order\n" ); - fprintf( pErr, "\t 3 : DFS pre-order\n" ); - fprintf( pErr, "\t 4 : bit-slicing\n" ); - fprintf( pErr, "\t partitions are ordered by level (high level first)\n" ); - fprintf( pErr, "\t-P num : limit on the partition size [default = %d]\n", nPartSize ); - fprintf( pErr, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfTotal ); - fprintf( pErr, "\t-p : align polarity of SAT variables [default = %s]\n", fAlignPol? "yes": "no" ); - fprintf( pErr, "\t-s : apply logic synthesis to each partition [default = %s]\n", fSynthesize? "yes": "no" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: psat [-APC num] [-psvh]\n" ); + Abc_Print( -2, "\t solves the combinational miter using partitioning\n" ); + Abc_Print( -2, "\t (derives CNF from the current network and leave it unchanged)\n" ); + Abc_Print( -2, "\t for multi-output miters, tries to prove that the AND of POs is always 0\n" ); + Abc_Print( -2, "\t (if POs should be ORed instead of ANDed, use command \"orpos\")\n" ); + Abc_Print( -2, "\t-A num : partitioning algorithm [default = %d]\n", nAlgo ); + Abc_Print( -2, "\t 0 : no partitioning\n" ); + Abc_Print( -2, "\t 1 : partitioning by level\n" ); + Abc_Print( -2, "\t 2 : DFS post-order\n" ); + Abc_Print( -2, "\t 3 : DFS pre-order\n" ); + Abc_Print( -2, "\t 4 : bit-slicing\n" ); + Abc_Print( -2, "\t partitions are ordered by level (high level first)\n" ); + Abc_Print( -2, "\t-P num : limit on the partition size [default = %d]\n", nPartSize ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfTotal ); + Abc_Print( -2, "\t-p : align polarity of SAT variables [default = %s]\n", fAlignPol? "yes": "no" ); + Abc_Print( -2, "\t-s : apply logic synthesis to each partition [default = %s]\n", fSynthesize? "yes": "no" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -17697,15 +17492,11 @@ usage: ***********************************************************************/ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkTemp; Prove_Params_t Params, * pParams = &Params; int c, clk, RetValue; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Prove_ParamsSetDefault( pParams ); Extra_UtilGetoptReset(); @@ -17716,7 +17507,7 @@ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pParams->nItersMax = atoi(argv[globalUtilOptind]); @@ -17727,7 +17518,7 @@ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pParams->nMiteringLimitStart = atoi(argv[globalUtilOptind]); @@ -17738,7 +17529,7 @@ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pParams->nFraigingLimitStart = atoi(argv[globalUtilOptind]); @@ -17749,7 +17540,7 @@ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pParams->nMiteringLimitLast = atoi(argv[globalUtilOptind]); @@ -17760,7 +17551,7 @@ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pParams->nTotalInspectLimit = atoi(argv[globalUtilOptind]); @@ -17789,17 +17580,17 @@ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) > 0 ) { - fprintf( stdout, "Currently can only solve the miter for combinational circuits.\n" ); + Abc_Print( -1, "Currently can only solve the miter for combinational circuits.\n" ); return 0; } if ( Abc_NtkCoNum(pNtk) != 1 ) { - fprintf( stdout, "Currently can only solve the miter with one output.\n" ); + Abc_Print( -1, "Currently can only solve the miter with one output.\n" ); return 0; } clk = clock(); @@ -17816,38 +17607,38 @@ int Abc_CommandProve( Abc_Frame_t * pAbc, int argc, char ** argv ) { int * pSimInfo = Abc_NtkVerifySimulatePattern( pNtk, pNtkTemp->pModel ); if ( pSimInfo[0] != 1 ) - printf( "ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" ); + Abc_Print( 1, "ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" ); ABC_FREE( pSimInfo ); } - + pAbc->Status = RetValue; if ( RetValue == -1 ) - printf( "UNDECIDED " ); + Abc_Print( 1, "UNDECIDED " ); else if ( RetValue == 0 ) - printf( "SATISFIABLE " ); + Abc_Print( 1, "SATISFIABLE " ); else - printf( "UNSATISFIABLE " ); - //printf( "\n" ); + Abc_Print( 1, "UNSATISFIABLE " ); + //Abc_Print( -1, "\n" ); - ABC_PRT( "Time", clock() - clk ); + Abc_PrintTime( 1, "Time", clock() - clk ); // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkTemp ); return 0; usage: - fprintf( pErr, "usage: prove [-N num] [-C num] [-F num] [-L num] [-I num] [-rfbvh]\n" ); - fprintf( pErr, "\t solves combinational miter by rewriting, FRAIGing, and SAT\n" ); - fprintf( pErr, "\t replaces the current network by the cone modified by rewriting\n" ); - fprintf( pErr, "\t (there are also newer CEC commands, \"iprove\" and \"dprove\")\n" ); - fprintf( pErr, "\t-N num : max number of iterations [default = %d]\n", pParams->nItersMax ); - fprintf( pErr, "\t-C num : max starting number of conflicts in mitering [default = %d]\n", pParams->nMiteringLimitStart ); - fprintf( pErr, "\t-F num : max starting number of conflicts in fraiging [default = %d]\n", pParams->nFraigingLimitStart ); - fprintf( pErr, "\t-L num : max last-gasp number of conflicts in mitering [default = %d]\n", pParams->nMiteringLimitLast ); - fprintf( pErr, "\t-I num : max number of clause inspections in all SAT calls [default = %d]\n", (int)pParams->nTotalInspectLimit ); - fprintf( pErr, "\t-r : toggle the use of rewriting [default = %s]\n", pParams->fUseRewriting? "yes": "no" ); - fprintf( pErr, "\t-f : toggle the use of FRAIGing [default = %s]\n", pParams->fUseFraiging? "yes": "no" ); - fprintf( pErr, "\t-b : toggle the use of BDDs [default = %s]\n", pParams->fUseBdds? "yes": "no" ); - fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", pParams->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: prove [-N num] [-C num] [-F num] [-L num] [-I num] [-rfbvh]\n" ); + Abc_Print( -2, "\t solves combinational miter by rewriting, FRAIGing, and SAT\n" ); + Abc_Print( -2, "\t replaces the current network by the cone modified by rewriting\n" ); + Abc_Print( -2, "\t (there are also newer CEC commands, \"iprove\" and \"dprove\")\n" ); + Abc_Print( -2, "\t-N num : max number of iterations [default = %d]\n", pParams->nItersMax ); + Abc_Print( -2, "\t-C num : max starting number of conflicts in mitering [default = %d]\n", pParams->nMiteringLimitStart ); + Abc_Print( -2, "\t-F num : max starting number of conflicts in fraiging [default = %d]\n", pParams->nFraigingLimitStart ); + Abc_Print( -2, "\t-L num : max last-gasp number of conflicts in mitering [default = %d]\n", pParams->nMiteringLimitLast ); + Abc_Print( -2, "\t-I num : max number of clause inspections in all SAT calls [default = %d]\n", (int)pParams->nTotalInspectLimit ); + Abc_Print( -2, "\t-r : toggle the use of rewriting [default = %s]\n", pParams->fUseRewriting? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle the use of FRAIGing [default = %s]\n", pParams->fUseFraiging? "yes": "no" ); + Abc_Print( -2, "\t-b : toggle the use of BDDs [default = %s]\n", pParams->fUseBdds? "yes": "no" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", pParams->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -17864,16 +17655,10 @@ usage: ***********************************************************************/ int Abc_CommandDebug( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; extern void Abc_NtkAutoDebug( Abc_Ntk_t * pNtk, int (*pFuncError) (Abc_Ntk_t *) ); extern int Abc_NtkRetimeDebug( Abc_Ntk_t * pNtk ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -17889,12 +17674,12 @@ int Abc_CommandDebug( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { - fprintf( pErr, "This command is applicable to logic networks.\n" ); + Abc_Print( -1, "This command is applicable to logic networks.\n" ); return 1; } @@ -17902,9 +17687,9 @@ int Abc_CommandDebug( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( pErr, "usage: debug [-h]\n" ); - fprintf( pErr, "\t performs automated debugging of the given procedure\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: debug [-h]\n" ); + Abc_Print( -2, "\t performs automated debugging of the given procedure\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -17921,8 +17706,7 @@ usage: ***********************************************************************/ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nFrames; int nSizeMax; @@ -17933,13 +17717,10 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) int fNewAlgo; int nCofFanLit; int fVerbose; + int iFrames; + char * pLogFileName = NULL; - extern int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nStart, int nFrames, int nSizeMax, int nNodeDelta, int nTimeOut, int nBTLimit, int nBTLimitAll, int fRewrite, int fNewAlgo, int nCofFanLit, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - + extern int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nStart, int nFrames, int nSizeMax, int nNodeDelta, int nTimeOut, int nBTLimit, int nBTLimitAll, int fRewrite, int fNewAlgo, int nCofFanLit, int fVerbose, int * piFrames ); // set defaults nFrames = 20; nSizeMax = 100000; @@ -17958,7 +17739,7 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -17969,7 +17750,7 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nSizeMax = atoi(argv[globalUtilOptind]); @@ -17980,7 +17761,7 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nBTLimit = atoi(argv[globalUtilOptind]); @@ -17991,7 +17772,7 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'G': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-G\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-G\" should be followed by an integer.\n" ); goto usage; } nBTLimitAll = atoi(argv[globalUtilOptind]); @@ -18002,7 +17783,7 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } nNodeDelta = atoi(argv[globalUtilOptind]); @@ -18010,10 +17791,11 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( nNodeDelta < 0 ) goto usage; break; +/* case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nCofFanLit = atoi(argv[globalUtilOptind]); @@ -18021,6 +17803,16 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( nCofFanLit < 0 ) goto usage; break; +*/ + case 'L': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-L\" should be followed by a file name.\n" ); + goto usage; + } + pLogFileName = argv[globalUtilOptind]; + globalUtilOptind++; + break; case 'r': fRewrite ^= 1; break; @@ -18038,37 +17830,38 @@ int Abc_CommandBmc( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } if ( Abc_NtkLatchNum(pNtk) == 0 ) { - fprintf( stdout, "Does not work for combinational networks.\n" ); + Abc_Print( -1, "Does not work for combinational networks.\n" ); return 0; } - Abc_NtkDarBmc( pNtk, 0, nFrames, nSizeMax, nNodeDelta, 0, nBTLimit, nBTLimitAll, fRewrite, fNewAlgo, nCofFanLit, fVerbose ); - pAbc->pCex = pNtk->pSeqModel; // temporary ??? + pAbc->Status = Abc_NtkDarBmc( pNtk, 0, nFrames, nSizeMax, nNodeDelta, 0, nBTLimit, nBTLimitAll, fRewrite, fNewAlgo, nCofFanLit, fVerbose, &iFrames ); + pAbc->nFrames = iFrames; + Abc_FrameReplaceCex( pAbc, &pNtk->pSeqModel ); + if ( pLogFileName ) + Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, "bmc" ); return 0; usage: -// fprintf( pErr, "usage: bmc [-FNCGD num] [-ravh]\n" ); - fprintf( pErr, "usage: bmc [-FNCL num] [-rcvh]\n" ); - fprintf( pErr, "\t performs bounded model checking with static unrolling\n" ); - fprintf( pErr, "\t-F num : the number of time frames [default = %d]\n", nFrames ); - fprintf( pErr, "\t-N num : the max number of nodes in the frames [default = %d]\n", nSizeMax ); - fprintf( pErr, "\t-C num : the max number of conflicts at a node [default = %d]\n", nBTLimit ); -// fprintf( pErr, "\t-G num : the max number of conflicts globally [default = %d]\n", nBTLimitAll ); -// fprintf( pErr, "\t-D num : the delta in the number of nodes [default = %d]\n", nNodeDelta ); - fprintf( pErr, "\t-L num : the limit on fanout count of resets/enables to cofactor [default = %d]\n", nCofFanLit ); - fprintf( pErr, "\t-r : toggle the use of rewriting [default = %s]\n", fRewrite? "yes": "no" ); -// fprintf( pErr, "\t-a : toggle SAT sweeping and SAT solving [default = %s]\n", fNewAlgo? "SAT solving": "SAT sweeping" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: bmc [-FNC num] [-L file] [-rcvh]\n" ); + Abc_Print( -2, "\t performs bounded model checking with static unrolling\n" ); + Abc_Print( -2, "\t-F num : the number of time frames [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-N num : the max number of nodes in the frames [default = %d]\n", nSizeMax ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", nBTLimit ); +// Abc_Print( -2, "\t-L num : the limit on fanout count of resets/enables to cofactor [default = %d]\n", nCofFanLit ); + Abc_Print( -2, "\t-L file: the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" ); + Abc_Print( -2, "\t-r : toggle the use of rewriting [default = %s]\n", fRewrite? "yes": "no" ); +// Abc_Print( -2, "\t-a : toggle SAT sweeping and SAT solving [default = %s]\n", fNewAlgo? "SAT solving": "SAT sweeping" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -18085,8 +17878,7 @@ usage: ***********************************************************************/ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nStart; int nFrames; @@ -18098,12 +17890,10 @@ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) int fRewrite; int fNewAlgo; int fVerbose; + int iFrames; + char * pLogFileName = NULL; - extern int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nStart, int nFrames, int nSizeMax, int nNodeDelta, int nTimeOut, int nBTLimit, int nBTLimitAll, int fRewrite, int fNewAlgo, int nCofFanLit, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); + extern int Abc_NtkDarBmc( Abc_Ntk_t * pNtk, int nStart, int nFrames, int nSizeMax, int nNodeDelta, int nTimeOut, int nBTLimit, int nBTLimitAll, int fRewrite, int fNewAlgo, int nCofFanLit, int fVerbose, int * piFrames ); // set defaults nStart = 0; @@ -18117,14 +17907,14 @@ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) fNewAlgo = 0; fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "SFNTCGDrvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "SFNTCGDLrvh" ) ) != EOF ) { switch ( c ) { case 'S': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } nStart = atoi(argv[globalUtilOptind]); @@ -18135,7 +17925,7 @@ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -18146,7 +17936,7 @@ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nSizeMax = atoi(argv[globalUtilOptind]); @@ -18157,7 +17947,7 @@ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } nTimeOut = atoi(argv[globalUtilOptind]); @@ -18168,7 +17958,7 @@ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nBTLimit = atoi(argv[globalUtilOptind]); @@ -18179,7 +17969,7 @@ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'G': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-G\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-G\" should be followed by an integer.\n" ); goto usage; } nBTLimitAll = atoi(argv[globalUtilOptind]); @@ -18190,7 +17980,7 @@ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } nNodeDelta = atoi(argv[globalUtilOptind]); @@ -18198,6 +17988,15 @@ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( nNodeDelta < 0 ) goto usage; break; + case 'L': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-L\" should be followed by a file name.\n" ); + goto usage; + } + pLogFileName = argv[globalUtilOptind]; + globalUtilOptind++; + break; case 'r': fRewrite ^= 1; break; @@ -18215,41 +18014,193 @@ int Abc_CommandBmc2( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } if ( Abc_NtkLatchNum(pNtk) == 0 ) { - fprintf( stdout, "Does not work for combinational networks.\n" ); + Abc_Print( -1, "Does not work for combinational networks.\n" ); return 0; } - Abc_NtkDarBmc( pNtk, nStart, nFrames, nSizeMax, nNodeDelta, nTimeOut, nBTLimit, nBTLimitAll, fRewrite, fNewAlgo, 0, fVerbose ); - pAbc->pCex = pNtk->pSeqModel; // temporary ??? + pAbc->Status = Abc_NtkDarBmc( pNtk, nStart, nFrames, nSizeMax, nNodeDelta, nTimeOut, nBTLimit, nBTLimitAll, fRewrite, fNewAlgo, 0, fVerbose, &iFrames ); + pAbc->nFrames = iFrames; + Abc_FrameReplaceCex( pAbc, &pNtk->pSeqModel ); + if ( pLogFileName ) + Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, "bmc2" ); return 0; usage: -// fprintf( pErr, "usage: bmc2 [-FNCGD num] [-ravh]\n" ); - fprintf( pErr, "usage: bmc2 [-SFTCGD num] [-vh]\n" ); - fprintf( pErr, "\t performs bounded model checking with dynamic unrolling\n" ); - fprintf( pErr, "\t-S num : the starting time frame [default = %d]\n", nStart ); - fprintf( pErr, "\t-F num : the max number of time frames [default = %d]\n", nFrames ); -// fprintf( pErr, "\t-N num : the max number of nodes in the frames [default = %d]\n", nSizeMax ); - fprintf( pErr, "\t-T num : approximate runtime limit in seconds [default = %d]\n", nTimeOut ); - fprintf( pErr, "\t-C num : the max number of conflicts at a node [default = %d]\n", nBTLimit ); - fprintf( pErr, "\t-G num : the max number of conflicts globally [default = %d]\n", nBTLimitAll ); - fprintf( pErr, "\t-D num : the delta in the number of nodes [default = %d]\n", nNodeDelta ); -// fprintf( pErr, "\t-r : toggle the use of rewriting [default = %s]\n", fRewrite? "yes": "no" ); -// fprintf( pErr, "\t-a : toggle SAT sweeping and SAT solving [default = %s]\n", fNewAlgo? "SAT solving": "SAT sweeping" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); +// Abc_Print( -2, "usage: bmc2 [-FNCGD num] [-ravh]\n" ); + Abc_Print( -2, "usage: bmc2 [-SFTCGD num] [-L file] [-vh]\n" ); + Abc_Print( -2, "\t performs bounded model checking with dynamic unrolling\n" ); + Abc_Print( -2, "\t-S num : the starting time frame [default = %d]\n", nStart ); + Abc_Print( -2, "\t-F num : the max number of time frames [default = %d]\n", nFrames ); +// Abc_Print( -2, "\t-N num : the max number of nodes in the frames [default = %d]\n", nSizeMax ); + Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", nTimeOut ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", nBTLimit ); + Abc_Print( -2, "\t-G num : the max number of conflicts globally [default = %d]\n", nBTLimitAll ); + Abc_Print( -2, "\t-D num : the delta in the number of nodes [default = %d]\n", nNodeDelta ); + Abc_Print( -2, "\t-L file: the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" ); +// Abc_Print( -2, "\t-r : toggle the use of rewriting [default = %s]\n", fRewrite? "yes": "no" ); +// Abc_Print( -2, "\t-a : toggle SAT sweeping and SAT solving [default = %s]\n", fNewAlgo? "SAT solving": "SAT sweeping" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandBmc3( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern Abc_Ntk_t * Abc_NtkDarLatchSweep( Abc_Ntk_t * pNtk, int fLatchConst, int fLatchEqual, int fSaveNames, int fVerbose ); + extern int Abc_NtkDarBmc3( Abc_Ntk_t * pNtk, Saig_ParBmc_t * pPars ); + Saig_ParBmc_t Pars, * pPars = &Pars; + Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc); + char * pLogFileName = NULL; + int c; + Saig_ParBmcSetDefaultParams( pPars ); + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "SFTCLsdrvh" ) ) != EOF ) + { + switch ( c ) + { + case 'S': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nStart = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nStart < 0 ) + goto usage; + break; + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nFramesMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nFramesMax < 0 ) + goto usage; + break; + case 'T': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nTimeOut = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nTimeOut < 0 ) + goto usage; + break; + case 'C': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nConfLimit = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nConfLimit < 0 ) + goto usage; + break; + case 'L': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-L\" should be followed by a file name.\n" ); + goto usage; + } + pLogFileName = argv[globalUtilOptind]; + globalUtilOptind++; + break; + case 's': + pPars->fSolveAll ^= 1; + break; + case 'd': + pPars->fDropSatOuts ^= 1; + break; + case 'v': + pPars->fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pNtk == NULL ) + { + Abc_Print( -1, "Empty network.\n" ); + return 1; + } + if ( !Abc_NtkIsStrash(pNtk) ) + { + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); + return 0; + } + if ( Abc_NtkLatchNum(pNtk) == 0 ) + { + Abc_Print( -1, "Does not work for combinational networks.\n" ); + return 0; + } + pAbc->Status = Abc_NtkDarBmc3( pNtk, pPars ); + pAbc->nFrames = pPars->iFrame; + Abc_FrameReplaceCex( pAbc, &pNtk->pSeqModel ); + if ( pLogFileName ) + Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, "bmc3" ); + if ( pPars->fSolveAll && pPars->fDropSatOuts ) + { + if ( pNtk->pSeqModelVec == NULL ) + printf( "The array of counter-examples is not available.\n" ); + else if ( Vec_PtrSize(pNtk->pSeqModelVec) != Abc_NtkPoNum(pNtk) ) + printf( "The array size does not match the number of outputs.\n" ); + else + { + extern void Abc_NtkDropSatOutputs( Abc_Ntk_t * pNtk, Vec_Ptr_t * vCexes, int fVerbose ); + Abc_NtkDropSatOutputs( pNtk, pNtk->pSeqModelVec, pPars->fVerbose ); + pNtkRes = Abc_NtkDarLatchSweep( pNtk, 1, 1, 1, 0 ); + if ( pNtkRes == NULL ) + { + Abc_Print( -1, "Removing SAT outputs has failed.\n" ); + return 1; + } + Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); + } + } + return 0; + +usage: + Abc_Print( -2, "usage: bmc3 [-SFTC num] [-L file] [-sdvh]\n" ); + Abc_Print( -2, "\t performs bounded model checking with dynamic unrolling\n" ); + Abc_Print( -2, "\t-S num : the starting time frame [default = %d]\n", pPars->nStart ); + Abc_Print( -2, "\t-F num : the max number of time frames [default = %d]\n", pPars->nFramesMax ); + Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->nTimeOut ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nConfLimit ); + Abc_Print( -2, "\t-L file: the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" ); + Abc_Print( -2, "\t-s : solve all outputs (do not stop when one is SAT) [default = %s]\n", pPars->fSolveAll? "yes": "no" ); + Abc_Print( -2, "\t-d : drops (replaces by 0) satisfiable outputs [default = %s]\n", pPars->fDropSatOuts? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } - /**Function************************************************************* @@ -18265,27 +18216,22 @@ usage: int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv ) { Inter_ManParams_t Pars, * pPars = &Pars; - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtkRes, * pNtk = Abc_FrameReadNtk(pAbc); int c; + char * pLogFileName = NULL; - extern int Abc_NtkDarBmcInter( Abc_Ntk_t * pNtk, Inter_ManParams_t * pPars ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - + extern int Abc_NtkDarBmcInter( Abc_Ntk_t * pNtk, Inter_ManParams_t * pPars, Abc_Ntk_t ** ppNtkRes ); // set defaults Inter_ManSetDefaultParams( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "CNFrtpomcgbkvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "CFTNLrtpomcgbkdvh" ) ) != EOF ) { switch ( c ) { case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -18293,10 +18239,10 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->nBTLimit < 0 ) goto usage; break; - case 'N': + case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesMax = atoi(argv[globalUtilOptind]); @@ -18304,10 +18250,21 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->nFramesMax < 0 ) goto usage; break; - case 'F': + case 'T': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nSecLimit = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nSecLimit < 0 ) + goto usage; + break; + case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesK = atoi(argv[globalUtilOptind]); @@ -18315,6 +18272,15 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->nFramesK < 0 ) goto usage; break; + case 'L': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-L\" should be followed by a file name.\n" ); + goto usage; + } + pLogFileName = argv[globalUtilOptind]; + globalUtilOptind++; + break; case 'r': pPars->fRewrite ^= 1; break; @@ -18342,6 +18308,9 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'k': pPars->fUseSeparate ^= 1; break; + case 'd': + pPars->fDropSatOuts ^= 1; + break; case 'v': pPars->fVerbose ^= 1; break; @@ -18353,64 +18322,84 @@ int Abc_CommandBmcInter( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; - } + } if ( Abc_NtkLatchNum(pNtk) == 0 ) { - fprintf( stdout, "Does not work for combinational networks.\n" ); + Abc_Print( -1, "Does not work for combinational networks.\n" ); return 0; } - if ( Abc_NtkPoNum(pNtk) != 1 ) + if ( Abc_NtkPoNum(pNtk)-Abc_NtkConstrNum(pNtk) != 1 ) { + if ( Abc_NtkConstrNum(pNtk) > 0 ) + { + printf( "Cannot solve multiple-output miter with constraints.\n" ); + return 0; + } if ( pPars->fUseSeparate ) { - printf( "Each of %d outputs will be solved separately.\n", Abc_NtkPoNum(pNtk) ); - Abc_NtkDarBmcInter( pNtk, pPars ); + Abc_Print( 0, "Each of %d outputs will be solved separately.\n", Abc_NtkPoNum(pNtk) ); + pAbc->Status = Abc_NtkDarBmcInter( pNtk, pPars, &pNtkRes ); + Abc_FrameReplaceCex( pAbc, &pNtk->pSeqModel ); + if ( pNtkRes == NULL ) + { + Abc_Print( -1, "Generating resulting network has failed.\n" ); + return 0; + } + Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } else { Abc_Ntk_t * pNtkNew = Abc_NtkDup( pNtk ); - printf( "All %d outputs will be ORed together.\n", Abc_NtkPoNum(pNtk) ); + Abc_Print( 0, "All %d outputs will be ORed together.\n", Abc_NtkPoNum(pNtk) ); if ( !Abc_NtkCombinePos( pNtkNew, 0 ) ) { Abc_NtkDelete( pNtkNew ); - printf( "ORing outputs has failed.\n" ); + Abc_Print( -1, "ORing outputs has failed.\n" ); return 0; } - Abc_NtkDarBmcInter( pNtkNew, pPars ); + pAbc->Status = Abc_NtkDarBmcInter( pNtkNew, pPars, NULL ); + Abc_FrameReplaceCex( pAbc, &pNtkNew->pSeqModel ); Abc_NtkDelete( pNtkNew ); } + pAbc->nFrames = -1; } else { - Abc_NtkDarBmcInter( pNtk, pPars ); + pAbc->Status = Abc_NtkDarBmcInter( pNtk, pPars, NULL ); + pAbc->nFrames = pPars->iFrameMax; + Abc_FrameReplaceCex( pAbc, &pNtk->pSeqModel ); } - pAbc->pCex = pNtk->pSeqModel; // temporary ??? + if ( pLogFileName ) + Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, "int" ); return 0; usage: - fprintf( pErr, "usage: int [-CNF num] [-rtpomcgbvh]\n" ); - fprintf( pErr, "\t uses interpolation to prove the property\n" ); - fprintf( pErr, "\t-C num : the limit on conflicts for one SAT run [default = %d]\n", pPars->nBTLimit ); - fprintf( pErr, "\t-N num : the limit on number of frames to unroll [default = %d]\n", pPars->nFramesMax ); - fprintf( pErr, "\t-F num : the number of steps in inductive checking [default = %d]\n", pPars->nFramesK ); - fprintf( pErr, "\t-r : toggle rewriting of the unrolled timeframes [default = %s]\n", pPars->fRewrite? "yes": "no" ); - fprintf( pErr, "\t-t : toggle adding transition into the initial state [default = %s]\n", pPars->fTransLoop? "yes": "no" ); - fprintf( pErr, "\t-p : toggle using original Pudlak's interpolation procedure [default = %s]\n", pPars->fUsePudlak? "yes": "no" ); - fprintf( pErr, "\t-o : toggle using optimized Pudlak's interpolation procedure [default = %s]\n", pPars->fUseOther? "yes": "no" ); - fprintf( pErr, "\t-m : toggle using MiniSat-1.14p (now, Windows-only) [default = %s]\n", pPars->fUseMiniSat? "yes": "no" ); - fprintf( pErr, "\t-c : toggle using inductive containment check [default = %s]\n", pPars->fCheckKstep? "yes": "no" ); - fprintf( pErr, "\t-g : toggle using bias for global variables using SAT [default = %s]\n", pPars->fUseBias? "yes": "no" ); - fprintf( pErr, "\t-b : toggle using backward interpolation [default = %s]\n", pPars->fUseBackward? "yes": "no" ); - fprintf( pErr, "\t-k : toggle solving each output separately [default = %s]\n", pPars->fUseSeparate? "yes": "no" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: int [-CFTN num] [-L file] [-rtpomcgbkdvh]\n" ); + Abc_Print( -2, "\t uses interpolation to prove the property\n" ); + Abc_Print( -2, "\t-C num : the limit on conflicts for one SAT run [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-F num : the limit on number of frames to unroll [default = %d]\n", pPars->nFramesMax ); + Abc_Print( -2, "\t-T num : the limit on runtime per output in seconds [default = %d]\n", pPars->nSecLimit ); + Abc_Print( -2, "\t-N num : the number of steps in inductive checking [default = %d]\n", pPars->nFramesK ); + Abc_Print( -2, "\t-L file: the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" ); + Abc_Print( -2, "\t-r : toggle rewriting of the unrolled timeframes [default = %s]\n", pPars->fRewrite? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle adding transition into the initial state [default = %s]\n", pPars->fTransLoop? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle using original Pudlak's interpolation procedure [default = %s]\n", pPars->fUsePudlak? "yes": "no" ); + Abc_Print( -2, "\t-o : toggle using optimized Pudlak's interpolation procedure [default = %s]\n", pPars->fUseOther? "yes": "no" ); + Abc_Print( -2, "\t-m : toggle using MiniSat-1.14p (now, Windows-only) [default = %s]\n", pPars->fUseMiniSat? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle using inductive containment check [default = %s]\n", pPars->fCheckKstep? "yes": "no" ); + Abc_Print( -2, "\t-g : toggle using bias for global variables using SAT [default = %s]\n", pPars->fUseBias? "yes": "no" ); + Abc_Print( -2, "\t-b : toggle using backward interpolation [default = %s]\n", pPars->fUseBackward? "yes": "no" ); + Abc_Print( -2, "\t-k : toggle solving each output separately [default = %s]\n", pPars->fUseSeparate? "yes": "no" ); + Abc_Print( -2, "\t-d : drops (replaces by 0) sat outputs (with -k is used) [default = %s]\n", pPars->fDropSatOuts? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -18427,8 +18416,7 @@ usage: ***********************************************************************/ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int nFrames; int nPref; int nClauses; @@ -18444,11 +18432,6 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) int fVeryVerbose; int c; extern int Abc_NtkDarClau( Abc_Ntk_t * pNtk, int nFrames, int nPref, int nClauses, int nLutSize, int nLevels, int nCutsMax, int nBatches, int fStepUp, int fBmc, int fRegs, int fTarget, int fVerbose, int fVeryVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nFrames = 1; nPref = 0; @@ -18471,7 +18454,7 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -18482,7 +18465,7 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPref = atoi(argv[globalUtilOptind]); @@ -18493,7 +18476,7 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nClauses = atoi(argv[globalUtilOptind]); @@ -18504,7 +18487,7 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'M': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-K\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); @@ -18515,7 +18498,7 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLevels = atoi(argv[globalUtilOptind]); @@ -18526,7 +18509,7 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nCutsMax = atoi(argv[globalUtilOptind]); @@ -18537,7 +18520,7 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'B': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-B\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" ); goto usage; } nBatches = atoi(argv[globalUtilOptind]); @@ -18571,43 +18554,43 @@ int Abc_CommandIndcut( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } if ( nLutSize > 12 ) { - fprintf( stdout, "The cut size should be not exceed 12.\n" ); + Abc_Print( -1, "The cut size should be not exceed 12.\n" ); return 0; } Abc_NtkDarClau( pNtk, nFrames, nPref, nClauses, nLutSize, nLevels, nCutsMax, nBatches, fStepUp, fBmc, fRegs, fTarget, fVerbose, fVeryVerbose ); return 0; usage: - fprintf( pErr, "usage: indcut [-FPCMLNB num] [-sbrtvh]\n" ); - fprintf( pErr, "\t K-step induction strengthened with cut properties\n" ); - fprintf( pErr, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", nFrames ); - fprintf( pErr, "\t-P num : number of time frames in the prefix (0=no prefix) [default = %d]\n", nPref ); - fprintf( pErr, "\t-C num : the max number of clauses to use for strengthening [default = %d]\n", nClauses ); - fprintf( pErr, "\t-M num : the cut size (2 <= M <= 12) [default = %d]\n", nLutSize ); - fprintf( pErr, "\t-L num : the max number of levels for cut computation [default = %d]\n", nLevels ); - fprintf( pErr, "\t-N num : the max number of cuts to compute at a node [default = %d]\n", nCutsMax ); - fprintf( pErr, "\t-B num : the max number of invariant batches to try [default = %d]\n", nBatches ); - fprintf( pErr, "\t-s : toggle increment cut size in each batch [default = %s]\n", fStepUp? "yes": "no" ); - fprintf( pErr, "\t-b : toggle enabling BMC check [default = %s]\n", fBmc? "yes": "no" ); - fprintf( pErr, "\t-r : toggle enabling register clauses [default = %s]\n", fRegs? "yes": "no" ); - fprintf( pErr, "\t-t : toggle proving target / computing don't-cares [default = %s]\n", fTarget? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); -// fprintf( pErr, "\t-w : toggle printing very verbose information [default = %s]\n", fVeryVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: indcut [-FPCMLNB num] [-sbrtvh]\n" ); + Abc_Print( -2, "\t K-step induction strengthened with cut properties\n" ); + Abc_Print( -2, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-P num : number of time frames in the prefix (0=no prefix) [default = %d]\n", nPref ); + Abc_Print( -2, "\t-C num : the max number of clauses to use for strengthening [default = %d]\n", nClauses ); + Abc_Print( -2, "\t-M num : the cut size (2 <= M <= 12) [default = %d]\n", nLutSize ); + Abc_Print( -2, "\t-L num : the max number of levels for cut computation [default = %d]\n", nLevels ); + Abc_Print( -2, "\t-N num : the max number of cuts to compute at a node [default = %d]\n", nCutsMax ); + Abc_Print( -2, "\t-B num : the max number of invariant batches to try [default = %d]\n", nBatches ); + Abc_Print( -2, "\t-s : toggle increment cut size in each batch [default = %s]\n", fStepUp? "yes": "no" ); + Abc_Print( -2, "\t-b : toggle enabling BMC check [default = %s]\n", fBmc? "yes": "no" ); + Abc_Print( -2, "\t-r : toggle enabling register clauses [default = %s]\n", fRegs? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle proving target / computing don't-cares [default = %s]\n", fTarget? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); +// Abc_Print( -2, "\t-w : toggle printing very verbose information [default = %s]\n", fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -18624,7 +18607,6 @@ usage: ***********************************************************************/ int Abc_CommandEnlarge( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int nFrames; int fVerbose; @@ -18632,9 +18614,6 @@ int Abc_CommandEnlarge( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkDarEnlarge( Abc_Ntk_t * pNtk, int nFrames, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults nFrames = 5; fVerbose = 0; @@ -18646,7 +18625,7 @@ int Abc_CommandEnlarge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -18665,17 +18644,17 @@ int Abc_CommandEnlarge( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } @@ -18683,18 +18662,18 @@ int Abc_CommandEnlarge( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkRes = Abc_NtkDarEnlarge( pNtk, nFrames, fVerbose ); if ( pNtkRes == NULL ) { - fprintf( pErr, "Target enlargement has failed.\n" ); + Abc_Print( -1, "Target enlargement has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: - fprintf( pErr, "usage: enlarge [-F num] [-vh]\n" ); - fprintf( pErr, "\t performs structural K-step target enlargement\n" ); - fprintf( pErr, "\t-F num : the number of timeframes for enlargement [default = %d]\n", nFrames ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: enlarge [-F num] [-vh]\n" ); + Abc_Print( -2, "\t performs structural K-step target enlargement\n" ); + Abc_Print( -2, "\t-F num : the number of timeframes for enlargement [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -18711,31 +18690,31 @@ usage: ***********************************************************************/ int Abc_CommandInduction( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int nFramesMax; int nConfMax; + int fUnique; + int fUniqueAll; int fVerbose; + int fVeryVerbose; int c; - extern void Abc_NtkDarInduction( Abc_Ntk_t * pNtk, int nFramesMax, int nConfMax, int fVerbose ); - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - + extern int Abc_NtkDarInduction( Abc_Ntk_t * pNtk, int nFramesMax, int nConfMax, int fUnique, int fUniqueAll, int fVerbose, int fVeryVerbose ); // set defaults - nFramesMax = 100; - nConfMax = 1000; - fVerbose = 0; + nFramesMax = 100; + nConfMax = 1000; + fUnique = 0; + fUniqueAll = 0; + fVerbose = 0; + fVeryVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "FCvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "FCuavwh" ) ) != EOF ) { switch ( c ) { case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFramesMax = atoi(argv[globalUtilOptind]); @@ -18746,7 +18725,7 @@ int Abc_CommandInduction( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfMax = atoi(argv[globalUtilOptind]); @@ -18754,9 +18733,18 @@ int Abc_CommandInduction( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( nConfMax < 0 ) goto usage; break; + case 'u': + fUnique ^= 1; + break; + case 'a': + fUniqueAll ^= 1; + break; case 'v': fVerbose ^= 1; break; + case 'w': + fVeryVerbose ^= 1; + break; case 'h': goto usage; default: @@ -18765,35 +18753,43 @@ int Abc_CommandInduction( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } if ( Abc_NtkPoNum(pNtk) != 1 ) { - fprintf( pErr, "Currently this command works only for single-output miter.\n" ); + Abc_Print( -1, "Currently this command works only for single-output miter.\n" ); + return 0; + } + if ( fUnique && fUniqueAll ) + { + Abc_Print( -1, "Only one of the options, \"-u\" or \"-a\", should be selected.\n" ); return 0; } // modify the current network - Abc_NtkDarInduction( pNtk, nFramesMax, nConfMax, fVerbose ); + pAbc->Status = Abc_NtkDarInduction( pNtk, nFramesMax, nConfMax, fUnique, fUniqueAll, fVerbose, fVeryVerbose ); return 0; usage: - fprintf( pErr, "usage: ind [-FC num] [-vh]\n" ); - fprintf( pErr, "\t runs the inductive case of the K-step induction\n" ); - fprintf( pErr, "\t-F num : the max number of timeframes [default = %d]\n", nFramesMax ); - fprintf( pErr, "\t-C num : the max number of conflicts by SAT solver [default = %d]\n", nConfMax ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: ind [-FC num] [-uavwh]\n" ); + Abc_Print( -2, "\t runs the inductive case of the K-step induction\n" ); + Abc_Print( -2, "\t-F num : the max number of timeframes [default = %d]\n", nFramesMax ); + Abc_Print( -2, "\t-C num : the max number of conflicts by SAT solver [default = %d]\n", nConfMax ); + Abc_Print( -2, "\t-u : toggle adding uniqueness constraints on demand [default = %s]\n", fUnique? "yes": "no" ); + Abc_Print( -2, "\t-a : toggle adding uniqueness constraints always [default = %s]\n", fUniqueAll? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printing additional verbose information [default = %s]\n", fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -18808,51 +18804,25 @@ usage: SeeAlso [] ***********************************************************************/ -int Abc_CommandPBAbstraction( Abc_Frame_t * pAbc, int argc, char ** argv ) +int Abc_CommandCegar( Abc_Frame_t * pAbc, int argc, char ** argv ) { Gia_ParAbs_t Pars, * pPars = &Pars; - FILE * pOut, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; - extern Abc_Ntk_t * Abc_NtkDarPBAbstraction( Abc_Ntk_t * pNtk, Gia_ParAbs_t * pPars ); + extern Abc_Ntk_t * Abc_NtkDarCegar( Abc_Ntk_t * pNtk, Gia_ParAbs_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Gia_ManAbsSetDefaultParams( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "FCGDRdesrpfvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "FCRcrpfvh" ) ) != EOF ) { switch ( c ) { case 'F': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-F\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nFramesMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nFramesMax < 0 ) - goto usage; - break; - case 'C': - if ( globalUtilOptind >= argc ) - { - fprintf( pErr, "Command line switch \"-C\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nConfMax = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nConfMax < 0 ) - goto usage; - break; - case 'G': - if ( globalUtilOptind >= argc ) - { - fprintf( pErr, "Command line switch \"-G\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesBmc = atoi(argv[globalUtilOptind]); @@ -18860,10 +18830,10 @@ int Abc_CommandPBAbstraction( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->nFramesBmc < 0 ) goto usage; break; - case 'D': + case 'C': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nConfMaxBmc = atoi(argv[globalUtilOptind]); @@ -18874,7 +18844,7 @@ int Abc_CommandPBAbstraction( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'R': if ( globalUtilOptind >= argc ) { - fprintf( pErr, "Command line switch \"-R\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } pPars->nRatio = atoi(argv[globalUtilOptind]); @@ -18882,14 +18852,8 @@ int Abc_CommandPBAbstraction( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->nRatio < 0 ) goto usage; break; - case 'd': - pPars->fDynamic ^= 1; - break; - case 'e': - pPars->fExtend ^= 1; - break; - case 's': - pPars->fSkipProof ^= 1; + case 'c': + pPars->fConstr ^= 1; break; case 'r': pPars->fUseBdds ^= 1; @@ -18911,56 +18875,357 @@ int Abc_CommandPBAbstraction( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { - fprintf( pErr, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( stdout, "Currently only works for structurally hashed circuits.\n" ); + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); return 0; } if ( !(0 <= pPars->nRatio && pPars->nRatio <= 100) ) { - fprintf( stdout, "Wrong value of parameter \"-R <num>\".\n" ); + Abc_Print( -1, "Wrong value of parameter \"-R <num>\".\n" ); return 0; } // modify the current network - pNtkRes = Abc_NtkDarPBAbstraction( pNtk, pPars ); + pNtkRes = Abc_NtkDarCegar( pNtk, pPars ); if ( pNtkRes == NULL ) { if ( pNtk->pSeqModel == NULL ) - printf( "Abstraction has failed.\n" ); + Abc_Print( -1, "Abstraction has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: - fprintf( pErr, "usage: abs [-FCGDR num] [-desrpfvh]\n" ); - fprintf( pErr, "\t proof-based abstraction (PBA) using UNSAT core of BMC\n" ); - fprintf( pErr, "\t followed by counter-example-based abstraction\n" ); - fprintf( pErr, "\t-F num : the max number of timeframes for PBA [default = %d]\n", pPars->nFramesMax ); - fprintf( pErr, "\t-C num : the max number of conflicts by SAT solver for PBA [default = %d]\n", pPars->nConfMax ); - fprintf( pErr, "\t-G num : the max number of timeframes for BMC [default = %d]\n", pPars->nFramesBmc ); - fprintf( pErr, "\t-D num : the max number of conflicts by SAT solver for BMC [default = %d]\n", pPars->nConfMaxBmc ); - fprintf( pErr, "\t-R num : the %% of abstracted flops when refinement stops (0<=num<=100) [default = %d]\n", pPars->nRatio ); - fprintf( pErr, "\t-d : toggle dynamic unrolling of timeframes [default = %s]\n", pPars->fDynamic? "yes": "no" ); - fprintf( pErr, "\t-e : toggle extending abstraction using COI of flops [default = %s]\n", pPars->fExtend? "yes": "no" ); - fprintf( pErr, "\t-s : toggle skipping proof-based abstraction [default = %s]\n", pPars->fSkipProof? "yes": "no" ); - fprintf( pErr, "\t-r : toggle using BDD-based reachability for filtering [default = %s]\n", pPars->fUseBdds? "yes": "no" ); - fprintf( pErr, "\t-p : toggle using \"dprove\" for filtering [default = %s]\n", pPars->fUseDprove? "yes": "no" ); - fprintf( pErr, "\t-f : toggle starting BMC from a later frame [default = %s]\n", pPars->fUseStart? "yes": "no" ); - fprintf( pErr, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: abs [-FCR num] [-crpfvh]\n" ); + Abc_Print( -2, "\t performs counter-example-based abstraction\n" ); + Abc_Print( -2, "\t-F num : the max number of timeframes for BMC [default = %d]\n", pPars->nFramesBmc ); + Abc_Print( -2, "\t-C num : the max number of conflicts by SAT solver for BMC [default = %d]\n", pPars->nConfMaxBmc ); + Abc_Print( -2, "\t-R num : the %% of abstracted flops when refinement stops (0<=num<=100) [default = %d]\n", pPars->nRatio ); + Abc_Print( -2, "\t-c : toggle dynamic addition of constraints [default = %s]\n", pPars->fConstr? "yes": "no" ); + Abc_Print( -2, "\t-r : toggle using BDD-based reachability for filtering [default = %s]\n", pPars->fUseBdds? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle using \"dprove\" for filtering [default = %s]\n", pPars->fUseDprove? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle starting BMC from a later frame [default = %s]\n", pPars->fUseStart? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandConstr( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Abc_Ntk_t * pNtk; + int c; + int nFrames; + int nConfs; + int nProps; + int fStruct; + int fInvert; + int fOldAlgo; + int fVerbose; + int nConstrs; + extern void Abc_NtkDarConstr( Abc_Ntk_t * pNtk, int nFrames, int nConfs, int nProps, int fStruct, int fOldAlgo, int fVerbose ); + + pNtk = Abc_FrameReadNtk(pAbc); + // set defaults + nFrames = 1; + nConfs = 1000; + nProps = 1000; + fStruct = 0; + fInvert = 0; + fOldAlgo = 0; + fVerbose = 0; + nConstrs = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "FCPNsiavh" ) ) != EOF ) + { + switch ( c ) + { + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + nFrames = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nFrames < 0 ) + goto usage; + break; + case 'C': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); + goto usage; + } + nConfs = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nConfs < 0 ) + goto usage; + break; + case 'P': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); + goto usage; + } + nProps = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nProps < 0 ) + goto usage; + break; + case 'N': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); + goto usage; + } + nConstrs = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nConstrs < 0 ) + goto usage; + break; + case 's': + fStruct ^= 1; + break; + case 'i': + fInvert ^= 1; + break; + case 'a': + fOldAlgo ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pNtk == NULL ) + { + Abc_Print( -1, "Empty network.\n" ); + return 1; + } + if ( Abc_NtkIsComb(pNtk) ) + { + Abc_Print( -1, "The network is combinational.\n" ); + return 0; + } + if ( !Abc_NtkIsStrash(pNtk) ) + { + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); + return 0; + } + // consider the case of already defined constraints + if ( Abc_NtkConstrNum(pNtk) > 0 ) + { + extern void Abc_NtkDarConstrProfile( Abc_Ntk_t * pNtk, int fVerbose ); + if ( fInvert ) + { + Abc_Obj_t * pObj; + int i; + Abc_NtkForEachPo( pNtk, pObj, i ) + { + if ( i >= Abc_NtkPoNum(pNtk) - Abc_NtkConstrNum(pNtk) ) + Abc_ObjXorFaninC( pObj, 0 ); + } + if ( Abc_NtkConstrNum(pNtk) == 1 ) + Abc_Print( 1, "The outputs of %d constraint is complemented.\n", Abc_NtkConstrNum(pNtk) ); + else + Abc_Print( 1, "The outputs of %d constraints are complemented.\n", Abc_NtkConstrNum(pNtk) ); + } + if ( fVerbose ) + Abc_NtkDarConstrProfile( pNtk, fVerbose ); + return 0; + } + // consider the case of manual constraint definition + if ( nConstrs > 0 ) + { + if ( Abc_NtkConstrNum(pNtk) > 0 ) + { + Abc_Print( -1, "The network already has constraints.\n" ); + return 0; + } + if ( nConstrs >= Abc_NtkPoNum(pNtk) ) + { + Abc_Print( -1, "The number of constraints specified (%d) should be less than POs (%d).\n", nConstrs, Abc_NtkPoNum(pNtk) ); + return 0; + } + Abc_Print( 0, "Considering the last %d POs as constraint outputs.\n", nConstrs ); + pNtk->nConstrs = nConstrs; + return 0; + } + // detect constraints using functional/structural methods + Abc_NtkDarConstr( pNtk, nFrames, nConfs, nProps, fStruct, fOldAlgo, fVerbose ); + return 0; +usage: + Abc_Print( -2, "usage: constr [-FCPN num] [-isavh]\n" ); + Abc_Print( -2, "\t a toolkit for constraint manipulation\n" ); + Abc_Print( -2, "\t if constraints are absent, detect them functionally\n" ); + Abc_Print( -2, "\t if constraints are present, profiles them using random simulation\n" ); + Abc_Print( -2, "\t-F num : the max number of timeframes to consider [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-C num : the max number of conflicts in SAT solving [default = %d]\n", nConfs ); + Abc_Print( -2, "\t-P num : the max number of propagations in SAT solving [default = %d]\n", nProps ); + Abc_Print( -2, "\t-N num : manually set the last <num> POs to be constraints [default = %d]\n", nConstrs ); + Abc_Print( -2, "\t-i : toggle inverting already defined constraints [default = %s]\n", fInvert? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle using structural detection methods [default = %s]\n", fStruct? "yes": "no" ); + Abc_Print( -2, "\t-a : toggle fast implication detection [default = %s]\n", !fOldAlgo? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandUnfold( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Abc_Ntk_t * pNtk, * pNtkRes; + int nFrames; + int nConfs; + int nProps; + int fStruct; + int fOldAlgo; + int fVerbose; + int c; + extern Abc_Ntk_t * Abc_NtkDarUnfold( Abc_Ntk_t * pNtk, int nFrames, int nConfs, int nProps, int fStruct, int fOldAlgo, int fVerbose ); + pNtk = Abc_FrameReadNtk(pAbc); + // set defaults + nFrames = 1; + nConfs = 1000; + nProps = 1000; + fStruct = 0; + fOldAlgo = 0; + fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "FCPsavh" ) ) != EOF ) + { + switch ( c ) + { + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + nFrames = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nFrames < 0 ) + goto usage; + break; + case 'C': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); + goto usage; + } + nConfs = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nConfs < 0 ) + goto usage; + break; + case 'P': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); + goto usage; + } + nProps = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nProps < 0 ) + goto usage; + break; + case 's': + fStruct ^= 1; + break; + case 'a': + fOldAlgo ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pNtk == NULL ) + { + Abc_Print( -1, "Empty network.\n" ); + return 1; + } + if ( Abc_NtkIsComb(pNtk) ) + { + Abc_Print( -1, "The network is combinational.\n" ); + return 0; + } + if ( !Abc_NtkIsStrash(pNtk) ) + { + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); + return 0; + } + if ( Abc_NtkConstrNum(pNtk) > 0 ) + { + Abc_Print( -1, "Constraints are already extracted.\n" ); + return 0; + } + if ( Abc_NtkPoNum(pNtk) > 1 ) + { + Abc_Print( -1, "Constraint extraction works for single-output miters (use \"orpos\").\n" ); + return 0; + } + // modify the current network + pNtkRes = Abc_NtkDarUnfold( pNtk, nFrames, nConfs, nProps, fStruct, fOldAlgo, fVerbose ); + if ( pNtkRes == NULL ) + { + printf( "Transformation has failed.\n" ); + return 0; + } + // replace the current network + Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); + return 0; +usage: + Abc_Print( -2, "usage: unfold [-FCP num] [-savh]\n" ); + Abc_Print( -2, "\t unfold hidden constraints as separate outputs\n" ); + Abc_Print( -2, "\t-F num : the max number of timeframes to consider [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-C num : the max number of conflicts in SAT solving [default = %d]\n", nConfs ); + Abc_Print( -2, "\t-P num : the max number of constraint propagations [default = %d]\n", nProps ); + Abc_Print( -2, "\t-s : toggle detecting structural constraints [default = %s]\n", fStruct? "yes": "no" ); + Abc_Print( -2, "\t-a : toggle fast implication detection [default = %s]\n", !fOldAlgo? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} /**Function************************************************************* @@ -18973,16 +19238,169 @@ usage: SeeAlso [] ***********************************************************************/ -int Abc_CommandTraceStart( Abc_Frame_t * pAbc, int argc, char ** argv ) +int Abc_CommandFold( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk, * pNtkRes; + int fCompl; + int fVerbose; int c; + extern Abc_Ntk_t * Abc_NtkDarFold( Abc_Ntk_t * pNtk, int fCompl, int fVerbose ); + pNtk = Abc_FrameReadNtk(pAbc); + // set defaults + fCompl = 0; + fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "cvh" ) ) != EOF ) + { + switch ( c ) + { + case 'c': + fCompl ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pNtk == NULL ) + { + Abc_Print( -1, "Empty network.\n" ); + return 1; + } + if ( Abc_NtkIsComb(pNtk) ) + { + Abc_Print( -1, "The network is combinational.\n" ); + return 0; + } + if ( !Abc_NtkIsStrash(pNtk) ) + { + Abc_Print( -1, "Currently only works for structurally hashed circuits.\n" ); + return 0; + } + if ( Abc_NtkConstrNum(pNtk) == 0 ) + { + Abc_Print( -1, "The network has no constraints.\n" ); + return 0; + } + // modify the current network + pNtkRes = Abc_NtkDarFold( pNtk, fCompl, fVerbose ); + if ( pNtkRes == NULL ) + { + printf( "Transformation has failed.\n" ); + return 0; + } + // replace the current network + Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); + return 0; +usage: + Abc_Print( -2, "usage: fold [-cvh]\n" ); + Abc_Print( -2, "\t folds constraints represented as separate outputs\n" ); + Abc_Print( -2, "\t-c : toggle complementing constraints while folding [default = %s]\n", fCompl? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandBm( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + FILE * pOut, * pErr; + Abc_Ntk_t *pNtk, *pNtk1, *pNtk2; + int fDelete1, fDelete2; + char ** pArgvNew; + int c, nArgcNew; + int p_equivalence = FALSE; + extern void bmGateWay( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int p_equivalence ); pNtk = Abc_FrameReadNtk(pAbc); pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); + pErr = Abc_FrameReadErr(pAbc); + + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "Ph" ) ) != EOF ) + { + switch ( c ) + { + case 'h': + goto usage; + case 'P': + p_equivalence = 1; + break; + default: + fprintf( pErr, "Unkown switch.\n"); + goto usage; + } + } + + pArgvNew = argv + globalUtilOptind; + nArgcNew = argc - globalUtilOptind; + if ( !Abc_NtkPrepareTwoNtks( pErr, pNtk, pArgvNew, nArgcNew , &pNtk1, &pNtk2, &fDelete1, &fDelete2 ) ) + return 1; + + if( (unsigned)Abc_NtkPiNum(pNtk1) != (unsigned)Abc_NtkPiNum(pNtk2) || (unsigned)Abc_NtkPoNum(pNtk1) != (unsigned)Abc_NtkPoNum(pNtk2) ) + { + fprintf( pErr, "Mismatch in the number of inputs or outputs\n"); + if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); + if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); + return 1; + } + + bmGateWay( pNtk1, pNtk2, p_equivalence ); + + if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); + if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); + return 0; + +usage: + fprintf( pErr, "usage: bm [-P] <file1> <file2>\n" ); + fprintf( pErr, "\t performs Boolean matching (P-equivalence & PP-equivalence)\n" ); + fprintf( pErr, "\t for equivalent circuits, I/O matches are printed in IOmatch.txt\n" ); + fprintf( pErr, "\t-P : performs P-equivalnce checking\n"); + fprintf( pErr, "\t default is PP-equivalence checking (when -P is not provided)\n" ); + fprintf( pErr, "\t-h : print the command usage\n"); + fprintf( pErr, "\tfile1 : the file with the first network\n"); + fprintf( pErr, "\tfile2 : the file with the second network\n"); + + fprintf( pErr, "\t \n" ); + fprintf( pErr, "\t This command was contributed by Hadi Katebi from U Michigan.\n" ); + fprintf( pErr, "\t The paper describing the method: H. Katebi and I. L. Markov.\n" ); + fprintf( pErr, "\t \"Large-scale Boolean matching\". Proc. DATE 2010. \n" ); + fprintf( pErr, "\t http://www.eecs.umich.edu/~imarkov/pubs/conf/date10-match.pdf\n" ); + fprintf( pErr, "\t \n" ); + + return 1; +} + + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] +***********************************************************************/ +int Abc_CommandTraceStart( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); + int c; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -18998,28 +19416,28 @@ int Abc_CommandTraceStart( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command is applicable to AIGs.\n" ); + Abc_Print( -1, "This command is applicable to AIGs.\n" ); return 1; } /* Abc_HManStart(); if ( !Abc_HManPopulate( pNtk ) ) { - fprintf( pErr, "Failed to start the tracing database.\n" ); + Abc_Print( -1, "Failed to start the tracing database.\n" ); return 1; } */ return 0; usage: - fprintf( pErr, "usage: trace_start [-h]\n" ); - fprintf( pErr, "\t starts verification tracing\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: trace_start [-h]\n" ); + Abc_Print( -2, "\t starts verification tracing\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -19036,14 +19454,8 @@ usage: ***********************************************************************/ int Abc_CommandTraceCheck( Abc_Frame_t * pAbc, int argc, char ** argv ) { - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; - - pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); - // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) @@ -19059,31 +19471,31 @@ int Abc_CommandTraceCheck( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pNtk == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { - fprintf( pErr, "This command is applicable to AIGs.\n" ); + Abc_Print( -1, "This command is applicable to AIGs.\n" ); return 1; } /* if ( !Abc_HManIsRunning(pNtk) ) { - fprintf( pErr, "The tracing database is not available.\n" ); + Abc_Print( -1, "The tracing database is not available.\n" ); return 1; } if ( !Abc_HManVerify( 1, pNtk->Id ) ) - fprintf( pErr, "Verification failed.\n" ); + Abc_Print( -1, "Verification failed.\n" ); Abc_HManStop(); */ return 0; usage: - fprintf( pErr, "usage: trace_check [-h]\n" ); - fprintf( pErr, "\t checks the current network using verification trace\n" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: trace_check [-h]\n" ); + Abc_Print( -2, "\t checks the current network using verification trace\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -19107,18 +19519,12 @@ int Abc_CommandAbc8Read( Abc_Frame_t * pAbc, int argc, char ** argv ) int c; int fMapped; int fTest; - int fAlter; - extern void * Ioa_ReadBlif( char * pFileName, int fCheck ); - extern void Ioa_WriteBlif( void * p, char * pFileName ); - extern void * Ntl_ManExtractNwk( void * p, Aig_Man_t * pAig, Tim_Man_t * pManTime ); - extern void Ntl_ManPrintStats( void * p ); // set defaults fMapped = 0; fTest = 0; - fAlter = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "mtah" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "mth" ) ) != EOF ) { switch ( c ) { @@ -19128,9 +19534,6 @@ int Abc_CommandAbc8Read( Abc_Frame_t * pAbc, int argc, char ** argv ) case 't': fTest ^= 1; break; - case 'a': - fAlter ^= 1; - break; case 'h': goto usage; default: @@ -19142,69 +19545,52 @@ int Abc_CommandAbc8Read( Abc_Frame_t * pAbc, int argc, char ** argv ) pFileName = argv[globalUtilOptind]; if ( (pFile = fopen( pFileName, "r" )) == NULL ) { - fprintf( stdout, "Cannot open input file \"%s\". ", pFileName ); + Abc_Print( -1, "Cannot open input file \"%s\". ", pFileName ); if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".blif", NULL, NULL, NULL, NULL )) ) - fprintf( stdout, "Did you mean \"%s\"?", pFileName ); - fprintf( stdout, "\n" ); + Abc_Print( 1, "Did you mean \"%s\"?", pFileName ); + Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); if ( fTest ) { - extern void Ntl_ManFree( void * p ); - void * pTemp = Ioa_ReadBlif( pFileName, 1 ); + Ntl_Man_t * pTemp = Ntl_ManReadBlif( pFileName, 1 ); if ( pTemp ) { - Ntl_ManPrintStats( pTemp ); -// Ioa_WriteBlif( pTemp, "test_boxes.blif" ); - Ntl_ManFree( pTemp ); +// Ntl_ManWriteBlif( pTemp, "test_boxes.blif" ); + Ntl_ManPrintStats( pTemp ); + Ntl_ManFree( pTemp ); } return 0; } Abc_FrameClearDesign(); - if ( !fAlter ) - { - pAbc->pAbc8Ntl = Ioa_ReadBlif( pFileName, 1 ); - if ( pAbc->pAbc8Ntl == NULL ) - { - printf( "Abc_CommandAbc8Read(): Reading BLIF has failed.\n" ); - return 1; - } - } - else + pAbc->pAbc8Ntl = Ntl_ManReadBlif( pFileName, 1 ); + if ( pAbc->pAbc8Ntl == NULL ) { - pAbc->pAbc8Ntl = NULL; -// extern void * Nal_ManRead( char * pFileName ); -// pAbc->pAbc8Ntl = Nal_ManRead( pFileName ); -// Ioa_WriteBlif( pAbc->pAbc8Ntl, "test_boxes.blif" ); - if ( pAbc->pAbc8Ntl == NULL ) - { - printf( "Abc_CommandAbc8Read(): Reading design has failed.\n" ); - return 1; - } + Abc_Print( -1, "Abc_CommandAbc8Read(): Reading BLIF has failed.\n" ); + return 1; } pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8Read(): AIG extraction has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Read(): AIG extraction has failed.\n" ); return 1; } if ( fMapped ) { pAbc->pAbc8Nwk = Ntl_ManExtractNwk( pAbc->pAbc8Ntl, pAbc->pAbc8Aig, NULL ); if ( pAbc->pAbc8Nwk == NULL ) - printf( "Abc_CommandAbc8Read(): Warning! Mapped network is not extracted.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Read(): Warning! Mapped network is not extracted.\n" ); } return 0; usage: - fprintf( stdout, "usage: *r [-mtah]\n" ); - fprintf( stdout, "\t reads the design with whiteboxes\n" ); - fprintf( stdout, "\t-m : toggle extracting mapped network [default = %s]\n", fMapped? "yes": "no" ); - fprintf( stdout, "\t-t : toggle reading in the test mode [default = %s]\n", fTest? "yes": "no" ); - fprintf( stdout, "\t-a : toggle reading another file type [default = %s]\n", fAlter? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *r [-mth]\n" ); + Abc_Print( -2, "\t reads the design with whiteboxes\n" ); + Abc_Print( -2, "\t-m : toggle extracting mapped network [default = %s]\n", fMapped? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle reading in the test mode [default = %s]\n", fTest? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -19223,11 +19609,8 @@ int Abc_CommandAbc8ReadLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) { FILE * pFile; char * pFileName; - void * pNtkNew; + Nwk_Man_t * pNtkNew; int c; - extern void * Ntl_ManReadNwk( char * pFileName, Aig_Man_t * pAig, Tim_Man_t * pManTime ); - extern Tim_Man_t * Ntl_ManReadTimeMan( void * p ); - extern void Nwk_ManFree( void * p ); // set defaults Extra_UtilGetoptReset(); @@ -19246,17 +19629,17 @@ int Abc_CommandAbc8ReadLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) pFileName = argv[globalUtilOptind]; if ( (pFile = fopen( pFileName, "r" )) == NULL ) { - fprintf( stdout, "Cannot open input file \"%s\". ", pFileName ); + Abc_Print( -1, "Cannot open input file \"%s\". ", pFileName ); if ( (pFileName = Extra_FileGetSimilarName( pFileName, ".blif", NULL, NULL, NULL, NULL )) ) - fprintf( stdout, "Did you mean \"%s\"?", pFileName ); - fprintf( stdout, "\n" ); + Abc_Print( 1, "Did you mean \"%s\"?", pFileName ); + Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); if ( pAbc->pAbc8Ntl == NULL || pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8ReadLogic(): There is no design or its AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc8ReadLogic(): There is no design or its AIG.\n" ); return 1; } @@ -19264,7 +19647,7 @@ int Abc_CommandAbc8ReadLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtkNew = Ntl_ManReadNwk( pFileName, pAbc->pAbc8Aig, Ntl_ManReadTimeMan(pAbc->pAbc8Ntl) ); if ( pNtkNew == NULL ) { - printf( "Abc_CommandAbc8ReadLogic(): Procedure has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8ReadLogic(): Procedure has failed.\n" ); return 1; } if ( pAbc->pAbc8Nwk != NULL ) @@ -19273,11 +19656,11 @@ int Abc_CommandAbc8ReadLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *rlogic [-h]\n" ); - fprintf( stdout, "\t reads the logic part of the design without whiteboxes\n" ); - fprintf( stdout, "\t and sets the new logic as the current mapped network\n" ); - fprintf( stdout, "\t (the logic part should be comb and with the same PIs/POs)\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *rlogic [-h]\n" ); + Abc_Print( -2, "\t reads the logic part of the design without whiteboxes\n" ); + Abc_Print( -2, "\t and sets the new logic as the current mapped network\n" ); + Abc_Print( -2, "\t (the logic part should be comb and with the same PIs/POs)\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -19295,17 +19678,12 @@ usage: int Abc_CommandAbc8Write( Abc_Frame_t * pAbc, int argc, char ** argv ) { char * pFileName; - void * pTemp; + Aig_Man_t * pTemp; + Ntl_Man_t * pTemp2; int fAig; int fBlif; int fCollapsed; int c; - extern void Ioa_WriteBlif( void * p, char * pFileName ); - extern void * Ntl_ManInsertNtk( void * p, void * pNtk ); - extern void * Ntl_ManInsertAig( void * p, Aig_Man_t * pAig ); - extern void * Ntl_ManDup( void * pOld ); - extern void Ntl_ManFree( void * p ); - extern Aig_Man_t * Ntl_ManCollapseSeq( void * p, int nMinDomSize, int fVerbose ); // set defaults fAig = 0; @@ -19333,7 +19711,7 @@ int Abc_CommandAbc8Write( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Write(): There is no design to write.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Write(): There is no design to write.\n" ); return 1; } // create the design to write @@ -19342,7 +19720,6 @@ int Abc_CommandAbc8Write( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( fCollapsed ) { - extern void Ioa_WriteAiger( Aig_Man_t * pMan, char * pFileName, int fWriteSymbols, int fCompact ); pTemp = Ntl_ManCollapseSeq( pAbc->pAbc8Ntl, 0, 0 ); if ( fBlif ) Saig_ManDumpBlif( pTemp, pFileName ); @@ -19356,21 +19733,21 @@ int Abc_CommandAbc8Write( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( fBlif ) { - pTemp = Ntl_ManInsertAig( pAbc->pAbc8Ntl, pAbc->pAbc8Aig ); - if ( pTemp == NULL ) + pTemp2 = Ntl_ManInsertAig( pAbc->pAbc8Ntl, pAbc->pAbc8Aig ); + if ( pTemp2 == NULL ) { - printf( "Abc_CommandAbc8Write(): Inserting AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Write(): Inserting AIG has failed.\n" ); return 1; } - Ioa_WriteBlif( pTemp, pFileName ); - Ntl_ManFree( pTemp ); + Ntl_ManWriteBlif( pTemp2, pFileName ); + Ntl_ManFree( pTemp2 ); } else Ioa_WriteAiger( pAbc->pAbc8Aig, pFileName, 0, 0 ); } else { - printf( "There is no AIG to write.\n" ); + Abc_Print( -1, "There is no AIG to write.\n" ); return 1; } } @@ -19379,31 +19756,31 @@ int Abc_CommandAbc8Write( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( pAbc->pAbc8Nwk != NULL ) { - pTemp = Ntl_ManInsertNtk( pAbc->pAbc8Ntl, pAbc->pAbc8Nwk ); - if ( pTemp == NULL ) + pTemp2 = Ntl_ManInsertNtk( pAbc->pAbc8Ntl, pAbc->pAbc8Nwk ); + if ( pTemp2 == NULL ) { - printf( "Abc_CommandAbc8Write(): Inserting mapped network has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Write(): Inserting mapped network has failed.\n" ); return 1; } - Ioa_WriteBlif( pTemp, pFileName ); - Ntl_ManFree( pTemp ); + Ntl_ManWriteBlif( pTemp2, pFileName ); + Ntl_ManFree( pTemp2 ); } else { - printf( "Writing the unmapped netlist.\n" ); - pTemp = pAbc->pAbc8Ntl; - Ioa_WriteBlif( pTemp, pFileName ); + Abc_Print( -1, "Writing the unmapped netlist.\n" ); + pTemp2 = pAbc->pAbc8Ntl; + Ntl_ManWriteBlif( pTemp2, pFileName ); } } return 0; usage: - fprintf( stdout, "usage: *w [-abch]\n" ); - fprintf( stdout, "\t write the design with whiteboxes\n" ); - fprintf( stdout, "\t-a : toggle writing mapped network or AIG [default = %s]\n", fAig? "AIG": "mapped" ); - fprintf( stdout, "\t-b : toggle writing AIG as BLIF or AIGER [default = %s]\n", fBlif? "BLIF": "AIGER" ); - fprintf( stdout, "\t-c : toggle writing collapsed sequential AIG [default = %s]\n", fCollapsed? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *w [-abch]\n" ); + Abc_Print( -2, "\t write the design with whiteboxes\n" ); + Abc_Print( -2, "\t-a : toggle writing design or internal AIG [default = %s]\n", fAig? "AIG": "design" ); + Abc_Print( -2, "\t-b : toggle writing AIG as BLIF or AIGER [default = %s]\n", fBlif? "BLIF": "AIGER" ); + Abc_Print( -2, "\t-c : toggle writing collapsed sequential AIG [default = %s]\n", fCollapsed? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -19424,9 +19801,6 @@ int Abc_CommandAbc8WriteLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) char * pFileName; int fAig; int c; - extern Vec_Ptr_t * Ntl_ManCollectCiNames( void * p ); - extern Vec_Ptr_t * Ntl_ManCollectCoNames( void * p ); - extern void Nwk_ManDumpBlif( void * p, char * pFileName, Vec_Ptr_t * vCiNames, Vec_Ptr_t * vCoNames ); // set defaults fAig = 0; @@ -19446,7 +19820,7 @@ int Abc_CommandAbc8WriteLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Write(): There is no design to write.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Write(): There is no design to write.\n" ); return 1; } // create the design to write @@ -19460,7 +19834,7 @@ int Abc_CommandAbc8WriteLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) Aig_ManDumpBlif( pAbc->pAbc8Aig, pFileName, vCiNames, vCoNames ); else { - printf( "There is no AIG to write.\n" ); + Abc_Print( -1, "There is no AIG to write.\n" ); return 1; } } @@ -19470,7 +19844,7 @@ int Abc_CommandAbc8WriteLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) Nwk_ManDumpBlif( pAbc->pAbc8Nwk, pFileName, vCiNames, vCoNames ); else { - printf( "There is no mapped network to write.\n" ); + Abc_Print( -1, "There is no mapped network to write.\n" ); return 1; } } @@ -19479,10 +19853,10 @@ int Abc_CommandAbc8WriteLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *wlogic [-ah]\n" ); - fprintf( stdout, "\t write the logic part of the design without whiteboxes\n" ); - fprintf( stdout, "\t-a : toggle writing mapped network or AIG [default = %s]\n", fAig? "AIG": "mapped" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *wlogic [-ah]\n" ); + Abc_Print( -2, "\t write the logic part of the design without whiteboxes\n" ); + Abc_Print( -2, "\t-a : toggle writing mapped network or AIG [default = %s]\n", fAig? "AIG": "network" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -19501,7 +19875,7 @@ int Abc_CommandAbc8ReadLut( Abc_Frame_t * pAbc, int argc, char **argv ) { FILE * pFile; char * FileName; - void * pLib; + If_Lib_t * pLib; int c; extern If_Lib_t * If_LutLibRead( char * FileName ); extern void If_LutLibFree( If_Lib_t * pLutLib ); @@ -19530,10 +19904,10 @@ int Abc_CommandAbc8ReadLut( Abc_Frame_t * pAbc, int argc, char **argv ) FileName = argv[globalUtilOptind]; if ( (pFile = fopen( FileName, "r" )) == NULL ) { - fprintf( stdout, "Cannot open input file \"%s\". ", FileName ); + Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); if ( (FileName = Extra_FileGetSimilarName( FileName, ".lut", NULL, NULL, NULL, NULL )) ) - fprintf( stdout, "Did you mean \"%s\"?", FileName ); - fprintf( stdout, "\n" ); + Abc_Print( 1, "Did you mean \"%s\"?", FileName ); + Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); @@ -19542,7 +19916,7 @@ int Abc_CommandAbc8ReadLut( Abc_Frame_t * pAbc, int argc, char **argv ) pLib = If_LutLibRead( FileName ); if ( pLib == NULL ) { - fprintf( stdout, "Reading LUT library has failed.\n" ); + Abc_Print( -1, "Reading LUT library has failed.\n" ); goto usage; } // replace the current library @@ -19552,21 +19926,21 @@ int Abc_CommandAbc8ReadLut( Abc_Frame_t * pAbc, int argc, char **argv ) return 0; usage: - fprintf( stdout, "\nusage: *rlut [-h]\n"); - fprintf( stdout, "\t read the LUT library from the file\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); - fprintf( stdout, "\t \n"); - fprintf( stdout, "\t File format for a LUT library:\n"); - fprintf( stdout, "\t (the default library is shown)\n"); - fprintf( stdout, "\t \n"); - fprintf( stdout, "\t # The area/delay of k-variable LUTs:\n"); - fprintf( stdout, "\t # k area delay\n"); - fprintf( stdout, "\t 1 1 1\n"); - fprintf( stdout, "\t 2 2 2\n"); - fprintf( stdout, "\t 3 4 3\n"); - fprintf( stdout, "\t 4 8 4\n"); - fprintf( stdout, "\t 5 16 5\n"); - fprintf( stdout, "\t 6 32 6\n"); + Abc_Print( -2, "\nusage: *rlut [-h]\n"); + Abc_Print( -2, "\t read the LUT library from the file\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t \n"); + Abc_Print( -2, "\t File format for a LUT library:\n"); + Abc_Print( -2, "\t (the default library is shown)\n"); + Abc_Print( -2, "\t \n"); + Abc_Print( -2, "\t # The area/delay of k-variable LUTs:\n"); + Abc_Print( -2, "\t # k area delay\n"); + Abc_Print( -2, "\t 1 1 1\n"); + Abc_Print( -2, "\t 2 2 2\n"); + Abc_Print( -2, "\t 3 4 3\n"); + Abc_Print( -2, "\t 4 8 4\n"); + Abc_Print( -2, "\t 5 16 5\n"); + Abc_Print( -2, "\t 6 32 6\n"); return 1; /* error exit */ } @@ -19607,15 +19981,15 @@ int Abc_CommandAbc8PrintLut( Abc_Frame_t * pAbc, int argc, char **argv ) // set the new network if ( pAbc->pAbc8Lib == NULL ) - printf( "Abc_CommandAbc8PrintLut(): LUT library is not specified.\n" ); + Abc_Print( -1, "Abc_CommandAbc8PrintLut(): LUT library is not specified.\n" ); else - If_LutLibPrint( pAbc->pAbc8Lib ); + If_LutLibPrint( (If_Lib_t *)pAbc->pAbc8Lib ); return 0; usage: - fprintf( stdout, "\nusage: *plut [-h]\n"); - fprintf( stdout, "\t print the current LUT library\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "\nusage: *plut [-h]\n"); + Abc_Print( -2, "\t print the current LUT library\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; /* error exit */ } @@ -19633,7 +20007,6 @@ usage: int Abc_CommandAbc8Check( Abc_Frame_t * pAbc, int argc, char **argv ) { int c; - extern int Nwk_ManCheck( void * p ); // set the defaults Extra_UtilGetoptReset(); @@ -19656,15 +20029,15 @@ int Abc_CommandAbc8Check( Abc_Frame_t * pAbc, int argc, char **argv ) // set the new network if ( pAbc->pAbc8Nwk == NULL ) - printf( "Abc_CommandAbc8Check(): There is no mapped network.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Check(): There is no mapped network.\n" ); else Nwk_ManCheck( pAbc->pAbc8Nwk ); return 0; usage: - fprintf( stdout, "\nusage: *check [-h]\n"); - fprintf( stdout, "\t checks if the current mapped network has duplicated fanins\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "\nusage: *check [-h]\n"); + Abc_Print( -2, "\t checks if the current mapped network has duplicated fanins\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; /* error exit */ } @@ -19687,9 +20060,7 @@ int Abc_CommandAbc8Ps( Abc_Frame_t * pAbc, int argc, char ** argv ) int fDumpResult; int fPower; int fShort; - extern void Ntl_ManPrintStats( void * p ); - extern void Nwk_ManPrintStats( void * p, void * pLutLib, int fSaveBest, int fDumpResult, int fPower, void * pNtl ); - extern void Nwk_ManPrintStatsShort( void * p, void * pAig, void * pNtk ); + extern If_Lib_t * If_SetSimpleLutLib( int nLutSize ); // set defaults fSaveBest = 0; @@ -19721,7 +20092,7 @@ int Abc_CommandAbc8Ps( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Ps(): There is no design to show.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Ps(): There is no design to show.\n" ); return 1; } @@ -19733,34 +20104,34 @@ int Abc_CommandAbc8Ps( Abc_Frame_t * pAbc, int argc, char ** argv ) // get the input file name if ( pAbc->pAbc8Ntl ) { - printf( "NETLIST: " ); + Abc_Print( -1, "NETLIST: " ); Ntl_ManPrintStats( pAbc->pAbc8Ntl ); } if ( pAbc->pAbc8Aig ) { - printf( "AIG: " ); + Abc_Print( -1, "AIG: " ); Aig_ManPrintStats( pAbc->pAbc8Aig ); } if ( pAbc->pAbc8Nwk ) { if ( pAbc->pAbc8Lib == NULL ) { - printf( "LUT library is not given. Using default LUT library.\n" ); + Abc_Print( -1, "LUT library is not given. Using default LUT library.\n" ); pAbc->pAbc8Lib = If_SetSimpleLutLib( 6 ); } - printf( "MAPPED: " ); + Abc_Print( -1, "MAPPED: " ); Nwk_ManPrintStats( pAbc->pAbc8Nwk, pAbc->pAbc8Lib, fSaveBest, fDumpResult, fPower, pAbc->pAbc8Ntl ); } return 0; usage: - fprintf( stdout, "usage: *ps [-bdpsh]\n" ); - fprintf( stdout, "\t prints design statistics\n" ); - fprintf( stdout, "\t-b : toggles saving the best logic network in \"best.blif\" [default = %s]\n", fSaveBest? "yes": "no" ); - fprintf( stdout, "\t-d : toggles dumping network into file \"<input_file_name>_dump.blif\" [default = %s]\n", fDumpResult? "yes": "no" ); - fprintf( stdout, "\t-p : toggles printing power dissipation due to switching [default = %s]\n", fPower? "yes": "no" ); - fprintf( stdout, "\t-s : toggles short printing mode [default = %s]\n", fShort? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *ps [-bdpsh]\n" ); + Abc_Print( -2, "\t prints design statistics\n" ); + Abc_Print( -2, "\t-b : toggles saving the best logic network in \"best.blif\" [default = %s]\n", fSaveBest? "yes": "no" ); + Abc_Print( -2, "\t-d : toggles dumping network into file \"<input_file_name>_dump.blif\" [default = %s]\n", fDumpResult? "yes": "no" ); + Abc_Print( -2, "\t-p : toggles printing power dissipation due to switching [default = %s]\n", fPower? "yes": "no" ); + Abc_Print( -2, "\t-s : toggles short printing mode [default = %s]\n", fShort? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -19778,7 +20149,6 @@ usage: int Abc_CommandAbc8Pfan( Abc_Frame_t * pAbc, int argc, char ** argv ) { int c; - extern void Nwk_ManPrintFanioNew( void * p ); // set defaults Extra_UtilGetoptReset(); @@ -19794,16 +20164,16 @@ int Abc_CommandAbc8Pfan( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Pfan(): There is no mapped network for print fanin/fanout.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Pfan(): There is no mapped network for print fanin/fanout.\n" ); return 1; } Nwk_ManPrintFanioNew( pAbc->pAbc8Nwk ); return 0; usage: - fprintf( stdout, "usage: *pfan [-h]\n" ); - fprintf( stdout, "\t prints fanin/fanout stats of the mapped network\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *pfan [-h]\n" ); + Abc_Print( -2, "\t prints fanin/fanout stats of the mapped network\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -19823,17 +20193,12 @@ int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) char Buffer[200]; char LutSize[200]; If_Par_t Pars, * pPars = &Pars; - void * pNtkNew; + Nwk_Man_t * pNtkNew; int c; - extern void * Nwk_MappingIf( Aig_Man_t * p, Tim_Man_t * pManTime, If_Par_t * pPars ); - extern Tim_Man_t * Ntl_ManReadTimeMan( void * p ); - extern If_Lib_t * If_SetSimpleLutLib( int nLutSize ); - extern void Nwk_ManSetIfParsDefault( If_Par_t * pPars ); - extern void Nwk_ManFree( void * p ); if ( pAbc->pAbc8Lib == NULL ) { -// printf( "LUT library is not given. Using default LUT library.\n" ); +// Abc_Print( -1, "LUT library is not given. Using default LUT library.\n" ); pAbc->pAbc8Lib = If_SetSimpleLutLib( 6 ); } @@ -19841,14 +20206,14 @@ int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) Nwk_ManSetIfParsDefault( pPars ); pPars->pLutLib = pAbc->pAbc8Lib; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "KCFADEqaflepmrstbvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "KCFADEqaflepmrsdbvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-K\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by a positive integer.\n" ); goto usage; } pPars->nLutSize = atoi(argv[globalUtilOptind]); @@ -19861,7 +20226,7 @@ int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by a positive integer.\n" ); goto usage; } pPars->nCutsMax = atoi(argv[globalUtilOptind]); @@ -19872,7 +20237,7 @@ int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by a positive integer.\n" ); goto usage; } pPars->nFlowIters = atoi(argv[globalUtilOptind]); @@ -19883,7 +20248,7 @@ int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'A': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-A\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-A\" should be followed by a positive integer.\n" ); goto usage; } pPars->nAreaIters = atoi(argv[globalUtilOptind]); @@ -19894,7 +20259,7 @@ int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-D\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by a floating point number.\n" ); goto usage; } pPars->DelayTarget = (float)atof(argv[globalUtilOptind]); @@ -19905,7 +20270,7 @@ int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'E': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-E\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-E\" should be followed by a floating point number.\n" ); goto usage; } pPars->Epsilon = (float)atof(argv[globalUtilOptind]); @@ -19940,11 +20305,11 @@ int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 's': pPars->fSeqMap ^= 1; break; - case 't': - pPars->fLiftLeaves ^= 1; + case 'd': + pPars->fBidec ^= 1; break; case 'b': - pPars->fBidec ^= 1; + pPars->fUseBat ^= 1; break; case 'v': pPars->fVerbose ^= 1; @@ -19956,28 +20321,39 @@ int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8If(): There is no AIG to map.\n" ); + Abc_Print( -1, "Abc_CommandAbc8If(): There is no AIG to map.\n" ); return 1; } if ( pPars->nLutSize < 3 || pPars->nLutSize > IF_MAX_LUTSIZE ) { - fprintf( stdout, "Incorrect LUT size (%d).\n", pPars->nLutSize ); + Abc_Print( -1, "Incorrect LUT size (%d).\n", pPars->nLutSize ); return 1; } if ( pPars->nCutsMax < 1 || pPars->nCutsMax >= (1<<12) ) { - fprintf( stdout, "Incorrect number of cuts.\n" ); + Abc_Print( -1, "Incorrect number of cuts.\n" ); return 1; } // enable truth table computation if choices are selected if ( (c = Aig_ManChoiceNum( pAbc->pAbc8Aig )) ) { -// printf( "Performing LUT mapping with %d choices.\n", c ); +// Abc_Print( 0, "Performing LUT mapping with %d choices.\n", c ); pPars->fExpRed = 0; } + + if ( pPars->fUseBat ) + { + if ( pPars->nLutSize < 4 || pPars->nLutSize > 6 ) + { + Abc_Print( -1, "This feature only works for {4,5,6}-LUTs.\n" ); + return 1; + } + pPars->fCutMin = 1; + } + // enable truth table computation if cut minimization is selected if ( pPars->fCutMin ) { @@ -19988,14 +20364,14 @@ int Abc_CommandAbc8If( Abc_Frame_t * pAbc, int argc, char ** argv ) // complain if truth tables are requested but the cut size is too large if ( pPars->fTruth && pPars->nLutSize > IF_MAX_FUNC_LUTSIZE ) { - fprintf( stdout, "Truth tables cannot be computed for LUT larger than %d inputs.\n", IF_MAX_FUNC_LUTSIZE ); + Abc_Print( -1, "Truth tables cannot be computed for LUT larger than %d inputs.\n", IF_MAX_FUNC_LUTSIZE ); return 1; } pNtkNew = Nwk_MappingIf( pAbc->pAbc8Aig, Ntl_ManReadTimeMan(pAbc->pAbc8Ntl), pPars ); if ( pNtkNew == NULL ) { - printf( "Abc_CommandAbc8If(): Mapping of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8If(): Mapping of the AIG has failed.\n" ); return 1; } if ( pAbc->pAbc8Nwk != NULL ) @@ -20012,27 +20388,27 @@ usage: sprintf( LutSize, "library" ); else sprintf( LutSize, "%d", pPars->nLutSize ); - fprintf( stdout, "usage: *if [-KCFA num] [-DE float] [-qarlepmbvh]\n" ); - fprintf( stdout, "\t performs FPGA technology mapping of the network\n" ); - fprintf( stdout, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); - fprintf( stdout, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); - fprintf( stdout, "\t-F num : the number of area flow recovery iterations (num >= 0) [default = %d]\n", pPars->nFlowIters ); - fprintf( stdout, "\t-A num : the number of exact area recovery iterations (num >= 0) [default = %d]\n", pPars->nAreaIters ); - fprintf( stdout, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer ); - fprintf( stdout, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->Epsilon ); - fprintf( stdout, "\t-q : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" ); - fprintf( stdout, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" ); -// fprintf( stdout, "\t-f : toggles one fancy feature [default = %s]\n", pPars->fFancy? "yes": "no" ); - fprintf( stdout, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" ); - fprintf( stdout, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" ); - fprintf( stdout, "\t-e : uses edge-based cut selection heuristics [default = %s]\n", pPars->fEdge? "yes": "no" ); - fprintf( stdout, "\t-p : uses power-aware cut selection heuristics [default = %s]\n", pPars->fPower? "yes": "no" ); - fprintf( stdout, "\t-m : enables cut minimization by removing vacuous variables [default = %s]\n", pPars->fCutMin? "yes": "no" ); -// fprintf( stdout, "\t-s : toggles sequential mapping [default = %s]\n", pPars->fSeqMap? "yes": "no" ); -// fprintf( stdout, "\t-t : toggles the use of true sequential cuts [default = %s]\n", pPars->fLiftLeaves? "yes": "no" ); - fprintf( stdout, "\t-b : toggles deriving local AIGs using bi-decomposition [default = %s]\n", pPars->fBidec? "yes": "no" ); - fprintf( stdout, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : prints the command usage\n"); + Abc_Print( -2, "usage: *if [-KCFA num] [-DE float] [-qarlepmdbvh]\n" ); + Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" ); + Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); + Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); + Abc_Print( -2, "\t-F num : the number of area flow recovery iterations (num >= 0) [default = %d]\n", pPars->nFlowIters ); + Abc_Print( -2, "\t-A num : the number of exact area recovery iterations (num >= 0) [default = %d]\n", pPars->nAreaIters ); + Abc_Print( -2, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer ); + Abc_Print( -2, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->Epsilon ); + Abc_Print( -2, "\t-q : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" ); + Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" ); +// Abc_Print( -2, "\t-f : toggles one fancy feature [default = %s]\n", pPars->fFancy? "yes": "no" ); + Abc_Print( -2, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" ); + Abc_Print( -2, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" ); + Abc_Print( -2, "\t-e : uses edge-based cut selection heuristics [default = %s]\n", pPars->fEdge? "yes": "no" ); + Abc_Print( -2, "\t-p : uses power-aware cut selection heuristics [default = %s]\n", pPars->fPower? "yes": "no" ); + Abc_Print( -2, "\t-m : enables cut minimization by removing vacuous variables [default = %s]\n", pPars->fCutMin? "yes": "no" ); +// Abc_Print( -2, "\t-s : toggles sequential mapping [default = %s]\n", pPars->fSeqMap? "yes": "no" ); + Abc_Print( -2, "\t-d : toggles deriving local AIGs using bi-decomposition [default = %s]\n", pPars->fBidec? "yes": "no" ); + Abc_Print( -2, "\t-b : toggles the use of one special feature [default = %s]\n", pPars->fUseBat? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : prints the command usage\n"); return 1; } @@ -20070,7 +20446,7 @@ int Abc_CommandAbc8DChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfMax = atoi(argv[globalUtilOptind]); @@ -20081,7 +20457,7 @@ int Abc_CommandAbc8DChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLevelMax = atoi(argv[globalUtilOptind]); @@ -20109,7 +20485,7 @@ int Abc_CommandAbc8DChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8DChoice(): There is no AIG to synthesize.\n" ); + Abc_Print( -1, "Abc_CommandAbc8DChoice(): There is no AIG to synthesize.\n" ); return 1; } @@ -20117,7 +20493,7 @@ int Abc_CommandAbc8DChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) pAigNew = Ntl_ManPerformChoicing( pAbc->pAbc8Aig, fBalance, fUpdateLevel, fConstruct, nConfMax, nLevelMax, fVerbose ); if ( pAigNew == NULL ) { - printf( "Abc_CommandAbc8DChoice(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8DChoice(): Tranformation has failed.\n" ); return 1; } Aig_ManStop( pAbc->pAbc8Aig ); @@ -20125,15 +20501,15 @@ int Abc_CommandAbc8DChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *dchoice [-C num] [-L num] [-blcvh]\n" ); - fprintf( stdout, "\t performs AIG-based synthesis and derives choices\n" ); - fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", nConfMax ); - fprintf( stdout, "\t-L num : the max level of nodes to consider (0 = not used) [default = %d]\n", nLevelMax ); - fprintf( stdout, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); - fprintf( stdout, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( stdout, "\t-c : toggle constructive computation of choices [default = %s]\n", fConstruct? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *dchoice [-C num] [-L num] [-blcvh]\n" ); + Abc_Print( -2, "\t performs AIG-based synthesis and derives choices\n" ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", nConfMax ); + Abc_Print( -2, "\t-L num : the max level of nodes to consider (0 = not used) [default = %d]\n", nLevelMax ); + Abc_Print( -2, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle constructive computation of choices [default = %s]\n", fConstruct? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -20165,7 +20541,7 @@ int Abc_CommandAbc8Dch( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nWords = atoi(argv[globalUtilOptind]); @@ -20176,7 +20552,7 @@ int Abc_CommandAbc8Dch( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -20187,7 +20563,7 @@ int Abc_CommandAbc8Dch( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nSatVarMax = atoi(argv[globalUtilOptind]); @@ -20218,7 +20594,7 @@ int Abc_CommandAbc8Dch( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8Dch(): There is no AIG to synthesize.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Dch(): There is no AIG to synthesize.\n" ); return 1; } @@ -20226,7 +20602,7 @@ int Abc_CommandAbc8Dch( Abc_Frame_t * pAbc, int argc, char ** argv ) pAigNew = Ntl_ManPerformChoicingNew( pAbc->pAbc8Aig, pPars ); if ( pAigNew == NULL ) { - printf( "Abc_CommandAbc8Dch(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Dch(): Tranformation has failed.\n" ); return 1; } // Aig_ManStop( pAbc->pAbc8Aig ); @@ -20234,17 +20610,17 @@ int Abc_CommandAbc8Dch( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *dch [-WCS num] [-sptfvh]\n" ); - fprintf( stdout, "\t computes structural choices using a new approach\n" ); - fprintf( stdout, "\t-W num : the max number of simulation words [default = %d]\n", pPars->nWords ); - fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); - fprintf( stdout, "\t-S num : the max number of SAT variables [default = %d]\n", pPars->nSatVarMax ); - fprintf( stdout, "\t-s : toggle synthesizing three snapshots [default = %s]\n", pPars->fSynthesis? "yes": "no" ); - fprintf( stdout, "\t-p : toggle power-aware rewriting [default = %s]\n", pPars->fPower? "yes": "no" ); - fprintf( stdout, "\t-t : toggle simulation of the TFO classes [default = %s]\n", pPars->fSimulateTfo? "yes": "no" ); - fprintf( stdout, "\t-f : toggle using lighter logic synthesis [default = %s]\n", pPars->fLightSynth? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *dch [-WCS num] [-sptfvh]\n" ); + Abc_Print( -2, "\t computes structural choices using a new approach\n" ); + Abc_Print( -2, "\t-W num : the max number of simulation words [default = %d]\n", pPars->nWords ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-S num : the max number of SAT variables [default = %d]\n", pPars->nSatVarMax ); + Abc_Print( -2, "\t-s : toggle synthesizing three snapshots [default = %s]\n", pPars->fSynthesis? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle power-aware rewriting [default = %s]\n", pPars->fPower? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle simulation of the TFO classes [default = %s]\n", pPars->fSimulateTfo? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle using lighter logic synthesis [default = %s]\n", pPars->fLightSynth? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -20259,7 +20635,7 @@ usage: SeeAlso [] ***********************************************************************/ -int Abc_CommandAbc8DC2( Abc_Frame_t * pAbc, int argc, char ** argv ) +int Abc_CommandAbc8Dc2( Abc_Frame_t * pAbc, int argc, char ** argv ) { Aig_Man_t * pAigNew; int c; @@ -20300,7 +20676,7 @@ int Abc_CommandAbc8DC2( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8DC2(): There is no AIG to synthesize.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Dc2(): There is no AIG to synthesize.\n" ); return 1; } @@ -20308,7 +20684,7 @@ int Abc_CommandAbc8DC2( Abc_Frame_t * pAbc, int argc, char ** argv ) pAigNew = Dar_ManCompress2( pAbc->pAbc8Aig, fBalance, fUpdateLevel, 1, fPower, fVerbose ); if ( pAigNew == NULL ) { - printf( "Abc_CommandAbc8DC2(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Dc2(): Tranformation has failed.\n" ); return 1; } Aig_ManStop( pAbc->pAbc8Aig ); @@ -20316,13 +20692,13 @@ int Abc_CommandAbc8DC2( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *dc2 [-blpvh]\n" ); - fprintf( stdout, "\t performs AIG-based synthesis without deriving choices\n" ); - fprintf( stdout, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); - fprintf( stdout, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( stdout, "\t-p : toggle power-aware rewriting [default = %s]\n", fPower? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *dc2 [-blpvh]\n" ); + Abc_Print( -2, "\t performs AIG-based synthesis without deriving choices\n" ); + Abc_Print( -2, "\t-b : toggle internal balancing [default = %s]\n", fBalance? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle power-aware rewriting [default = %s]\n", fPower? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -20341,7 +20717,6 @@ usage: int Abc_CommandAbc8Bidec( Abc_Frame_t * pAbc, int argc, char ** argv ) { int c; - extern void Nwk_ManBidecResyn( void * pNtk, int fVerbose ); // set defaults Extra_UtilGetoptReset(); @@ -20357,16 +20732,16 @@ int Abc_CommandAbc8Bidec( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Bidec(): There is no mapped network to strash.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Bidec(): There is no mapped network to strash.\n" ); return 1; } Nwk_ManBidecResyn( pAbc->pAbc8Nwk, 0 ); return 0; usage: - fprintf( stdout, "usage: *bidec [-h]\n" ); - fprintf( stdout, "\t performs bi-decomposition of local functions\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *bidec [-h]\n" ); + Abc_Print( -2, "\t performs bi-decomposition of local functions\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -20385,7 +20760,6 @@ int Abc_CommandAbc8Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) { Aig_Man_t * pAigNew; int c; - extern Aig_Man_t * Nwk_ManStrash( void * pNtk ); // set defaults Extra_UtilGetoptReset(); @@ -20401,14 +20775,14 @@ int Abc_CommandAbc8Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Strash(): There is no mapped network to strash.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Strash(): There is no mapped network to strash.\n" ); return 1; } pAigNew = Nwk_ManStrash( pAbc->pAbc8Nwk ); if ( pAigNew == NULL ) { - printf( "Abc_CommandAbc8Strash(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Strash(): Tranformation has failed.\n" ); return 1; } Aig_ManStop( pAbc->pAbc8Aig ); @@ -20416,9 +20790,9 @@ int Abc_CommandAbc8Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *st [-h]\n" ); - fprintf( stdout, "\t performs structural hashing of mapped network\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *st [-h]\n" ); + Abc_Print( -2, "\t performs structural hashing of mapped network\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -20438,7 +20812,7 @@ int Abc_CommandAbc8Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) { Mfx_Par_t Pars, * pPars = &Pars; int c; - extern int Mfx_Perform( void * pNtk, Mfx_Par_t * pPars, If_Lib_t * pLutLib ); +// extern int Mfx_Perform( void * pNtk, Mfx_Par_t * pPars, If_Lib_t * pLutLib ); // set defaults Mfx_ParsDefault( pPars ); @@ -20450,7 +20824,7 @@ int Abc_CommandAbc8Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nWinTfoLevs = atoi(argv[globalUtilOptind]); @@ -20461,7 +20835,7 @@ int Abc_CommandAbc8Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFanoutsMax = atoi(argv[globalUtilOptind]); @@ -20472,7 +20846,7 @@ int Abc_CommandAbc8Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nDepthMax = atoi(argv[globalUtilOptind]); @@ -20483,7 +20857,7 @@ int Abc_CommandAbc8Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'M': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-M\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nWinSizeMax = atoi(argv[globalUtilOptind]); @@ -20494,7 +20868,7 @@ int Abc_CommandAbc8Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nGrowthLevel = atoi(argv[globalUtilOptind]); @@ -20505,7 +20879,7 @@ int Abc_CommandAbc8Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -20542,18 +20916,18 @@ int Abc_CommandAbc8Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Mfs(): There is no mapped network.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Mfs(): There is no mapped network.\n" ); return 1; } if ( pAbc->pAbc8Lib == NULL ) { - printf( "Abc_CommandAbc8Mfs(): There is no LUT library.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Mfs(): There is no LUT library.\n" ); return 1; } if ( If_LutLibDelaysAreDifferent(pAbc->pAbc8Lib) ) { - printf( "Abc_CommandAbc8Mfs(): Cannot perform don't-care simplication with variable-pin-delay LUT model.\n" ); - printf( "The delay model should be fixed-pin-delay, for example, the delay of all pins of all LUTs is 0.4.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Mfs(): Cannot perform don't-care simplication with variable-pin-delay LUT model.\n" ); + Abc_Print( -1, "The delay model should be fixed-pin-delay, for example, the delay of all pins of all LUTs is 0.4.\n" ); return 1; } @@ -20561,28 +20935,28 @@ int Abc_CommandAbc8Mfs( Abc_Frame_t * pAbc, int argc, char ** argv ) // modify the current network if ( !Mfx_Perform( pAbc->pAbc8Nwk, pPars, pAbc->pAbc8Lib ) ) { - fprintf( stdout, "Abc_CommandAbc8Mfs(): Command has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Mfs(): Command has failed.\n" ); return 1; } return 0; usage: - fprintf( stdout, "usage: *mfs [-WFDMLC <num>] [-raespvh]\n" ); - fprintf( stdout, "\t performs don't-care-based optimization of logic networks\n" ); - fprintf( stdout, "\t-W <num> : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nWinTfoLevs ); - fprintf( stdout, "\t-F <num> : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutsMax ); - fprintf( stdout, "\t-D <num> : the max depth nodes to try (0 = no limit) [default = %d]\n", pPars->nDepthMax ); - fprintf( stdout, "\t-M <num> : the max node count of windows to consider (0 = no limit) [default = %d]\n", pPars->nWinSizeMax ); - fprintf( stdout, "\t-L <num> : the max increase in node level after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); - fprintf( stdout, "\t-C <num> : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit ); - fprintf( stdout, "\t-r : toggle resubstitution and dc-minimization [default = %s]\n", pPars->fResub? "resub": "dc-min" ); - fprintf( stdout, "\t-a : toggle minimizing area or area+edges [default = %s]\n", pPars->fArea? "area": "area+edges" ); - fprintf( stdout, "\t-e : toggle high-effort resubstitution [default = %s]\n", pPars->fMoreEffort? "yes": "no" ); - fprintf( stdout, "\t-s : toggle evaluation of edge swapping [default = %s]\n", pPars->fSwapEdge? "yes": "no" ); - fprintf( stdout, "\t-p : toggle power-aware optimization [default = %s]\n", pPars->fPower? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *mfs [-WFDMLC <num>] [-raespvh]\n" ); + Abc_Print( -2, "\t performs don't-care-based optimization of logic networks\n" ); + Abc_Print( -2, "\t-W <num> : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nWinTfoLevs ); + Abc_Print( -2, "\t-F <num> : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutsMax ); + Abc_Print( -2, "\t-D <num> : the max depth nodes to try (0 = no limit) [default = %d]\n", pPars->nDepthMax ); + Abc_Print( -2, "\t-M <num> : the max node count of windows to consider (0 = no limit) [default = %d]\n", pPars->nWinSizeMax ); + Abc_Print( -2, "\t-L <num> : the max increase in node level after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); + Abc_Print( -2, "\t-C <num> : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-r : toggle resubstitution and dc-minimization [default = %s]\n", pPars->fResub? "resub": "dc-min" ); + Abc_Print( -2, "\t-a : toggle minimizing area or area+edges [default = %s]\n", pPars->fArea? "area": "area+edges" ); + Abc_Print( -2, "\t-e : toggle high-effort resubstitution [default = %s]\n", pPars->fMoreEffort? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle evaluation of edge swapping [default = %s]\n", pPars->fSwapEdge? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle power-aware optimization [default = %s]\n", pPars->fPower? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -20601,7 +20975,7 @@ int Abc_CommandAbc8Lutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) { int c; - printf( "This command is temporarily disabled.\n" ); + Abc_Print( -1, "This command is temporarily disabled.\n" ); return 0; // set defaults @@ -20618,7 +20992,7 @@ int Abc_CommandAbc8Lutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Lutpack(): There is no mapped network to strash.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Lutpack(): There is no mapped network to strash.\n" ); return 1; } @@ -20626,23 +21000,23 @@ int Abc_CommandAbc8Lutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: /* - fprintf( stdout, "usage: *lp [-h]\n" ); - fprintf( stdout, "usage: lutpack [-N <num>] [-Q <num>] [-S <num>] [-L <num>] [-szfovwh]\n" ); - fprintf( stdout, "\t performs \"rewriting\" for LUT network;\n" ); - fprintf( stdout, "\t determines LUT size as the max fanin count of a node;\n" ); - fprintf( stdout, "\t if the network is not LUT-mapped, packs it into 6-LUTs\n" ); - fprintf( stdout, "\t (there is another command for resynthesis after LUT mapping, \"imfs\")\n" ); - fprintf( stdout, "\t-N <num> : the max number of LUTs in the structure (2 <= num) [default = %d]\n", pPars->nLutsMax ); - fprintf( stdout, "\t-Q <num> : the max number of LUTs not in MFFC (0 <= num) [default = %d]\n", pPars->nLutsOver ); - fprintf( stdout, "\t-S <num> : the max number of LUT inputs shared (0 <= num <= 3) [default = %d]\n", pPars->nVarsShared ); - fprintf( stdout, "\t-L <num> : max level increase after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); - fprintf( stdout, "\t-s : toggle iteration till saturation [default = %s]\n", pPars->fSatur? "yes": "no" ); - fprintf( stdout, "\t-z : toggle zero-cost replacements [default = %s]\n", pPars->fZeroCost? "yes": "no" ); - fprintf( stdout, "\t-f : toggle using only first node and first cut [default = %s]\n", pPars->fFirst? "yes": "no" ); - fprintf( stdout, "\t-o : toggle using old implementation [default = %s]\n", pPars->fOldAlgo? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-w : toggle detailed printout of decomposed functions [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *lp [-h]\n" ); + Abc_Print( -2, "usage: lutpack [-N <num>] [-Q <num>] [-S <num>] [-L <num>] [-szfovwh]\n" ); + Abc_Print( -2, "\t performs \"rewriting\" for LUT network;\n" ); + Abc_Print( -2, "\t determines LUT size as the max fanin count of a node;\n" ); + Abc_Print( -2, "\t if the network is not LUT-mapped, packs it into 6-LUTs\n" ); + Abc_Print( -2, "\t (there is another command for resynthesis after LUT mapping, \"imfs\")\n" ); + Abc_Print( -2, "\t-N <num> : the max number of LUTs in the structure (2 <= num) [default = %d]\n", pPars->nLutsMax ); + Abc_Print( -2, "\t-Q <num> : the max number of LUTs not in MFFC (0 <= num) [default = %d]\n", pPars->nLutsOver ); + Abc_Print( -2, "\t-S <num> : the max number of LUT inputs shared (0 <= num <= 3) [default = %d]\n", pPars->nVarsShared ); + Abc_Print( -2, "\t-L <num> : max level increase after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); + Abc_Print( -2, "\t-s : toggle iteration till saturation [default = %s]\n", pPars->fSatur? "yes": "no" ); + Abc_Print( -2, "\t-z : toggle zero-cost replacements [default = %s]\n", pPars->fZeroCost? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle using only first node and first cut [default = %s]\n", pPars->fFirst? "yes": "no" ); + Abc_Print( -2, "\t-o : toggle using old implementation [default = %s]\n", pPars->fOldAlgo? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle detailed printout of decomposed functions [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); */ return 1; } @@ -20693,7 +21067,7 @@ int Abc_CommandAbc8Balance( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8Balance(): There is no AIG to synthesize.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Balance(): There is no AIG to synthesize.\n" ); return 1; } @@ -20701,7 +21075,7 @@ int Abc_CommandAbc8Balance( Abc_Frame_t * pAbc, int argc, char ** argv ) pAigNew = Dar_ManBalanceXor( pAbc->pAbc8Aig, fExor, fUpdateLevel, fVerbose ); if ( pAigNew == NULL ) { - printf( "Abc_CommandAbc8Balance(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Balance(): Tranformation has failed.\n" ); return 1; } Aig_ManStop( pAbc->pAbc8Aig ); @@ -20709,12 +21083,12 @@ int Abc_CommandAbc8Balance( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *b [-xlvh]\n" ); - fprintf( stdout, "\t performs balanacing of the AIG\n" ); - fprintf( stdout, "\t-x : toggle using XOR-balancing [default = %s]\n", fExor? "yes": "no" ); - fprintf( stdout, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *b [-xlvh]\n" ); + Abc_Print( -2, "\t performs balancing of the AIG\n" ); + Abc_Print( -2, "\t-x : toggle using XOR-balancing [default = %s]\n", fExor? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle updating level [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -20738,7 +21112,6 @@ int Abc_CommandAbc8Speedup( Abc_Frame_t * pAbc, int argc, char ** argv ) int Degree = 5; int fVerbose = 0; int fVeryVerbose = 0; - extern Aig_Man_t * Nwk_ManSpeedup( void * pNtk, int fUseLutLib, int Percentage, int Degree, int fVerbose, int fVeryVerbose ); // set defaults fUseLutLib = 0; @@ -20754,7 +21127,7 @@ int Abc_CommandAbc8Speedup( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } Percentage = atoi(argv[globalUtilOptind]); @@ -20765,7 +21138,7 @@ int Abc_CommandAbc8Speedup( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } Degree = atoi(argv[globalUtilOptind]); @@ -20790,14 +21163,14 @@ int Abc_CommandAbc8Speedup( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Speedup(): There is no mapped network to strash.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Speedup(): There is no mapped network to strash.\n" ); return 1; } pAigNew = Nwk_ManSpeedup( pAbc->pAbc8Nwk, fUseLutLib, Percentage, Degree, fVerbose, fVeryVerbose ); if ( pAigNew == NULL ) { - printf( "Abc_CommandAbc8Speedup(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Speedup(): Tranformation has failed.\n" ); return 1; } Aig_ManStop( pAbc->pAbc8Aig ); @@ -20805,15 +21178,15 @@ int Abc_CommandAbc8Speedup( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *speedup [-P num] [-N num] [-lvwh]\n" ); - fprintf( stdout, "\t transforms LUT-mapped network into an AIG with choices;\n" ); - fprintf( stdout, "\t the choices are added to speedup the next round of mapping\n" ); - fprintf( stdout, "\t-P <num> : delay delta defining critical path for library model [default = %d%%]\n", Percentage ); - fprintf( stdout, "\t-N <num> : the max critical path degree for resynthesis (0 < num < 6) [default = %d]\n", Degree ); - fprintf( stdout, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib" : "unit" ); - fprintf( stdout, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-w : toggle printing detailed stats for each node [default = %s]\n", fVeryVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *speedup [-P num] [-N num] [-lvwh]\n" ); + Abc_Print( -2, "\t transforms LUT-mapped network into an AIG with choices;\n" ); + Abc_Print( -2, "\t the choices are added to speedup the next round of mapping\n" ); + Abc_Print( -2, "\t-P <num> : delay delta defining critical path for library model [default = %d%%]\n", Percentage ); + Abc_Print( -2, "\t-N <num> : the max critical path degree for resynthesis (0 < num < 6) [default = %d]\n", Degree ); + Abc_Print( -2, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib" : "unit" ); + Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -20833,7 +21206,6 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv ) Nwk_LMPars_t Pars, * pPars = &Pars; Vec_Int_t * vResult; int c; - extern Vec_Int_t * Nwk_ManLutMerge( void * pNtk, Nwk_LMPars_t * pPars ); // set defaults memset( pPars, 0, sizeof(Nwk_LMPars_t) ); @@ -20854,7 +21226,7 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLutSize = atoi(argv[globalUtilOptind]); @@ -20865,7 +21237,7 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxSuppSize = atoi(argv[globalUtilOptind]); @@ -20876,7 +21248,7 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxDistance = atoi(argv[globalUtilOptind]); @@ -20887,7 +21259,7 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLevelDiff = atoi(argv[globalUtilOptind]); @@ -20898,7 +21270,7 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxFanout = atoi(argv[globalUtilOptind]); @@ -20926,7 +21298,7 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Speedup(): There is no mapped network to merge LUTs.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Speedup(): There is no mapped network to merge LUTs.\n" ); return 1; } @@ -20935,18 +21307,18 @@ int Abc_CommandAbc8Merge( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *merge [-NSDLF num] [-scwvh]\n" ); - fprintf( stdout, "\t creates pairs of topologically-related LUTs\n" ); - fprintf( stdout, "\t-N <num> : the max LUT size for merging (1 < num) [default = %d]\n", pPars->nMaxLutSize ); - fprintf( stdout, "\t-S <num> : the max total support size after merging (1 < num) [default = %d]\n", pPars->nMaxSuppSize ); - fprintf( stdout, "\t-D <num> : the max distance in terms of LUTs (0 < num) [default = %d]\n", pPars->nMaxDistance ); - fprintf( stdout, "\t-L <num> : the max difference in levels (0 <= num) [default = %d]\n", pPars->nMaxLevelDiff ); - fprintf( stdout, "\t-F <num> : the max number of fanouts to stop traversal (0 < num) [default = %d]\n", pPars->nMaxFanout ); - fprintf( stdout, "\t-s : toggle the use of nodes without support overlap [default = %s]\n", pPars->fUseDiffSupp? "yes" : "no" ); - fprintf( stdout, "\t-c : toggle the use of TFI/TFO nodes as candidates [default = %s]\n", pPars->fUseTfiTfo? "yes" : "no" ); - fprintf( stdout, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *merge [-NSDLF num] [-scwvh]\n" ); + Abc_Print( -2, "\t creates pairs of topologically-related LUTs\n" ); + Abc_Print( -2, "\t-N <num> : the max LUT size for merging (1 < num) [default = %d]\n", pPars->nMaxLutSize ); + Abc_Print( -2, "\t-S <num> : the max total support size after merging (1 < num) [default = %d]\n", pPars->nMaxSuppSize ); + Abc_Print( -2, "\t-D <num> : the max distance in terms of LUTs (0 < num) [default = %d]\n", pPars->nMaxDistance ); + Abc_Print( -2, "\t-L <num> : the max difference in levels (0 <= num) [default = %d]\n", pPars->nMaxLevelDiff ); + Abc_Print( -2, "\t-F <num> : the max number of fanouts to stop traversal (0 < num) [default = %d]\n", pPars->nMaxFanout ); + Abc_Print( -2, "\t-s : toggle the use of nodes without support overlap [default = %s]\n", pPars->fUseDiffSupp? "yes" : "no" ); + Abc_Print( -2, "\t-c : toggle the use of TFI/TFO nodes as candidates [default = %s]\n", pPars->fUseTfiTfo? "yes" : "no" ); + Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -20963,8 +21335,7 @@ usage: ***********************************************************************/ int Abc_CommandAbc8Insert( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern void * Ntl_ManInsertNtk( void * p, void * pNtk ); - void * pNtlNew; + Ntl_Man_t * pNtlNew; int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) @@ -20979,12 +21350,12 @@ int Abc_CommandAbc8Insert( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Insert(): There is no design.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Insert(): There is no design.\n" ); return 1; } if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Insert(): There is no network to insert.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Insert(): There is no network to insert.\n" ); return 1; } pNtlNew = Ntl_ManInsertNtk( pAbc->pAbc8Ntl, pAbc->pAbc8Nwk ); @@ -20993,9 +21364,9 @@ int Abc_CommandAbc8Insert( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *insert [-h]\n" ); - fprintf( stdout, "\t inserts the mapped network into the netlist\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *insert [-h]\n" ); + Abc_Print( -2, "\t inserts the mapped network into the netlist\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -21013,8 +21384,7 @@ usage: ***********************************************************************/ int Abc_CommandAbc8ClpLut( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern void * Ntl_ManDupCollapseLuts( void * p ); - void * pNtlNew; + Ntl_Man_t * pNtlNew; int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) @@ -21029,7 +21399,7 @@ int Abc_CommandAbc8ClpLut( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Insert(): There is no design.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Insert(): There is no design.\n" ); return 1; } pNtlNew = Ntl_ManDupCollapseLuts( pAbc->pAbc8Ntl ); @@ -21039,9 +21409,9 @@ int Abc_CommandAbc8ClpLut( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *clplut [-h]\n" ); - fprintf( stdout, "\t collapses comb white boxes whose model name begins with \"LUT\"\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *clplut [-h]\n" ); + Abc_Print( -2, "\t collapses comb white boxes whose model name begins with \"LUT\"\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* @@ -21057,14 +21427,12 @@ usage: ***********************************************************************/ int Abc_CommandAbc8Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) { - void * pNtlNew, * pNtlOld; + Ntl_Man_t * pNtlNew, * pNtlOld; int c, fVerbose; int nPartSize; int nConfLimit; int nLevelMax; int fUseCSat; - extern void * Ntl_ManFraig( void * p, int nPartSize, int nConfLimit, int nLevelMax, int fUseCSat, int fVerbose ); - extern void Ntl_ManFree( void * p ); // set defaults nPartSize = 0; @@ -21080,7 +21448,7 @@ int Abc_CommandAbc8Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPartSize = atoi(argv[globalUtilOptind]); @@ -21091,7 +21459,7 @@ int Abc_CommandAbc8Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); @@ -21102,7 +21470,7 @@ int Abc_CommandAbc8Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLevelMax = atoi(argv[globalUtilOptind]); @@ -21125,7 +21493,7 @@ int Abc_CommandAbc8Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Fraig(): There is no design to SAT sweep.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Fraig(): There is no design to SAT sweep.\n" ); return 1; } @@ -21134,7 +21502,7 @@ int Abc_CommandAbc8Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtlNew = Ntl_ManFraig( pNtlOld, nPartSize, nConfLimit, nLevelMax, fUseCSat, fVerbose ); if ( pNtlNew == NULL ) { - printf( "Abc_CommandAbc8Fraig(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Fraig(): Tranformation has failed.\n" ); return 1; } @@ -21142,26 +21510,26 @@ int Abc_CommandAbc8Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) pAbc->pAbc8Ntl = pNtlNew; if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Fraig(): Reading BLIF has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Fraig(): Reading BLIF has failed.\n" ); return 1; } pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8Fraig(): AIG extraction has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Fraig(): AIG extraction has failed.\n" ); return 1; } return 0; usage: - fprintf( stdout, "usage: *fraig [-P num] [-C num] [-L num] [-vh]\n" ); - fprintf( stdout, "\t applies SAT sweeping to netlist with white-boxes\n" ); - fprintf( stdout, "\t-P num : partition size (0 = partitioning is not used) [default = %d]\n", nPartSize ); - fprintf( stdout, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - fprintf( stdout, "\t-L num : limit on node level to fraig (0 = fraig all nodes) [default = %d]\n", nLevelMax ); -// fprintf( stdout, "\t-c : toggle using new AIG package and SAT solver [default = %s]\n", fUseCSat? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *fraig [-P num] [-C num] [-L num] [-vh]\n" ); + Abc_Print( -2, "\t applies SAT sweeping to netlist with white-boxes\n" ); + Abc_Print( -2, "\t-P num : partition size (0 = partitioning is not used) [default = %d]\n", nPartSize ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); + Abc_Print( -2, "\t-L num : limit on node level to fraig (0 = fraig all nodes) [default = %d]\n", nLevelMax ); +// Abc_Print( -2, "\t-c : toggle using new AIG package and SAT solver [default = %s]\n", fUseCSat? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -21178,13 +21546,11 @@ usage: ***********************************************************************/ int Abc_CommandAbc8Scl( Abc_Frame_t * pAbc, int argc, char ** argv ) { - void * pNtlNew, * pNtlOld; + Ntl_Man_t * pNtlNew, * pNtlOld; int c; int fLatchConst; int fLatchEqual; int fVerbose; - extern void * Ntl_ManScl( void * p, int fLatchConst, int fLatchEqual, int fVerbose ); - extern int Ntl_ManIsComb( void * p ); // set defaults fLatchConst = 1; @@ -21213,13 +21579,13 @@ int Abc_CommandAbc8Scl( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Scl(): There is no design to SAT sweep.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Scl(): There is no design to SAT sweep.\n" ); return 1; } if ( Ntl_ManIsComb(pAbc->pAbc8Ntl) ) { - fprintf( stdout, "Abc_CommandAbc8Scl(): The network is combinational.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Scl(): The network is combinational.\n" ); return 0; } @@ -21228,7 +21594,7 @@ int Abc_CommandAbc8Scl( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtlNew = Ntl_ManScl( pNtlOld, fLatchConst, fLatchEqual, fVerbose ); if ( pNtlNew == NULL ) { - printf( "Abc_CommandAbc8Scl(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Scl(): Tranformation has failed.\n" ); return 1; } @@ -21236,25 +21602,25 @@ int Abc_CommandAbc8Scl( Abc_Frame_t * pAbc, int argc, char ** argv ) pAbc->pAbc8Ntl = pNtlNew; if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Scl(): Reading BLIF has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Scl(): Reading BLIF has failed.\n" ); return 1; } pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8Scl(): AIG extraction has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Scl(): AIG extraction has failed.\n" ); return 1; } return 0; usage: - fprintf( stdout, "usage: *scl [-cevh]\n" ); - fprintf( stdout, "\t performs sequential cleanup of the netlist\n" ); - fprintf( stdout, "\t by removing nodes and latches that do not feed into POs\n" ); - fprintf( stdout, "\t-c : sweep stuck-at latches detected by ternary simulation [default = %s]\n", fLatchConst? "yes": "no" ); - fprintf( stdout, "\t-e : merge equal latches (same data inputs and init states) [default = %s]\n", fLatchEqual? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *scl [-cevh]\n" ); + Abc_Print( -2, "\t performs sequential cleanup of the netlist\n" ); + Abc_Print( -2, "\t by removing nodes and latches that do not feed into POs\n" ); + Abc_Print( -2, "\t-c : sweep stuck-at latches detected by ternary simulation [default = %s]\n", fLatchConst? "yes": "no" ); + Abc_Print( -2, "\t-e : merge equal latches (same data inputs and init states) [default = %s]\n", fLatchEqual? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -21271,15 +21637,13 @@ usage: ***********************************************************************/ int Abc_CommandAbc8Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) { - void * pNtlNew, * pNtlOld; + Ntl_Man_t * pNtlNew, * pNtlOld; int c; int fScorrGia; int fUseCSat; int nFramesP; int nConfMax; int fVerbose; - extern void * Ntl_ManLcorr( void * p, int nConfMax, int fScorrGia, int fUseCSat, int fVerbose ); - extern int Ntl_ManIsComb( void * p ); // set defaults fScorrGia = 0; @@ -21295,7 +21659,7 @@ int Abc_CommandAbc8Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nFramesP = atoi(argv[globalUtilOptind]); @@ -21306,7 +21670,7 @@ int Abc_CommandAbc8Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfMax = atoi(argv[globalUtilOptind]); @@ -21332,13 +21696,13 @@ int Abc_CommandAbc8Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Lcorr(): There is no design to SAT sweep.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Lcorr(): There is no design to SAT sweep.\n" ); return 1; } if ( Ntl_ManIsComb(pAbc->pAbc8Ntl) ) { - fprintf( stdout, "Abc_CommandAbc8Lcorr(): The network is combinational.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Lcorr(): The network is combinational.\n" ); return 0; } @@ -21347,7 +21711,7 @@ int Abc_CommandAbc8Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtlNew = Ntl_ManLcorr( pNtlOld, nConfMax, fScorrGia, fUseCSat, fVerbose ); if ( pNtlNew == NULL ) { - printf( "Abc_CommandAbc8Lcorr(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Lcorr(): Tranformation has failed.\n" ); return 1; } @@ -21355,26 +21719,26 @@ int Abc_CommandAbc8Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) pAbc->pAbc8Ntl = pNtlNew; if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Lcorr(): Reading BLIF has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Lcorr(): Reading BLIF has failed.\n" ); return 1; } pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8Lcorr(): AIG extraction has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Lcorr(): AIG extraction has failed.\n" ); return 1; } return 0; usage: - fprintf( stdout, "usage: *lcorr [-C num] [-ncvh]\n" ); - fprintf( stdout, "\t computes latch correspondence for the netlist\n" ); -// fprintf( stdout, "\t-P num : number of time frames to use as the prefix [default = %d]\n", nFramesP ); - fprintf( stdout, "\t-C num : max conflict number when proving latch equivalence [default = %d]\n", nConfMax ); - fprintf( stdout, "\t-n : toggle using new AIG package [default = %s]\n", fScorrGia? "yes": "no" ); - fprintf( stdout, "\t-c : toggle using new AIG package and SAT solver [default = %s]\n", fUseCSat? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *lcorr [-C num] [-ncvh]\n" ); + Abc_Print( -2, "\t computes latch correspondence for the netlist\n" ); +// Abc_Print( -2, "\t-P num : number of time frames to use as the prefix [default = %d]\n", nFramesP ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfMax ); + Abc_Print( -2, "\t-n : toggle using new AIG package [default = %s]\n", fScorrGia? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle using new AIG package and SAT solver [default = %s]\n", fUseCSat? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -21391,11 +21755,9 @@ usage: ***********************************************************************/ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) { - void * pNtlNew, * pNtlOld; + Ntl_Man_t * pNtlNew, * pNtlOld; Fra_Ssw_t Pars, * pPars = &Pars; int c; - extern void * Ntl_ManSsw( void * p, Fra_Ssw_t * pPars ); - extern int Ntl_ManIsComb( void * p ); // set defaults pPars->nPartSize = 0; @@ -21421,7 +21783,7 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } pPars->nPartSize = atoi(argv[globalUtilOptind]); @@ -21432,7 +21794,7 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'Q': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-Q\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-Q\" should be followed by an integer.\n" ); goto usage; } pPars->nOverSize = atoi(argv[globalUtilOptind]); @@ -21443,7 +21805,7 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesP = atoi(argv[globalUtilOptind]); @@ -21454,7 +21816,7 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesK = atoi(argv[globalUtilOptind]); @@ -21465,7 +21827,7 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxImps = atoi(argv[globalUtilOptind]); @@ -21476,7 +21838,7 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLevs = atoi(argv[globalUtilOptind]); @@ -21487,7 +21849,7 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nMinDomSize = atoi(argv[globalUtilOptind]); @@ -21525,25 +21887,25 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Ssw(): There is no design to SAT sweep.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Ssw(): There is no design to SAT sweep.\n" ); return 1; } if ( Ntl_ManIsComb(pAbc->pAbc8Ntl) ) { - fprintf( stdout, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } if ( pPars->nFramesK > 1 && pPars->fUse1Hot ) { - printf( "Currrently can only use one-hotness for simple induction (K=1).\n" ); + Abc_Print( -1, "Currrently can only use one-hotness for simple induction (K=1).\n" ); return 0; } if ( pPars->nFramesP && pPars->fUse1Hot ) { - printf( "Currrently can only use one-hotness without prefix.\n" ); + Abc_Print( -1, "Currrently can only use one-hotness without prefix.\n" ); return 0; } @@ -21552,7 +21914,7 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtlNew = Ntl_ManSsw( pNtlOld, pPars ); if ( pNtlNew == NULL ) { - printf( "Abc_CommandAbc8Ssw(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Ssw(): Tranformation has failed.\n" ); return 1; } @@ -21560,35 +21922,35 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv ) pAbc->pAbc8Ntl = pNtlNew; if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Ssw(): Reading BLIF has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Ssw(): Reading BLIF has failed.\n" ); return 1; } pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8Ssw(): AIG extraction has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Ssw(): AIG extraction has failed.\n" ); return 1; } return 0; usage: - fprintf( stdout, "usage: *ssw [-PQNFLD num] [-lrfetvh]\n" ); - fprintf( stdout, "\t performs sequential sweep using K-step induction on the netlist \n" ); - fprintf( stdout, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); - fprintf( stdout, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); - fprintf( stdout, "\t-N num : number of time frames to use as the prefix [default = %d]\n", pPars->nFramesP ); - fprintf( stdout, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); - fprintf( stdout, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); - fprintf( stdout, "\t-D num : min size of a clock domain used for synthesis [default = %d]\n", pPars->nMinDomSize ); -// fprintf( stdout, "\t-I num : max number of implications to consider [default = %d]\n", pPars->nMaxImps ); -// fprintf( stdout, "\t-i : toggle using implications [default = %s]\n", pPars->fUseImps? "yes": "no" ); - fprintf( stdout, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); - fprintf( stdout, "\t-r : toggle AIG rewriting [default = %s]\n", pPars->fRewrite? "yes": "no" ); - fprintf( stdout, "\t-f : toggle fraiging (combinational SAT sweeping) [default = %s]\n", pPars->fFraiging? "yes": "no" ); - fprintf( stdout, "\t-e : toggle writing implications as assertions [default = %s]\n", pPars->fWriteImps? "yes": "no" ); - fprintf( stdout, "\t-t : toggle using one-hotness conditions [default = %s]\n", pPars->fUse1Hot? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *ssw [-PQNFLD num] [-lrfetvh]\n" ); + Abc_Print( -2, "\t performs sequential sweep using K-step induction on the netlist \n" ); + Abc_Print( -2, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); + Abc_Print( -2, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); + Abc_Print( -2, "\t-N num : number of time frames to use as the prefix [default = %d]\n", pPars->nFramesP ); + Abc_Print( -2, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); + Abc_Print( -2, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); + Abc_Print( -2, "\t-D num : min size of a clock domain used for synthesis [default = %d]\n", pPars->nMinDomSize ); +// Abc_Print( -2, "\t-I num : max number of implications to consider [default = %d]\n", pPars->nMaxImps ); +// Abc_Print( -2, "\t-i : toggle using implications [default = %s]\n", pPars->fUseImps? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); + Abc_Print( -2, "\t-r : toggle AIG rewriting [default = %s]\n", pPars->fRewrite? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle fraiging (combinational SAT sweeping) [default = %s]\n", pPars->fFraiging? "yes": "no" ); + Abc_Print( -2, "\t-e : toggle writing implications as assertions [default = %s]\n", pPars->fWriteImps? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle using one-hotness conditions [default = %s]\n", pPars->fUse1Hot? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -21605,23 +21967,21 @@ usage: ***********************************************************************/ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) { - void * pNtlNew, * pNtlOld; + Ntl_Man_t * pNtlNew, * pNtlOld; Ssw_Pars_t Pars, * pPars = &Pars; int c; - extern void * Ntl_ManScorr( void * p, Ssw_Pars_t * pPars ); - extern int Ntl_ManIsComb( void * p ); // set defaults Ssw_ManSetDefaultParams( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "PQFCLNSDVMpldsncvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "PQFCLSDVMpldsncvh" ) ) != EOF ) { switch ( c ) { case 'P': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } pPars->nPartSize = atoi(argv[globalUtilOptind]); @@ -21632,7 +21992,7 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'Q': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-Q\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-Q\" should be followed by an integer.\n" ); goto usage; } pPars->nOverSize = atoi(argv[globalUtilOptind]); @@ -21643,7 +22003,7 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesK = atoi(argv[globalUtilOptind]); @@ -21654,7 +22014,7 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -21665,7 +22025,7 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLevs = atoi(argv[globalUtilOptind]); @@ -21673,21 +22033,10 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pPars->nMaxLevs <= 0 ) goto usage; break; - case 'N': - if ( globalUtilOptind >= argc ) - { - fprintf( stdout, "Command line switch \"-N\" should be followed by an integer.\n" ); - goto usage; - } - pPars->nConstrs = atoi(argv[globalUtilOptind]); - globalUtilOptind++; - if ( pPars->nConstrs < 0 ) - goto usage; - break; case 'S': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nFramesAddSim = atoi(argv[globalUtilOptind]); @@ -21698,7 +22047,7 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nMinDomSize = atoi(argv[globalUtilOptind]); @@ -21709,7 +22058,7 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'V': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-V\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-V\" should be followed by an integer.\n" ); goto usage; } pPars->nSatVarMax2 = atoi(argv[globalUtilOptind]); @@ -21720,7 +22069,7 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'M': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-M\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nRecycleCalls2 = atoi(argv[globalUtilOptind]); @@ -21758,13 +22107,13 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Ssw(): There is no design to SAT sweep.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Ssw(): There is no design to SAT sweep.\n" ); return 1; } if ( Ntl_ManIsComb(pAbc->pAbc8Ntl) ) { - fprintf( stdout, "The network is combinational.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); return 0; } @@ -21772,7 +22121,7 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) { pPars->nPartSize = 0; pPars->nOverSize = 0; - printf( "With dynamic partitioning (-d) enabled, static one (-P <num> -Q <num>) is ignored.\n" ); + Abc_Print( -1, "With dynamic partitioning (-d) enabled, static one (-P <num> -Q <num>) is ignored.\n" ); } // get the input file name @@ -21780,7 +22129,7 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) pNtlNew = Ntl_ManScorr( pNtlOld, pPars ); if ( pNtlNew == NULL ) { - printf( "Abc_CommandAbc8Scorr(): Tranformation of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Scorr(): Tranformation has failed.\n" ); return 1; } @@ -21788,38 +22137,37 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) pAbc->pAbc8Ntl = pNtlNew; if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Scorr(): Reading BLIF has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Scorr(): Reading BLIF has failed.\n" ); return 1; } pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8Scorr(): AIG extraction has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Scorr(): AIG extraction has failed.\n" ); return 1; } return 0; usage: - fprintf( stdout, "usage: *scorr [-PQFCLNSDVM <num>] [-pldsncvh]\n" ); - fprintf( stdout, "\t performs sequential sweep using K-step induction\n" ); - fprintf( stdout, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); - fprintf( stdout, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); - fprintf( stdout, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); - fprintf( stdout, "\t-C num : max number of conflicts at a node (0=inifinite) [default = %d]\n", pPars->nBTLimit ); - fprintf( stdout, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); - fprintf( stdout, "\t-N num : number of last POs treated as constraints (0=none) [default = %d]\n", pPars->nConstrs ); - fprintf( stdout, "\t-S num : additional simulation frames for c-examples (0=none) [default = %d]\n", pPars->nFramesAddSim ); - fprintf( stdout, "\t-D num : min size of a clock domain used for synthesis [default = %d]\n", pPars->nMinDomSize ); - fprintf( stdout, "\t-V num : min var num needed to recycle the SAT solver [default = %d]\n", pPars->nSatVarMax2 ); - fprintf( stdout, "\t-M num : min call num needed to recycle the SAT solver [default = %d]\n", pPars->nRecycleCalls2 ); - fprintf( stdout, "\t-p : toggle alighning polarity of SAT variables [default = %s]\n", pPars->fPolarFlip? "yes": "no" ); - fprintf( stdout, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); - fprintf( stdout, "\t-d : toggle dynamic addition of constraints [default = %s]\n", pPars->fDynamic? "yes": "no" ); - fprintf( stdout, "\t-s : toggle local simulation in the cone of influence [default = %s]\n", pPars->fLocalSim? "yes": "no" ); - fprintf( stdout, "\t-n : toggle using new AIG package [default = %s]\n", pPars->fScorrGia? "yes": "no" ); - fprintf( stdout, "\t-c : toggle using new AIG package and SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); - fprintf( stdout, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *scorr [-PQFCLSDVM <num>] [-pldsncvh]\n" ); + Abc_Print( -2, "\t performs sequential sweep using K-step induction\n" ); + Abc_Print( -2, "\t-P num : max partition size (0 = no partitioning) [default = %d]\n", pPars->nPartSize ); + Abc_Print( -2, "\t-Q num : partition overlap (0 = no overlap) [default = %d]\n", pPars->nOverSize ); + Abc_Print( -2, "\t-F num : number of time frames for induction (1=simple) [default = %d]\n", pPars->nFramesK ); + Abc_Print( -2, "\t-C num : max number of conflicts at a node (0=inifinite) [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-L num : max number of levels to consider (0=all) [default = %d]\n", pPars->nMaxLevs ); + Abc_Print( -2, "\t-S num : additional simulation frames for c-examples (0=none) [default = %d]\n", pPars->nFramesAddSim ); + Abc_Print( -2, "\t-D num : min size of a clock domain used for synthesis [default = %d]\n", pPars->nMinDomSize ); + Abc_Print( -2, "\t-V num : min var num needed to recycle the SAT solver [default = %d]\n", pPars->nSatVarMax2 ); + Abc_Print( -2, "\t-M num : min call num needed to recycle the SAT solver [default = %d]\n", pPars->nRecycleCalls2 ); + Abc_Print( -2, "\t-p : toggle alighning polarity of SAT variables [default = %s]\n", pPars->fPolarFlip? "yes": "no" ); + Abc_Print( -2, "\t-l : toggle latch correspondence only [default = %s]\n", pPars->fLatchCorr? "yes": "no" ); + Abc_Print( -2, "\t-d : toggle dynamic addition of constraints [default = %s]\n", pPars->fDynamic? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle local simulation in the cone of influence [default = %s]\n", pPars->fLocalSim? "yes": "no" ); + Abc_Print( -2, "\t-n : toggle using new AIG package [default = %s]\n", pPars->fScorrGia? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle using new AIG package and SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -21836,15 +22184,11 @@ usage: ***********************************************************************/ int Abc_CommandAbc8Sweep( Abc_Frame_t * pAbc, int argc, char ** argv ) { - void * pNtlTemp; + Ntl_Man_t * pNtlTemp; int Counter; int fMapped; int fVerbose; int c; - extern int Ntl_ManSweep( void * p, int fVerbose ); - extern void * Ntl_ManInsertNtk( void * p, void * pNtk ); - extern Aig_Man_t * Ntl_ManExtract( void * p ); - extern void * Ntl_ManExtractNwk( void * p, Aig_Man_t * pAig, Tim_Man_t * pManTime ); // set defaults fMapped = 0; @@ -21868,7 +22212,7 @@ int Abc_CommandAbc8Sweep( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Sweep(): There is no design to sweep.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Sweep(): There is no design to sweep.\n" ); return 1; } @@ -21877,13 +22221,13 @@ int Abc_CommandAbc8Sweep( Abc_Frame_t * pAbc, int argc, char ** argv ) { if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Sweep(): There is no mapped network to sweep.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Sweep(): There is no mapped network to sweep.\n" ); return 1; } pNtlTemp = Ntl_ManInsertNtk( pAbc->pAbc8Ntl, pAbc->pAbc8Nwk ); if ( pNtlTemp == NULL ) { - printf( "Abc_CommandAbc8Sweep(): Inserting mapped network has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Sweep(): Inserting mapped network has failed.\n" ); return 1; } Abc_FrameClearDesign(); @@ -21893,7 +22237,7 @@ int Abc_CommandAbc8Sweep( Abc_Frame_t * pAbc, int argc, char ** argv ) // sweep the current design Counter = Ntl_ManSweep( pAbc->pAbc8Ntl, fVerbose ); if ( Counter == 0 && fVerbose ) - printf( "The netlist is unchanged by sweep.\n" ); + Abc_Print( -1, "The netlist is unchanged by sweep.\n" ); // if mapped, create new AIG and new mapped network if ( fMapped ) @@ -21901,13 +22245,13 @@ int Abc_CommandAbc8Sweep( Abc_Frame_t * pAbc, int argc, char ** argv ) pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8Sweep(): AIG extraction has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Sweep(): AIG extraction has failed.\n" ); return 1; } pAbc->pAbc8Nwk = Ntl_ManExtractNwk( pAbc->pAbc8Ntl, pAbc->pAbc8Aig, NULL ); if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Sweep(): Failed to extract the mapped network.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Sweep(): Failed to extract the mapped network.\n" ); return 1; } } @@ -21920,19 +22264,19 @@ int Abc_CommandAbc8Sweep( Abc_Frame_t * pAbc, int argc, char ** argv ) pAbc->pAbc8Aig = Ntl_ManExtract( pAbc->pAbc8Ntl ); if ( pAbc->pAbc8Aig == NULL ) { - printf( "Abc_CommandAbc8Sweep(): AIG extraction has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Sweep(): AIG extraction has failed.\n" ); return 1; } } return 0; usage: - fprintf( stdout, "usage: *sw [-mvh]\n" ); - fprintf( stdout, "\t performs structural sweep of the netlist\n" ); - fprintf( stdout, "\t removes dangling nodes, registers, and white-boxes\n" ); - fprintf( stdout, "\t-m : inserts mapped network into netlist and sweeps it [default = %s]\n", fMapped? "yes": "no" ); - fprintf( stdout, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *sw [-mvh]\n" ); + Abc_Print( -2, "\t performs structural sweep of the netlist\n" ); + Abc_Print( -2, "\t removes dangling nodes, registers, and white-boxes\n" ); + Abc_Print( -2, "\t-m : inserts mapped network into netlist and sweeps it [default = %s]\n", fMapped? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -21949,10 +22293,9 @@ usage: ***********************************************************************/ int Abc_CommandAbc8Zero( Abc_Frame_t * pAbc, int argc, char ** argv ) { - void * pNtlNew; + Ntl_Man_t * pNtlNew; int fVerbose; int c; - extern void Ntl_ManTransformInitValues( void * p ); // set defaults fVerbose = 0; @@ -21972,7 +22315,7 @@ int Abc_CommandAbc8Zero( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Zero(): There is no design to convert.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Zero(): There is no design to convert.\n" ); return 1; } @@ -21987,10 +22330,10 @@ int Abc_CommandAbc8Zero( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *zero [-h]\n" ); - fprintf( stdout, "\t converts registers to have constant-0 initial value\n" ); - fprintf( stdout, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: *zero [-h]\n" ); + Abc_Print( -2, "\t converts registers to have constant-0 initial value\n" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22008,7 +22351,7 @@ usage: int Abc_CommandAbc8Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) { Aig_Man_t * pAig1, * pAig2; - void * pTemp1, * pTemp2; + Ntl_Man_t * pTemp1, * pTemp2; char ** pArgvNew; int nArgcNew; int c; @@ -22016,14 +22359,7 @@ int Abc_CommandAbc8Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) int nConfLimit; int fSmart; int nPartSize; - extern Aig_Man_t * Ntl_ManCollapse( void * p, int fSeq ); - extern void * Ntl_ManDup( void * pOld ); - extern void Ntl_ManFree( void * p ); - extern void * Ntl_ManInsertNtk( void * p, void * pNtk ); - - extern void Ntl_ManPrepareCecMans( void * pMan1, void * pMan2, Aig_Man_t ** ppAig1, Aig_Man_t ** ppAig2 ); - extern void Ntl_ManPrepareCec( char * pFileName1, char * pFileName2, Aig_Man_t ** ppMan1, Aig_Man_t ** ppMan2 ); - extern int Fra_FraigCecTop( Aig_Man_t * pMan1, Aig_Man_t * pMan2, int nConfLimit, int nPartSize, int fSmart, int fVerbose ); + extern int Fra_FraigCecTop( Aig_Man_t * pMan1, Aig_Man_t * pMan2, int nConfLimit, int nPartSize, int fSmart, int fVerbose ); // set defaults nConfLimit = 100000; @@ -22038,7 +22374,7 @@ int Abc_CommandAbc8Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); @@ -22049,7 +22385,7 @@ int Abc_CommandAbc8Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPartSize = atoi(argv[globalUtilOptind]); @@ -22072,7 +22408,7 @@ int Abc_CommandAbc8Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) nArgcNew = argc - globalUtilOptind; if ( nArgcNew != 0 && nArgcNew != 2 ) { - printf( "Currently can only compare current mapped network against the spec, or designs derived from two files.\n" ); + Abc_Print( -1, "Currently can only compare current mapped network against the spec, or designs derived from two files.\n" ); return 0; } if ( nArgcNew == 2 ) @@ -22088,15 +22424,15 @@ int Abc_CommandAbc8Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pAbc->pAbc8Ntl == NULL ) { - printf( "Abc_CommandAbc8Cec(): There is no design to verify.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Cec(): There is no design to verify.\n" ); return 1; } if ( pAbc->pAbc8Nwk == NULL ) { - printf( "Abc_CommandAbc8Cec(): There is no mapped network to verify.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Cec(): There is no mapped network to verify.\n" ); return 1; } -// printf( "Currently *cec works only for two designs given on command line.\n" ); +// Abc_Print( -1, "Currently *cec works only for two designs given on command line.\n" ); // insert the mapped network pTemp1 = Ntl_ManDup( pAbc->pAbc8Ntl ); @@ -22104,7 +22440,7 @@ int Abc_CommandAbc8Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( pTemp2 == NULL ) { Ntl_ManFree( pTemp1 ); - printf( "Abc_CommandAbc8Cec(): Inserting the design has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc8Cec(): Inserting the design has failed.\n" ); return 1; } Ntl_ManPrepareCecMans( pTemp1, pTemp2, &pAig1, &pAig2 ); @@ -22118,17 +22454,17 @@ int Abc_CommandAbc8Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *cec [-C num] [-P num] [-svh] <file1> <file2>\n" ); - fprintf( stdout, "\t performs combinational equivalence checking\n" ); - fprintf( stdout, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); - fprintf( stdout, "\t-P num : the partition size for partitioned CEC [default = %d]\n", nPartSize ); - fprintf( stdout, "\t-s : toggle smart and natural output partitioning [default = %s]\n", fSmart? "smart": "natural" ); - fprintf( stdout, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); - fprintf( stdout, "\tfile1 : (optional) the file with the first network\n"); - fprintf( stdout, "\tfile2 : (optional) the file with the second network\n"); - fprintf( stdout, "\t if no files are given, uses the current network and its spec\n"); - fprintf( stdout, "\t if two files are given, compares designs derived from files\n"); + Abc_Print( -2, "usage: *cec [-C num] [-P num] [-svh] <file1> <file2>\n" ); + Abc_Print( -2, "\t performs combinational equivalence checking\n" ); + Abc_Print( -2, "\t-C num : limit on the number of conflicts [default = %d]\n", nConfLimit ); + Abc_Print( -2, "\t-P num : the partition size for partitioned CEC [default = %d]\n", nPartSize ); + Abc_Print( -2, "\t-s : toggle smart and natural output partitioning [default = %s]\n", fSmart? "smart": "natural" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tfile1 : (optional) the file with the first network\n"); + Abc_Print( -2, "\tfile2 : (optional) the file with the second network\n"); + Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); + Abc_Print( -2, "\t if two files are given, compares designs derived from files\n"); return 1; } @@ -22153,7 +22489,6 @@ int Abc_CommandAbc8DSec( Abc_Frame_t * pAbc, int argc, char ** argv ) extern void Fra_SecSetDefaultParams( Fra_Sec_t * pSecPar ); extern int Fra_FraigSec( Aig_Man_t * p, Fra_Sec_t * pSecPar, Aig_Man_t ** ppResult ); - extern Aig_Man_t * Ntl_ManPrepareSec( char * pFileName1, char * pFileName2 ); // set defaults Fra_SecSetDefaultParams( pSecPar ); @@ -22169,7 +22504,7 @@ int Abc_CommandAbc8DSec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pSecPar->nFramesMax = atoi(argv[globalUtilOptind]); @@ -22204,7 +22539,7 @@ int Abc_CommandAbc8DSec( Abc_Frame_t * pAbc, int argc, char ** argv ) nArgcNew = argc - globalUtilOptind; if ( nArgcNew != 2 ) { - printf( "Only works for two designs written from files specified on the command line.\n" ); + Abc_Print( -1, "Only works for two designs written from files specified on the command line.\n" ); return 1; } @@ -22216,20 +22551,77 @@ int Abc_CommandAbc8DSec( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: *dsec [-F num] [-armfwvh] <file1> <file2>\n" ); - fprintf( stdout, "\t performs sequential equivalence checking for two designs\n" ); - fprintf( stdout, "\t-F num : the limit on the depth of induction [default = %d]\n", pSecPar->nFramesMax ); - fprintf( stdout, "\t-a : toggles the use of phase abstraction [default = %s]\n", pSecPar->fPhaseAbstract? "yes": "no" ); - fprintf( stdout, "\t-r : toggles forward retiming at the beginning [default = %s]\n", pSecPar->fRetimeFirst? "yes": "no" ); - fprintf( stdout, "\t-m : toggles min-register retiming [default = %s]\n", pSecPar->fRetimeRegs? "yes": "no" ); - fprintf( stdout, "\t-f : toggles the internal use of fraiging [default = %s]\n", pSecPar->fFraiging? "yes": "no" ); - fprintf( stdout, "\t-v : toggles verbose output [default = %s]\n", pSecPar->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-w : toggles additional verbose output [default = %s]\n", pSecPar->fVeryVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); - fprintf( stdout, "\tfile1 : the file with the first design\n"); - fprintf( stdout, "\tfile2 : the file with the second design\n"); -// fprintf( stdout, "\t if no files are given, uses the current network and its spec\n"); -// fprintf( stdout, "\t if one file is given, uses the current network and the file\n"); + Abc_Print( -2, "usage: *dsec [-F num] [-armfwvh] <file1> <file2>\n" ); + Abc_Print( -2, "\t performs sequential equivalence checking for two designs\n" ); + Abc_Print( -2, "\t-F num : the limit on the depth of induction [default = %d]\n", pSecPar->nFramesMax ); + Abc_Print( -2, "\t-a : toggles the use of phase abstraction [default = %s]\n", pSecPar->fPhaseAbstract? "yes": "no" ); + Abc_Print( -2, "\t-r : toggles forward retiming at the beginning [default = %s]\n", pSecPar->fRetimeFirst? "yes": "no" ); + Abc_Print( -2, "\t-m : toggles min-register retiming [default = %s]\n", pSecPar->fRetimeRegs? "yes": "no" ); + Abc_Print( -2, "\t-f : toggles the internal use of fraiging [default = %s]\n", pSecPar->fFraiging? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pSecPar->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggles additional verbose output [default = %s]\n", pSecPar->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\tfile1 : the file with the first design\n"); + Abc_Print( -2, "\tfile2 : the file with the second design\n"); +// Abc_Print( -2, "\t if no files are given, uses the current network and its spec\n"); +// Abc_Print( -2, "\t if one file is given, uses the current network and the file\n"); + return 1; +} + + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbcTestNew( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern int Abc_NtkTestProcedure( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 ); + + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); + int c; + + pNtk = Abc_FrameReadNtk(pAbc); + + // set defaults + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) + { + switch ( c ) + { + case 'h': + goto usage; + default: + goto usage; + } + } + + if ( pNtk == NULL ) + { + Abc_Print( -1, "Empty network.\n" ); + return 1; + } + + if ( !Abc_NtkIsStrash( pNtk) ) + { + Abc_Print( -1, "The current network is not an AIG. Cannot continue.\n" ); + return 1; + } + +// Abc_NtkTestProcedure( pNtk, NULL ); + + return 0; + +usage: + Abc_Print( -2, "usage: testnew [-h]\n" ); + Abc_Print( -2, "\t new testing procedure\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22269,7 +22661,7 @@ int Abc_CommandAbc9Read( Abc_Frame_t * pAbc, int argc, char ** argv ) nArgcNew = argc - globalUtilOptind; if ( nArgcNew != 1 ) { - printf( "There is no file name.\n" ); + Abc_Print( -1, "There is no file name.\n" ); return 1; } @@ -22281,31 +22673,24 @@ int Abc_CommandAbc9Read( Abc_Frame_t * pAbc, int argc, char ** argv ) *pTemp = '\\'; if ( (pFile = fopen( FileName, "r" )) == NULL ) { - fprintf( pAbc->Err, "Cannot open input file \"%s\". ", FileName ); + Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); if ( (FileName = Extra_FileGetSimilarName( FileName, ".aig", ".blif", ".pla", ".eqn", ".bench" )) ) - fprintf( pAbc->Err, "Did you mean \"%s\"?", FileName ); - fprintf( pAbc->Err, "\n" ); + Abc_Print( 1, "Did you mean \"%s\"?", FileName ); + Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); pAig = Gia_ReadAiger( FileName, 0 ); - if ( pAig == NULL ) - { - printf( "Reading AIGER has failed.\n" ); - return 0; - } - if ( pAbc->pAig ) - Gia_ManStop( pAbc->pAig ); - pAbc->pAig = pAig; + Abc_CommandUpdate9( pAbc, pAig ); return 0; usage: - fprintf( stdout, "usage: &r [-vh] <file>\n" ); - fprintf( stdout, "\t reads the current AIG from the AIGER file\n" ); - fprintf( stdout, "\t-v : toggles additional verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); - fprintf( stdout, "\t<file> : the file name\n"); + Abc_Print( -2, "usage: &r [-vh] <file>\n" ); + Abc_Print( -2, "\t reads the current AIG from the AIGER file\n" ); + Abc_Print( -2, "\t-v : toggles additional verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : the file name\n"); return 1; } @@ -22347,17 +22732,17 @@ int Abc_CommandAbc9Get( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( pAbc->pNtkCur == NULL ) { - printf( "There is no current network\n" ); + Abc_Print( -1, "There is no current network\n" ); return 1; } if ( !Abc_NtkIsStrash( pAbc->pNtkCur ) ) { - printf( "The current network should be strashed.\n" ); + Abc_Print( -1, "The current network should be strashed.\n" ); return 1; } // if ( Abc_NtkGetChoiceNum(pAbc->pNtkCur) ) // { -// printf( "Removing %d choices from the AIG.\n", Abc_NtkGetChoiceNum(pAbc->pNtkCur) ); +// Abc_Print( -1, "Removing %d choices from the AIG.\n", Abc_NtkGetChoiceNum(pAbc->pNtkCur) ); // Abc_AigCleanup(pAbc->pNtkCur->pManFunc); // } if ( Abc_NtkGetChoiceNum(pAbc->pNtkCur) ) @@ -22366,14 +22751,7 @@ int Abc_CommandAbc9Get( Abc_Frame_t * pAbc, int argc, char ** argv ) pMan = Abc_NtkToDar( pAbc->pNtkCur, 0, 1 ); pAig = Gia_ManFromAig( pMan ); Aig_ManStop( pMan ); - if ( pAig == NULL ) - { - printf( "Transferring AIG has failed.\n" ); - return 0; - } - if ( pAbc->pAig ) - Gia_ManStop( pAbc->pAig ); - pAbc->pAig = pAig; + Abc_CommandUpdate9( pAbc, pAig ); if ( fNames ) { pAig->vNamesIn = Abc_NtkCollectCiNames( pAbc->pNtkCur ); @@ -22382,12 +22760,12 @@ int Abc_CommandAbc9Get( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: &get [-nvh] <file>\n" ); - fprintf( stdout, "\t converts the network into an AIG and moves to the new ABC\n" ); - fprintf( stdout, "\t-n : toggles saving CI/CO names of the AIG [default = %s]\n", fNames? "yes": "no" ); - fprintf( stdout, "\t-v : toggles additional verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); - fprintf( stdout, "\t<file> : the file name\n"); + Abc_Print( -2, "usage: &get [-nvh] <file>\n" ); + Abc_Print( -2, "\t converts the network into an AIG and moves to the new ABC\n" ); + Abc_Print( -2, "\t-n : toggles saving CI/CO names of the AIG [default = %s]\n", fNames? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles additional verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : the file name\n"); return 1; } @@ -22407,14 +22785,13 @@ int Abc_CommandAbc9Put( Abc_Frame_t * pAbc, int argc, char ** argv ) extern Abc_Ntk_t * Abc_NtkFromAigPhase( Aig_Man_t * pMan ); extern Abc_Ntk_t * Abc_NtkFromDarChoices( Abc_Ntk_t * pNtkOld, Aig_Man_t * pMan ); Aig_Man_t * pMan; - FILE * pOut, * pErr; - Abc_Ntk_t * pNtk; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fVerbose; pNtk = Abc_FrameReadNtk(pAbc); - pOut = Abc_FrameReadOut(pAbc); - pErr = Abc_FrameReadErr(pAbc); + + // set defaults fVerbose = 0; @@ -22432,14 +22809,14 @@ int Abc_CommandAbc9Put( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - fprintf( pErr, "Empty network.\n" ); + Abc_Print( -1, "Empty network.\n" ); return 1; } - if ( Gia_ManHasDandling(pAbc->pAig) == 0 ) + if ( Gia_ManHasDangling(pAbc->pGia) == 0 ) { - pMan = Gia_ManToAig( pAbc->pAig, 0 ); + pMan = Gia_ManToAig( pAbc->pGia, 0 ); pNtk = Abc_NtkFromAigPhase( pMan ); pNtk->pName = Extra_UtilStrsav(pMan->pName); Aig_ManStop( pMan ); @@ -22447,27 +22824,28 @@ int Abc_CommandAbc9Put( Abc_Frame_t * pAbc, int argc, char ** argv ) else { Abc_Ntk_t * pNtkNoCh; -// printf( "Transforming AIG with %d choice nodes.\n", Gia_ManEquivCountClasses(pAbc->pAig) ); +// Abc_Print( -1, "Transforming AIG with %d choice nodes.\n", Gia_ManEquivCountClasses(pAbc->pGia) ); // create network without choices - pMan = Gia_ManToAig( pAbc->pAig, 0 ); + pMan = Gia_ManToAig( pAbc->pGia, 0 ); pNtkNoCh = Abc_NtkFromAigPhase( pMan ); pNtkNoCh->pName = Extra_UtilStrsav(pMan->pName); Aig_ManStop( pMan ); // derive network with choices - pMan = Gia_ManToAig( pAbc->pAig, 1 ); + pMan = Gia_ManToAig( pAbc->pGia, 1 ); pNtk = Abc_NtkFromDarChoices( pNtkNoCh, pMan ); Abc_NtkDelete( pNtkNoCh ); Aig_ManStop( pMan ); } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtk ); + Abc_FrameClearVerifStatus( pAbc ); return 0; usage: - fprintf( pErr, "usage: &put [-vh]\n" ); - fprintf( pErr, "\t transfer the current network into the old ABC\n" ); - fprintf( pErr, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( pErr, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &put [-vh]\n" ); + Abc_Print( -2, "\t transfer the current network into the old ABC\n" ); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22503,24 +22881,24 @@ int Abc_CommandAbc9Write( Abc_Frame_t * pAbc, int argc, char ** argv ) nArgcNew = argc - globalUtilOptind; if ( nArgcNew != 1 ) { - printf( "There is no file name.\n" ); + Abc_Print( -1, "There is no file name.\n" ); return 1; } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Write(): There is no AIG to write.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Write(): There is no AIG to write.\n" ); return 1; } // create the design to write pFileName = argv[globalUtilOptind]; - Gia_WriteAiger( pAbc->pAig, pFileName, 0, 0 ); + Gia_WriteAiger( pAbc->pGia, pFileName, 0, 0 ); return 0; usage: - fprintf( stdout, "usage: &w [-h] <file>\n" ); - fprintf( stdout, "\t writes the current AIG into the AIGER file\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); - fprintf( stdout, "\t<file> : the file name\n"); + Abc_Print( -2, "usage: &w [-h] <file>\n" ); + Abc_Print( -2, "\t writes the current AIG into the AIGER file\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : the file name\n"); return 1; } @@ -22553,19 +22931,19 @@ int Abc_CommandAbc9Ps( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Ps(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Ps(): There is no AIG.\n" ); return 1; } - Gia_ManPrintStats( pAbc->pAig, fSwitch ); + Gia_ManPrintStats( pAbc->pGia, fSwitch ); return 0; usage: - fprintf( stdout, "usage: &ps [-ph]\n" ); - fprintf( stdout, "\t prints stats of the current AIG\n" ); - fprintf( stdout, "\t-p : toggle printing switching activity [default = %s]\n", fSwitch? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &ps [-ph]\n" ); + Abc_Print( -2, "\t prints stats of the current AIG\n" ); + Abc_Print( -2, "\t-p : toggle printing switching activity [default = %s]\n", fSwitch? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22592,7 +22970,7 @@ int Abc_CommandAbc9PFan( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nNodes = atoi(argv[globalUtilOptind]); @@ -22606,19 +22984,19 @@ int Abc_CommandAbc9PFan( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9PFan(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9PFan(): There is no AIG.\n" ); return 1; } - Gia_ManPrintFanio( pAbc->pAig, nNodes ); + Gia_ManPrintFanio( pAbc->pGia, nNodes ); return 0; usage: - fprintf( stdout, "usage: &pfan [-N num] [-h]\n" ); - fprintf( stdout, "\t prints fanin/fanout statistics\n" ); - fprintf( stdout, "\t-N num : the number of high-fanout nodes to explore [default = %d]\n", nNodes ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &pfan [-N num] [-h]\n" ); + Abc_Print( -2, "\t prints fanin/fanout statistics\n" ); + Abc_Print( -2, "\t-N num : the number of high-fanout nodes to explore [default = %d]\n", nNodes ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22651,24 +23029,24 @@ int Abc_CommandAbc9PSig( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9PSigs(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9PSigs(): There is no AIG.\n" ); return 1; } - if ( Gia_ManRegNum(pAbc->pAig) == 0 ) + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) { - printf( "Abc_CommandAbc9PSigs(): Works only for sequential circuits.\n" ); + Abc_Print( -1, "Abc_CommandAbc9PSigs(): Works only for sequential circuits.\n" ); return 1; } - Gia_ManDetectSeqSignals( pAbc->pAig, fSetReset, 1 ); + Gia_ManDetectSeqSignals( pAbc->pGia, fSetReset, 1 ); return 0; usage: - fprintf( stdout, "usage: &psig [-rh]\n" ); - fprintf( stdout, "\t prints enable/set/reset statistics\n" ); - fprintf( stdout, "\t-r : toggle printing set/reset signals [default = %s]\n", fSetReset? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &psig [-rh]\n" ); + Abc_Print( -2, "\t prints enable/set/reset statistics\n" ); + Abc_Print( -2, "\t-r : toggle printing set/reset signals [default = %s]\n", fSetReset? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22697,18 +23075,18 @@ int Abc_CommandAbc9Status( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Status(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Status(): There is no AIG.\n" ); return 1; } - Gia_ManPrintMiterStatus( pAbc->pAig ); + Gia_ManPrintMiterStatus( pAbc->pGia ); return 0; usage: - fprintf( stdout, "usage: &status [-h]\n" ); - fprintf( stdout, "\t prints status of the miter\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &status [-h]\n" ); + Abc_Print( -2, "\t prints status of the miter\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22738,20 +23116,20 @@ int Abc_CommandAbc9Show( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Show(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Show(): There is no AIG.\n" ); return 1; } - pMan = Gia_ManToAig( pAbc->pAig, 0 ); + pMan = Gia_ManToAig( pAbc->pGia, 0 ); Aig_ManShow( pMan, 0, NULL ); Aig_ManStop( pMan ); return 0; usage: - fprintf( stdout, "usage: &show [-h]\n" ); - fprintf( stdout, "\t shows the current AIG using GSView\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &show [-h]\n" ); + Abc_Print( -2, "\t shows the current AIG using GSView\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22785,20 +23163,20 @@ int Abc_CommandAbc9Hash( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Hash(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Hash(): There is no AIG.\n" ); return 1; } - pAbc->pAig = Gia_ManRehash( pTemp = pAbc->pAig, fAddStrash ); - Gia_ManStop( pTemp ); + pTemp = Gia_ManRehash( pAbc->pGia, fAddStrash ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &st [-ah]\n" ); - fprintf( stdout, "\t performs structural hashing\n" ); - fprintf( stdout, "\t-a : toggle additional hashing [default = %s]\n", fAddStrash? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &st [-ah]\n" ); + Abc_Print( -2, "\t performs structural hashing\n" ); + Abc_Print( -2, "\t-a : toggle additional hashing [default = %s]\n", fAddStrash? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22831,25 +23209,25 @@ int Abc_CommandAbc9Topand( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Topand(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Topand(): There is no AIG.\n" ); return 1; } - if ( Gia_ManRegNum(pAbc->pAig) > 0 ) + if ( Gia_ManRegNum(pAbc->pGia) > 0 ) { - printf( "Abc_CommandAbc9Topand(): Can only be applied to a combinational miter.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Topand(): Can only be applied to a combinational miter.\n" ); return 1; } - pAbc->pAig = Gia_ManDupTopAnd( pTemp = pAbc->pAig, fVerbose ); - Gia_ManStop( pTemp ); + pTemp = Gia_ManDupTopAnd( pAbc->pGia, fVerbose ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &topand [-vh]\n" ); - fprintf( stdout, "\t performs AND decomposition for combinational miter\n" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &topand [-vh]\n" ); + Abc_Print( -2, "\t performs AND decomposition for combinational miter\n" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22877,7 +23255,7 @@ int Abc_CommandAbc9Cof( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'V': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-V\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-V\" should be followed by an integer.\n" ); goto usage; } iVar = atoi(argv[globalUtilOptind]); @@ -22888,7 +23266,7 @@ int Abc_CommandAbc9Cof( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLimFan = atoi(argv[globalUtilOptind]); @@ -22905,42 +23283,37 @@ int Abc_CommandAbc9Cof( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Cof(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Cof(): There is no AIG.\n" ); return 1; } if ( nLimFan ) { - printf( "Cofactoring all variables whose fanout count is higher than %d.\n", nLimFan ); - pAbc->pAig = Gia_ManDupCofAll( pTemp = pAbc->pAig, nLimFan, fVerbose ); + Abc_Print( -1, "Cofactoring all variables whose fanout count is higher than %d.\n", nLimFan ); + pTemp = Gia_ManDupCofAll( pAbc->pGia, nLimFan, fVerbose ); + Abc_CommandUpdate9( pAbc, pTemp ); } else if ( iVar ) { - printf( "Cofactoring one variable with object ID %d.\n", iVar ); - pAbc->pAig = Gia_ManDupCof( pTemp = pAbc->pAig, iVar ); + Abc_Print( -1, "Cofactoring one variable with object ID %d.\n", iVar ); + pTemp = Gia_ManDupCof( pAbc->pGia, iVar ); + Abc_CommandUpdate9( pAbc, pTemp ); } else { - printf( "One of the paramters, -V <num> or -L <num>, should be set on the command line.\n" ); + Abc_Print( -1, "One of the paramters, -V <num> or -L <num>, should be set on the command line.\n" ); goto usage; } - if ( pAbc->pAig == NULL ) - { - pAbc->pAig = pTemp; - printf( "Abc_CommandAbc9Cof(): Transformation has failed.\n" ); - return 1; - } - Gia_ManStop( pTemp ); return 0; usage: - fprintf( stdout, "usage: &cof [-VL num] [-vh]\n" ); - fprintf( stdout, "\t performs cofactoring w.r.t. variable(s)\n" ); - fprintf( stdout, "\t-V num : the zero-based ID of one variable to cofactor [default = %d]\n", iVar ); - fprintf( stdout, "\t-L num : cofactor vars with fanout count higher than this [default = %d]\n", nLimFan ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &cof [-VL num] [-vh]\n" ); + Abc_Print( -2, "\t performs cofactoring w.r.t. variable(s)\n" ); + Abc_Print( -2, "\t-V num : the zero-based ID of one variable to cofactor [default = %d]\n", iVar ); + Abc_Print( -2, "\t-L num : cofactor vars with fanout count higher than this [default = %d]\n", nLimFan ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -22978,21 +23351,21 @@ int Abc_CommandAbc9Trim( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Trim(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Trim(): There is no AIG.\n" ); return 1; } - pAbc->pAig = Gia_ManDupTrimmed( pTemp = pAbc->pAig, fTrimCis, fTrimCos ); - Gia_ManStop( pTemp ); + pTemp = Gia_ManDupTrimmed( pAbc->pGia, fTrimCis, fTrimCos ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &trim [-ioh]\n" ); - fprintf( stdout, "\t removes PIs without fanout and PO driven by constants\n" ); - fprintf( stdout, "\t-i : toggle removing PIs [default = %s]\n", fTrimCis? "yes": "no" ); - fprintf( stdout, "\t-o : toggle removing POs [default = %s]\n", fTrimCos? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &trim [-ioh]\n" ); + Abc_Print( -2, "\t removes PIs without fanout and PO driven by constants\n" ); + Abc_Print( -2, "\t-i : toggle removing PIs [default = %s]\n", fTrimCis? "yes": "no" ); + Abc_Print( -2, "\t-o : toggle removing POs [default = %s]\n", fTrimCos? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23034,39 +23407,39 @@ int Abc_CommandAbc9Dfs( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Dfs(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Dfs(): There is no AIG.\n" ); return 1; } if ( fNormal ) { - pAbc->pAig = Gia_ManDupOrderAiger( pTemp = pAbc->pAig ); + pTemp = Gia_ManDupOrderAiger( pAbc->pGia ); if ( fVerbose ) - printf( "AIG objects are reordered as follows: CIs, ANDs, COs.\n" ); + Abc_Print( -1, "AIG objects are reordered as follows: CIs, ANDs, COs.\n" ); } else if ( fReverse ) { - pAbc->pAig = Gia_ManDupOrderDfsReverse( pTemp = pAbc->pAig ); + pTemp = Gia_ManDupOrderDfsReverse( pAbc->pGia ); if ( fVerbose ) - printf( "AIG objects are reordered in the reserve DFS order.\n" ); + Abc_Print( -1, "AIG objects are reordered in the reserve DFS order.\n" ); } else { - pAbc->pAig = Gia_ManDupOrderDfs( pTemp = pAbc->pAig ); + pTemp = Gia_ManDupOrderDfs( pAbc->pGia ); if ( fVerbose ) - printf( "AIG objects are reordered in the DFS order.\n" ); + Abc_Print( -1, "AIG objects are reordered in the DFS order.\n" ); } - Gia_ManStop( pTemp ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &dfs [-nrvh]\n" ); - fprintf( stdout, "\t orders objects in the DFS order\n" ); - fprintf( stdout, "\t-n : toggle using normalized ordering [default = %s]\n", fNormal? "yes": "no" ); - fprintf( stdout, "\t-r : toggle using reverse DFS ordering [default = %s]\n", fReverse? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &dfs [-nrvh]\n" ); + Abc_Print( -2, "\t orders objects in the DFS order\n" ); + Abc_Print( -2, "\t-n : toggle using normalized ordering [default = %s]\n", fNormal? "yes": "no" ); + Abc_Print( -2, "\t-r : toggle using reverse DFS ordering [default = %s]\n", fReverse? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23094,7 +23467,7 @@ int Abc_CommandAbc9Sim( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nWords = atoi(argv[globalUtilOptind]); @@ -23105,7 +23478,7 @@ int Abc_CommandAbc9Sim( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nIters = atoi(argv[globalUtilOptind]); @@ -23116,7 +23489,7 @@ int Abc_CommandAbc9Sim( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } pPars->TimeLimit = atoi(argv[globalUtilOptind]); @@ -23136,23 +23509,28 @@ int Abc_CommandAbc9Sim( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Sim(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Sim(): There is no AIG.\n" ); return 1; } - Gia_ManSimSimulate( pAbc->pAig, pPars ); + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) + { + Abc_Print( -1, "The network is combinational.\n" ); + return 0; + } + Gia_ManSimSimulate( pAbc->pGia, pPars ); return 0; usage: - fprintf( stdout, "usage: &sim [-WFT <num>] [-mvh]\n" ); - fprintf( stdout, "\t performs random simulation of the sequential miter\n" ); - fprintf( stdout, "\t-W num : the number of words to simulate [default = %d]\n", pPars->nWords ); - fprintf( stdout, "\t-F num : the number of frames to simulate [default = %d]\n", pPars->nIters ); - fprintf( stdout, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->TimeLimit ); - fprintf( stdout, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &sim [-WFT <num>] [-mvh]\n" ); + Abc_Print( -2, "\t performs random simulation of the sequential miter\n" ); + Abc_Print( -2, "\t-W num : the number of words to simulate [default = %d]\n", pPars->nWords ); + Abc_Print( -2, "\t-F num : the number of frames to simulate [default = %d]\n", pPars->nIters ); + Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->TimeLimit ); + Abc_Print( -2, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23170,7 +23548,7 @@ usage: int Abc_CommandAbc9Resim( Abc_Frame_t * pAbc, int argc, char ** argv ) { Cec_ParSim_t Pars, * pPars = &Pars; - int c; + int c, RetValue; Cec_ManSimSetDefaultParams( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Fmvh" ) ) != EOF ) @@ -23180,7 +23558,7 @@ int Abc_CommandAbc9Resim( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFrames = atoi(argv[globalUtilOptind]); @@ -23200,21 +23578,24 @@ int Abc_CommandAbc9Resim( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Resim(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Resim(): There is no AIG.\n" ); return 1; } - Cec_ManSeqResimulateCounter( pAbc->pAig, pPars, pAbc->pCex ); + RetValue = Cec_ManSeqResimulateCounter( pAbc->pGia, pPars, pAbc->pCex ); + pAbc->Status = RetValue ? 0 : -1; + pAbc->nFrames = pAbc->pCex->iFrame; +// Abc_FrameReplaceCex( pAbc, &pAbc->pCex ); return 0; usage: - fprintf( stdout, "usage: &resim [-F <num>] [-mvh]\n" ); - fprintf( stdout, "\t resimulates equivalence classes using counter-example\n" ); - fprintf( stdout, "\t-F num : the number of additinal frames to simulate [default = %d]\n", pPars->nFrames ); - fprintf( stdout, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &resim [-F <num>] [-mvh]\n" ); + Abc_Print( -2, "\t resimulates equivalence classes using counter-example\n" ); + Abc_Print( -2, "\t-F num : the number of additinal frames to simulate [default = %d]\n", pPars->nFrames ); + Abc_Print( -2, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23246,7 +23627,7 @@ int Abc_CommandAbc9SpecI( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nFrames = atoi(argv[globalUtilOptind]); @@ -23257,7 +23638,7 @@ int Abc_CommandAbc9SpecI( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nBTLimit = atoi(argv[globalUtilOptind]); @@ -23280,23 +23661,23 @@ int Abc_CommandAbc9SpecI( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9SpecI(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9SpecI(): There is no AIG.\n" ); return 1; } - Gia_CommandSpecI( pAbc->pAig, nFrames, nBTLimit, fUseStart, fCheckMiter, fVerbose ); + Gia_CommandSpecI( pAbc->pGia, nFrames, nBTLimit, fUseStart, fCheckMiter, fVerbose ); return 0; usage: - fprintf( stdout, "usage: &speci [-FC <num>] [-fmvh]\n" ); - fprintf( stdout, "\t refines equivalence classes using speculative reduction\n" ); - fprintf( stdout, "\t-F num : the max number of time frames [default = %d]\n", nFrames ); - fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", nBTLimit ); - fprintf( stdout, "\t-f : toggle starting BMC from a later frame [default = %s]\n", fUseStart? "yes": "no" ); - fprintf( stdout, "\t-m : toggle miter vs. any circuit [default = %s]\n", fCheckMiter? "miter": "circuit" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &speci [-FC <num>] [-fmvh]\n" ); + Abc_Print( -2, "\t refines equivalence classes using speculative reduction\n" ); + Abc_Print( -2, "\t-F num : the max number of time frames [default = %d]\n", nFrames ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", nBTLimit ); + Abc_Print( -2, "\t-f : toggle starting BMC from a later frame [default = %s]\n", fUseStart? "yes": "no" ); + Abc_Print( -2, "\t-m : toggle miter vs. any circuit [default = %s]\n", fCheckMiter? "miter": "circuit" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23326,7 +23707,7 @@ int Abc_CommandAbc9Equiv( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nWords = atoi(argv[globalUtilOptind]); @@ -23337,7 +23718,7 @@ int Abc_CommandAbc9Equiv( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFrames = atoi(argv[globalUtilOptind]); @@ -23348,7 +23729,7 @@ int Abc_CommandAbc9Equiv( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'R': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-R\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } pPars->nRounds = atoi(argv[globalUtilOptind]); @@ -23359,7 +23740,7 @@ int Abc_CommandAbc9Equiv( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nNonRefines = atoi(argv[globalUtilOptind]); @@ -23370,7 +23751,7 @@ int Abc_CommandAbc9Equiv( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } pPars->TimeLimit = atoi(argv[globalUtilOptind]); @@ -23396,27 +23777,155 @@ int Abc_CommandAbc9Equiv( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Equiv(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Equiv(): There is no AIG.\n" ); return 1; } - Cec_ManSimulation( pAbc->pAig, pPars ); + Cec_ManSimulation( pAbc->pGia, pPars ); return 0; usage: - fprintf( stdout, "usage: &equiv [-WFRST <num>] [-smdvh]\n" ); - fprintf( stdout, "\t computes candidate equivalence classes\n" ); - fprintf( stdout, "\t-W num : the number of words to simulate [default = %d]\n", pPars->nWords ); - fprintf( stdout, "\t-F num : the number of frames to simulate [default = %d]\n", pPars->nFrames ); - fprintf( stdout, "\t-R num : the max number of simulation rounds [default = %d]\n", pPars->nRounds ); - fprintf( stdout, "\t-S num : the max number of rounds w/o refinement to stop [default = %d]\n", pPars->nNonRefines ); - fprintf( stdout, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->TimeLimit ); - fprintf( stdout, "\t-s : toggle seq vs. comb simulation [default = %s]\n", pPars->fSeqSimulate? "yes": "no" ); - fprintf( stdout, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); - fprintf( stdout, "\t-d : toggle using two POs intead of XOR [default = %s]\n", pPars->fDualOut? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &equiv [-WFRST <num>] [-smdvh]\n" ); + Abc_Print( -2, "\t computes candidate equivalence classes\n" ); + Abc_Print( -2, "\t-W num : the number of words to simulate [default = %d]\n", pPars->nWords ); + Abc_Print( -2, "\t-F num : the number of frames to simulate [default = %d]\n", pPars->nFrames ); + Abc_Print( -2, "\t-R num : the max number of simulation rounds [default = %d]\n", pPars->nRounds ); + Abc_Print( -2, "\t-S num : the max number of rounds w/o refinement to stop [default = %d]\n", pPars->nNonRefines ); + Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->TimeLimit ); + Abc_Print( -2, "\t-s : toggle seq vs. comb simulation [default = %s]\n", pPars->fSeqSimulate? "yes": "no" ); + Abc_Print( -2, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); + Abc_Print( -2, "\t-d : toggle using two POs intead of XOR [default = %s]\n", pPars->fDualOut? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Equiv2( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern void Ssw_SignalFilterGia( Gia_Man_t * p, int nFramesMax, int nConfMax, int nRounds, int TimeLimit, int TimeLimit2, Abc_Cex_t * pCex, int fVerbose ); + int nFramesMax = 20; + int nConfMax = 500; + int nRounds = 10; + int TimeLimit = 0; + int TimeLimit2 = 0; + int fUseCex = 0; + int fVerbose = 0; + int c; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "FCRTSxvh" ) ) != EOF ) + { + switch ( c ) + { + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + nFramesMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nFramesMax < 0 ) + goto usage; + break; + case 'C': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); + goto usage; + } + nConfMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nConfMax < 0 ) + goto usage; + break; + case 'R': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); + goto usage; + } + nRounds = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nRounds < 0 ) + goto usage; + break; + case 'T': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); + goto usage; + } + TimeLimit = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( TimeLimit < 0 ) + goto usage; + break; + case 'S': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); + goto usage; + } + TimeLimit2 = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( TimeLimit2 < 0 ) + goto usage; + break; + case 'x': + fUseCex ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Equiv2(): There is no AIG.\n" ); + return 1; + } + if ( fUseCex ) + { + if ( pAbc->pCex->nPis != Gia_ManPiNum(pAbc->pGia) ) + { + Abc_Print( -1, "Abc_CommandAbc9Equiv2(): The number of PIs differs in cex (%d) and in AIG (%d).\n", + pAbc->pCex->nPis, Gia_ManPiNum(pAbc->pGia) ); + return 1; + } + } + Ssw_SignalFilterGia( pAbc->pGia, nFramesMax, nConfMax, nRounds, TimeLimit, TimeLimit2, fUseCex? pAbc->pCex: NULL, fVerbose ); + pAbc->Status = -1; +// pAbc->nFrames = pAbc->pCex->iFrame; +// Abc_FrameReplaceCex( pAbc, &pAbc->pCex ); + return 0; + +usage: + Abc_Print( -2, "usage: &equiv2 [-FCRTS <num>] [-xvh]\n" ); + Abc_Print( -2, "\t computes candidate equivalence classes\n" ); + Abc_Print( -2, "\t-F num : the max number of frames for BMC [default = %d]\n", nFramesMax ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", nConfMax ); + Abc_Print( -2, "\t-R num : the max number of BMC rounds [default = %d]\n", nRounds ); + Abc_Print( -2, "\t-T num : runtime limit in seconds for all rounds [default = %d]\n", TimeLimit ); + Abc_Print( -2, "\t-S num : runtime limit in seconds for one round [default = %d]\n", TimeLimit2 ); + Abc_Print( -2, "\t-x : toggle using the current cex to perform refinement [default = %s]\n", fUseCex? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23444,7 +23953,7 @@ int Abc_CommandAbc9Semi( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nWords = atoi(argv[globalUtilOptind]); @@ -23455,7 +23964,7 @@ int Abc_CommandAbc9Semi( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'R': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-R\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } pPars->nRounds = atoi(argv[globalUtilOptind]); @@ -23466,7 +23975,7 @@ int Abc_CommandAbc9Semi( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFrames = atoi(argv[globalUtilOptind]); @@ -23477,7 +23986,7 @@ int Abc_CommandAbc9Semi( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nNonRefines = atoi(argv[globalUtilOptind]); @@ -23488,7 +23997,7 @@ int Abc_CommandAbc9Semi( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'M': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-M\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nMinOutputs = atoi(argv[globalUtilOptind]); @@ -23499,7 +24008,7 @@ int Abc_CommandAbc9Semi( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -23510,7 +24019,7 @@ int Abc_CommandAbc9Semi( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } pPars->TimeLimit = atoi(argv[globalUtilOptind]); @@ -23533,28 +24042,28 @@ int Abc_CommandAbc9Semi( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Resim(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Resim(): There is no AIG.\n" ); return 1; } - Cec_ManSeqSemiformal( pAbc->pAig, pPars ); + Cec_ManSeqSemiformal( pAbc->pGia, pPars ); return 0; usage: - fprintf( stdout, "usage: &semi [-WRFSMCT <num>] [-mdvh]\n" ); - fprintf( stdout, "\t performs semiformal refinement of equivalence classes\n" ); - fprintf( stdout, "\t-W num : the number of words to simulate [default = %d]\n", pPars->nWords ); - fprintf( stdout, "\t-R num : the max number of rounds to simulate [default = %d]\n", pPars->nRounds ); - fprintf( stdout, "\t-F num : the max number of frames to unroll [default = %d]\n", pPars->nFrames ); - fprintf( stdout, "\t-S num : the max number of rounds w/o refinement to stop [default = %d]\n", pPars->nNonRefines ); - fprintf( stdout, "\t-M num : the min number of outputs of bounded SRM [default = %d]\n", pPars->nMinOutputs ); - fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); - fprintf( stdout, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->TimeLimit ); - fprintf( stdout, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); - fprintf( stdout, "\t-d : toggle using two POs intead of XOR [default = %s]\n", pPars->fDualOut? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &semi [-WRFSMCT <num>] [-mdvh]\n" ); + Abc_Print( -2, "\t performs semiformal refinement of equivalence classes\n" ); + Abc_Print( -2, "\t-W num : the number of words to simulate [default = %d]\n", pPars->nWords ); + Abc_Print( -2, "\t-R num : the max number of rounds to simulate [default = %d]\n", pPars->nRounds ); + Abc_Print( -2, "\t-F num : the max number of frames to unroll [default = %d]\n", pPars->nFrames ); + Abc_Print( -2, "\t-S num : the max number of rounds w/o refinement to stop [default = %d]\n", pPars->nNonRefines ); + Abc_Print( -2, "\t-M num : the min number of outputs of bounded SRM [default = %d]\n", pPars->nMinOutputs ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->TimeLimit ); + Abc_Print( -2, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); + Abc_Print( -2, "\t-d : toggle using two POs intead of XOR [default = %s]\n", pPars->fDualOut? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23582,7 +24091,7 @@ int Abc_CommandAbc9Times( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } nTimes = atoi(argv[globalUtilOptind]); @@ -23599,21 +24108,21 @@ int Abc_CommandAbc9Times( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Times(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Times(): There is no AIG.\n" ); return 1; } - pAbc->pAig = Gia_ManDupTimes( pTemp = pAbc->pAig, nTimes ); - Gia_ManStop( pTemp ); + pTemp = Gia_ManDupTimes( pAbc->pGia, nTimes ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: × [-N <num>] [-vh]\n" ); - fprintf( stdout, "\t creates several \"parallel\" copies of the design\n" ); - fprintf( stdout, "\t-N num : number of copies to create [default = %d]\n", nTimes ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: × [-N <num>] [-vh]\n" ); + Abc_Print( -2, "\t creates several \"parallel\" copies of the design\n" ); + Abc_Print( -2, "\t-N num : number of copies to create [default = %d]\n", nTimes ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23643,7 +24152,7 @@ int Abc_CommandAbc9Frames( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFrames = atoi(argv[globalUtilOptind]); @@ -23654,7 +24163,7 @@ int Abc_CommandAbc9Frames( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nCofFanLit = atoi(argv[globalUtilOptind]); @@ -23674,26 +24183,31 @@ int Abc_CommandAbc9Frames( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Frames(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Frames(): There is no AIG.\n" ); return 1; } + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) + { + Abc_Print( -1, "The network is combinational.\n" ); + return 0; + } if ( nCofFanLit ) - pAbc->pAig = Gia_ManUnrollAndCofactor( pTemp = pAbc->pAig, pPars->nFrames, nCofFanLit, pPars->fVerbose ); + pTemp = Gia_ManUnrollAndCofactor( pAbc->pGia, pPars->nFrames, nCofFanLit, pPars->fVerbose ); else - pAbc->pAig = Gia_ManFrames( pTemp = pAbc->pAig, pPars ); - Gia_ManStop( pTemp ); + pTemp = Gia_ManFrames( pAbc->pGia, pPars ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &frames [-FL <num>] [-ivh]\n" ); - fprintf( stdout, "\t unrolls the design for several timeframes\n" ); - fprintf( stdout, "\t-F num : the number of frames to unroll [default = %d]\n", pPars->nFrames ); - fprintf( stdout, "\t-L num : the limit on fanout count of resets/enables to cofactor [default = %d]\n", nCofFanLit ); - fprintf( stdout, "\t-i : toggle initializing registers [default = %s]\n", pPars->fInit? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &frames [-FL <num>] [-ivh]\n" ); + Abc_Print( -2, "\t unrolls the design for several timeframes\n" ); + Abc_Print( -2, "\t-F num : the number of frames to unroll [default = %d]\n", pPars->nFrames ); + Abc_Print( -2, "\t-L num : the limit on fanout count of resets/enables to cofactor [default = %d]\n", nCofFanLit ); + Abc_Print( -2, "\t-i : toggle initializing registers [default = %s]\n", pPars->fInit? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23722,7 +24236,7 @@ int Abc_CommandAbc9Retime( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nMaxIters = atoi(argv[globalUtilOptind]); @@ -23739,21 +24253,26 @@ int Abc_CommandAbc9Retime( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Retime(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Retime(): There is no AIG.\n" ); return 1; } - pAbc->pAig = Gia_ManRetimeForward( pTemp = pAbc->pAig, nMaxIters, fVerbose ); - Gia_ManStop( pTemp ); + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) + { + Abc_Print( -1, "The network is combinational.\n" ); + return 0; + } + pTemp = Gia_ManRetimeForward( pAbc->pGia, nMaxIters, fVerbose ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &retime [-N <num>] [-vh]\n" ); - fprintf( stdout, "\t performs most-forward retiming\n" ); - fprintf( stdout, "\t-N num : the number of incremental iterations [default = %d]\n", nMaxIters ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &retime [-N <num>] [-vh]\n" ); + Abc_Print( -2, "\t performs most-forward retiming\n" ); + Abc_Print( -2, "\t-N num : the number of incremental iterations [default = %d]\n", nMaxIters ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23791,24 +24310,187 @@ int Abc_CommandAbc9Enable( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Enable(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Enable(): There is no AIG.\n" ); return 1; } if ( fRemove ) - pAbc->pAig = Gia_ManRemoveEnables( pTemp = pAbc->pAig ); + pTemp = Gia_ManRemoveEnables( pAbc->pGia ); else - pAbc->pAig = Gia_ManDupSelf( pTemp = pAbc->pAig ); - Gia_ManStop( pTemp ); + pTemp = Gia_ManDupSelf( pAbc->pGia ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &enable [-rvh]\n" ); - fprintf( stdout, "\t adds or removes flop enable signals\n" ); - fprintf( stdout, "\t-r : toggle adding vs. removing enables [default = %s]\n", fRemove? "remove": "add" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &enable [-rvh]\n" ); + Abc_Print( -2, "\t adds or removes flop enable signals\n" ); + Abc_Print( -2, "\t-r : toggle adding vs. removing enables [default = %s]\n", fRemove? "remove": "add" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Dc2( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_Man_t * pTemp; + int c, fVerbose = 0; + int fUpdateLevel = 1; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "lvh" ) ) != EOF ) + { + switch ( c ) + { + case 'l': + fUpdateLevel ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Dc2(): There is no AIG.\n" ); + return 1; + } + pTemp = Gia_ManCompress2( pAbc->pGia, fUpdateLevel, fVerbose ); + Abc_CommandUpdate9( pAbc, pTemp ); + return 0; + +usage: + Abc_Print( -2, "usage: &dc2 [-lvh]\n" ); + Abc_Print( -2, "\t performs heavy rewriting of the AIG\n" ); + Abc_Print( -2, "\t-l : toggle level update during rewriting [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Bidec( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_Man_t * pTemp; + int c, fVerbose = 0; + int fUpdateLevel = 1; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "lvh" ) ) != EOF ) + { + switch ( c ) + { + case 'l': + fUpdateLevel ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Bidec(): There is no AIG.\n" ); + return 1; + } + if ( pAbc->pGia->pMapping == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Bidec(): Mapping of the AIG is not defined.\n" ); + return 1; + } + pTemp = Gia_ManPerformBidec( pAbc->pGia, fVerbose ); + Abc_CommandUpdate9( pAbc, pTemp ); + return 0; + +usage: + Abc_Print( -2, "usage: &bidec [-vh]\n" ); + Abc_Print( -2, "\t performs heavy rewriting of the AIG\n" ); +// Abc_Print( -2, "\t-l : toggle level update during rewriting [default = %s]\n", fUpdateLevel? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Shrink( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_Man_t * pTemp; + int c,fVerbose = 0; + int fKeepLevel = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "lvh" ) ) != EOF ) + { + switch ( c ) + { + case 'l': + fKeepLevel ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Shrink(): There is no AIG.\n" ); + return 1; + } + if ( pAbc->pGia->pMapping == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Shrink(): Mapping of the AIG is not defined.\n" ); + return 1; + } + pTemp = Gia_ManPerformMapShrink( pAbc->pGia, fKeepLevel, fVerbose ); + Abc_CommandUpdate9( pAbc, pTemp ); + return 0; + +usage: + Abc_Print( -2, "usage: &shrink [-lvh]\n" ); + Abc_Print( -2, "\t performs fast shrinking using current mapping\n" ); + Abc_Print( -2, "\t-l : toggle level update during shrinking [default = %s]\n", fKeepLevel? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -23861,14 +24543,14 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( fTrans ) { - if ( (Gia_ManPoNum(pAbc->pAig) & 1) == 1 ) + if ( (Gia_ManPoNum(pAbc->pGia) & 1) == 1 ) { - printf( "Abc_CommandAbc9Miter(): The number of outputs should be even.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Miter(): The number of outputs should be even.\n" ); return 0; } - pAbc->pAig = Gia_ManTransformMiter( pAux = pAbc->pAig ); + pAbc->pGia = Gia_ManTransformMiter( pAux = pAbc->pGia ); Gia_ManStop( pAux ); - printf( "The miter (current AIG) is transformed by XORing POs pair-wise.\n" ); + Abc_Print( -1, "The miter (current AIG) is transformed by XORing POs pair-wise.\n" ); return 0; } @@ -23876,7 +24558,7 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) nArgcNew = argc - globalUtilOptind; if ( nArgcNew != 1 ) { - printf( "File name is not given on the command line.\n" ); + Abc_Print( -1, "File name is not given on the command line.\n" ); return 1; } @@ -23888,40 +24570,34 @@ int Abc_CommandAbc9Miter( Abc_Frame_t * pAbc, int argc, char ** argv ) *pTemp = '\\'; if ( (pFile = fopen( FileName, "r" )) == NULL ) { - fprintf( pAbc->Err, "Cannot open input file \"%s\". ", FileName ); + Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); if ( (FileName = Extra_FileGetSimilarName( FileName, ".aig", NULL, NULL, NULL, NULL )) ) - fprintf( pAbc->Err, "Did you mean \"%s\"?", FileName ); - fprintf( pAbc->Err, "\n" ); + Abc_Print( 1, "Did you mean \"%s\"?", FileName ); + Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); pSecond = Gia_ReadAiger( FileName, 0 ); if ( pSecond == NULL ) { - printf( "Reading AIGER has failed.\n" ); + Abc_Print( -1, "Reading AIGER has failed.\n" ); return 0; } // compute the miter - pAbc->pAig = Gia_ManMiter( pAux = pAbc->pAig, pSecond, fDualOut, fSeq, fVerbose ); + pAux = Gia_ManMiter( pAbc->pGia, pSecond, fDualOut, fSeq, fVerbose ); Gia_ManStop( pSecond ); - if ( pAbc->pAig == NULL ) - { - printf( "Miter construction has failed.\n" ); - pAbc->pAig = pAux; - } - else - Gia_ManStop( pAux ); + Abc_CommandUpdate9( pAbc, pAux ); return 0; usage: - fprintf( stdout, "usage: &miter [-dstvh] <file>\n" ); - fprintf( stdout, "\t creates miter of two designs (current AIG vs. <file>)\n" ); - fprintf( stdout, "\t-d : toggle creating dual output miter [default = %s]\n", fDualOut? "yes": "no" ); - fprintf( stdout, "\t-s : toggle creating sequential miter [default = %s]\n", fSeq? "yes": "no" ); - fprintf( stdout, "\t-t : toggle XORing pair-wise POs of the miter [default = %s]\n", fTrans? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); - fprintf( stdout, "\t<file> : AIGER file with the design to miter\n"); + Abc_Print( -2, "usage: &miter [-dstvh] <file>\n" ); + Abc_Print( -2, "\t creates miter of two designs (current AIG vs. <file>)\n" ); + Abc_Print( -2, "\t-d : toggle creating dual output miter [default = %s]\n", fDualOut? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle creating sequential miter [default = %s]\n", fSeq? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle XORing pair-wise POs of the miter [default = %s]\n", fTrans? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + Abc_Print( -2, "\t<file> : AIGER file with the design to miter\n"); return 1; } @@ -23961,22 +24637,22 @@ int Abc_CommandAbc9Scl( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Scl(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Scl(): There is no AIG.\n" ); return 1; } - pAbc->pAig = Gia_ManSeqStructSweep( pTemp = pAbc->pAig, fConst, fEquiv, fVerbose ); - Gia_ManStop( pTemp ); + pTemp = Gia_ManSeqStructSweep( pAbc->pGia, fConst, fEquiv, fVerbose ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &scl [-cevh]\n" ); - fprintf( stdout, "\t performs structural sequential cleanup\n" ); - fprintf( stdout, "\t-c : toggle removing stuck-at constant registers [default = %s]\n", fConst? "yes": "no" ); - fprintf( stdout, "\t-e : toggle removing equivalent-driver registers [default = %s]\n", fEquiv? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &scl [-cevh]\n" ); + Abc_Print( -2, "\t performs structural sequential cleanup\n" ); + Abc_Print( -2, "\t-c : toggle removing stuck-at constant registers [default = %s]\n", fConst? "yes": "no" ); + Abc_Print( -2, "\t-e : toggle removing equivalent-driver registers [default = %s]\n", fEquiv? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24006,7 +24682,7 @@ int Abc_CommandAbc9Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFrames = atoi(argv[globalUtilOptind]); @@ -24017,7 +24693,7 @@ int Abc_CommandAbc9Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -24028,7 +24704,7 @@ int Abc_CommandAbc9Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } pPars->nPrefix = atoi(argv[globalUtilOptind]); @@ -24049,31 +24725,30 @@ int Abc_CommandAbc9Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Lcorr(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Lcorr(): There is no AIG.\n" ); return 1; } - pAbc->pAig = Cec_ManLSCorrespondence( pTemp = pAbc->pAig, pPars ); - if ( pAbc->pAig == NULL ) + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) { - pAbc->pAig = pTemp; - printf( "Abc_CommandAbc9Lcorr(): Command has failed.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); + return 0; } - else - Gia_ManStop( pTemp ); + pTemp = Cec_ManLSCorrespondence( pAbc->pGia, pPars ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &lcorr [-FCP num] [-rcvh]\n" ); - fprintf( stdout, "\t performs latch correpondence computation\n" ); - fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); - fprintf( stdout, "\t-F num : the number of timeframes in inductive case [default = %d]\n", pPars->nFrames ); - fprintf( stdout, "\t-P num : the number of timeframes in the prefix [default = %d]\n", pPars->nPrefix ); - fprintf( stdout, "\t-r : toggle using implication rings during refinement [default = %s]\n", pPars->fUseRings? "yes": "no" ); - fprintf( stdout, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &lcorr [-FCP num] [-rcvh]\n" ); + Abc_Print( -2, "\t performs latch correpondence computation\n" ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-F num : the number of timeframes in inductive case [default = %d]\n", pPars->nFrames ); + Abc_Print( -2, "\t-P num : the number of timeframes in the prefix [default = %d]\n", pPars->nPrefix ); + Abc_Print( -2, "\t-r : toggle using implication rings during refinement [default = %s]\n", pPars->fUseRings? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24102,7 +24777,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } pPars->nFrames = atoi(argv[globalUtilOptind]); @@ -24113,7 +24788,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -24124,7 +24799,7 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'P': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-P\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } pPars->nPrefix = atoi(argv[globalUtilOptind]); @@ -24151,33 +24826,32 @@ int Abc_CommandAbc9Scorr( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Scorr(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Scorr(): There is no AIG.\n" ); return 1; } - pAbc->pAig = Cec_ManLSCorrespondence( pTemp = pAbc->pAig, pPars ); - if ( pAbc->pAig == NULL ) + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) { - pAbc->pAig = pTemp; - printf( "Abc_CommandAbc9Scorr(): Command has failed.\n" ); + Abc_Print( -1, "The network is combinational.\n" ); + return 0; } - else - Gia_ManStop( pTemp ); + pTemp = Cec_ManLSCorrespondence( pAbc->pGia, pPars ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &scorr [-FCP num] [-recwvh]\n" ); - fprintf( stdout, "\t performs signal correpondence computation\n" ); - fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); - fprintf( stdout, "\t-F num : the number of timeframes in inductive case [default = %d]\n", pPars->nFrames ); - fprintf( stdout, "\t-P num : the number of timeframes in the prefix [default = %d]\n", pPars->nPrefix ); - fprintf( stdout, "\t-r : toggle using implication rings during refinement [default = %s]\n", pPars->fUseRings? "yes": "no" ); - fprintf( stdout, "\t-e : toggle using equivalences as choices [default = %s]\n", pPars->fMakeChoices? "yes": "no" ); - fprintf( stdout, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); - fprintf( stdout, "\t-w : toggle printing verbose info about equivalent flops [default = %s]\n", pPars->fVerboseFlops? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &scorr [-FCP num] [-recwvh]\n" ); + Abc_Print( -2, "\t performs signal correpondence computation\n" ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-F num : the number of timeframes in inductive case [default = %d]\n", pPars->nFrames ); + Abc_Print( -2, "\t-P num : the number of timeframes in the prefix [default = %d]\n", pPars->nPrefix ); + Abc_Print( -2, "\t-r : toggle using implication rings during refinement [default = %s]\n", pPars->fUseRings? "yes": "no" ); + Abc_Print( -2, "\t-e : toggle using equivalences as choices [default = %s]\n", pPars->fMakeChoices? "yes": "no" ); + Abc_Print( -2, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printing verbose info about equivalent flops [default = %s]\n", pPars->fVerboseFlops? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24206,7 +24880,7 @@ int Abc_CommandAbc9Choice( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -24224,28 +24898,22 @@ int Abc_CommandAbc9Choice( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Choice(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Choice(): There is no AIG.\n" ); return 1; } - pAbc->pAig = Cec_ManChoiceComputation( pTemp = pAbc->pAig, pPars ); - if ( pAbc->pAig == NULL ) - { - pAbc->pAig = pTemp; - printf( "Abc_CommandAbc9Choice(): Command has failed.\n" ); - } - else - Gia_ManStop( pTemp ); + pTemp = Cec_ManChoiceComputation( pAbc->pGia, pPars ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &choice [-C num] [-cvh]\n" ); - fprintf( stdout, "\t performs computation of structural choices\n" ); - fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); - fprintf( stdout, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &choice [-C num] [-cvh]\n" ); + Abc_Print( -2, "\t performs computation of structural choices\n" ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", pPars->fUseCSat? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24275,7 +24943,7 @@ int Abc_CommandAbc9Sat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -24286,7 +24954,7 @@ int Abc_CommandAbc9Sat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-S\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } pPars->nSatVarMax = atoi(argv[globalUtilOptind]); @@ -24297,7 +24965,7 @@ int Abc_CommandAbc9Sat( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'N': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-N\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nCallsRecycle = atoi(argv[globalUtilOptind]); @@ -24324,9 +24992,9 @@ int Abc_CommandAbc9Sat( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Sat(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Sat(): There is no AIG.\n" ); return 1; } if ( fCSat ) @@ -24334,33 +25002,33 @@ int Abc_CommandAbc9Sat( Abc_Frame_t * pAbc, int argc, char ** argv ) Vec_Int_t * vCounters; Vec_Str_t * vStatus; if ( pPars->fLearnCls ) - vCounters = Tas_ManSolveMiterNc( pAbc->pAig, pPars->nBTLimit, &vStatus, pPars->fVerbose ); + vCounters = Tas_ManSolveMiterNc( pAbc->pGia, pPars->nBTLimit, &vStatus, pPars->fVerbose ); else if ( pPars->fNonChrono ) - vCounters = Cbs_ManSolveMiterNc( pAbc->pAig, pPars->nBTLimit, &vStatus, pPars->fVerbose ); + vCounters = Cbs_ManSolveMiterNc( pAbc->pGia, pPars->nBTLimit, &vStatus, pPars->fVerbose ); else - vCounters = Cbs_ManSolveMiter( pAbc->pAig, pPars->nBTLimit, &vStatus, pPars->fVerbose ); + vCounters = Cbs_ManSolveMiter( pAbc->pGia, pPars->nBTLimit, &vStatus, pPars->fVerbose ); Vec_IntFree( vCounters ); Vec_StrFree( vStatus ); } else { - pAbc->pAig = Cec_ManSatSolving( pTemp = pAbc->pAig, pPars ); - Gia_ManStop( pTemp ); + pTemp = Cec_ManSatSolving( pAbc->pGia, pPars ); + Abc_CommandUpdate9( pAbc, pTemp ); } return 0; usage: - fprintf( stdout, "usage: &sat [-CSN <num>] [-nmctvh]\n" ); - fprintf( stdout, "\t performs SAT solving for the combinational outputs\n" ); - fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); - fprintf( stdout, "\t-S num : the min number of variables to recycle the solver [default = %d]\n", pPars->nSatVarMax ); - fprintf( stdout, "\t-N num : the min number of calls to recycle the solver [default = %d]\n", pPars->nCallsRecycle ); - fprintf( stdout, "\t-n : toggle using non-chronological backtracking [default = %s]\n", pPars->fNonChrono? "yes": "no" ); - fprintf( stdout, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); - fprintf( stdout, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", fCSat? "yes": "no" ); - fprintf( stdout, "\t-t : toggle using learning in curcuit-based solver [default = %s]\n", pPars->fLearnCls? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &sat [-CSN <num>] [-nmctvh]\n" ); + Abc_Print( -2, "\t performs SAT solving for the combinational outputs\n" ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-S num : the min number of variables to recycle the solver [default = %d]\n", pPars->nSatVarMax ); + Abc_Print( -2, "\t-N num : the min number of calls to recycle the solver [default = %d]\n", pPars->nCallsRecycle ); + Abc_Print( -2, "\t-n : toggle using non-chronological backtracking [default = %s]\n", pPars->fNonChrono? "yes": "no" ); + Abc_Print( -2, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); + Abc_Print( -2, "\t-c : toggle using circuit-based SAT solver [default = %s]\n", fCSat? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle using learning in curcuit-based solver [default = %s]\n", pPars->fLearnCls? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24381,6 +25049,7 @@ int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) Gia_Man_t * pTemp; int c; Cec_ManFraSetDefaultParams( pPars ); + pPars->fSatSweeping = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "WRILDCrmdwvh" ) ) != EOF ) { @@ -24389,7 +25058,7 @@ int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'W': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-W\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nWords = atoi(argv[globalUtilOptind]); @@ -24400,7 +25069,7 @@ int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'R': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-R\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } pPars->nRounds = atoi(argv[globalUtilOptind]); @@ -24411,7 +25080,7 @@ int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pPars->nItersMax = atoi(argv[globalUtilOptind]); @@ -24422,7 +25091,7 @@ int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'L': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-L\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nLevelMax = atoi(argv[globalUtilOptind]); @@ -24433,7 +25102,7 @@ int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nDepthMax = atoi(argv[globalUtilOptind]); @@ -24444,7 +25113,7 @@ int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -24471,34 +25140,30 @@ int Abc_CommandAbc9Fraig( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Fraig(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Fraig(): There is no AIG.\n" ); return 1; } - pTemp = Cec_ManSatSweeping( pAbc->pAig, pPars ); - if ( pTemp ) - { - Gia_ManStop( pAbc->pAig ); - pAbc->pAig = pTemp; - } + pTemp = Cec_ManSatSweeping( pAbc->pGia, pPars ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &fraig [-WRILDC <num>] [-rmdwvh]\n" ); - fprintf( stdout, "\t performs combinational SAT sweeping\n" ); - fprintf( stdout, "\t-W num : the number of simulation words [default = %d]\n", pPars->nWords ); - fprintf( stdout, "\t-R num : the number of simulation rounds [default = %d]\n", pPars->nRounds ); - fprintf( stdout, "\t-I num : the number of sweeping iterations [default = %d]\n", pPars->nItersMax ); - fprintf( stdout, "\t-L num : the max number of levels of nodes to consider [default = %d]\n", pPars->nLevelMax ); - fprintf( stdout, "\t-D num : the max number of steps of speculative reduction [default = %d]\n", pPars->nDepthMax ); - fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); - fprintf( stdout, "\t-r : toggle the use of AIG rewriting [default = %s]\n", pPars->fRewriting? "yes": "no" ); - fprintf( stdout, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); - fprintf( stdout, "\t-d : toggle using double output miters [default = %s]\n", pPars->fDualOut? "yes": "no" ); - fprintf( stdout, "\t-w : toggle printing even more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &fraig [-WRILDC <num>] [-rmdwvh]\n" ); + Abc_Print( -2, "\t performs combinational SAT sweeping\n" ); + Abc_Print( -2, "\t-W num : the number of simulation words [default = %d]\n", pPars->nWords ); + Abc_Print( -2, "\t-R num : the number of simulation rounds [default = %d]\n", pPars->nRounds ); + Abc_Print( -2, "\t-I num : the number of sweeping iterations [default = %d]\n", pPars->nItersMax ); + Abc_Print( -2, "\t-L num : the max number of levels of nodes to consider [default = %d]\n", pPars->nLevelMax ); + Abc_Print( -2, "\t-D num : the max number of steps of speculative reduction [default = %d]\n", pPars->nDepthMax ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-r : toggle the use of AIG rewriting [default = %s]\n", pPars->fRewriting? "yes": "no" ); + Abc_Print( -2, "\t-m : toggle miter vs. any circuit [default = %s]\n", pPars->fCheckMiter? "miter": "circuit" ); + Abc_Print( -2, "\t-d : toggle using double output miters [default = %s]\n", pPars->fDualOut? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printing even more verbose information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24541,32 +25206,32 @@ int Abc_CommandAbc9Srm( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Srm(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Srm(): There is no AIG.\n" ); return 1; } - pTemp = Gia_ManSpecReduce( pAbc->pAig, fDualOut, fVerbose ); + pTemp = Gia_ManSpecReduce( pAbc->pGia, fDualOut, fSynthesis, fVerbose ); if ( pTemp ) { pTemp = Gia_ManSeqStructSweep( pAux = pTemp, 1, 1, 0 ); Gia_ManStop( pAux ); Gia_WriteAiger( pTemp, pFileName, 0, 0 ); - printf( "Speculatively reduced model was written into file \"%s\".\n", pFileName ); + Abc_Print( 1, "Speculatively reduced model was written into file \"%s\".\n", pFileName ); Gia_ManPrintStatsShort( pTemp ); Gia_ManStop( pTemp ); } if ( fSynthesis ) { - pTemp = Gia_ManEquivReduce( pAbc->pAig, 1, fDualOut, fVerbose ); + pTemp = Gia_ManEquivReduce( pAbc->pGia, 1, fDualOut, fVerbose ); if ( pTemp ) { pTemp = Gia_ManSeqStructSweep( pAux = pTemp, 1, 1, 0 ); Gia_ManStop( pAux ); Gia_WriteAiger( pTemp, pFileName2, 0, 0 ); - printf( "Reduced original network was written into file \"%s\".\n", pFileName2 ); + Abc_Print( 1, "Reduced original network was written into file \"%s\".\n", pFileName2 ); Gia_ManPrintStatsShort( pTemp ); Gia_ManStop( pTemp ); } @@ -24574,12 +25239,12 @@ int Abc_CommandAbc9Srm( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: &srm [-dsvh]\n" ); - fprintf( stdout, "\t writes speculatively reduced model into file \"%s\"\n", pFileName ); - fprintf( stdout, "\t-d : toggle creating dual output miter [default = %s]\n", fDualOut? "yes": "no" ); - fprintf( stdout, "\t-s : toggle writing reduced network for synthesis [default = %s]\n", fSynthesis? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &srm [-dsvh]\n" ); + Abc_Print( -2, "\t writes speculatively reduced model into file \"%s\"\n", pFileName ); + Abc_Print( -2, "\t-d : toggle creating dual output miter [default = %s]\n", fDualOut? "yes": "no" ); + Abc_Print( -2, "\t-s : toggle writing reduced network for synthesis [default = %s]\n", fSynthesis? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24596,7 +25261,7 @@ usage: ***********************************************************************/ int Abc_CommandAbc9Reduce( Abc_Frame_t * pAbc, int argc, char ** argv ) { - Gia_Man_t * pTemp; + Gia_Man_t * pTemp, * pTemp2; int c, fVerbose = 0; int fUseAll = 0; int fDualOut = 0; @@ -24620,29 +25285,27 @@ int Abc_CommandAbc9Reduce( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Reduce(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Reduce(): There is no AIG.\n" ); return 1; } - pAbc->pAig = Gia_ManEquivReduce( pTemp = pAbc->pAig, fUseAll, fDualOut, fVerbose ); - if ( pAbc->pAig == NULL ) - pAbc->pAig = pTemp; - else + pTemp = Gia_ManEquivReduce( pAbc->pGia, fUseAll, fDualOut, fVerbose ); + if ( pTemp != NULL ) { - Gia_ManStop( pTemp ); - pAbc->pAig = Gia_ManSeqStructSweep( pTemp = pAbc->pAig, 1, 1, 0 ); - Gia_ManStop( pTemp ); + pTemp = Gia_ManSeqStructSweep( pTemp2 = pTemp, 1, 1, 0 ); + Gia_ManStop( pTemp2 ); + Abc_CommandUpdate9( pAbc, pTemp ); } return 0; usage: - fprintf( stdout, "usage: &reduce [-advh]\n" ); - fprintf( stdout, "\t reduces the circuit using equivalence classes\n" ); - fprintf( stdout, "\t-a : toggle merging all equivalences [default = %s]\n", fUseAll? "yes": "no" ); - fprintf( stdout, "\t-d : toggle using dual-output merging [default = %s]\n", fDualOut? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &reduce [-advh]\n" ); + Abc_Print( -2, "\t reduces the circuit using equivalence classes\n" ); + Abc_Print( -2, "\t-a : toggle merging all equivalences [default = %s]\n", fUseAll? "yes": "no" ); + Abc_Print( -2, "\t-d : toggle using dual-output merging [default = %s]\n", fDualOut? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24674,7 +25337,7 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); @@ -24685,7 +25348,7 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'T': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-T\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } pPars->TimeLimit = atoi(argv[globalUtilOptind]); @@ -24707,8 +25370,13 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) } if ( fMiter ) { - printf( "Assuming the current network is a double-output miter. (Conflict limit = %d.)\n", pPars->nBTLimit ); - Cec_ManVerify( pAbc->pAig, pPars ); + if ( Gia_ManPoNum(pAbc->pGia) & 1 ) + { + Abc_Print( -1, "The dual-output miter should have an even number of outputs.\n" ); + return 1; + } + Abc_Print( 1, "Assuming the current network is a double-output miter. (Conflict limit = %d.)\n", pPars->nBTLimit ); + Cec_ManVerify( pAbc->pGia, pPars ); return 0; } @@ -24716,7 +25384,7 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) nArgcNew = argc - globalUtilOptind; if ( nArgcNew != 1 ) { - printf( "File name is not given on the command line.\n" ); + Abc_Print( -1, "File name is not given on the command line.\n" ); return 1; } @@ -24728,21 +25396,21 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) *pTemp = '\\'; if ( (pFile = fopen( FileName, "r" )) == NULL ) { - fprintf( pAbc->Err, "Cannot open input file \"%s\". ", FileName ); + Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); if ( (FileName = Extra_FileGetSimilarName( FileName, ".aig", NULL, NULL, NULL, NULL )) ) - fprintf( pAbc->Err, "Did you mean \"%s\"?", FileName ); - fprintf( pAbc->Err, "\n" ); + Abc_Print( 1, "Did you mean \"%s\"?", FileName ); + Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); pSecond = Gia_ReadAiger( FileName, 0 ); if ( pSecond == NULL ) { - printf( "Reading AIGER has failed.\n" ); + Abc_Print( -1, "Reading AIGER has failed.\n" ); return 0; } // compute the miter - pMiter = Gia_ManMiter( pAbc->pAig, pSecond, 1, 0, pPars->fVerbose ); + pMiter = Gia_ManMiter( pAbc->pGia, pSecond, 1, 0, pPars->fVerbose ); if ( pMiter ) { Cec_ManVerify( pMiter, pPars ); @@ -24752,13 +25420,13 @@ int Abc_CommandAbc9Cec( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - fprintf( stdout, "usage: &cec [-CT num] [-mvh]\n" ); - fprintf( stdout, "\t new combinational equivalence checker\n" ); - fprintf( stdout, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); - fprintf( stdout, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->TimeLimit ); - fprintf( stdout, "\t-m : toggle miter vs. two circuits [default = %s]\n", fMiter? "miter":"two circuits"); - fprintf( stdout, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes":"no"); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &cec [-CT num] [-mvh]\n" ); + Abc_Print( -2, "\t new combinational equivalence checker\n" ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-T num : approximate runtime limit in seconds [default = %d]\n", pPars->TimeLimit ); + Abc_Print( -2, "\t-m : toggle miter vs. two circuits [default = %s]\n", fMiter? "miter":"two circuits"); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes":"no"); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24787,7 +25455,7 @@ int Abc_CommandAbc9Force( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-I\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); @@ -24807,22 +25475,22 @@ int Abc_CommandAbc9Force( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Force(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Force(): There is no AIG.\n" ); return 1; } - For_ManExperiment( pAbc->pAig, nIters, fClustered, fVerbose ); + For_ManExperiment( pAbc->pGia, nIters, fClustered, fVerbose ); return 0; usage: - fprintf( stdout, "usage: &force [-I <num>] [-cvh]\n" ); - fprintf( stdout, "\t one-dimensional placement algorithm FORCE introduced by\n" ); - fprintf( stdout, "\t F. A. Aloul, I. L. Markov, and K. A. Sakallah (GLSVLSI’03).\n" ); - fprintf( stdout, "\t-I num : the number of refinement iterations [default = %d]\n", nIters ); - fprintf( stdout, "\t-c : toggle clustered representation [default = %s]\n", fClustered? "yes":"no"); - fprintf( stdout, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes":"no"); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &force [-I <num>] [-cvh]\n" ); + Abc_Print( -2, "\t one-dimensional placement algorithm FORCE introduced by\n" ); + Abc_Print( -2, "\t F. A. Aloul, I. L. Markov, and K. A. Sakallah (GLSVLSI�03).\n" ); + Abc_Print( -2, "\t-I num : the number of refinement iterations [default = %d]\n", nIters ); + Abc_Print( -2, "\t-c : toggle clustered representation [default = %s]\n", fClustered? "yes":"no"); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes":"no"); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24858,7 +25526,7 @@ int Abc_CommandAbc9Embed( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nDims = atoi(argv[globalUtilOptind]); @@ -24869,7 +25537,7 @@ int Abc_CommandAbc9Embed( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'I': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-D\" should be followed by an integer.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nIters = atoi(argv[globalUtilOptind]); @@ -24901,28 +25569,28 @@ int Abc_CommandAbc9Embed( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Embed(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Embed(): There is no AIG.\n" ); return 1; } - Gia_ManSolveProblem( pAbc->pAig, pPars ); + Gia_ManSolveProblem( pAbc->pGia, pPars ); return 0; usage: - fprintf( stdout, "usage: &embed [-DI <num>] [-rdlscvh]\n" ); - fprintf( stdout, "\t fast placement based on high-dimensional embedding from\n" ); - fprintf( stdout, "\t D. Harel and Y. Koren, \"Graph drawing by high-dimensional\n" ); - fprintf( stdout, "\t embedding\", J. Graph Algs & Apps, 2004, Vol 8(2), pp. 195-217\n" ); - fprintf( stdout, "\t-D num : the number of dimensions for embedding [default = %d]\n", pPars->nDims ); - fprintf( stdout, "\t-I num : the number of refinement iterations [default = %d]\n", pPars->nIters ); - fprintf( stdout, "\t-r : toggle the use of refinement [default = %s]\n", pPars->fRefine? "yes":"no"); - fprintf( stdout, "\t-c : toggle clustered representation [default = %s]\n", pPars->fCluster? "yes":"no"); - fprintf( stdout, "\t-d : toggle dumping placement into a Gnuplot file [default = %s]\n", pPars->fDump? "yes":"no"); - fprintf( stdout, "\t-l : toggle dumping Gnuplot for large placement [default = %s]\n", pPars->fDumpLarge? "yes":"no"); - fprintf( stdout, "\t-s : toggle showing image if Gnuplot is installed [default = %s]\n", pPars->fShowImage? "yes":"no"); - fprintf( stdout, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes":"no"); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &embed [-DI <num>] [-rdlscvh]\n" ); + Abc_Print( -2, "\t fast placement based on high-dimensional embedding from\n" ); + Abc_Print( -2, "\t D. Harel and Y. Koren, \"Graph drawing by high-dimensional\n" ); + Abc_Print( -2, "\t embedding\", J. Graph Algs & Apps, 2004, Vol 8(2), pp. 195-217\n" ); + Abc_Print( -2, "\t-D num : the number of dimensions for embedding [default = %d]\n", pPars->nDims ); + Abc_Print( -2, "\t-I num : the number of refinement iterations [default = %d]\n", pPars->nIters ); + Abc_Print( -2, "\t-r : toggle the use of refinement [default = %s]\n", pPars->fRefine? "yes":"no"); + Abc_Print( -2, "\t-c : toggle clustered representation [default = %s]\n", pPars->fCluster? "yes":"no"); + Abc_Print( -2, "\t-d : toggle dumping placement into a Gnuplot file [default = %s]\n", pPars->fDump? "yes":"no"); + Abc_Print( -2, "\t-l : toggle dumping Gnuplot for large placement [default = %s]\n", pPars->fDumpLarge? "yes":"no"); + Abc_Print( -2, "\t-s : toggle showing image if Gnuplot is installed [default = %s]\n", pPars->fShowImage? "yes":"no"); + Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", pPars->fVerbose? "yes":"no"); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -24947,21 +25615,21 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) extern int Gia_MappingIf( Gia_Man_t * p, If_Par_t * pPars ); if ( pAbc->pAbc8Lib == NULL ) { - printf( "LUT library is not given. Using default LUT library.\n" ); + Abc_Print( -1, "LUT library is not given. Using default LUT library.\n" ); pAbc->pAbc8Lib = If_SetSimpleLutLib( 6 ); } // set defaults Gia_ManSetIfParsDefault( pPars ); pPars->pLutLib = pAbc->pAbc8Lib; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "KCFADEqaflepmrstbvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "KCFADEqaflepmrsdbvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-K\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-K\" should be followed by a positive integer.\n" ); goto usage; } pPars->nLutSize = atoi(argv[globalUtilOptind]); @@ -24974,7 +25642,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by a positive integer.\n" ); goto usage; } pPars->nCutsMax = atoi(argv[globalUtilOptind]); @@ -24985,7 +25653,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'F': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-F\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-F\" should be followed by a positive integer.\n" ); goto usage; } pPars->nFlowIters = atoi(argv[globalUtilOptind]); @@ -24996,7 +25664,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'A': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-A\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-A\" should be followed by a positive integer.\n" ); goto usage; } pPars->nAreaIters = atoi(argv[globalUtilOptind]); @@ -25007,7 +25675,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'D': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-D\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-D\" should be followed by a floating point number.\n" ); goto usage; } pPars->DelayTarget = (float)atof(argv[globalUtilOptind]); @@ -25018,7 +25686,7 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'E': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-E\" should be followed by a floating point number.\n" ); + Abc_Print( -1, "Command line switch \"-E\" should be followed by a floating point number.\n" ); goto usage; } pPars->Epsilon = (float)atof(argv[globalUtilOptind]); @@ -25053,11 +25721,11 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) case 's': pPars->fSeqMap ^= 1; break; - case 't': - pPars->fLiftLeaves ^= 1; + case 'd': + pPars->fBidec ^= 1; break; case 'b': - pPars->fBidec ^= 1; + pPars->fUseBat ^= 1; break; case 'v': pPars->fVerbose ^= 1; @@ -25067,31 +25735,41 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9If(): There is no AIG to map.\n" ); + Abc_Print( -1, "Abc_CommandAbc9If(): There is no AIG to map.\n" ); return 1; } if ( pPars->nLutSize < 3 || pPars->nLutSize > IF_MAX_LUTSIZE ) { - fprintf( stdout, "Incorrect LUT size (%d).\n", pPars->nLutSize ); + Abc_Print( -1, "Incorrect LUT size (%d).\n", pPars->nLutSize ); return 1; } if ( pPars->nCutsMax < 1 || pPars->nCutsMax >= (1<<12) ) { - fprintf( stdout, "Incorrect number of cuts.\n" ); + Abc_Print( -1, "Incorrect number of cuts.\n" ); return 1; } -/* + // enable truth table computation if choices are selected - if ( (c = Aig_ManChoiceNum( pAbc->pAbc8Aig )) ) + if ( (c = Gia_ManCountChoiceNodes( pAbc->pGia )) ) { - printf( "Performing LUT mapping with %d choices.\n", c ); + Abc_Print( 0, "Performing LUT mapping with %d choices.\n", c ); pPars->fExpRed = 0; } -*/ + + if ( pPars->fUseBat ) + { + if ( pPars->nLutSize < 4 || pPars->nLutSize > 6 ) + { + Abc_Print( -1, "This feature only works for {4,5,6}-LUTs.\n" ); + return 1; + } + pPars->fCutMin = 1; + } + // enable truth table computation if cut minimization is selected if ( pPars->fCutMin ) { @@ -25102,13 +25780,13 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) // complain if truth tables are requested but the cut size is too large if ( pPars->fTruth && pPars->nLutSize > IF_MAX_FUNC_LUTSIZE ) { - fprintf( stdout, "Truth tables cannot be computed for LUT larger than %d inputs.\n", IF_MAX_FUNC_LUTSIZE ); + Abc_Print( -1, "Truth tables cannot be computed for LUT larger than %d inputs.\n", IF_MAX_FUNC_LUTSIZE ); return 1; } - if ( !Gia_MappingIf( pAbc->pAig, pPars ) ) + if ( !Gia_MappingIf( pAbc->pGia, pPars ) ) { - printf( "Abc_CommandAbc9If(): Mapping of the AIG has failed.\n" ); + Abc_Print( -1, "Abc_CommandAbc9If(): Mapping of the AIG has failed.\n" ); return 1; } return 0; @@ -25122,27 +25800,184 @@ usage: sprintf( LutSize, "library" ); else sprintf( LutSize, "%d", pPars->nLutSize ); - fprintf( stdout, "usage: &if [-KCFA num] [-DE float] [-qarlepmbvh]\n" ); - fprintf( stdout, "\t performs FPGA technology mapping of the network\n" ); - fprintf( stdout, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); - fprintf( stdout, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); - fprintf( stdout, "\t-F num : the number of area flow recovery iterations (num >= 0) [default = %d]\n", pPars->nFlowIters ); - fprintf( stdout, "\t-A num : the number of exact area recovery iterations (num >= 0) [default = %d]\n", pPars->nAreaIters ); - fprintf( stdout, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer ); - fprintf( stdout, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->Epsilon ); - fprintf( stdout, "\t-q : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" ); - fprintf( stdout, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" ); -// fprintf( stdout, "\t-f : toggles one fancy feature [default = %s]\n", pPars->fFancy? "yes": "no" ); - fprintf( stdout, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" ); - fprintf( stdout, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" ); - fprintf( stdout, "\t-e : uses edge-based cut selection heuristics [default = %s]\n", pPars->fEdge? "yes": "no" ); - fprintf( stdout, "\t-p : uses power-aware cut selection heuristics [default = %s]\n", pPars->fPower? "yes": "no" ); - fprintf( stdout, "\t-m : enables cut minimization by removing vacuous variables [default = %s]\n", pPars->fCutMin? "yes": "no" ); -// fprintf( stdout, "\t-s : toggles sequential mapping [default = %s]\n", pPars->fSeqMap? "yes": "no" ); -// fprintf( stdout, "\t-t : toggles the use of true sequential cuts [default = %s]\n", pPars->fLiftLeaves? "yes": "no" ); - fprintf( stdout, "\t-b : toggles deriving local AIGs using bi-decomposition [default = %s]\n", pPars->fBidec? "yes": "no" ); - fprintf( stdout, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : prints the command usage\n"); + Abc_Print( -2, "usage: &if [-KCFA num] [-DE float] [-qarlepmdbvh]\n" ); + Abc_Print( -2, "\t performs FPGA technology mapping of the network\n" ); + Abc_Print( -2, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); + Abc_Print( -2, "\t-C num : the max number of priority cuts (0 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); + Abc_Print( -2, "\t-F num : the number of area flow recovery iterations (num >= 0) [default = %d]\n", pPars->nFlowIters ); + Abc_Print( -2, "\t-A num : the number of exact area recovery iterations (num >= 0) [default = %d]\n", pPars->nAreaIters ); + Abc_Print( -2, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer ); + Abc_Print( -2, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->Epsilon ); + Abc_Print( -2, "\t-q : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" ); + Abc_Print( -2, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" ); +// Abc_Print( -2, "\t-f : toggles one fancy feature [default = %s]\n", pPars->fFancy? "yes": "no" ); + Abc_Print( -2, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" ); + Abc_Print( -2, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" ); + Abc_Print( -2, "\t-e : uses edge-based cut selection heuristics [default = %s]\n", pPars->fEdge? "yes": "no" ); + Abc_Print( -2, "\t-p : uses power-aware cut selection heuristics [default = %s]\n", pPars->fPower? "yes": "no" ); + Abc_Print( -2, "\t-m : enables cut minimization by removing vacuous variables [default = %s]\n", pPars->fCutMin? "yes": "no" ); +// Abc_Print( -2, "\t-s : toggles sequential mapping [default = %s]\n", pPars->fSeqMap? "yes": "no" ); + Abc_Print( -2, "\t-d : toggles deriving local AIGs using bi-decomposition [default = %s]\n", pPars->fBidec? "yes": "no" ); + Abc_Print( -2, "\t-b : toggles the use of one special feature [default = %s]\n", pPars->fUseBat? "yes": "no" ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : prints the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Trace( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); + int c; + int fUseLutLib; + int fVerbose; + pNtk = Abc_FrameReadNtk(pAbc); + // set defaults + fUseLutLib = 0; + fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "lvh" ) ) != EOF ) + { + switch ( c ) + { + case 'l': + fUseLutLib ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Speedup(): There is no AIG to map.\n" ); + return 1; + } + if ( pAbc->pGia->pMapping == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Speedup(): Mapping of the AIG is not defined.\n" ); + return 1; + } + pAbc->pGia->pLutLib = fUseLutLib ? pAbc->pLibLut : NULL; + Gia_ManDelayTraceLutPrint( pAbc->pGia, fVerbose ); + return 0; + +usage: + Abc_Print( -2, "usage: &trace [-lvh]\n" ); + Abc_Print( -2, "\t performs delay trace of LUT-mapped network\n" ); + Abc_Print( -2, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib": "unit" ); + Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Speedup( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_Man_t * pTemp; + int fUseLutLib; + int Percentage; + int Degree; + int fVerbose; + int c, fVeryVerbose; + + // set defaults + fUseLutLib = 0; + Percentage = 5; + Degree = 2; + fVerbose = 0; + fVeryVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "PNlvwh" ) ) != EOF ) + { + switch ( c ) + { + case 'P': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); + goto usage; + } + Percentage = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( Percentage < 1 || Percentage > 100 ) + goto usage; + break; + case 'N': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); + goto usage; + } + Degree = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( Degree < 1 || Degree > 5 ) + goto usage; + break; + case 'l': + fUseLutLib ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'w': + fVeryVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Speedup(): There is no AIG to map.\n" ); + return 1; + } + if ( pAbc->pGia->pMapping == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Speedup(): Mapping of the AIG is not defined.\n" ); + return 1; + } + pAbc->pGia->pLutLib = fUseLutLib ? pAbc->pLibLut : NULL; + pTemp = Gia_ManSpeedup( pAbc->pGia, Percentage, Degree, fVerbose, fVeryVerbose ); + Abc_CommandUpdate9( pAbc, pTemp ); + return 0; + +usage: + Abc_Print( -2, "usage: &speedup [-P num] [-N num] [-lvwh]\n" ); + Abc_Print( -2, "\t transforms LUT-mapped network into an AIG with choices;\n" ); + Abc_Print( -2, "\t the choices are added to speedup the next round of mapping\n" ); + Abc_Print( -2, "\t-P <num> : delay delta defining critical path for library model [default = %d%%]\n", Percentage ); + Abc_Print( -2, "\t-N <num> : the max critical path degree for resynthesis (0 < num < 6) [default = %d]\n", Degree ); + Abc_Print( -2, "\t-l : toggle using unit- or LUT-library-delay model [default = %s]\n", fUseLutLib? "lib" : "unit" ); + Abc_Print( -2, "\t-v : toggle printing optimization summary [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printing detailed stats for each node [default = %s]\n", fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -25164,8 +25999,8 @@ int Abc_CommandAbc9Era( Abc_Frame_t * pAbc, int argc, char ** argv ) int fUseCubes = 1; int fMiter = 0; int nStatesMax = 1000000000; - extern void Gia_ManCollectReachable( Gia_Man_t * pAig, int nStatesMax, int fMiter, int fVerbose ); - extern void Gia_ManArePerform( Gia_Man_t * pAig, int nStatesMax, int fMiter, int fVerbose ); + extern int Gia_ManCollectReachable( Gia_Man_t * pAig, int nStatesMax, int fMiter, int fVerbose ); + extern int Gia_ManArePerform( Gia_Man_t * pAig, int nStatesMax, int fMiter, int fVerbose ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Smcvh" ) ) != EOF ) @@ -25175,7 +26010,7 @@ int Abc_CommandAbc9Era( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'S': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-S\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-S\" should be followed by a positive integer.\n" ); goto usage; } nStatesMax = atoi(argv[globalUtilOptind]); @@ -25198,38 +26033,37 @@ int Abc_CommandAbc9Era( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Era(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Era(): There is no AIG.\n" ); return 1; } - if ( Gia_ManRegNum(pAbc->pAig) == 0 ) + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) { - printf( "Abc_CommandAbc9Era(): The network is combinational.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Era(): The network is combinational.\n" ); return 1; } - if ( !fUseCubes && Gia_ManPiNum(pAbc->pAig) > 12 ) + if ( !fUseCubes && Gia_ManPiNum(pAbc->pGia) > 12 ) { - printf( "Abc_CommandAbc9Era(): The number of PIs (%d) should be no more than 12 when cubes are not used.\n", Gia_ManPiNum(pAbc->pAig) ); + Abc_Print( -1, "Abc_CommandAbc9Era(): The number of PIs (%d) should be no more than 12 when cubes are not used.\n", Gia_ManPiNum(pAbc->pGia) ); return 1; } if ( fUseCubes ) - Gia_ManArePerform( pAbc->pAig, nStatesMax, fMiter, fVerbose ); + pAbc->Status = Gia_ManArePerform( pAbc->pGia, nStatesMax, fMiter, fVerbose ); else - Gia_ManCollectReachable( pAbc->pAig, nStatesMax, fMiter, fVerbose ); - pAbc->pCex = ((Gia_Man_t *)pAbc->pAig)->pCexSeq; // temporary ??? - ((Gia_Man_t *)pAbc->pAig)->pCexSeq = NULL; + pAbc->Status = Gia_ManCollectReachable( pAbc->pGia, nStatesMax, fMiter, fVerbose ); + Abc_FrameReplaceCex( pAbc, &pAbc->pGia->pCexSeq ); return 0; usage: - fprintf( stdout, "usage: &era [-S num] [-mcvh]\n" ); -// fprintf( stdout, "usage: &era [-S num] [-mvh]\n" ); - fprintf( stdout, "\t explicit reachability analysis for small sequential AIGs\n" ); - fprintf( stdout, "\t-S num : the max number of states (num > 0) [default = %d]\n", nStatesMax ); - fprintf( stdout, "\t-m : stop when the miter output is 1 [default = %s]\n", fMiter? "yes": "no" ); - fprintf( stdout, "\t-c : use state cubes instead of state minterms [default = %s]\n", fUseCubes? "yes": "no" ); - fprintf( stdout, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &era [-S num] [-mcvh]\n" ); +// Abc_Print( -2, "usage: &era [-S num] [-mvh]\n" ); + Abc_Print( -2, "\t explicit reachability analysis for small sequential AIGs\n" ); + Abc_Print( -2, "\t-S num : the max number of states (num > 0) [default = %d]\n", nStatesMax ); + Abc_Print( -2, "\t-m : stop when the miter output is 1 [default = %s]\n", fMiter? "yes": "no" ); + Abc_Print( -2, "\t-c : use state cubes instead of state minterms [default = %s]\n", fUseCubes? "yes": "no" ); + Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -25246,36 +26080,63 @@ usage: ***********************************************************************/ int Abc_CommandAbc9Dch( Abc_Frame_t * pAbc, int argc, char ** argv ) { -// extern void Hcd_ComputeChoicesTest( Gia_Man_t * pAig, int nBTLimit, int fSynthesis, int fUseMiniSat, int fVerbose ); - Gia_Man_t * pTemp = NULL; - int nBTLimit = 100; - int fSynthesis = 1; - int fUseMiniSat = 0; - int c, fVerbose = 0; + Gia_Man_t * pTemp; + Dch_Pars_t Pars, * pPars = &Pars; + int c; + // set defaults + Dch_ManSetDefaultParams( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Csmvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "WCSsptfvh" ) ) != EOF ) { switch ( c ) { + case 'W': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nWords = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nWords < 0 ) + goto usage; + break; case 'C': if ( globalUtilOptind >= argc ) { - fprintf( stdout, "Command line switch \"-C\" should be followed by a positive integer.\n" ); + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } - nBTLimit = atoi(argv[globalUtilOptind]); + pPars->nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; - if ( nBTLimit < 0 ) + if ( pPars->nBTLimit < 0 ) + goto usage; + break; + case 'S': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nSatVarMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nSatVarMax < 0 ) goto usage; break; case 's': - fSynthesis ^= 1; + pPars->fSynthesis ^= 1; break; - case 'm': - fUseMiniSat ^= 1; + case 'p': + pPars->fPower ^= 1; + break; + case 't': + pPars->fSimulateTfo ^= 1; + break; + case 'f': + pPars->fLightSynth ^= 1; break; case 'v': - fVerbose ^= 1; + pPars->fVerbose ^= 1; break; case 'h': goto usage; @@ -25283,22 +26144,27 @@ int Abc_CommandAbc9Dch( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Test(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Test(): There is no AIG.\n" ); return 1; } -// Hcd_ComputeChoicesTest( pAbc->pAig, nBTLimit, fSynthesis, fUseMiniSat, fVerbose ); + pTemp = Gia_ManPerformDch( pAbc->pGia, pPars ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &dch [-C num] [-smvh]\n" ); - fprintf( stdout, "\t computing choices using the latest algorithm\n" ); - fprintf( stdout, "\t-C num : the max number of states to traverse (num > 0) [default = %d]\n", nBTLimit ); - fprintf( stdout, "\t-s : toggle printing verbose information [default = %s]\n", fSynthesis? "yes": "no" ); - fprintf( stdout, "\t-m : toggle using MiniSat as a SAT solver [default = %s]\n", fUseMiniSat? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &dch [-WCS num] [-sptfvh]\n" ); + Abc_Print( -2, "\t computes structural choices using a new approach\n" ); + Abc_Print( -2, "\t-W num : the max number of simulation words [default = %d]\n", pPars->nWords ); + Abc_Print( -2, "\t-C num : the max number of conflicts at a node [default = %d]\n", pPars->nBTLimit ); + Abc_Print( -2, "\t-S num : the max number of SAT variables [default = %d]\n", pPars->nSatVarMax ); + Abc_Print( -2, "\t-s : toggle synthesizing three snapshots [default = %s]\n", pPars->fSynthesis? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle power-aware rewriting [default = %s]\n", pPars->fPower? "yes": "no" ); + Abc_Print( -2, "\t-t : toggle simulation of the TFO classes [default = %s]\n", pPars->fSimulateTfo? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle using lighter logic synthesis [default = %s]\n", pPars->fLightSynth? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -25313,24 +26179,76 @@ usage: SeeAlso [] ***********************************************************************/ -int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) +int Abc_CommandAbc9AbsStart( Abc_Frame_t * pAbc, int argc, char ** argv ) { - Gia_Man_t * pTemp = NULL; - int c, fVerbose = 0; - int fSwitch = 0; - extern void Gia_SatSolveTest( Gia_Man_t * p ); - extern void Cbs_ManSolveTest( Gia_Man_t * pGia ); + Gia_ParAbs_t Pars, * pPars = &Pars; + int c; + extern void Gia_ManCexAbstractionStart( Gia_Man_t * pGia, Gia_ParAbs_t * pPars ); + // set defaults + Gia_ManAbsSetDefaultParams( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "svh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "FCRrpfvh" ) ) != EOF ) { switch ( c ) { - case 's': - fSwitch ^= 1; + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nFramesBmc = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nFramesBmc < 0 ) + goto usage; + break; +/* + case 'S': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nStableMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nStableMax < 0 ) + goto usage; + break; +*/ + case 'C': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nConfMaxBmc = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nConfMaxBmc < 0 ) + goto usage; + break; + case 'R': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nRatio = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nRatio < 0 ) + goto usage; + break; + case 'r': + pPars->fUseBdds ^= 1; + break; + case 'p': + pPars->fUseDprove ^= 1; + break; + case 'f': + pPars->fUseStart ^= 1; break; case 'v': - fVerbose ^= 1; + pPars->fVerbose ^= 1; break; case 'h': goto usage; @@ -25338,33 +26256,356 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) goto usage; } } - if ( pAbc->pAig == NULL ) + if ( pAbc->pGia == NULL ) { - printf( "Abc_CommandAbc9Test(): There is no AIG.\n" ); + Abc_Print( -1, "Abc_CommandAbc9AbsStart(): There is no AIG.\n" ); return 1; + } + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) + { + Abc_Print( -1, "Abc_CommandAbc9AbsStart(): The AIG is combinational.\n" ); + return 0; + } + if ( !(0 <= pPars->nRatio && pPars->nRatio <= 100) ) + { + Abc_Print( -1, "Abc_CommandAbc9AbsStart(): Wrong value of parameter \"-R <num>\".\n" ); + return 0; + } + Gia_ManCexAbstractionStart( pAbc->pGia, pPars ); + pAbc->Status = pPars->Status; + pAbc->nFrames = pPars->nFramesDone; + Abc_FrameReplaceCex( pAbc, &pAbc->pGia->pCexSeq ); + return 0; +usage: + Abc_Print( -2, "usage: &abs_start [-FCR num] [-rpfvh]\n" ); + Abc_Print( -2, "\t initializes flop map using cex-based abstraction\n" ); + Abc_Print( -2, "\t-F num : the max number of timeframes for BMC [default = %d]\n", pPars->nFramesBmc ); +// Abc_Print( -2, "\t-S num : the max number of stable frames for BMC [default = %d]\n", pPars->nStableMax ); + Abc_Print( -2, "\t-C num : the max number of conflicts by SAT solver for BMC [default = %d]\n", pPars->nConfMaxBmc ); + Abc_Print( -2, "\t-R num : the %% of abstracted flops when refinement stops (0<=num<=100) [default = %d]\n", pPars->nRatio ); + Abc_Print( -2, "\t-r : toggle using BDD-based reachability for filtering [default = %s]\n", pPars->fUseBdds? "yes": "no" ); + Abc_Print( -2, "\t-p : toggle using \"dprove\" for filtering [default = %s]\n", pPars->fUseDprove? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle starting BMC from a later frame [default = %s]\n", pPars->fUseStart? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9AbsStartNew( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_ParAbs_t Pars, * pPars = &Pars; + int c; + extern void Gia_ManCexAbstractionStartNew( Gia_Man_t * pGia, Gia_ParAbs_t * pPars ); + + // set defaults + Gia_ManAbsSetDefaultParams( pPars ); + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "AFSCRBTVrpfvwh" ) ) != EOF ) + { + switch ( c ) + { + case 'A': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + pPars->Algo = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->Algo < 0 ) + goto usage; + break; + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nFramesBmc = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nFramesBmc < 0 ) + goto usage; + break; + case 'S': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nStableMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nStableMax < 0 ) + goto usage; + break; + case 'C': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nConfMaxBmc = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nConfMaxBmc < 0 ) + goto usage; + break; + case 'R': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nRatio = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nRatio < 0 ) + goto usage; + break; + case 'B': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nBobPar = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nBobPar < 0 ) + goto usage; + break; + case 'T': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); + goto usage; + } + pPars->TimeOut = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->TimeOut < 0 ) + goto usage; + break; + case 'V': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-V\" should be followed by an integer.\n" ); + goto usage; + } + pPars->TimeOutVT = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->TimeOutVT < 0 ) + goto usage; + break; + case 'r': + pPars->fUseBdds ^= 1; + break; + case 'p': + pPars->fUseDprove ^= 1; + break; + case 'f': + pPars->fUseStart ^= 1; + break; + case 'v': + pPars->fVerbose ^= 1; + break; + case 'w': + pPars->fVeryVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9AbsStartNew(): There is no AIG.\n" ); + return 1; + } + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) + { + Abc_Print( -1, "Abc_CommandAbc9AbsStartNew(): The AIG is combinational.\n" ); + return 0; + } + if ( !(0 <= pPars->nRatio && pPars->nRatio <= 100) ) + { + Abc_Print( -1, "Abc_CommandAbc9AbsStartNew(): Wrong value of parameter \"-R <num>\".\n" ); + return 0; + } + Gia_ManCexAbstractionStartNew( pAbc->pGia, pPars ); + pAbc->Status = pPars->Status; + pAbc->nFrames = pPars->nFramesDone; + Abc_FrameReplaceCex( pAbc, &pAbc->pGia->pCexSeq ); + if ( pPars->fVerbose ) + printf( "Updating ABC solving status to be %d and bmc_frames_done to be %d.\n", pPars->Status, pAbc->nFrames ); + return 0; +usage: + Abc_Print( -2, "usage: &abs_newstart [-AFSCBTV num] [-vwh]\n" ); + Abc_Print( -2, "\t initializes flop map using cex-based abstraction (by Niklas Een)\n" ); + Abc_Print( -2, "\t-A num : selects the algorithm to use [default = %d]\n", pPars->Algo ); + Abc_Print( -2, "\t 0 = cba\n" ); + Abc_Print( -2, "\t 1 = pba\n" ); + Abc_Print( -2, "\t 2 = cba-then-pba\n" ); + Abc_Print( -2, "\t 3 = cba-with-pba\n" ); + Abc_Print( -2, "\t-F num : the max number of timeframes for BMC [default = %d]\n", pPars->nFramesBmc ); + Abc_Print( -2, "\t-S num : the max number of stable frames for BMC [default = %d]\n", pPars->nStableMax ); + Abc_Print( -2, "\t-C num : the max number of conflicts by SAT solver for BMC [default = %d]\n", pPars->nConfMaxBmc ); + Abc_Print( -2, "\t-B num : the max number of frames to wait before trying to quit [default = %d]\n", pPars->nBobPar ); + Abc_Print( -2, "\t-T num : approximate time limit in seconds (0=infinite) [default = %d]\n", pPars->TimeOut ); + Abc_Print( -2, "\t-V num : approximate \"virtual time\" limit in seconds (0=infinite) [default = %d]\n", pPars->TimeOutVT ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : toggle printing additional information [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9PbaStart( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_ParAbs_t Pars, * pPars = &Pars; + int c; + extern void Gia_ManProofAbstractionStart( Gia_Man_t * pGia, Gia_ParAbs_t * pPars ); + + // set defaults + Gia_ManAbsSetDefaultParams( pPars ); + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "FCdvh" ) ) != EOF ) + { + switch ( c ) + { + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nFramesMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nFramesMax < 0 ) + goto usage; + break; + case 'C': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nConfMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nConfMax < 0 ) + goto usage; + break; + case 'd': + pPars->fDynamic ^= 1; + break; + case 'v': + pPars->fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9PbaStart(): There is no AIG.\n" ); + return 1; + } + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) + { + Abc_Print( -1, "Abc_CommandAbc9PbaStart(): The AIG is combinational.\n" ); + return 0; } -// Gia_ManFrontTest( pAbc->pAig ); -// Gia_ManReduceConst( pAbc->pAig, 1 ); -// Sat_ManTest( pAbc->pAig, Gia_ManCo(pAbc->pAig, 0), 0 ); -// Gia_ManTestDistance( pAbc->pAig ); -// Gia_SatSolveTest( pAbc->pAig ); -// For_ManExperiment( pAbc->pAig, 20, 1, 1 ); -// Gia_ManUnrollSpecial( pAbc->pAig, 5, 100, 1 ); + Gia_ManProofAbstractionStart( pAbc->pGia, pPars ); + pAbc->Status = pPars->Status; + Abc_FrameReplaceCex( pAbc, &pAbc->pGia->pCexSeq ); + return 0; +usage: + Abc_Print( -2, "usage: &pba_start [-FC num] [-dvh]\n" ); + Abc_Print( -2, "\t computes initial flop map using proof-based abstraction\n" ); + Abc_Print( -2, "\t-F num : the max number of timeframes for PBA [default = %d]\n", pPars->nFramesMax ); + Abc_Print( -2, "\t-C num : the max number of conflicts by SAT solver for PBA [default = %d]\n", pPars->nConfMax ); +// Abc_Print( -2, "\t-G num : the max number of timeframes for BMC [default = %d]\n", pPars->nFramesBmc ); +// Abc_Print( -2, "\t-D num : the max number of conflicts by SAT solver for BMC [default = %d]\n", pPars->nConfMaxBmc ); +// Abc_Print( -2, "\t-R num : the %% of abstracted flops when refinement stops (0<=num<=100) [default = %d]\n", pPars->nRatio ); + Abc_Print( -2, "\t-d : toggle dynamic unrolling of timeframes [default = %s]\n", pPars->fDynamic? "yes": "no" ); +// Abc_Print( -2, "\t-e : toggle extending abstraction using COI of flops [default = %s]\n", pPars->fExtend? "yes": "no" ); +// Abc_Print( -2, "\t-s : toggle skipping proof-based abstraction [default = %s]\n", pPars->fSkipProof? "yes": "no" ); +// Abc_Print( -2, "\t-r : toggle using BDD-based reachability for filtering [default = %s]\n", pPars->fUseBdds? "yes": "no" ); +// Abc_Print( -2, "\t-p : toggle using \"dprove\" for filtering [default = %s]\n", pPars->fUseDprove? "yes": "no" ); +// Abc_Print( -2, "\t-f : toggle starting BMC from a later frame [default = %s]\n", pPars->fUseStart? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} - if ( fSwitch ) - pAbc->pAig = Gia_ManDupSelf( pTemp = pAbc->pAig ); - else - pAbc->pAig = Gia_ManRemoveEnables( pTemp = pAbc->pAig ); - Gia_ManStop( pTemp ); -// Cbs_ManSolveTest( pAbc->pAig ); +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9AbsDerive( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_Man_t * pTemp = NULL; + int c, fVerbose = 0; + extern Gia_Man_t * Gia_ManCexAbstractionDerive( Gia_Man_t * pGia ); + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + { + switch ( c ) + { + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9AbsDerive(): There is no AIG.\n" ); + return 1; + } + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) + { + Abc_Print( -1, "The network is combinational.\n" ); + return 0; + } + pTemp = Gia_ManCexAbstractionDerive( pAbc->pGia ); + Abc_CommandUpdate9( pAbc, pTemp ); return 0; usage: - fprintf( stdout, "usage: &test [-svh]\n" ); - fprintf( stdout, "\t testing various procedures\n" ); - fprintf( stdout, "\t-s : toggle enable (yes) vs. disable (no) [default = %s]\n", fSwitch? "yes": "no" ); - fprintf( stdout, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &abs_derive [-vh]\n" ); + Abc_Print( -2, "\t performs abstraction using the pre-computed flop map\n" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } @@ -25379,54 +26620,458 @@ usage: SeeAlso [] ***********************************************************************/ -int Abc_CommandAbcTestNew( Abc_Frame_t * pAbc, int argc, char ** argv ) +int Abc_CommandAbc9AbsRefine( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern int Abc_NtkTestProcedure( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 ); + Gia_Man_t * pTemp = NULL; + int c, fVerbose = 0; + extern int Gia_ManCexAbstractionRefine( Gia_Man_t * pGia, Abc_Cex_t * pCex, int fVerbose ); + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + { + switch ( c ) + { + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9AbsRefine(): There is no AIG.\n" ); + return 1; + } + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) + { + Abc_Print( -1, "The network is combinational.\n" ); + return 0; + } + if ( pAbc->pCex == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9AbsRefine(): There is no counter-example.\n" ); + return 1; + } + pAbc->Status = Gia_ManCexAbstractionRefine( pAbc->pGia, pAbc->pCex, fVerbose ); + Abc_FrameReplaceCex( pAbc, &pAbc->pGia->pCexSeq ); + return 0; - Abc_Ntk_t * pNtk; - int c; +usage: + Abc_Print( -2, "usage: &abs_refine [-vh]\n" ); + Abc_Print( -2, "\t refines the pre-computed flop map using the counter-example\n" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} - pNtk = Abc_FrameReadNtk(pAbc); +/**Function************************************************************* - // set defaults + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Reparam( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_Man_t * pTemp = NULL; + int c, fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) { switch ( c ) { + case 'v': + fVerbose ^= 1; + break; case 'h': goto usage; default: goto usage; } } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Reparam(): There is no AIG.\n" ); + return 1; + } + pTemp = Gia_ManReparm( pAbc->pGia, fVerbose ); + Abc_CommandUpdate9( pAbc, pTemp ); + return 0; - if ( pNtk == NULL ) +usage: + Abc_Print( -2, "usage: &reparam [-vh]\n" ); + Abc_Print( -2, "\t performs input trimming nad reparameterization\n" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Posplit( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern Aig_Man_t * Aig_ManSplit( Aig_Man_t * p, int nVars, int fVerbose ); + Aig_Man_t * pMan, * pAux; + Gia_Man_t * pTemp = NULL; + int c, nVars = 5, fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "Nvh" ) ) != EOF ) + { + switch ( c ) + { + case 'N': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); + goto usage; + } + nVars = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( nVars < 0 ) + goto usage; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) { - fprintf( stdout, "Empty network.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Posplit(): There is no AIG.\n" ); return 1; + } + pMan = Gia_ManToAigSimple( pAbc->pGia ); + pMan = Aig_ManSplit( pAux = pMan, nVars, fVerbose ); + Aig_ManStop( pAux ); + if ( pMan != NULL ) + { + pTemp = Gia_ManFromAigSimple( pMan ); + Aig_ManStop( pMan ); + Abc_CommandUpdate9( pAbc, pTemp ); } + return 0; - if ( !Abc_NtkIsStrash( pNtk) ) +usage: + Abc_Print( -2, "usage: &posplit [-N num] [-vh]\n" ); + Abc_Print( -2, "\t cofactors the property output w.r.t. a support subset\n" ); + Abc_Print( -2, "\t (the OR of new PO functions is equal to the original property)\n" ); + Abc_Print( -2, "\t-N num : the number of random cofactoring variables [default = %d]\n", nVars ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Reach( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_ParLlb_t Pars, * pPars = &Pars; + Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); + char * pLogFileName = NULL; + int c; + extern int Llb_ManModelCheckGia( Gia_Man_t * pGia, Gia_ParLlb_t * pPars ); + + // set defaults + Llb_ManSetDefaultParams( pPars ); + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "TBFCHSLripcsyzvwh" ) ) != EOF ) + { + switch ( c ) + { + case 'T': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); + goto usage; + } + pPars->TimeLimit = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->TimeLimit < 0 ) + goto usage; + break; + case 'B': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nBddMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nBddMax < 0 ) + goto usage; + break; + case 'F': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nIterMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nIterMax < 0 ) + goto usage; + break; + case 'C': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nClusterMax = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nClusterMax < 0 ) + goto usage; + break; + case 'H': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-H\" should be followed by an integer.\n" ); + goto usage; + } + pPars->nHintDepth = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->nHintDepth < 0 ) + goto usage; + break; + case 'S': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); + goto usage; + } + pPars->HintFirst = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + if ( pPars->HintFirst < 0 ) + goto usage; + break; + case 'L': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-L\" should be followed by a file name.\n" ); + goto usage; + } + pLogFileName = argv[globalUtilOptind]; + globalUtilOptind++; + break; + case 'r': + pPars->fReorder ^= 1; + break; + case 'i': + pPars->fIndConstr ^= 1; + break; + case 'p': + pPars->fUsePivots ^= 1; + break; + case 'c': + pPars->fCluster ^= 1; + break; + case 's': + pPars->fSchedule ^= 1; + break; + case 'y': + pPars->fSkipOutCheck ^= 1; + break; + case 'z': + pPars->fSkipReach ^= 1; + break; + case 'v': + pPars->fVerbose ^= 1; + break; + case 'w': + pPars->fVeryVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) { - fprintf( stdout, "The current network is not an AIG. Cannot continue.\n" ); + Abc_Print( -1, "Abc_CommandAbc9Reach(): There is no AIG.\n" ); return 1; } + if ( Gia_ManRegNum(pAbc->pGia) == 0 ) + { + Abc_Print( -1, "Abc_CommandAbc9Reach(): The current AIG has no latches.\n" ); + return 0; + } + pAbc->Status = Llb_ManModelCheckGia( pAbc->pGia, pPars ); + pAbc->nFrames = pPars->iFrame; + Abc_FrameReplaceCex( pAbc, &pAbc->pGia->pCexSeq ); + if ( pLogFileName ) + Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, "&reach" ); + return 0; -// Abc_NtkTestProcedure( pNtk, NULL ); +usage: + Abc_Print( -2, "usage: &reach [-TBFCHS num] [-L file] [-ripcsyzvwh]\n" ); + Abc_Print( -2, "\t verifies sequential miter using BDD-based reachability\n" ); + Abc_Print( -2, "\t-T num : approximate time limit in seconds (0=infinite) [default = %d]\n", pPars->TimeLimit ); + Abc_Print( -2, "\t-B num : max number of nodes in the intermediate BDDs [default = %d]\n", pPars->nBddMax ); + Abc_Print( -2, "\t-F num : max number of reachability iterations [default = %d]\n", pPars->nIterMax ); + Abc_Print( -2, "\t-C num : max number of variables in a cluster [default = %d]\n", pPars->nClusterMax ); + Abc_Print( -2, "\t-H num : max number of hints to use [default = %d]\n", pPars->nHintDepth ); + Abc_Print( -2, "\t-S num : the number of the starting hint [default = %d]\n", pPars->HintFirst ); + Abc_Print( -2, "\t-L file: the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" ); + Abc_Print( -2, "\t-r : enable dynamic BDD variable reordering [default = %s]\n", pPars->fReorder? "yes": "no" ); + Abc_Print( -2, "\t-i : enable extraction of inductive constraints [default = %s]\n", pPars->fIndConstr? "yes": "no" ); + Abc_Print( -2, "\t-p : enable partitions for internal cut-points [default = %s]\n", pPars->fUsePivots? "yes": "no" ); + Abc_Print( -2, "\t-c : enable clustering of partitions [default = %s]\n", pPars->fCluster? "yes": "no" ); + Abc_Print( -2, "\t-s : enable scheduling of clusters [default = %s]\n", pPars->fSchedule? "yes": "no" ); + Abc_Print( -2, "\t-y : skip checking property outputs [default = %s]\n", pPars->fSkipOutCheck? "yes": "no" ); + Abc_Print( -2, "\t-z : skip reachability (run preparation phase only) [default = %s]\n", pPars->fSkipReach? "yes": "no" ); + Abc_Print( -2, "\t-v : prints verbose information [default = %s]\n", pPars->fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-w : prints dependency matrix [default = %s]\n", pPars->fVeryVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Undo( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + int c; + // set defaults + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) + { + switch ( c ) + { + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Undo(): There is no design.\n" ); + return 1; + } + if ( pAbc->pGia2 == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Undo(): There is no previously saved network.\n" ); + return 1; + } + Gia_ManStop( pAbc->pGia ); + pAbc->pGia = pAbc->pGia2; + pAbc->pGia2 = NULL; return 0; usage: - fprintf( stdout, "usage: testnew [-h]\n" ); - fprintf( stdout, "\t new testing procedure\n" ); - fprintf( stdout, "\t-h : print the command usage\n"); + Abc_Print( -2, "usage: &undo [-h]\n" ); + Abc_Print( -2, "\t reverses the previous AIG transformation\n" ); + Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + Gia_Man_t * pTemp = NULL; + int c, fVerbose = 0; + int fSwitch = 0; + extern void Gia_SatSolveTest( Gia_Man_t * p ); + extern void Cbs_ManSolveTest( Gia_Man_t * pGia ); + + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "svh" ) ) != EOF ) + { + switch ( c ) + { + case 's': + fSwitch ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9Test(): There is no AIG.\n" ); + return 1; + } +// Gia_ManFrontTest( pAbc->pGia ); +// Gia_ManReduceConst( pAbc->pGia, 1 ); +// Sat_ManTest( pAbc->pGia, Gia_ManCo(pAbc->pGia, 0), 0 ); +// Gia_ManTestDistance( pAbc->pGia ); +// Gia_SatSolveTest( pAbc->pGia ); +// For_ManExperiment( pAbc->pGia, 20, 1, 1 ); +// Gia_ManUnrollSpecial( pAbc->pGia, 5, 100, 1 ); + + if ( fSwitch ) + pAbc->pGia = Gia_ManDupSelf( pTemp = pAbc->pGia ); + else + pAbc->pGia = Gia_ManRemoveEnables( pTemp = pAbc->pGia ); + Gia_ManStop( pTemp ); +// Cbs_ManSolveTest( pAbc->pGia ); + return 0; + +usage: + Abc_Print( -2, "usage: &test [-svh]\n" ); + Abc_Print( -2, "\t testing various procedures\n" ); + Abc_Print( -2, "\t-s : toggle enable (yes) vs. disable (no) [default = %s]\n", fSwitch? "yes": "no" ); + Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : print the command usage\n"); + return 1; +} //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// +ABC_NAMESPACE_IMPL_END + |