/**CFile**************************************************************** FileName [abc.c] SystemName [ABC: Logic synthesis and verification system.] PackageName [Network and node package.] Synopsis [Command file.] Author [Alan Mishchenko] Affiliation [UC Berkeley] Date [Ver. 1.0. Started - June 20, 2005.] Revision [$Id: abc.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $] ***********************************************************************/ #include "base/abc/abc.h" #include "base/main/main.h" #include "base/main/mainInt.h" #include "proof/fraig/fraig.h" #include "opt/fxu/fxu.h" #include "opt/fxch/Fxch.h" #include "opt/cut/cut.h" #include "map/fpga/fpga.h" #include "map/if/if.h" #include "opt/sim/sim.h" #include "opt/res/res.h" #include "opt/lpk/lpk.h" #include "aig/gia/giaAig.h" #include "opt/dar/dar.h" #include "opt/mfs/mfs.h" #include "proof/fra/fra.h" #include "aig/saig/saig.h" #include "proof/int/int.h" #include "proof/dch/dch.h" #include "proof/ssw/ssw.h" #include "opt/cgt/cgt.h" #include "bool/kit/kit.h" #include "map/amap/amap.h" #include "opt/ret/retInt.h" #include "sat/xsat/xsat.h" #include "sat/satoko/satoko.h" #include "sat/cnf/cnf.h" #include "proof/cec/cec.h" #include "proof/acec/acec.h" #include "proof/pdr/pdr.h" #include "misc/tim/tim.h" #include "bdd/llb/llb.h" #include "bdd/bbr/bbr.h" #include "map/cov/cov.h" #include "base/cmd/cmd.h" #include "proof/abs/abs.h" #include "sat/bmc/bmc.h" #include "proof/ssc/ssc.h" #include "opt/sfm/sfm.h" #include "opt/sbd/sbd.h" #include "bool/rpo/rpo.h" #include "map/mpm/mpm.h" #include "map/mio/mio.h" #include "opt/fret/fretime.h" #include "opt/nwk/nwkMerge.h" #include "base/acb/acbPar.h" #include "misc/extra/extra.h" #ifndef _WIN32 #include #endif ABC_NAMESPACE_IMPL_START //////////////////////////////////////////////////////////////////////// /// DECLARATIONS /// //////////////////////////////////////////////////////////////////////// //#define USE_MINISAT22 static int Abc_CommandPrintStats ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintExdc ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintIo ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintLatch ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintFanio ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintMffc ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintFactor ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintLevel ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintSupport ( Abc_Frame_t * pAbc, int argc, char ** argv ); #ifdef ABC_USE_CUDD static int Abc_CommandPrintMint ( Abc_Frame_t * pAbc, int argc, char ** argv ); #endif static int Abc_CommandPrintSymms ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintUnate ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintAuto ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintKMap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintGates ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintSharing ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPrintXCut ( Abc_Frame_t * pAbc, int argc, char ** argv ); 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_CommandPrintDelay ( 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 ); static int Abc_CommandShowCut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCollapse ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSatClp ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandStrash ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBalance ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMuxStruct ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMulti ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRenode ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCleanup ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSweep ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFastExtract ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFxch ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandEliminate ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDisjoint ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSparsify ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandLutpack ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandLutmin ( Abc_Frame_t * pAbc, int argc, char ** argv ); //static int Abc_CommandImfs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMfs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMfs2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMfs3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMfse ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandLogicPush ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTrace ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandGlitch ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSpeedup ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPowerdown ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAddBuffs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMerge ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTestDec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTestNpn ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTestRPO ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTestTruth ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRunSat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRunEco ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRunGen ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRunTest ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRewrite ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRefactor ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRestructure ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandResubstitute ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandResubUnate ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandResubCore ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandResubCheck ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRr ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCascade ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandLutCasDec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandLutCas ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBsEval ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandExtract ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandVarMin ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFaultClasses ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandExact ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBmsStart ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBmsStop ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBmsPs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMajExact ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTwoExact ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandLutExact ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAllExact ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTestExact ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMajGen ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandOrchestrate ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAIGAugmentation ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandLogic ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandComb ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMiter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMiter2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); 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_CommandSwapPos ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRemovePo ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDropSat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAddPi ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAddFlop ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAppend ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPutOnTop ( 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 ); static int Abc_CommandSop ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBdd ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandReorder ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBidec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandOrder ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMuxes ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCubes ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandExpand ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSplitSop ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandExtSeqDcs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandReach ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCone ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandNode ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRange ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCof ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTopmost ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBottommost ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTopAnd ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTrim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandShortNames ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMoveNames ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandExdcFree ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandExdcGet ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandExdcSet ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCareSet ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandEspresso ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandGen ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandGenTF ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandGenAT ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandGenFsm ( Abc_Frame_t * pAbc, int argc, char ** argv ); 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_CommandOutdec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandNodeDup ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandWrap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTestColor ( 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 ); static int Abc_CommandQuaRel ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandQuaReach ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSenseInput ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandNpnLoad ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandNpnSave ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSendAig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSendStatus ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBackup ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRestore ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMinisat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMinisimp ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandIStrash ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandICut ( Abc_Frame_t * pAbc, int argc, char ** argv ); 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_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 ); static int Abc_CommandIRewriteSeq ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandIResyn ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandISat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandIFraig ( Abc_Frame_t * pAbc, int argc, char ** argv ); 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_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 ); //static int Abc_CommandHaig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandQbf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFraig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFraigTrust ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFraigStore ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFraigRestore ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFraigClean ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFraigSweep ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFraigDress ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDumpEquiv ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRecStart3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRecStop3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRecPs3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRecAdd3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRecDump3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRecMerge3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandMap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAmap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPhaseMap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandStochMap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandUnmap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAttach ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSuperChoice ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSuperChoiceLut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTimeScale ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRewire ( Abc_Frame_t * pAbc, int argc, char ** argv ); //static int Abc_CommandFpga ( Abc_Frame_t * pAbc, int argc, char ** argv ); //static int Abc_CommandFpgaFast ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandIf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandIfif ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDsdSave ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDsdLoad ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDsdFree ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDsdPs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDsdMatch ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDsdMerge ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDsdFilter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandScut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandInit ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandZero ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandUndc ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandOneHot ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPipe ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSeq ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandUnseq ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandRetime ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDRetime ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFlowRetime ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCRetime ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSeqFpga ( Abc_Frame_t * pAbc, int argc, char ** argv ); 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_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 ); static int Abc_CommandXsim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSim3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDarPhase ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSynch ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandClockGate ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandExtWin ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandInsWin ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSymFun ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPermute ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandUnpermute ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCubeEnum ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPathEnum ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFunEnum ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDCec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDSec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDSat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandXSat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSatoko ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Satoko ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Sat3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Kissat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPSat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandProve ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandIProve ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDebug ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandEco ( 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_CommandTempor ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandInduction ( 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_CommandUnfold2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandFold2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBm ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBm2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandSaucy ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandTestCex ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandPdr ( Abc_Frame_t * pAbc, int argc, char ** argv ); #ifdef ABC_USE_CUDD static int Abc_CommandReconcile ( Abc_Frame_t * pAbc, int argc, char ** argv ); #endif static int Abc_CommandCexSave ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCexLoad ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCexCut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandCexMerge ( Abc_Frame_t * pAbc, int argc, char ** argv ); //static int Abc_CommandCexMin ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandDualRail ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandBlockPo ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandIso ( 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 ); static int Abc_CommandAbcSave ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbcLoad ( 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_CommandAbc9MoveNames ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Save ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Save2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SaveAig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Load ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Load2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9LoadAig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Read ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ReadBlif ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ReadCBlif ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ReadStg ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ReadVer ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9WriteVer ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Write ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9WriteLut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Ps ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9PFan ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Pms ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9PSig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Status ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9MuxProfile ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9MuxPos ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9MuxStr ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9MuxDec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9PrintTruth ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Unate ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Rex2Gia ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9RexWalk ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Show ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SetRegNum ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Strash ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Topand ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Add1Hot ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Cof ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Cofs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Trim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Dfs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Sim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Sim2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Sim3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9MLGen ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9MLTest ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Iwls21Test ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ReadSim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9WriteSim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9PrintSim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GenSim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SimRsb ( Abc_Frame_t * pAbc, int argc, char ** argv ); 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_CommandAbc9Equiv3 ( 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_CommandAbc9Dsd ( 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_CommandAbc9Fx ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Extract ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Balance ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9BalanceLut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Resub ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Reshape ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Syn2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Syn3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Syn4 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Synch2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9False ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Miter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Miter2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Append ( 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 ); static int Abc_CommandAbc9Scorr ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Choice ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Sat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SatEnum ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9AdvGenSim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Fraig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9CFraig ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Srm ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Srm2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Filter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Reduce ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9EquivMark ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9EquivFilter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Cec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ICec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Verify ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Sweep ( Abc_Frame_t * pAbc, int argc, char ** argv ); 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_CommandAbc9Sopb ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Dsdb ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Flow ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Flow2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Flow3 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9If ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Iff ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Iiff ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9If2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Sif ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Jf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Kf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Lf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Mf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Nf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Of ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Pack ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Edge ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SatLut ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9LNetRead ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9LNetSim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9LNetEval ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9LNetOpt ( Abc_Frame_t * pAbc, int argc, char ** argv ); //#ifndef _WIN32 static int Abc_CommandAbc9Ttopt ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Transduction ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9TranStoch ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Rrr ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Rewire ( Abc_Frame_t * pAbc, int argc, char ** argv ); //#endif static int Abc_CommandAbc9LNetMap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Unmap ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Struct ( 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_CommandAbc9Rpm ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9BackReach ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Posplit ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Permute ( Abc_Frame_t * pAbc, int argc, char ** argv ); #ifdef ABC_USE_CUDD static int Abc_CommandAbc9ReachM ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ReachP ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ReachN ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ReachY ( Abc_Frame_t * pAbc, int argc, char ** argv ); #endif static int Abc_CommandAbc9Undo ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Mesh ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Iso ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9IsoNpn ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9IsoSt ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Compare ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9RevEng ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Uif ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9CexInfo ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Cycle ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Cone ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Slice ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9PoPart ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GroupProve ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9MultiProve ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SplitProve ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SProve ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SplitSat ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Bmc ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SBmc ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ChainBmc ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9BCore ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ICheck ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SatTest ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9FFTest ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Qbf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9QVar ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GenQbf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9HomoQbf ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SatFx ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SatClp ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Inse ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Maxi ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Bmci ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9PoXsim ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Demiter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Fadds ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ATree ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Polyn ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Acec ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Anorm ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Decla ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Esop ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Exorcism ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Mfs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Mfsd ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9DeepSyn ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9RandSyn ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9SatSyn ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9StochSyn ( Abc_Frame_t * pAbc, int argc, char ** argv ); //static int Abc_CommandAbc9PoPart2 ( Abc_Frame_t * pAbc, int argc, char ** argv ); //static int Abc_CommandAbc9CexCut ( Abc_Frame_t * pAbc, int argc, char ** argv ); //static int Abc_CommandAbc9CexMerge ( Abc_Frame_t * pAbc, int argc, char ** argv ); //static int Abc_CommandAbc9CexMin ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9AbsCreate ( 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_CommandAbc9GlaDerive ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GlaRefine ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GlaShrink ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Gla ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Vta ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Vta2Gla ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Gla2Vta ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Fla2Gla ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Gla2Fla ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Gen ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Cfs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9ProdAdd ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9AddFlop ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9BMiter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GenHie ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9PutOnTop ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9BRecover ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9StrEco ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GenCex ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Odc ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GenRel ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GenMux ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GenComp ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GenSorter ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9GenNeuron ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Window ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9FunAbs ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9DsdInfo ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9FunTrace ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9MulFind ( Abc_Frame_t * pAbc, int argc, char ** argv ); static int Abc_CommandAbc9Test ( 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 ); extern int Abc_CommandAbcLivenessToSafetyWithLTL( Abc_Frame_t * pAbc, int argc, char ** argv ); extern int Abc_CommandCS_kLiveness ( Abc_Frame_t * pAbc, int argc, char ** argv ); extern int Abc_CommandNChooseK ( Abc_Frame_t * pAbc, int argc, char ** argv ); extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters ); extern Abc_Ntk_t * Abc_NtkFromAigPhase( Aig_Man_t * pMan ); extern Vec_Ptr_t * Abc_NtkCollectCiNames( Abc_Ntk_t * pNtk ); extern Vec_Ptr_t * Abc_NtkCollectCoNames( Abc_Ntk_t * pNtk ); extern void Extra_BitMatrixTransposeP( Vec_Wrd_t * vSimsIn, int nWordsIn, Vec_Wrd_t * vSimsOut, int nWordsOut ); //////////////////////////////////////////////////////////////////////// /// FUNCTION DEFINITIONS /// //////////////////////////////////////////////////////////////////////// /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_FrameReplaceCex( Abc_Frame_t * pAbc, Abc_Cex_t ** ppCex ) { // update CEX ABC_FREE( pAbc->pCex ); pAbc->pCex = *ppCex; *ppCex = NULL; // remove CEX vector if ( pAbc->vCexVec ) { Vec_PtrFreeFree( pAbc->vCexVec ); pAbc->vCexVec = NULL; } } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_FrameReplaceCexVec( Abc_Frame_t * pAbc, Vec_Ptr_t ** pvCexVec ) { // update CEX vector if ( pAbc->vCexVec ) Vec_PtrFreeFree( pAbc->vCexVec ); pAbc->vCexVec = *pvCexVec; *pvCexVec = NULL; // remove CEX ABC_FREE( pAbc->pCex ); } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_FrameReplacePoEquivs( Abc_Frame_t * pAbc, Vec_Ptr_t ** pvPoEquivs ) { if ( pAbc->vPoEquivs ) Vec_VecFree( (Vec_Vec_t *)pAbc->vPoEquivs ); pAbc->vPoEquivs = *pvPoEquivs; *pvPoEquivs = NULL; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_FrameReplacePoStatuses( Abc_Frame_t * pAbc, Vec_Int_t ** pvStatuses ) { if ( pAbc->vStatuses ) Vec_IntFree( pAbc->vStatuses ); pAbc->vStatuses = *pvStatuses; *pvStatuses = NULL; } /**Function************************************************************* Synopsis [Derives array of statuses from the array of CEXes.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Vec_Int_t * Abc_FrameDeriveStatusArray( Vec_Ptr_t * vCexes ) { Vec_Int_t * vStatuses; Abc_Cex_t * pCex; int i; if ( vCexes == NULL ) return NULL; vStatuses = Vec_IntAlloc( Vec_PtrSize(vCexes) ); Vec_IntFill( vStatuses, Vec_PtrSize(vCexes), -1 ); // assume UNDEC Vec_PtrForEachEntry( Abc_Cex_t *, vCexes, pCex, i ) if ( pCex != NULL ) Vec_IntWriteEntry( vStatuses, i, 0 ); // set this output as SAT return vStatuses; } Vec_Int_t * Abc_FrameDeriveStatusArray2( Vec_Ptr_t * vCexes ) { Vec_Int_t * vStatuses; Abc_Cex_t * pCex; int i; if ( vCexes == NULL ) return NULL; vStatuses = Vec_IntAlloc( Vec_PtrSize(vCexes) ); Vec_IntFill( vStatuses, Vec_PtrSize(vCexes), -1 ); // assume UNDEC Vec_PtrForEachEntry( Abc_Cex_t *, vCexes, pCex, i ) if ( pCex == (Abc_Cex_t *)(ABC_PTRINT_T)1 ) { Vec_IntWriteEntry( vStatuses, i, 1 ); // set this output as UNSAT Vec_PtrWriteEntry( vCexes, i, NULL ); } else if ( pCex != NULL ) Vec_IntWriteEntry( vStatuses, i, 0 ); // set this output as SAT return vStatuses; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_FrameClearDesign() { } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_FrameUpdateGia( Abc_Frame_t * pAbc, Gia_Man_t * pNew ) { if ( pNew == NULL ) { Abc_Print( -1, "Abc_FrameUpdateGia(): Transformation has failed.\n" ); return; } if ( Gia_ManPoNum(pNew) == 0 ) Abc_Print( 0, "The current GIA has no primary outputs. Some commands may not work correctly.\n" ); if ( pNew == pAbc->pGia ) return; // transfer names if (!pNew->vNamesIn && pAbc->pGia && pAbc->pGia->vNamesIn && Gia_ManCiNum(pNew) == Vec_PtrSize(pAbc->pGia->vNamesIn)) { pNew->vNamesIn = pAbc->pGia->vNamesIn; pAbc->pGia->vNamesIn = NULL; } if (!pNew->vNamesOut && pAbc->pGia && pAbc->pGia->vNamesOut && Gia_ManCoNum(pNew) == Vec_PtrSize(pAbc->pGia->vNamesOut)) { pNew->vNamesOut = pAbc->pGia->vNamesOut; pAbc->pGia->vNamesOut = NULL; } if (!pNew->vNamesNode && pAbc->pGia && pAbc->pGia->vNamesNode && Gia_ManObjNum(pNew) == Vec_PtrSize(pAbc->pGia->vNamesNode)) { pNew->vNamesNode = pAbc->pGia->vNamesNode; pAbc->pGia->vNamesNode = NULL; } // update if ( pAbc->pGia2 ) Gia_ManStop( pAbc->pGia2 ); pAbc->pGia2 = pAbc->pGia; pAbc->pGia = pNew; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Gia_Man_t * Abc_FrameGetGia( Abc_Frame_t * pAbc ) { Gia_Man_t * pGia; if ( pAbc->pGia2 ) Gia_ManStop( pAbc->pGia2 ); pAbc->pGia2 = NULL; pGia = pAbc->pGia; pAbc->pGia = NULL; return pGia; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_Init( Abc_Frame_t * pAbc ) { Cmd_CommandAdd( pAbc, "Printing", "ps", Abc_CommandPrintStats, 0 ); 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 ); Cmd_CommandAdd( pAbc, "Printing", "print_latch", Abc_CommandPrintLatch, 0 ); Cmd_CommandAdd( pAbc, "Printing", "pfan", Abc_CommandPrintFanio, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_fanio", Abc_CommandPrintFanio, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_mffc", Abc_CommandPrintMffc, 0 ); Cmd_CommandAdd( pAbc, "Printing", "pf", Abc_CommandPrintFactor, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_factor", Abc_CommandPrintFactor, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_level", Abc_CommandPrintLevel, 0 ); Cmd_CommandAdd( pAbc, "Printing", "psu", Abc_CommandPrintSupport, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_supp", Abc_CommandPrintSupport, 0 ); #ifdef ABC_USE_CUDD Cmd_CommandAdd( pAbc, "Printing", "print_mint", Abc_CommandPrintMint, 0 ); #endif Cmd_CommandAdd( pAbc, "Printing", "print_symm", Abc_CommandPrintSymms, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_unate", Abc_CommandPrintUnate, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_auto", Abc_CommandPrintAuto, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_kmap", Abc_CommandPrintKMap, 0 ); Cmd_CommandAdd( pAbc, "Printing", "pg", Abc_CommandPrintGates, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_gates", Abc_CommandPrintGates, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_sharing", Abc_CommandPrintSharing, 0 ); Cmd_CommandAdd( pAbc, "Printing", "print_xcut", Abc_CommandPrintXCut, 0 ); 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", "print_delay", Abc_CommandPrintDelay, 0 ); Cmd_CommandAdd( pAbc, "Printing", "show", Abc_CommandShow, 0 ); Cmd_CommandAdd( pAbc, "Printing", "show_bdd", Abc_CommandShowBdd, 0 ); Cmd_CommandAdd( pAbc, "Printing", "show_cut", Abc_CommandShowCut, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "clp", Abc_CommandCollapse, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "collapse", Abc_CommandCollapse, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "satclp", Abc_CommandSatClp, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "st", Abc_CommandStrash, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "strash", Abc_CommandStrash, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "b", Abc_CommandBalance, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "balance", Abc_CommandBalance, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "mux_struct", Abc_CommandMuxStruct, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "multi", Abc_CommandMulti, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "renode", Abc_CommandRenode, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "cleanup", Abc_CommandCleanup, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "sweep", Abc_CommandSweep, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "fx", Abc_CommandFastExtract, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "fxch", Abc_CommandFxch, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "eliminate", Abc_CommandEliminate, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "dsd", Abc_CommandDisjoint, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "sparsify", Abc_CommandSparsify, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "lutpack", Abc_CommandLutpack, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "lutmin", Abc_CommandLutmin, 1 ); // Cmd_CommandAdd( pAbc, "Synthesis", "imfs", Abc_CommandImfs, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "mfs", Abc_CommandMfs, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "mfs2", Abc_CommandMfs2, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "mfs3", Abc_CommandMfs3, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "mfse", Abc_CommandMfse, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "logicpush", Abc_CommandLogicPush, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "trace", Abc_CommandTrace, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "glitch", Abc_CommandGlitch, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "speedup", Abc_CommandSpeedup, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "powerdown", Abc_CommandPowerdown, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "addbuffs", Abc_CommandAddBuffs, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "merge", Abc_CommandMerge, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "testdec", Abc_CommandTestDec, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "testnpn", Abc_CommandTestNpn, 0 ); Cmd_CommandAdd( pAbc, "LogiCS", "testrpo", Abc_CommandTestRPO, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "testtruth", Abc_CommandTestTruth, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "runsat", Abc_CommandRunSat, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "runeco", Abc_CommandRunEco, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "rungen", Abc_CommandRunGen, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "xec", Abc_CommandRunTest, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "rewrite", Abc_CommandRewrite, 1 ); 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", "resub_unate", Abc_CommandResubUnate, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "resub_core", Abc_CommandResubCore, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "resub_check", Abc_CommandResubCheck, 0 ); // Cmd_CommandAdd( pAbc, "Synthesis", "rr", Abc_CommandRr, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "cascade", Abc_CommandCascade, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "lutcasdec", Abc_CommandLutCasDec, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "lutcas", Abc_CommandLutCas, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "bseval", Abc_CommandBsEval, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "extract", Abc_CommandExtract, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "varmin", Abc_CommandVarMin, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "faultclasses", Abc_CommandFaultClasses, 0 ); Cmd_CommandAdd( pAbc, "Synthesis", "exact", Abc_CommandExact, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "orchestrate", Abc_CommandOrchestrate, 1 ); Cmd_CommandAdd( pAbc, "Synthesis", "aigaug", Abc_CommandAIGAugmentation, 1 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "bms_start", Abc_CommandBmsStart, 0 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "bms_stop", Abc_CommandBmsStop, 0 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "bms_ps", Abc_CommandBmsPs, 0 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "majexact", Abc_CommandMajExact, 0 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "twoexact", Abc_CommandTwoExact, 0 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "lutexact", Abc_CommandLutExact, 0 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "allexact", Abc_CommandAllExact, 0 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "testexact", Abc_CommandTestExact, 0 ); Cmd_CommandAdd( pAbc, "Exact synthesis", "majgen", Abc_CommandMajGen, 0 ); Cmd_CommandAdd( pAbc, "Various", "logic", Abc_CommandLogic, 1 ); Cmd_CommandAdd( pAbc, "Various", "comb", Abc_CommandComb, 1 ); Cmd_CommandAdd( pAbc, "Various", "miter", Abc_CommandMiter, 1 ); Cmd_CommandAdd( pAbc, "Various", "miter2", Abc_CommandMiter2, 1 ); 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", "swappos", Abc_CommandSwapPos, 1 ); Cmd_CommandAdd( pAbc, "Various", "removepo", Abc_CommandRemovePo, 1 ); Cmd_CommandAdd( pAbc, "Various", "dropsat", Abc_CommandDropSat, 1 ); Cmd_CommandAdd( pAbc, "Various", "addpi", Abc_CommandAddPi, 1 ); Cmd_CommandAdd( pAbc, "Various", "addflop", Abc_CommandAddFlop, 1 ); Cmd_CommandAdd( pAbc, "Various", "append", Abc_CommandAppend, 1 ); Cmd_CommandAdd( pAbc, "Various", "putontop", Abc_CommandPutOnTop, 1 ); Cmd_CommandAdd( pAbc, "Various", "frames", Abc_CommandFrames, 1 ); Cmd_CommandAdd( pAbc, "Various", "dframes", Abc_CommandDFrames, 1 ); Cmd_CommandAdd( pAbc, "Various", "sop", Abc_CommandSop, 0 ); Cmd_CommandAdd( pAbc, "Various", "bdd", Abc_CommandBdd, 0 ); Cmd_CommandAdd( pAbc, "Various", "aig", Abc_CommandAig, 0 ); Cmd_CommandAdd( pAbc, "Various", "reorder", Abc_CommandReorder, 0 ); Cmd_CommandAdd( pAbc, "Various", "bidec", Abc_CommandBidec, 1 ); Cmd_CommandAdd( pAbc, "Various", "order", Abc_CommandOrder, 0 ); Cmd_CommandAdd( pAbc, "Various", "muxes", Abc_CommandMuxes, 1 ); Cmd_CommandAdd( pAbc, "Various", "cubes", Abc_CommandCubes, 1 ); Cmd_CommandAdd( pAbc, "Various", "expand", Abc_CommandExpand, 1 ); Cmd_CommandAdd( pAbc, "Various", "splitsop", Abc_CommandSplitSop, 1 ); Cmd_CommandAdd( pAbc, "Various", "ext_seq_dcs", Abc_CommandExtSeqDcs, 0 ); Cmd_CommandAdd( pAbc, "Various", "reach", Abc_CommandReach, 0 ); Cmd_CommandAdd( pAbc, "Various", "cone", Abc_CommandCone, 1 ); Cmd_CommandAdd( pAbc, "Various", "node", Abc_CommandNode, 1 ); Cmd_CommandAdd( pAbc, "Various", "range", Abc_CommandRange, 1 ); Cmd_CommandAdd( pAbc, "Various", "cof", Abc_CommandCof, 1 ); Cmd_CommandAdd( pAbc, "Various", "topmost", Abc_CommandTopmost, 1 ); Cmd_CommandAdd( pAbc, "Various", "bottommost", Abc_CommandBottommost, 1 ); Cmd_CommandAdd( pAbc, "Various", "topand", Abc_CommandTopAnd, 1 ); Cmd_CommandAdd( pAbc, "Various", "trim", Abc_CommandTrim, 1 ); Cmd_CommandAdd( pAbc, "Various", "short_names", Abc_CommandShortNames, 0 ); Cmd_CommandAdd( pAbc, "Various", "move_names", Abc_CommandMoveNames, 0 ); Cmd_CommandAdd( pAbc, "Various", "exdc_free", Abc_CommandExdcFree, 1 ); Cmd_CommandAdd( pAbc, "Various", "exdc_get", Abc_CommandExdcGet, 1 ); Cmd_CommandAdd( pAbc, "Various", "exdc_set", Abc_CommandExdcSet, 1 ); Cmd_CommandAdd( pAbc, "Various", "care_set", Abc_CommandCareSet, 1 ); Cmd_CommandAdd( pAbc, "Various", "cut", Abc_CommandCut, 0 ); Cmd_CommandAdd( pAbc, "Various", "espresso", Abc_CommandEspresso, 1 ); Cmd_CommandAdd( pAbc, "Various", "gen", Abc_CommandGen, 0 ); Cmd_CommandAdd( pAbc, "Various", "gentf", Abc_CommandGenTF, 0 ); Cmd_CommandAdd( pAbc, "Various", "genat", Abc_CommandGenAT, 0 ); Cmd_CommandAdd( pAbc, "Various", "genfsm", Abc_CommandGenFsm, 0 ); 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", "outdec", Abc_CommandOutdec, 1 ); Cmd_CommandAdd( pAbc, "Various", "nodedup", Abc_CommandNodeDup, 1 ); Cmd_CommandAdd( pAbc, "Various", "wrap", Abc_CommandWrap, 0 ); Cmd_CommandAdd( pAbc, "Various", "testcolor", Abc_CommandTestColor, 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 ); Cmd_CommandAdd( pAbc, "Various", "qreach", Abc_CommandQuaReach, 1 ); Cmd_CommandAdd( pAbc, "Various", "senseinput", Abc_CommandSenseInput, 1 ); Cmd_CommandAdd( pAbc, "Various", "npnload", Abc_CommandNpnLoad, 0 ); Cmd_CommandAdd( pAbc, "Various", "npnsave", Abc_CommandNpnSave, 0 ); Cmd_CommandAdd( pAbc, "Various", "send_aig", Abc_CommandSendAig, 0 ); Cmd_CommandAdd( pAbc, "Various", "send_status", Abc_CommandSendStatus, 0 ); Cmd_CommandAdd( pAbc, "Various", "backup", Abc_CommandBackup, 0 ); Cmd_CommandAdd( pAbc, "Various", "restore", Abc_CommandRestore, 0 ); Cmd_CommandAdd( pAbc, "Various", "minisat", Abc_CommandMinisat, 0 ); Cmd_CommandAdd( pAbc, "Various", "minisimp", Abc_CommandMinisimp, 0 ); Cmd_CommandAdd( pAbc, "New AIG", "istrash", Abc_CommandIStrash, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "icut", Abc_CommandICut, 0 ); 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", "dchoice", Abc_CommandDChoice, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "dch", Abc_CommandDch, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "drwsat", Abc_CommandDrwsat, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "irws", Abc_CommandIRewriteSeq, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "iresyn", Abc_CommandIResyn, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "isat", Abc_CommandISat, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "ifraig", Abc_CommandIFraig, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "dfraig", Abc_CommandDFraig, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "csweep", Abc_CommandCSweep, 1 ); // Cmd_CommandAdd( pAbc, "New AIG", "haig", Abc_CommandHaig, 1 ); Cmd_CommandAdd( pAbc, "New AIG", "qbf", Abc_CommandQbf, 0 ); Cmd_CommandAdd( pAbc, "Fraiging", "fraig", Abc_CommandFraig, 1 ); Cmd_CommandAdd( pAbc, "Fraiging", "fraig_trust", Abc_CommandFraigTrust, 1 ); Cmd_CommandAdd( pAbc, "Fraiging", "fraig_store", Abc_CommandFraigStore, 0 ); Cmd_CommandAdd( pAbc, "Fraiging", "fraig_restore", Abc_CommandFraigRestore, 1 ); Cmd_CommandAdd( pAbc, "Fraiging", "fraig_clean", Abc_CommandFraigClean, 0 ); Cmd_CommandAdd( pAbc, "Fraiging", "fraig_sweep", Abc_CommandFraigSweep, 1 ); Cmd_CommandAdd( pAbc, "Fraiging", "dress", Abc_CommandFraigDress, 1 ); Cmd_CommandAdd( pAbc, "Fraiging", "dump_equiv", Abc_CommandDumpEquiv, 0 ); Cmd_CommandAdd( pAbc, "Choicing", "rec_start3", Abc_CommandRecStart3, 0 ); Cmd_CommandAdd( pAbc, "Choicing", "rec_stop3", Abc_CommandRecStop3, 0 ); Cmd_CommandAdd( pAbc, "Choicing", "rec_ps3", Abc_CommandRecPs3, 0 ); Cmd_CommandAdd( pAbc, "Choicing", "rec_add3", Abc_CommandRecAdd3, 0 ); Cmd_CommandAdd( pAbc, "Choicing", "rec_dump3", Abc_CommandRecDump3, 0 ); Cmd_CommandAdd( pAbc, "Choicing", "rec_merge3", Abc_CommandRecMerge3, 0 ); Cmd_CommandAdd( pAbc, "SC mapping", "map", Abc_CommandMap, 1 ); Cmd_CommandAdd( pAbc, "SC mapping", "amap", Abc_CommandAmap, 1 ); Cmd_CommandAdd( pAbc, "SC mapping", "phase_map", Abc_CommandPhaseMap, 1 ); Cmd_CommandAdd( pAbc, "SC mapping", "stochmap", Abc_CommandStochMap, 1 ); Cmd_CommandAdd( pAbc, "SC mapping", "unmap", Abc_CommandUnmap, 1 ); Cmd_CommandAdd( pAbc, "SC mapping", "attach", Abc_CommandAttach, 1 ); Cmd_CommandAdd( pAbc, "SC mapping", "superc", Abc_CommandSuperChoice, 1 ); Cmd_CommandAdd( pAbc, "SC mapping", "supercl", Abc_CommandSuperChoiceLut, 1 ); Cmd_CommandAdd( pAbc, "SC mapping", "timescale", Abc_CommandTimeScale, 0 ); Cmd_CommandAdd( pAbc, "SC mapping", "rewire", Abc_CommandRewire, 1 ); // Cmd_CommandAdd( pAbc, "FPGA mapping", "fpga", Abc_CommandFpga, 1 ); // Cmd_CommandAdd( pAbc, "FPGA mapping", "ffpga", Abc_CommandFpgaFast, 1 ); Cmd_CommandAdd( pAbc, "FPGA mapping", "if", Abc_CommandIf, 1 ); Cmd_CommandAdd( pAbc, "FPGA mapping", "ifif", Abc_CommandIfif, 1 ); Cmd_CommandAdd( pAbc, "DSD manager", "dsd_save", Abc_CommandDsdSave, 0 ); Cmd_CommandAdd( pAbc, "DSD manager", "dsd_load", Abc_CommandDsdLoad, 0 ); Cmd_CommandAdd( pAbc, "DSD manager", "dsd_free", Abc_CommandDsdFree, 0 ); Cmd_CommandAdd( pAbc, "DSD manager", "dsd_ps", Abc_CommandDsdPs, 0 ); Cmd_CommandAdd( pAbc, "DSD manager", "dsd_match", Abc_CommandDsdMatch, 0 ); Cmd_CommandAdd( pAbc, "DSD manager", "dsd_merge", Abc_CommandDsdMerge, 0 ); Cmd_CommandAdd( pAbc, "DSD manager", "dsd_filter", Abc_CommandDsdFilter, 0 ); // Cmd_CommandAdd( pAbc, "Sequential", "scut", Abc_CommandScut, 0 ); Cmd_CommandAdd( pAbc, "Sequential", "init", Abc_CommandInit, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "zero", Abc_CommandZero, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "undc", Abc_CommandUndc, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "onehot", Abc_CommandOneHot, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "pipe", Abc_CommandPipe, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "retime", Abc_CommandRetime, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "dretime", Abc_CommandDRetime, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "fretime", Abc_CommandFlowRetime, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "cretime", Abc_CommandCRetime, 1 ); // Cmd_CommandAdd( pAbc, "Sequential", "sfpga", Abc_CommandSeqFpga, 1 ); // 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_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 ); Cmd_CommandAdd( pAbc, "Sequential", "xsim", Abc_CommandXsim, 0 ); Cmd_CommandAdd( pAbc, "Sequential", "sim", Abc_CommandSim, 0 ); Cmd_CommandAdd( pAbc, "Sequential", "sim3", Abc_CommandSim3, 0 ); Cmd_CommandAdd( pAbc, "Sequential", "phase", Abc_CommandDarPhase, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "synch", Abc_CommandSynch, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "clockgate", Abc_CommandClockGate, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "extwin", Abc_CommandExtWin, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "inswin", Abc_CommandInsWin, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "symfun", Abc_CommandSymFun, 0 ); Cmd_CommandAdd( pAbc, "Sequential", "permute", Abc_CommandPermute, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "unpermute", Abc_CommandUnpermute, 1 ); Cmd_CommandAdd( pAbc, "Sequential", "cubeenum", Abc_CommandCubeEnum, 0 ); Cmd_CommandAdd( pAbc, "Sequential", "pathenum", Abc_CommandPathEnum, 0 ); Cmd_CommandAdd( pAbc, "Sequential", "funenum", Abc_CommandFunEnum, 0 ); Cmd_CommandAdd( pAbc, "Verification", "cec", Abc_CommandCec, 0 ); Cmd_CommandAdd( pAbc, "Verification", "dcec", Abc_CommandDCec, 0 ); Cmd_CommandAdd( pAbc, "Verification", "dsec", Abc_CommandDSec, 0 ); Cmd_CommandAdd( pAbc, "Verification", "dprove", Abc_CommandDProve, 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 ); Cmd_CommandAdd( pAbc, "Verification", "sat", Abc_CommandSat, 0 ); Cmd_CommandAdd( pAbc, "Verification", "dsat", Abc_CommandDSat, 0 ); Cmd_CommandAdd( pAbc, "Verification", "xsat", Abc_CommandXSat, 0 ); Cmd_CommandAdd( pAbc, "Verification", "satoko", Abc_CommandSatoko, 0 ); Cmd_CommandAdd( pAbc, "Verification", "&satoko", Abc_CommandAbc9Satoko, 0 ); Cmd_CommandAdd( pAbc, "Verification", "&sat3", Abc_CommandAbc9Sat3, 0 ); Cmd_CommandAdd( pAbc, "Verification", "&kissat", Abc_CommandAbc9Kissat, 0 ); Cmd_CommandAdd( pAbc, "Verification", "psat", Abc_CommandPSat, 0 ); Cmd_CommandAdd( pAbc, "Verification", "prove", Abc_CommandProve, 1 ); Cmd_CommandAdd( pAbc, "Verification", "iprove", Abc_CommandIProve, 1 ); Cmd_CommandAdd( pAbc, "Verification", "debug", Abc_CommandDebug, 0 ); Cmd_CommandAdd( pAbc, "Verification", "eco", Abc_CommandEco, 0 ); Cmd_CommandAdd( pAbc, "Verification", "bmc", Abc_CommandBmc, 0 ); Cmd_CommandAdd( pAbc, "Verification", "bmc2", Abc_CommandBmc2, 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", "tempor", Abc_CommandTempor, 1 ); Cmd_CommandAdd( pAbc, "Verification", "ind", Abc_CommandInduction, 0 ); 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", "unfold2", Abc_CommandUnfold2, 1 ); // jlong Cmd_CommandAdd( pAbc, "Verification", "fold2", Abc_CommandFold2, 1 ); // jlong Cmd_CommandAdd( pAbc, "Verification", "bm", Abc_CommandBm, 1 ); Cmd_CommandAdd( pAbc, "Verification", "bm2", Abc_CommandBm2, 1 ); Cmd_CommandAdd( pAbc, "Verification", "saucy3", Abc_CommandSaucy, 1 ); Cmd_CommandAdd( pAbc, "Verification", "testcex", Abc_CommandTestCex, 0 ); Cmd_CommandAdd( pAbc, "Verification", "pdr", Abc_CommandPdr, 0 ); #ifdef ABC_USE_CUDD Cmd_CommandAdd( pAbc, "Verification", "reconcile", Abc_CommandReconcile, 1 ); #endif Cmd_CommandAdd( pAbc, "Verification", "cexsave", Abc_CommandCexSave, 0 ); Cmd_CommandAdd( pAbc, "Verification", "cexload", Abc_CommandCexLoad, 0 ); Cmd_CommandAdd( pAbc, "Verification", "cexcut", Abc_CommandCexCut, 0 ); Cmd_CommandAdd( pAbc, "Verification", "cexmerge", Abc_CommandCexMerge, 0 ); // Cmd_CommandAdd( pAbc, "Verification", "cexmin", Abc_CommandCexMin, 0 ); Cmd_CommandAdd( pAbc, "Verification", "dualrail", Abc_CommandDualRail, 1 ); Cmd_CommandAdd( pAbc, "Verification", "blockpo", Abc_CommandBlockPo, 1 ); Cmd_CommandAdd( pAbc, "Verification", "iso", Abc_CommandIso, 1 ); Cmd_CommandAdd( pAbc, "Various", "save", Abc_CommandAbcSave, 0 ); Cmd_CommandAdd( pAbc, "Various", "load", Abc_CommandAbcLoad, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&get", Abc_CommandAbc9Get, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&put", Abc_CommandAbc9Put, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&move_names", Abc_CommandAbc9MoveNames, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&save", Abc_CommandAbc9Save, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&save2", Abc_CommandAbc9Save2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&saveaig", Abc_CommandAbc9SaveAig, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&load", Abc_CommandAbc9Load, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&load2", Abc_CommandAbc9Load2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&loadaig", Abc_CommandAbc9LoadAig, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&r", Abc_CommandAbc9Read, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&read", Abc_CommandAbc9Read, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&read_blif", Abc_CommandAbc9ReadBlif, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&read_cblif", Abc_CommandAbc9ReadCBlif, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&read_stg", Abc_CommandAbc9ReadStg, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&read_ver", Abc_CommandAbc9ReadVer, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&write_ver", Abc_CommandAbc9WriteVer, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&w", Abc_CommandAbc9Write, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&write", Abc_CommandAbc9Write, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&wlut", Abc_CommandAbc9WriteLut, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&ps", Abc_CommandAbc9Ps, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&pfan", Abc_CommandAbc9PFan, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&pms", Abc_CommandAbc9Pms, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&psig", Abc_CommandAbc9PSig, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&status", Abc_CommandAbc9Status, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&profile", Abc_CommandAbc9MuxProfile, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&muxpos", Abc_CommandAbc9MuxPos, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&muxstr", Abc_CommandAbc9MuxStr, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&muxdec", Abc_CommandAbc9MuxDec, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&print_truth", Abc_CommandAbc9PrintTruth, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&unate", Abc_CommandAbc9Unate, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&rex2gia", Abc_CommandAbc9Rex2Gia, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&rexwalk", Abc_CommandAbc9RexWalk, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&show", Abc_CommandAbc9Show, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&setregnum", Abc_CommandAbc9SetRegNum, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&st", Abc_CommandAbc9Strash, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&topand", Abc_CommandAbc9Topand, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&add1hot", Abc_CommandAbc9Add1Hot, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&cof", Abc_CommandAbc9Cof, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&cofs", Abc_CommandAbc9Cofs, 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", "&sim2", Abc_CommandAbc9Sim2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&sim3", Abc_CommandAbc9Sim3, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&mlgen", Abc_CommandAbc9MLGen, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&mltest", Abc_CommandAbc9MLTest, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&iwls21test", Abc_CommandAbc9Iwls21Test, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&sim_read", Abc_CommandAbc9ReadSim, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&sim_write", Abc_CommandAbc9WriteSim, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&sim_print", Abc_CommandAbc9PrintSim, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&sim_gen", Abc_CommandAbc9GenSim, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&simrsb", Abc_CommandAbc9SimRsb, 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", "&equiv3", Abc_CommandAbc9Equiv3, 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", "&dsd", Abc_CommandAbc9Dsd, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&bidec", Abc_CommandAbc9Bidec, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&shrink", Abc_CommandAbc9Shrink, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&fx", Abc_CommandAbc9Fx, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&extract", Abc_CommandAbc9Extract, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&b", Abc_CommandAbc9Balance, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&blut", Abc_CommandAbc9BalanceLut, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&resub", Abc_CommandAbc9Resub, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&reshape", Abc_CommandAbc9Reshape, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&syn2", Abc_CommandAbc9Syn2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&syn3", Abc_CommandAbc9Syn3, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&syn4", Abc_CommandAbc9Syn4, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&synch2", Abc_CommandAbc9Synch2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&false", Abc_CommandAbc9False, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&miter", Abc_CommandAbc9Miter, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&miter2", Abc_CommandAbc9Miter2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&append", Abc_CommandAbc9Append, 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", "&satenum", Abc_CommandAbc9SatEnum, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&adv_sim_gen", Abc_CommandAbc9AdvGenSim, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&fraig", Abc_CommandAbc9Fraig, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&cfraig", Abc_CommandAbc9CFraig, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&srm", Abc_CommandAbc9Srm, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&srm2", Abc_CommandAbc9Srm2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&filter", Abc_CommandAbc9Filter, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&reduce", Abc_CommandAbc9Reduce, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&equiv_mark", Abc_CommandAbc9EquivMark, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&equiv_filter", Abc_CommandAbc9EquivFilter, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&cec", Abc_CommandAbc9Cec, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&icec", Abc_CommandAbc9ICec, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&verify", Abc_CommandAbc9Verify, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&sweep", Abc_CommandAbc9Sweep, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&force", Abc_CommandAbc9Force, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&embed", Abc_CommandAbc9Embed, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&sopb", Abc_CommandAbc9Sopb, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&dsdb", Abc_CommandAbc9Dsdb, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&flow", Abc_CommandAbc9Flow, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&flow2", Abc_CommandAbc9Flow2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&flow3", Abc_CommandAbc9Flow3, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&if", Abc_CommandAbc9If, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&iff", Abc_CommandAbc9Iff, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&iiff", Abc_CommandAbc9Iiff, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&if2", Abc_CommandAbc9If2, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&sif", Abc_CommandAbc9Sif, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&jf", Abc_CommandAbc9Jf, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&kf", Abc_CommandAbc9Kf, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&lf", Abc_CommandAbc9Lf, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&mf", Abc_CommandAbc9Mf, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&nf", Abc_CommandAbc9Nf, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&of", Abc_CommandAbc9Of, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&pack", Abc_CommandAbc9Pack, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&edge", Abc_CommandAbc9Edge, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&satlut", Abc_CommandAbc9SatLut, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&lnetread", Abc_CommandAbc9LNetRead, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&lnetsim", Abc_CommandAbc9LNetSim, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&lneteval", Abc_CommandAbc9LNetEval, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&lnetopt", Abc_CommandAbc9LNetOpt, 0 ); //#ifndef _WIN32 Cmd_CommandAdd( pAbc, "ABC9", "&ttopt", Abc_CommandAbc9Ttopt, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&transduction", Abc_CommandAbc9Transduction, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&transtoch" , Abc_CommandAbc9TranStoch, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&rrr", Abc_CommandAbc9Rrr, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&rewire" , Abc_CommandAbc9Rewire, 0 ); //#endif Cmd_CommandAdd( pAbc, "ABC9", "&lnetmap", Abc_CommandAbc9LNetMap, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&unmap", Abc_CommandAbc9Unmap, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&struct", Abc_CommandAbc9Struct, 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", "&rpm", Abc_CommandAbc9Rpm, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&back_reach", Abc_CommandAbc9BackReach, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&posplit", Abc_CommandAbc9Posplit, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&permute", Abc_CommandAbc9Permute, 0 ); #ifdef ABC_USE_CUDD Cmd_CommandAdd( pAbc, "ABC9", "&reachm", Abc_CommandAbc9ReachM, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&reachp", Abc_CommandAbc9ReachP, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&reachn", Abc_CommandAbc9ReachN, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&reachy", Abc_CommandAbc9ReachY, 0 ); #endif Cmd_CommandAdd( pAbc, "ABC9", "&undo", Abc_CommandAbc9Undo, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&mesh", Abc_CommandAbc9Mesh, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&iso", Abc_CommandAbc9Iso, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&isonpn", Abc_CommandAbc9IsoNpn, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&isost", Abc_CommandAbc9IsoSt, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&compare", Abc_CommandAbc9Compare, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&reveng", Abc_CommandAbc9RevEng, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&uif", Abc_CommandAbc9Uif, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&cexinfo", Abc_CommandAbc9CexInfo, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&cycle", Abc_CommandAbc9Cycle, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&cone", Abc_CommandAbc9Cone, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&slice", Abc_CommandAbc9Slice, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&popart", Abc_CommandAbc9PoPart, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&gprove", Abc_CommandAbc9GroupProve, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&mprove", Abc_CommandAbc9MultiProve, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&splitprove", Abc_CommandAbc9SplitProve, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&sprove", Abc_CommandAbc9SProve, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&splitsat", Abc_CommandAbc9SplitSat, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&bmc", Abc_CommandAbc9Bmc, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&bmcs", Abc_CommandAbc9SBmc, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&chainbmc", Abc_CommandAbc9ChainBmc, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&bcore", Abc_CommandAbc9BCore, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&icheck", Abc_CommandAbc9ICheck, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&sattest", Abc_CommandAbc9SatTest, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&fftest", Abc_CommandAbc9FFTest, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&qbf", Abc_CommandAbc9Qbf, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&qvar", Abc_CommandAbc9QVar, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&genqbf", Abc_CommandAbc9GenQbf, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&homoqbf", Abc_CommandAbc9HomoQbf, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&satfx", Abc_CommandAbc9SatFx, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&satclp", Abc_CommandAbc9SatClp, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&inse", Abc_CommandAbc9Inse, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&maxi", Abc_CommandAbc9Maxi, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&bmci", Abc_CommandAbc9Bmci, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&poxsim", Abc_CommandAbc9PoXsim, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&demiter", Abc_CommandAbc9Demiter, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&fadds", Abc_CommandAbc9Fadds, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&atree", Abc_CommandAbc9ATree, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&polyn", Abc_CommandAbc9Polyn, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&acec", Abc_CommandAbc9Acec, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&anorm", Abc_CommandAbc9Anorm, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&decla", Abc_CommandAbc9Decla, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&esop", Abc_CommandAbc9Esop, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&exorcism", Abc_CommandAbc9Exorcism, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&mfs", Abc_CommandAbc9Mfs, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&mfsd", Abc_CommandAbc9Mfsd, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&deepsyn", Abc_CommandAbc9DeepSyn, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&randsyn", Abc_CommandAbc9RandSyn, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&satsyn", Abc_CommandAbc9SatSyn, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&stochsyn", Abc_CommandAbc9StochSyn, 0 ); // Cmd_CommandAdd( pAbc, "ABC9", "&popart2", Abc_CommandAbc9PoPart2, 0 ); // Cmd_CommandAdd( pAbc, "ABC9", "&cexcut", Abc_CommandAbc9CexCut, 0 ); // Cmd_CommandAdd( pAbc, "ABC9", "&cexmerge", Abc_CommandAbc9CexMerge, 0 ); // Cmd_CommandAdd( pAbc, "ABC9", "&cexmin", Abc_CommandAbc9CexMin, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&abs_create", Abc_CommandAbc9AbsCreate, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&abs_derive", Abc_CommandAbc9AbsDerive, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&abs_refine", Abc_CommandAbc9AbsRefine, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&gla_derive", Abc_CommandAbc9GlaDerive, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&gla_refine", Abc_CommandAbc9GlaRefine, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&gla_shrink", Abc_CommandAbc9GlaShrink, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&gla", Abc_CommandAbc9Gla, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&vta", Abc_CommandAbc9Vta, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&vta_gla", Abc_CommandAbc9Vta2Gla, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&gla_vta", Abc_CommandAbc9Gla2Vta, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&fla_gla", Abc_CommandAbc9Fla2Gla, 0 ); Cmd_CommandAdd( pAbc, "Abstraction", "&gla_fla", Abc_CommandAbc9Gla2Fla, 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, "Liveness", "kcs", Abc_CommandCS_kLiveness, 0 ); Cmd_CommandAdd( pAbc, "Liveness", "nck", Abc_CommandNChooseK, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&gen", Abc_CommandAbc9Gen, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&cfs", Abc_CommandAbc9Cfs, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&prodadd", Abc_CommandAbc9ProdAdd, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&addflop", Abc_CommandAbc9AddFlop, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&bmiter", Abc_CommandAbc9BMiter, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&gen_hie", Abc_CommandAbc9GenHie, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&putontop", Abc_CommandAbc9PutOnTop, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&brecover", Abc_CommandAbc9BRecover, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&str_eco", Abc_CommandAbc9StrEco, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&gencex", Abc_CommandAbc9GenCex, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&odc", Abc_CommandAbc9Odc, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&genrel", Abc_CommandAbc9GenRel, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&genmux", Abc_CommandAbc9GenMux, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&gencomp", Abc_CommandAbc9GenComp, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&gensorter", Abc_CommandAbc9GenSorter, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&genneuron", Abc_CommandAbc9GenNeuron, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&window", Abc_CommandAbc9Window, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&funabs", Abc_CommandAbc9FunAbs, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&dsdinfo", Abc_CommandAbc9DsdInfo, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&funtrace", Abc_CommandAbc9FunTrace, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&mulfind", Abc_CommandAbc9MulFind, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&test", Abc_CommandAbc9Test, 0 ); { // extern Mf_ManTruthCount(); // Mf_ManTruthCount(); } { extern void Dar_LibStart(); Dar_LibStart(); } { // extern void Dau_DsdTest(); // Dau_DsdTest(); // extern void If_ManSatTest(); // If_ManSatTest(); } // if ( Sdm_ManCanRead() ) // Sdm_ManRead(); } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_End( Abc_Frame_t * pAbc ) { extern Abc_Frame_t * Abc_FrameGetGlobalFrame(); Abc_FrameClearDesign(); Cnf_ManFree(); { extern int Abc_NtkCompareAndSaveBest( Abc_Ntk_t * pNtk ); Abc_NtkCompareAndSaveBest( NULL ); } { extern void Dar_LibStop(); Dar_LibStop(); } { extern void Aig_RManQuit(); Aig_RManQuit(); } { extern void Npn_ManClean(); Npn_ManClean(); } { extern void Sdm_ManQuit(); Sdm_ManQuit(); } Abc_NtkFraigStoreClean(); Gia_ManStopP( &pAbc->pGia ); Gia_ManStopP( &pAbc->pGia2 ); Gia_ManStopP( &pAbc->pGiaBest ); Gia_ManStopP( &pAbc->pGiaBest2 ); Gia_ManStopP( &pAbc->pGiaSaved ); if ( Abc_NtkRecIsRunning3() ) Abc_NtkRecStop3(); } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int fFactor; int fSaveBest; int fDumpResult; int fUseLutLib; int fPrintTime; int fPrintMuxes; int fPower; int fGlitch; int fSkipBuf; int fSkipSmall; int fPrintMem; int c; pNtk = Abc_FrameReadNtk(pAbc); // set the defaults fFactor = 0; fSaveBest = 0; fDumpResult = 0; fUseLutLib = 0; fPrintTime = 0; fPrintMuxes = 0; fPower = 0; fGlitch = 0; fSkipBuf = 0; fSkipSmall = 0; fPrintMem = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "fbdltmpgscuh" ) ) != EOF ) { switch ( c ) { case 'f': fFactor ^= 1; break; case 'b': fSaveBest ^= 1; break; case 'd': fDumpResult ^= 1; break; case 'l': fUseLutLib ^= 1; break; case 't': fPrintTime ^= 1; break; case 'm': fPrintMuxes ^= 1; break; case 'p': fPower ^= 1; break; case 'g': fGlitch ^= 1; break; case 's': fSkipBuf ^= 1; break; case 'c': fSkipSmall ^= 1; break; case 'u': fPrintMem ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) && fUseLutLib ) { Abc_Print( -1, "Cannot print LUT delay for a non-logic network.\n" ); return 1; } Abc_NtkPrintStats( pNtk, fFactor, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf, fSkipSmall, fPrintMem ); if ( fPrintTime ) { pAbc->TimeTotal += pAbc->TimeCommand; Abc_Print( 1, "elapse: %3.2f seconds, total: %3.2f seconds\n", pAbc->TimeCommand, pAbc->TimeTotal ); pAbc->TimeCommand = 0.0; } return 0; usage: Abc_Print( -2, "usage: print_stats [-fbdltmpgscuh]\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 statistics about the network into file [default = %s]\n", fDumpResult? "yes": "no" ); Abc_Print( -2, "\t-l : toggles printing delay of LUT mapping using LUT library [default = %s]\n", fUseLutLib? "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-g : toggles printing percentage of increased power due to glitching [default = %s]\n", fGlitch? "yes": "no" ); Abc_Print( -2, "\t-s : toggles not counting single-output nodes as nodes [default = %s]\n", fSkipBuf? "yes": "no" ); Abc_Print( -2, "\t-c : toggles not counting constants and single-output nodes as nodes [default = %s]\n", fSkipSmall? "yes": "no" ); Abc_Print( -2, "\t-u : toggles printing memory usage [default = %s]\n", fPrintMem? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintExdc( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkTemp; double Percentage; int fShort; int c; int fPrintDc; extern double Abc_NtkSpacePercentage( Abc_Obj_t * pNode ); pNtk = Abc_FrameReadNtk(pAbc); // set the defaults fShort = 1; fPrintDc = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "sdh" ) ) != EOF ) { switch ( c ) { case 's': fShort ^= 1; break; case 'd': fPrintDc ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( pNtk->pExdc == NULL ) { Abc_Print( -1, "Network has no EXDC.\n" ); return 1; } if ( fPrintDc ) { if ( !Abc_NtkIsStrash(pNtk->pExdc) ) { pNtkTemp = Abc_NtkStrash(pNtk->pExdc, 0, 0, 0); Percentage = Abc_NtkSpacePercentage( Abc_ObjChild0( Abc_NtkPo(pNtkTemp, 0) ) ); Abc_NtkDelete( pNtkTemp ); } else Percentage = Abc_NtkSpacePercentage( Abc_ObjChild0( Abc_NtkPo(pNtk->pExdc, 0) ) ); Abc_Print( 1, "EXDC network statistics: " ); Abc_Print( 1, "(" ); if ( Percentage > 0.05 && Percentage < 99.95 ) Abc_Print( 1, "%.2f", Percentage ); else if ( Percentage > 0.000005 && Percentage < 99.999995 ) Abc_Print( 1, "%.6f", Percentage ); else Abc_Print( 1, "%f", Percentage ); Abc_Print( 1, " %% don't-cares)\n" ); } else Abc_Print( 1, "EXDC network statistics: \n" ); Abc_NtkPrintStats( pNtk->pExdc, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintIo( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pNode; int c, fPrintFlops = 1; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "fh" ) ) != EOF ) { switch ( c ) { case 'f': fPrintFlops ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } if ( argc == globalUtilOptind + 1 ) { pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } Abc_NodePrintFanio( stdout, pNode ); return 0; } // print the nodes Abc_NtkPrintIo( stdout, pNtk, fPrintFlops ); return 0; usage: Abc_Print( -2, "usage: print_io [-fh] \n" ); Abc_Print( -2, "\t prints the PIs/POs/flops or fanins/fanouts of a node\n" ); Abc_Print( -2, "\t-f : toggles printing flops [default = %s]\n", fPrintFlops? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\tnode : the node to print fanins/fanouts\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintLatch( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fPrintSccs; extern void Abc_NtkPrintSccs( Abc_Ntk_t * pNtk, int fVerbose ); // set defaults fPrintSccs = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "sh" ) ) != EOF ) { switch ( c ) { case 's': fPrintSccs ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // print the nodes Abc_NtkPrintLatch( stdout, pNtk ); if ( fPrintSccs ) Abc_NtkPrintSccs( pNtk, 0 ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintFanio( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseFanio = 0; int fUsePio = 0; int fUseSupp = 0; int fUseCone = 0; int fMffc = 0; int fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "fiscmvh" ) ) != EOF ) { switch ( c ) { case 'f': fUseFanio ^= 1; break; case 'i': fUsePio ^= 1; break; case 's': fUseSupp ^= 1; break; case 'c': fUseCone ^= 1; break; case 'm': fMffc ^= 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; } // print the nodes if ( fMffc || !fVerbose ) Abc_NtkPrintFanioNew( stdout, pNtk, fMffc ); else { if ( fUseFanio + fUsePio + fUseSupp + fUseCone == 1 ) Abc_NtkPrintFanio( stdout, pNtk, fUseFanio, fUsePio, fUseSupp, fUseCone ); else printf( "Exactly one of the switches \"-f\", \"-i\", \"-s\", \"-c\" should be enabled.\n" ); } return 0; usage: Abc_Print( -2, "usage: print_fanio [-fiscmvh]\n" ); Abc_Print( -2, "\t prints the statistics about different objects in the network\n" ); Abc_Print( -2, "\t-f : toggles considering fanins/fanouts of all nodes [default = %s]\n", fUseFanio? "yes": "no" ); Abc_Print( -2, "\t-i : toggles considering fanins/fanouts of CI/CO [default = %s]\n", fUsePio? "yes": "no" ); Abc_Print( -2, "\t-s : toggles considering TFO/TFI support sizes of CI/CO [default = %s]\n", fUseSupp? "yes": "no" ); Abc_Print( -2, "\t-c : toggles considering TFO/TFI cone sizes of CI/CO [default = %s]\n", fUseCone? "yes": "no" ); Abc_Print( -2, "\t-m : toggles printing MFFC sizes instead of fanouts [default = %s]\n", fMffc? "yes": "no" ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintMffc( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; extern void Abc_NtkPrintMffc( FILE * pFile, Abc_Ntk_t * pNtk ); // 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; } // print the nodes Abc_NtkPrintMffc( stdout, pNtk ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintFactor( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_NodePrintSop( FILE * pFile, Abc_Obj_t * pNode, int fUseRealNames ); extern void Abc_NtkPrintSop( FILE * pFile, Abc_Ntk_t * pNtk, int fUseRealNames ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pNode; int c, fSop = 0; int fUseRealNames; // set defaults fUseRealNames = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "snh" ) ) != EOF ) { switch ( c ) { case 's': fSop ^= 1; break; case 'n': fUseRealNames ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsSopLogic(pNtk) ) { Abc_Print( -1, "Printing factored forms can be done for SOP networks.\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } if ( argc == globalUtilOptind + 1 ) { pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } if ( fSop ) Abc_NodePrintSop( stdout, pNode, fUseRealNames ); else Abc_NodePrintFactor( stdout, pNode, fUseRealNames ); return 0; } // print the nodes if ( fSop ) Abc_NtkPrintSop( stdout, pNtk, fUseRealNames ); else Abc_NtkPrintFactor( stdout, pNtk, fUseRealNames ); return 0; usage: Abc_Print( -2, "usage: print_factor [-snh] \n" ); Abc_Print( -2, "\t prints the factored forms (FFs) of nodes\n" ); Abc_Print( -2, "\t-s : toggles printing SOP instead of FF [default = %s]\n", fSop? "SOP": "FF" ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintLevel( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pNode; int c; int fListNodes; int fProfile; int fOutputs; int fVerbose; // set defaults fListNodes = 0; fProfile = 1; fOutputs = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "npovh" ) ) != EOF ) { switch ( c ) { case 'n': fListNodes ^= 1; break; case 'p': fProfile ^= 1; break; case 'o': fOutputs ^= 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 ( !fProfile && !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for AIGs (run \"strash\").\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } if ( argc == globalUtilOptind + 1 ) { pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } Abc_NodePrintLevel( stdout, pNode ); return 0; } // process all COs Abc_NtkPrintLevel( stdout, pNtk, fProfile, fListNodes, fOutputs, fVerbose ); return 0; usage: Abc_Print( -2, "usage: print_level [-npovh] \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-o : toggles printing output levels [default = %s]\n", fOutputs? "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"); Abc_Print( -2, "\tnode : (optional) one node to consider\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintSupport( Abc_Frame_t * pAbc, int argc, char ** argv ) { Vec_Ptr_t * vSuppFun; Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fStruct; int fVerbose; int fVeryVerbose; extern Vec_Ptr_t * Sim_ComputeFunSupp( Abc_Ntk_t * pNtk, int fVerbose ); extern void Abc_NtkPrintStrSupports( Abc_Ntk_t * pNtk, int fMatrix ); // set defaults fStruct = 1; fVerbose = 0; fVeryVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "svwh" ) ) != EOF ) { switch ( c ) { case 's': fStruct ^= 1; break; case 'v': fVerbose ^= 1; break; case 'w': fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // print support information if ( fStruct ) { Abc_NtkPrintStrSupports( pNtk, fVeryVerbose ); return 0; } if ( !Abc_NtkIsComb(pNtk) ) { Abc_Print( -1, "This command works only for combinational networks (run \"comb\").\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for AIGs (run \"strash\").\n" ); return 1; } vSuppFun = Sim_ComputeFunSupp( pNtk, fVerbose ); ABC_FREE( vSuppFun->pArray[0] ); Vec_PtrFree( vSuppFun ); return 0; usage: Abc_Print( -2, "usage: print_supp [-svwh]\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-w : enable printing CI/CO dependency matrix [default = %s].\n", fVeryVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ #ifdef ABC_USE_CUDD int Abc_CommandPrintMint( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pObj; int c; int fVerbose; // set defaults fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "svwh" ) ) != EOF ) { switch ( c ) { 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for logic networks (run \"clp\").\n" ); return 1; } if ( !Abc_NtkHasBdd(pNtk) ) { Abc_Print( -1, "This command works only for logic networks with local functions represented by BDDs.\n" ); return 1; } Abc_NtkForEachNode( pNtk, pObj, c ) printf( "ObjId %3d : SuppSize = %5d MintCount = %32.0f\n", c, Abc_ObjFaninNum(pObj), Cudd_CountMinterm((DdManager *)pNtk->pManFunc, (DdNode *)pObj->pData, Abc_ObjFaninNum(pObj)) ); return 0; usage: Abc_Print( -2, "usage: print_mint [-svwh]\n" ); Abc_Print( -2, "\t prints the number of on-set minterms in the PO functions\n" ); 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; } #endif /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintSymms( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseBdds; int fNaive; int fReorder; int fVerbose; extern void Abc_NtkSymmetries( Abc_Ntk_t * pNtk, int fUseBdds, int fNaive, int fReorder, int fVerbose ); // set defaults fUseBdds = 0; fNaive = 0; fReorder = 1; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "bnrvh" ) ) != EOF ) { switch ( c ) { case 'b': fUseBdds ^= 1; break; case 'n': fNaive ^= 1; break; case 'r': fReorder ^= 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, "This command works only for combinational networks (run \"comb\").\n" ); return 1; } if ( Abc_NtkIsStrash(pNtk) ) Abc_NtkSymmetries( pNtk, fUseBdds, fNaive, fReorder, fVerbose ); else { pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); Abc_NtkSymmetries( pNtk, fUseBdds, fNaive, fReorder, fVerbose ); Abc_NtkDelete( pNtk ); } return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintUnate( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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 ); // set defaults fUseBdds = 1; fUseNaive = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "bnvh" ) ) != EOF ) { switch ( c ) { case 'b': fUseBdds ^= 1; break; case 'n': fUseNaive ^= 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for AIGs (run \"strash\").\n" ); return 1; } Abc_NtkPrintUnate( pNtk, fUseBdds, fUseNaive, fVerbose ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintAuto( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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 ); // set defaults Output = -1; fNaive = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Onvh" ) ) != EOF ) { switch ( c ) { case 'O': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-O\" should be followed by an integer.\n" ); goto usage; } Output = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( Output < 0 ) goto usage; break; case 'n': fNaive ^= 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for AIGs (run \"strash\").\n" ); return 1; } Abc_NtkAutoPrint( pNtk, Output, fNaive, fVerbose ); return 0; usage: Abc_Print( -2, "usage: print_auto [-O ] [-nvh]\n" ); Abc_Print( -2, "\t computes autosymmetries of the PO functions\n" ); Abc_Print( -2, "\t-O : (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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintKMap( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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 ); // set defaults fUseRealNames = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "nh" ) ) != EOF ) { switch ( c ) { case 'n': fUseRealNames ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc == globalUtilOptind + 2 ) { Abc_NtkShow6VarFunc( argv[globalUtilOptind], argv[globalUtilOptind+1] ); return 0; } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "Visualization of Karnaugh maps works for logic networks.\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } if ( argc == globalUtilOptind ) { pNode = Abc_ObjFanin0( Abc_NtkPo(pNtk, 0) ); if ( !Abc_ObjIsNode(pNode) ) { Abc_Print( -1, "The driver \"%s\" of the first PO is not an internal node.\n", Abc_ObjName(pNode) ); return 1; } } else { pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } } Abc_NtkToBdd(pNtk); Abc_NodePrintKMap( pNode, fUseRealNames ); return 0; usage: Abc_Print( -2, "usage: print_kmap [-nh] \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, "\t: the node to consider (default = the driver of the first PO)\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintGates( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLibrary; int fUpdateProfile; extern void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary, int fUpdateProfile ); // set defaults fUseLibrary = 1; fUpdateProfile = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "luh" ) ) != EOF ) { switch ( c ) { case 'l': fUseLibrary ^= 1; break; case 'u': fUpdateProfile ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkHasAig(pNtk) ) { Abc_Print( -1, "Printing gates does not work for AIGs and sequential AIGs.\n" ); return 1; } Abc_NtkPrintGates( pNtk, fUseLibrary, fUpdateProfile ); return 0; usage: Abc_Print( -2, "usage: print_gates [-luh]\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-u : update profile before printing it[default = %s]\n", fUpdateProfile? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintSharing( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLibrary; extern void Abc_NtkPrintSharing( Abc_Ntk_t * pNtk ); // set defaults fUseLibrary = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "lh" ) ) != EOF ) { switch ( c ) { case 'l': fUseLibrary ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } Abc_NtkPrintSharing( pNtk ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintXCut( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLibrary; extern int Abc_NtkCrossCut( Abc_Ntk_t * pNtk ); // set defaults fUseLibrary = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "lh" ) ) != EOF ) { switch ( c ) { case 'l': fUseLibrary ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } Abc_NtkCrossCut( pNtk ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintDsd( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fCofactor; int nCofLevel; int fProfile; int fPrintDec; extern void Kit_DsdTest( unsigned * pTruth, int nVars ); extern void Kit_DsdPrintCofactors( unsigned * pTruth, int nVars, int nCofLevel, int fVerbose ); extern void Dau_DecTrySets( word * p, int nVars, int fVerbose ); // set defaults nCofLevel = 1; fCofactor = 0; fProfile = 0; fPrintDec = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Npcdh" ) ) != EOF ) { switch ( c ) { case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nCofLevel = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCofLevel < 0 ) goto usage; break; case 'p': fProfile ^= 1; break; case 'c': fCofactor ^= 1; break; case 'd': fPrintDec ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // get the truth table of the first output if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "Currently works only for logic networks.\n" ); return 1; } Abc_NtkToAig( pNtk ); // convert it to truth table { Abc_Obj_t * pObj = Abc_ObjFanin0( Abc_NtkPo(pNtk, 0) ); Vec_Int_t * vMemory; unsigned * pTruth; if ( !Abc_ObjIsNode(pObj) ) { Abc_Print( -1, "The fanin of the first PO node does not have a logic function.\n" ); return 1; } if ( Abc_ObjFaninNum(pObj) > 16 ) { Abc_Print( -1, "Currently works only for up to 16 inputs.\n" ); return 1; } vMemory = Vec_IntAlloc(0); 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) ); // Abc_Print( -1, "\n" ); if ( fPrintDec )//&&Abc_ObjFaninNum(pObj) <= 6 ) { word * pTruthW = (word *)pTruth; if ( Abc_ObjFaninNum(pObj) < 6 ) pTruthW[0] = Abc_Tt6Stretch( pTruthW[0], Abc_ObjFaninNum(pObj) ); Dau_DecTrySets( (word *)pTruth, Abc_ObjFaninNum(pObj), 1 ); } 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) ); Vec_IntFree( vMemory ); } return 0; usage: Abc_Print( -2, "usage: print_dsd [-pcdh] [-N ]\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-d : toggle printing decompositions [default = %s]\n", fPrintDec? "yes": "no" ); Abc_Print( -2, "\t-N : the number of levels to cofactor [default = %d]\n", nCofLevel ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintCone( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLibrary; // set defaults fUseLibrary = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "lh" ) ) != EOF ) { switch ( c ) { case 'l': fUseLibrary ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) == 0 ) { Abc_Print( -1, "The network is combinational.\n" ); return 1; } Abc_NtkDarPrintCone( pNtk ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseLibrary; extern void Abc_NtkPrintMiter( Abc_Ntk_t * pNtk ); // set defaults fUseLibrary = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "lh" ) ) != EOF ) { switch ( c ) { case 'l': fUseLibrary ^= 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, "The network is should be structurally hashed.\n" ); return 1; } Abc_NtkPrintMiter( pNtk ); return 0; usage: 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 ) { extern void Abc_NtkDumpOneCexSpecial( FILE * pFile, Abc_Ntk_t * pNtk, Abc_Cex_t * pCex ); extern void Abc_NtkPrintPoEquivs( Abc_Ntk_t * pNtk ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c, fOutStatus = 0, fShort = 1; char * pLogFileName = NULL; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Losh" ) ) != EOF ) { switch ( c ) { 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 'o': fOutStatus ^= 1; break; case 's': fShort ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( fOutStatus ) { if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } Abc_NtkPrintPoEquivs( pNtk ); return 0; } if ( !pAbc->vStatuses ) Abc_Print( 1,"Status = %d Frames = %d ", pAbc->Status, pAbc->nFrames ); if ( pAbc->pCex == NULL && pAbc->vCexVec == NULL ) Abc_Print( 1,"Cex is not defined.\n" ); else { if ( pAbc->pCex ) Abc_CexPrintStats( pAbc->pCex ); if ( pAbc->vCexVec ) { Abc_Cex_t * pTemp; int nCexes = 0; int Counter = 0; //printf( "\n" ); Vec_PtrForEachEntry( Abc_Cex_t *, pAbc->vCexVec, pTemp, c ) { if ( pTemp == (void *)(ABC_PTRINT_T)1 ) { Counter++; continue; } if ( pTemp ) { printf( "%4d : ", ++nCexes ); Abc_CexPrintStats( pTemp ); } } // if ( Counter ) // printf( "In total, %d (out of %d) outputs are \"sat\" but CEXes are not recorded.\n", Counter, Vec_PtrSize(pAbc->vCexVec) ); } } if ( pAbc->vStatuses ) { if ( pLogFileName ) { Abc_Cex_t * pTemp = NULL; FILE * pFile = fopen( pLogFileName, "wb" ); if ( pFile == NULL ) { printf( "Cannot open file \"%s\" for writing.\n", pLogFileName ); return 0; } Vec_PtrForEachEntry( Abc_Cex_t *, pAbc->vCexVec, pTemp, c ) { int Status = Vec_IntEntry( pAbc->vStatuses, c ); if ( Status == -1 ) // undec fprintf( pFile, "STATUS: ABORTED " ); else if ( Status == 0 ) fprintf( pFile, "STATUS: SAT " ); else if ( Status == 1 ) fprintf( pFile, "STATUS: UNSAT " ); fprintf( pFile, "%s\n", Abc_ObjName(Abc_NtkPo(pNtk, c)) ); if ( Status != 0 ) continue; Abc_NtkDumpOneCexSpecial( pFile, pNtk, pTemp ); } fclose( pFile ); } else if ( fShort ) { printf( "Status array contains %d SAT, %d UNSAT, and %d UNDEC entries (out of %d).", Vec_IntCountEntry(pAbc->vStatuses, 0), Vec_IntCountEntry(pAbc->vStatuses, 1), Vec_IntCountEntry(pAbc->vStatuses, -1), Vec_IntSize(pAbc->vStatuses) ); } else { int i, Entry; Vec_IntForEachEntry( pAbc->vStatuses, Entry, i ) printf( "%d=%d ", i, Entry ); } printf( "\n" ); } return 0; usage: Abc_Print( -2, "usage: print_status [-L file] [-osh]\n" ); Abc_Print( -2, "\t prints verification status\n" ); Abc_Print( -2, "\t-L file : the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" ); Abc_Print( -2, "\t-o : toggle printing output status [default = %s]\n", fOutStatus? "yes": "no" ); Abc_Print( -2, "\t-s : toggle using short print-out [default = %s]\n", fShort? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPrintDelay( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pObjIn = NULL, * pObjOut = NULL; int c; // 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_NtkIsMappedLogic(pNtk) ) { Abc_Print( -1, "Delay trace works only for network mapped into standard cells.\n" ); return 1; } if ( argc > globalUtilOptind + 2 ) { Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } // collect the first name (PO name) if ( argc >= globalUtilOptind + 1 ) { int Num = Nm_ManFindIdByName( pNtk->pManName, argv[globalUtilOptind], ABC_OBJ_PO ); if ( Num < 0 ) Num = Nm_ManFindIdByName( pNtk->pManName, argv[globalUtilOptind], ABC_OBJ_BI ); if ( Num >= 0 ) pObjOut = Abc_NtkObj( pNtk, Num ); if ( pObjOut == NULL ) { Abc_Print( 1, "Cannot find combinational output \"%s\".\n", argv[globalUtilOptind] ); return 1; } } // collect the second name (PI name) if ( argc == globalUtilOptind + 2 ) { int Num = Nm_ManFindIdByName( pNtk->pManName, argv[globalUtilOptind+1], ABC_OBJ_PI ); if ( Num < 0 ) Num = Nm_ManFindIdByName( pNtk->pManName, argv[globalUtilOptind+1], ABC_OBJ_BO ); if ( Num >= 0 ) pObjIn = Abc_NtkObj( pNtk, Num ); if ( pObjIn == NULL ) { Abc_Print( 1, "Cannot find combinational input \"%s\".\n", argv[globalUtilOptind+1] ); return 1; } } Abc_NtkDelayTrace( pNtk, pObjOut, pObjIn, 1 ); return 0; usage: Abc_Print( -2, "usage: print_delay [-h] \n" ); Abc_Print( -2, "\t prints one critical path of the mapped network\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t : (optional) the sink of the critical path (primary output or flop input)\n"); Abc_Print( -2, "\t : (optional) the source of the critical path (primary input or flop output)\n"); Abc_Print( -2, "\t (if CO and/or CI are not given, uses the most critical ones)\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandShow( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fSeq; int fGateNames; int fUseReverse; int fFlopDep; int fKeepDot; int fAigIds; extern void Abc_NtkShow( Abc_Ntk_t * pNtk, int fGateNames, int fSeq, int fUseReverse, int fKeepDot, int fAigIds ); extern void Abc_NtkShowFlopDependency( Abc_Ntk_t * pNtk ); // set defaults fSeq = 0; fGateNames = 0; fUseReverse = 1; fFlopDep = 0; fKeepDot = 0; fAigIds = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "rsgfdih" ) ) != EOF ) { switch ( c ) { case 'r': fUseReverse ^= 1; break; case 's': fSeq ^= 1; break; case 'g': fGateNames ^= 1; break; case 'f': fFlopDep ^= 1; break; case 'd': fKeepDot ^= 1; break; case 'i': fAigIds ^= 1; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( fFlopDep ) Abc_NtkShowFlopDependency( pNtk ); else Abc_NtkShow( pNtk, fGateNames, fSeq, fUseReverse, fKeepDot, fAigIds ); return 0; usage: Abc_Print( -2, "usage: show [-srgfdih]\n" ); Abc_Print( -2, " visualizes the network structure using DOT and GSVIEW\n" ); #ifdef WIN32 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 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-d : toggles keeping the .dot file used to produce the .ps file [default = %s].\n", fKeepDot? "yes": "no" ); Abc_Print( -2, "\t-i : toggles using original AIG object IDs as node labels [default = %s].\n", fAigIds? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandShowBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Obj_t * pNode; int c, fCompl = 0, fGlobal = 0, fReorder = 1, fWidth = 0; extern void Abc_NodeShowBdd( Abc_Obj_t * pNode, int fCompl ); extern void Abc_NtkShowBdd( Abc_Ntk_t * pNtk, int fCompl, int fReorder ); extern void Abc_NtkBddDecExplore( Abc_Obj_t * pNode ); // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "cgrwh" ) ) != EOF ) { switch ( c ) { case 'c': fCompl ^= 1; break; case 'g': fGlobal ^= 1; break; case 'r': fReorder ^= 1; break; case 'w': fWidth ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( fGlobal ) { Abc_Ntk_t * pTemp = Abc_NtkIsStrash(pNtk) ? pNtk : Abc_NtkStrash(pNtk, 0, 0, 0); Abc_NtkShowBdd( pTemp, fCompl, fReorder ); if ( pTemp != pNtk ) Abc_NtkDelete( pTemp ); return 0; } if ( !Abc_NtkIsBddLogic(pNtk) ) { Abc_Print( -1, "Visualizing BDDs can only be done for logic BDD networks (run \"bdd\").\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } if ( argc == globalUtilOptind ) { pNode = Abc_ObjFanin0( Abc_NtkPo(pNtk, 0) ); if ( !Abc_ObjIsNode(pNode) ) { Abc_Print( -1, "The driver \"%s\" of the first PO is not an internal node.\n", Abc_ObjName(pNode) ); return 1; } } else { pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } } if ( fWidth ) Abc_NtkBddDecExplore( pNode ); else Abc_NodeShowBdd( pNode, fCompl ); return 0; usage: Abc_Print( -2, "usage: show_bdd [-cgrwh] \n" ); Abc_Print( -2, " uses DOT and GSVIEW to visualize the global BDDs of primary outputs\n" ); Abc_Print( -2, " in terms of primary inputs or the local BDD of a node in terms of its fanins\n" ); #ifdef WIN32 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 Abc_Print( -2, "\t: (optional) the node to consider [default = the driver of the first PO]\n"); Abc_Print( -2, "\t-c : toggle visualizing BDD with complemented edges [default = %s].\n", fCompl? "yes": "no" ); Abc_Print( -2, "\t-g : toggle visualizing the global BDDs of primary outputs [default = %s].\n", fGlobal? "yes": "no" ); Abc_Print( -2, "\t-r : toggles dynamic variable reordering [default = %s]\n", fReorder? "yes": "no" ); Abc_Print( -2, "\t-w : toggles printing width profile of the node's BDD [default = %s]\n", fWidth? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandShowCut( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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 ); // set defaults nNodeSizeMax = 10; nConeSizeMax = ABC_INFINITY; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "NCh" ) ) != EOF ) { switch ( c ) { case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nNodeSizeMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nNodeSizeMax < 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; } nConeSizeMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nConeSizeMax < 0 ) goto usage; 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, "Visualizing cuts only works for AIGs (run \"strash\").\n" ); return 1; } if ( argc != globalUtilOptind + 1 ) { Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } Abc_NodeShowCut( pNode, nNodeSizeMax, nConeSizeMax ); return 0; usage: Abc_Print( -2, "usage: show_cut [-N ] [-C ] [-h] \n" ); Abc_Print( -2, " visualizes the cut of a node using DOT and GSVIEW\n" ); #ifdef WIN32 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 Abc_Print( -2, "\t-N : the max size of the cut to be computed [default = %d]\n", nNodeSizeMax ); Abc_Print( -2, "\t-C : the max support of the containing cone [default = %d]\n", nConeSizeMax ); Abc_Print( -2, "\t : the node to consider\n"); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int fVerbose; int fBddSizeMax; int fDualRail; int fReorder; int fReverse; int fDumpOrder; int c; char * pLogFileName = NULL; pNtk = Abc_FrameReadNtk(pAbc); // set defaults fVerbose = 0; fReorder = 1; fReverse = 0; fDualRail = 0; fDumpOrder = 0; fBddSizeMax = ABC_INFINITY; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "BLrodxvh" ) ) != EOF ) { switch ( c ) { case 'B': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" ); goto usage; } fBddSizeMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( fBddSizeMax < 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': fReorder ^= 1; break; case 'o': fReverse ^= 1; break; case 'd': fDualRail ^= 1; break; case 'x': fDumpOrder ^= 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_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Can only collapse a logic network or an AIG.\n" ); return 1; } // get the new network if ( Abc_NtkIsStrash(pNtk) ) pNtkRes = Abc_NtkCollapse( pNtk, fBddSizeMax, fDualRail, fReorder, fReverse, fDumpOrder, fVerbose ); else { pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); pNtkRes = Abc_NtkCollapse( pNtk, fBddSizeMax, fDualRail, fReorder, fReverse, fDumpOrder, fVerbose ); Abc_NtkDelete( pNtk ); } if ( pNtkRes == NULL ) { Abc_Print( -1, "Collapsing has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); if ( pLogFileName ) { pAbc->pCex = NULL; pAbc->nFrames = -1; if ( Abc_NtkNodeNum(pNtkRes) == 0 ) pAbc->Status = 1; // UNSAT else pAbc->Status = -1; // UNDEC Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, pAbc->nFrames, "collapse" ); } return 0; usage: Abc_Print( -2, "usage: collapse [-B ] [-L file] [-rodxvh]\n" ); Abc_Print( -2, "\t collapses the network by constructing global BDDs\n" ); Abc_Print( -2, "\t-B : limit on live BDD nodes during collapsing [default = %d]\n", fBddSizeMax ); Abc_Print( -2, "\t-L file : the log file name [default = %s]\n", pLogFileName ? pLogFileName : "no logging" ); Abc_Print( -2, "\t-r : toggles dynamic variable reordering [default = %s]\n", fReorder? "yes": "no" ); Abc_Print( -2, "\t-o : toggles reverse variable ordering [default = %s]\n", fReverse? "yes": "no" ); Abc_Print( -2, "\t-d : toggles dual-rail collapsing mode [default = %s]\n", fDualRail? "yes": "no" ); Abc_Print( -2, "\t-x : toggles dumping file \"order.txt\" with variable order [default = %s]\n", fDumpOrder? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandSatClp( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtkRes; int nCubeLim = 0; int nBTLimit = 1000000; int nCostMax = 20000000; int fCanon = 0; int fReverse = 0; int fCnfShared = 0; int fVerbose = 0; int c; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "CLZcrsvh" ) ) != EOF ) { switch ( c ) { case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nCubeLim = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCubeLim < 0 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nBTLimit < 0 ) goto usage; break; case 'Z': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-Z\" should be followed by an integer.\n" ); goto usage; } nCostMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCostMax < 0 ) goto usage; break; case 'c': fCanon ^= 1; break; case 'r': fReverse ^= 1; break; case 's': fCnfShared ^= 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_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Can only collapse a logic network or an AIG.\n" ); return 1; } // get the new network if ( Abc_NtkIsStrash(pNtk) ) pNtkRes = Abc_NtkCollapseSat( pNtk, nCubeLim, nBTLimit, nCostMax, fCanon, fReverse, fCnfShared, fVerbose ); else { pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); pNtkRes = Abc_NtkCollapseSat( pNtk, nCubeLim, nBTLimit, nCostMax, fCanon, fReverse, fCnfShared, fVerbose ); Abc_NtkDelete( pNtk ); } if ( pNtkRes == NULL ) { Abc_Print( -1, "Collapsing has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: satclp [-CLZ num] [-crsvh]\n" ); Abc_Print( -2, "\t performs SAT based collapsing\n" ); Abc_Print( -2, "\t-C num : the limit on the SOP size of one output [default = %d]\n", nCubeLim ); Abc_Print( -2, "\t-L num : the limit on the number of conflicts in one SAT call [default = %d]\n", nBTLimit ); Abc_Print( -2, "\t-Z num : the limit on the cost of the largest output [default = %d]\n", nCostMax ); Abc_Print( -2, "\t-c : toggles using canonical ISOP computation [default = %s]\n", fCanon? "yes": "no" ); Abc_Print( -2, "\t-r : toggles using reverse veriable ordering [default = %s]\n", fReverse? "yes": "no" ); Abc_Print( -2, "\t-s : toggles shared CNF computation (non-canonical only) [default = %s]\n", fCnfShared? "yes": "no" ); Abc_Print( -2, "\t-v : toggles 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_CommandStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; Abc_Obj_t * pObj; int c; int fAllNodes; int fRecord; int fCleanup; int fComplOuts; pNtk = Abc_FrameReadNtk(pAbc); // set defaults fAllNodes = 0; fCleanup = 1; fRecord = 0; fComplOuts= 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "acrih" ) ) != EOF ) { switch ( c ) { case 'a': fAllNodes ^= 1; break; case 'c': fCleanup ^= 1; break; case 'r': fRecord ^= 1; break; case 'i': fComplOuts ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network pNtkRes = Abc_NtkStrash( pNtk, fAllNodes, fCleanup, fRecord ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Strashing has failed.\n" ); return 1; } if ( fComplOuts ) Abc_NtkForEachPo( pNtkRes, pObj, c ) Abc_ObjXorFaninC( pObj, 0 ); // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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 dangling 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 POs of the AIG [default = %s]\n", fComplOuts? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandBalance( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes, * pNtkTemp; int c; int fDuplicate; int fSelective; int fUpdateLevel; int fExor; int fVerbose; pNtk = Abc_FrameReadNtk(pAbc); // set defaults fDuplicate = 0; fSelective = 0; fUpdateLevel = 1; fExor = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ldsxvh" ) ) != EOF ) { switch ( c ) { case 'l': fUpdateLevel ^= 1; break; case 'd': fDuplicate ^= 1; break; case 's': fSelective ^= 1; break; case 'x': fExor ^= 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; } // get the new network if ( Abc_NtkIsStrash(pNtk) ) { if ( fExor ) pNtkRes = Abc_NtkBalanceExor( pNtk, fUpdateLevel, fVerbose ); else pNtkRes = Abc_NtkBalance( pNtk, fDuplicate, fSelective, fUpdateLevel ); } else { pNtkTemp = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtkTemp == NULL ) { Abc_Print( -1, "Strashing before balancing has failed.\n" ); return 1; } if ( fExor ) pNtkRes = Abc_NtkBalanceExor( pNtkTemp, fUpdateLevel, fVerbose ); else pNtkRes = Abc_NtkBalance( pNtkTemp, fDuplicate, fSelective, fUpdateLevel ); Abc_NtkDelete( pNtkTemp ); } // check if balancing worked if ( pNtkRes == NULL ) { Abc_Print( -1, "Balancing has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMuxStruct( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults fVerbose = 0; 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Does not work for a logic network.\n" ); return 1; } // check if balancing worked // pNtkRes = Abc_NtkMuxRestructure( pNtk, fVerbose ); pNtkRes = NULL; if ( pNtkRes == NULL ) { Abc_Print( -1, "MUX restructuring has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMulti( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int nThresh, nFaninMax, c; int fCnf; int fMulti; int fSimple; int fFactor; 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); // set defaults nThresh = 1; nFaninMax = 20; fCnf = 0; fMulti = 1; fSimple = 0; fFactor = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "TFmcsfh" ) ) != EOF ) { switch ( c ) { case 'T': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } nThresh = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nThresh < 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; } nFaninMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nFaninMax < 0 ) goto usage; break; case 'c': fCnf ^= 1; break; case 'm': fMulti ^= 1; break; case 's': fSimple ^= 1; break; case 'f': fFactor ^= 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, "Cannot renode a network that is not an AIG (run \"strash\").\n" ); return 1; } // get the new network pNtkRes = Abc_NtkMulti( pNtk, nThresh, nFaninMax, fCnf, fMulti, fSimple, fFactor ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Renoding has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: multi [-TF ] [-msfch]\n" ); Abc_Print( -2, "\t transforms an AIG into a logic network by creating larger nodes\n" ); Abc_Print( -2, "\t-F : the maximum fanin size after renoding [default = %d]\n", nFaninMax ); Abc_Print( -2, "\t-T : 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRenode( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int nLutSize, nCutsMax, c; int nFlowIters, nAreaIters; int fArea; int fUseBdds; int fUseSops; int fUseCnfs; int fUseMv; int fVerbose; 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); // set defaults nLutSize = 8; nCutsMax = 4; nFlowIters = 1; nAreaIters = 1; fArea = 0; fUseBdds = 0; fUseSops = 0; fUseCnfs = 0; fUseMv = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "KCFAabscivh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-F\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLutSize < 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; } nCutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCutsMax < 0 ) goto usage; break; case 'F': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-F\" should be followed by a positive integer.\n" ); goto usage; } nFlowIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nFlowIters < 0 ) goto usage; break; case 'A': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-A\" should be followed by a positive integer.\n" ); goto usage; } nAreaIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nAreaIters < 0 ) goto usage; break; case 'a': fArea ^= 1; break; case 'b': fUseBdds ^= 1; break; case 's': fUseSops ^= 1; break; case 'c': fUseCnfs ^= 1; break; case 'i': fUseMv ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( fUseBdds + fUseSops + fUseCnfs + fUseMv > 1 ) { Abc_Print( -1, "Cannot optimize two parameters at the same time.\n" ); return 1; } if ( nLutSize < 2 || nLutSize > IF_MAX_FUNC_LUTSIZE ) { Abc_Print( -1, "Incorrect LUT size (%d).\n", nLutSize ); return 1; } if ( nCutsMax < 1 || nCutsMax >= (1<<12) ) { Abc_Print( -1, "Incorrect number of cuts.\n" ); return 1; } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Cannot renode a network that is not an AIG (run \"strash\").\n" ); return 1; } // get the new network pNtkRes = Abc_NtkRenode( pNtk, nLutSize, nCutsMax, nFlowIters, nAreaIters, fArea, fUseBdds, fUseSops, fUseCnfs, fUseMv, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Renoding has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: renode [-KCFA ] [-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 : the max cut size for renoding (2 < num < %d) [default = %d]\n", IF_MAX_FUNC_LUTSIZE+1, nLutSize ); Abc_Print( -2, "\t-C : the max number of cuts used at a node (0 < num < 2^12) [default = %d]\n", nCutsMax ); Abc_Print( -2, "\t-F : the number of area flow recovery iterations (num >= 0) [default = %d]\n", nFlowIters ); Abc_Print( -2, "\t-A : 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandCleanup( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c; int fCleanupPis; int fCleanupPos; int fVerbose; extern Abc_Ntk_t * Abc_NtkDarCleanupAig( Abc_Ntk_t * pNtk, int fCleanupPis, int fCleanupPos, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults fCleanupPis = 1; fCleanupPos = 1; fVerbose = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "iovh" ) ) != EOF ) { switch ( c ) { case 'i': fCleanupPis ^= 1; break; case 'o': fCleanupPos ^= 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_NtkIsStrash(pNtk) ) { if ( !fCleanupPis && !fCleanupPos ) { Abc_Print( -1, "Cleanup for PIs and POs is not enabled.\n" ); pNtkRes = Abc_NtkDup( pNtk ); } else pNtkRes = Abc_NtkDarCleanupAig( pNtk, fCleanupPis, fCleanupPos, fVerbose ); } else { Abc_NtkCleanup( pNtk, fVerbose ); pNtkRes = Abc_NtkDup( pNtk ); } if ( pNtkRes == NULL ) { Abc_Print( -1, "Cleanup has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fSingle = 0; int fVerbose = 0; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "svh" ) ) != EOF ) { switch ( c ) { case 's': fSingle ^= 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_NtkIsLogic(pNtk) ) { Abc_Print( -1, "The classical (SIS-like) sweep can only be performed on a logic network.\n" ); return 1; } // modify the current network if ( fSingle ) Abc_NtkSweepBufsInvs( pNtk, fVerbose ); else Abc_NtkSweep( pNtk, fVerbose ); return 0; usage: Abc_Print( -2, "usage: sweep [-svh]\n" ); Abc_Print( -2, "\t removes dangling nodes; propagates constant, buffers, inverters\n" ); Abc_Print( -2, "\t-s : toggle sweeping buffers/inverters only [default = %s]\n", fSingle? "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_CommandFastExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Abc_NtkFxPerform( Abc_Ntk_t * pNtk, int nNewNodesMax, int nLitCountMax, int fCanonDivs, int fVerbose, int fVeryVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Fxu_Data_t Params, * p = &Params; int c, fNewAlgo = 1; int nPairsLimit = 1000000000; // set the defaults Abc_NtkSetDefaultFxParams( p ); Extra_UtilGetoptReset(); while ( (c = Extra_UtilGetopt(argc, argv, "SDNWMPsdzcnxvwh")) != EOF ) { switch (c) { case 'S': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } p->nSingleMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( p->nSingleMax < 0 ) goto usage; break; case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } p->nPairsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( p->nPairsMax < 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; } p->nNodesExt = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( p->nNodesExt < 0 ) goto usage; break; case 'W': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } p->WeightMin = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( p->WeightMin < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } p->LitCountMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( p->LitCountMax < 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; } nPairsLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nPairsLimit < 0 ) goto usage; break; case 's': p->fOnlyS ^= 1; break; case 'd': p->fOnlyD ^= 1; break; case 'z': p->fUse0 ^= 1; break; case 'c': p->fUseCompl ^= 1; break; case 'n': fNewAlgo ^= 1; break; case 'x': p->fCanonDivs ^= 1; break; case 'v': p->fVerbose ^= 1; break; case 'w': p->fVeryVerbose ^= 1; break; case 'h': goto usage; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkNodeNum(pNtk) == 0 || Abc_NtkPiNum(pNtk) == 0 ) { Abc_Print( 0, "The network does not have internal nodes.\n" ); return 0; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "Fast extract can only be applied to a logic network (run \"renode\" or \"if\").\n" ); return 1; } if ( !Abc_NtkIsSopLogic(pNtk) ) { Abc_Print( -1, "Fast extract can only be applied to a logic network with SOP local functions (run \"bdd; sop\").\n" ); return 1; } if ( Abc_NtkGetCubePairNum(pNtk) > nPairsLimit ) { Abc_Print( -1, "Cannot perform \"fx\" because the number cube pairs exceeds the limit (%d).\n", nPairsLimit ); return 1; } // the nodes to be merged are linked into the special linked list if ( fNewAlgo ) Abc_NtkFxPerform( pNtk, p->nNodesExt, p->LitCountMax, p->fCanonDivs, p->fVerbose, p->fVeryVerbose ); else Abc_NtkFastExtract( pNtk, p ); Abc_NtkFxuFreeInfo( p ); return 0; usage: Abc_Print( -2, "usage: fx [-SDNWMP ] [-sdzcnxvwh]\n"); Abc_Print( -2, "\t performs unate fast extract on the current network\n"); Abc_Print( -2, "\t-S : max number of single-cube divisors to consider [default = %d]\n", p->nSingleMax ); Abc_Print( -2, "\t-D : max number of double-cube divisors to consider [default = %d]\n", p->nPairsMax ); Abc_Print( -2, "\t-N : max number of divisors to extract during this run [default = %d]\n", p->nNodesExt ); Abc_Print( -2, "\t-W : lower bound on the weight of divisors to extract [default = %d]\n", p->WeightMin ); Abc_Print( -2, "\t-M : upper bound on literal count of divisors to extract [default = %d]\n", p->LitCountMax ); Abc_Print( -2, "\t-P : skip \"fx\" if cube pair count exceeds this limit [default = %d]\n", nPairsLimit ); 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-n : use new implementation of fast extract [default = %s]\n", fNewAlgo? "yes": "no" ); Abc_Print( -2, "\t-x : use only canonical divisors (AND, XOR, MUX) [default = %s]\n", p->fCanonDivs? "yes": "no" ); Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", p->fVerbose? "yes": "no" ); Abc_Print( -2, "\t-w : print additional information [default = %s]\n", p->fVeryVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ static int Abc_CommandFxch( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Abc_NtkFxchPerform( Abc_Ntk_t * pNtk, int nMaxDivExt, int fVerbose, int fVeryVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c, nMaxDivExt = 0, fVerbose = 0, fVeryVerbose = 0; Extra_UtilGetoptReset(); while ( (c = Extra_UtilGetopt(argc, argv, "Nvwh")) != EOF ) { switch (c) { case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nMaxDivExt = atoi( argv[globalUtilOptind] ); globalUtilOptind++; if ( nMaxDivExt < 0 ) goto usage; break; case 'v': fVerbose ^= 1; break; case 'w': fVeryVerbose ^= 1; break; case 'h': goto usage; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkNodeNum( pNtk ) == 0 ) { Abc_Print( -1, "The network does not have internal nodes.\n" ); return 1; } if ( !Abc_NtkIsLogic( pNtk ) ) { Abc_Print( -1, "Fast extract can only be applied to a logic network (run \"renode\" or \"if\").\n" ); return 1; } if ( !Abc_NtkIsSopLogic( pNtk ) ) { Abc_Print( -1, "Fast extract can only be applied to a logic network with SOP local functions (run \"bdd; sop\").\n" ); return 1; } Abc_NtkFxchPerform( pNtk, nMaxDivExt, fVerbose, fVeryVerbose ); return 0; usage: Abc_Print( -2, "usage: fxch [-N ] [-svwh]\n"); Abc_Print( -2, "\t performs fast extract with cube hashing on the current network\n"); Abc_Print( -2, "\t-N : max number of divisors to extract during this run [default = unused]\n" ); Abc_Print( -2, "\t-v : print verbose information [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-w : print additional information [default = %s]\n", fVeryVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t\n" ); Abc_Print( -2, "\t This command was contributed by Bruno Schmitt from UFRGS in May 2016.\n" ); Abc_Print( -2, "\t The author can be contacted as boschmitt at inf.ufrgs.br\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandEliminate( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int ElimValue; int nMaxSize; int nIterMax; int fGreedy; int fReverse; int fSpecial; int fVerbose; int c; extern int Abc_NtkEliminate( Abc_Ntk_t * pNtk, int nMaxSize, int fReverse, int fVerbose ); extern int Abc_NtkEliminate1( Abc_Ntk_t * pNtk, int ElimValue, int nMaxSize, int nIterMax, int fReverse, int fVerbose ); extern int Abc_NtkEliminateSpecial( Abc_Ntk_t * pNtk, int nMaxSize, int fVerbose ); // set the defaults ElimValue = -1; nMaxSize = 12; nIterMax = 1; fGreedy = 0; fReverse = 0; fSpecial = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( (c = Extra_UtilGetopt(argc, argv, "VNIgrsvh")) != EOF ) { switch (c) { case 'V': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-V\" should be followed by an integer that is -1 or larger.\n" ); goto usage; } ElimValue = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( ElimValue < -1 ) goto usage; break; case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by a positive integer.\n" ); goto usage; } nMaxSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nMaxSize <= 0 ) goto usage; break; case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" ); goto usage; } nIterMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIterMax <= 0 ) goto usage; break; case 'g': fGreedy ^= 1; break; case 'r': fReverse ^= 1; break; case 's': fSpecial ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkNodeNum(pNtk) == 0 ) { Abc_Print( -1, "The network does not have internal nodes.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a logic network (run \"renode\" or \"if\").\n" ); return 1; } if ( fSpecial ) Abc_NtkEliminateSpecial( pNtk, 1000, fVerbose ); else if ( fGreedy ) Abc_NtkEliminate( pNtk, nMaxSize, fReverse, fVerbose ); else Abc_NtkEliminate1( pNtk, ElimValue, nMaxSize, nIterMax, fReverse, fVerbose ); return 0; usage: Abc_Print( -2, "usage: eliminate [-VNI ] [-grsvh]\n"); Abc_Print( -2, "\t traditional \"eliminate -1\", which collapses the node into its fanout\n"); Abc_Print( -2, "\t if the node's variable appears in the fanout's factored form only once\n"); Abc_Print( -2, "\t-V : the \"value\" parameter used by \"eliminate\" in SIS [default = %d]\n", ElimValue ); Abc_Print( -2, "\t-N : the maximum node support after collapsing [default = %d]\n", nMaxSize ); Abc_Print( -2, "\t-I : the maximum number of iterations [default = %d]\n", nIterMax ); Abc_Print( -2, "\t-g : toggle using greedy eliminate (without \"value\") [default = %s]\n", fGreedy? "yes": "no" ); Abc_Print( -2, "\t-r : use the reverse topological order [default = %s]\n", fReverse? "yes": "no" ); Abc_Print( -2, "\t-s : toggle eliminating similar nodes [default = %s]\n", fSpecial? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDisjoint( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes, * pNtkNew; int fGlobal, fRecursive, fVerbose, fPrint, fShort, c; 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); // set defaults fGlobal = 1; fRecursive = 0; fVerbose = 0; fPrint = 0; fShort = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "grvpsh" ) ) != EOF ) { switch ( c ) { case 'g': fGlobal ^= 1; break; case 'r': fRecursive ^= 1; break; case 'v': fVerbose ^= 1; break; case 'p': fPrint ^= 1; break; case 's': fShort ^= 1; break; case 'h': goto usage; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( fGlobal ) { // Abc_Print( 0, "Performing DSD of global functions of the network.\n" ); // get the new network if ( !Abc_NtkIsStrash(pNtk) ) { pNtkNew = Abc_NtkStrash( pNtk, 0, 0, 0 ); pNtkRes = Abc_NtkDsdGlobal( pNtkNew, fVerbose, fPrint, fShort ); Abc_NtkDelete( pNtkNew ); } else { pNtkRes = Abc_NtkDsdGlobal( pNtk, fVerbose, fPrint, fShort ); } if ( pNtkRes == NULL ) { Abc_Print( -1, "Global DSD has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } else if ( fRecursive ) { if ( !Abc_NtkIsBddLogic( pNtk ) ) { Abc_Print( -1, "This command is only applicable to logic BDD networks.\n" ); return 1; } if ( fVerbose ) Abc_Print( 1, "Performing recursive DSD and MUX decomposition of local functions.\n" ); if ( !Abc_NtkDsdLocal( pNtk, fVerbose, fRecursive ) ) Abc_Print( -1, "Recursive DSD has failed.\n" ); } else { if ( !Abc_NtkIsBddLogic( pNtk ) ) { Abc_Print( -1, "This command is only applicable to logic BDD networks (run \"bdd\").\n" ); return 1; } if ( fVerbose ) Abc_Print( 1, "Performing simple non-recursive DSD of local functions.\n" ); if ( !Abc_NtkDsdLocal( pNtk, fVerbose, fRecursive ) ) Abc_Print( -1, "Simple DSD of local functions has failed.\n" ); } return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandSparsify( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkSparsify( Abc_Ntk_t * pNtk, int nPerc, int fVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtkNew; int nPerc, fVerbose, c; // set defaults nPerc = 10; 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; } nPerc = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nPerc < 1 || nPerc > 100 ) goto usage; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsBddLogic( pNtk ) ) { Abc_Print( -1, "This command is only applicable to logic BDD networks (run \"bdd\").\n" ); return 1; } if ( Abc_NtkCiNum(pNtk) > 16 ) { Abc_Print( -1, "The number of primary inputs is more than 16.\n" ); return 1; } pNtkNew = Abc_NtkSparsify( pNtk, nPerc, fVerbose ); if ( pNtkNew == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkNew ); return 0; usage: Abc_Print( -2, "usage: sparsify [-N num] [-vh]\n" ); Abc_Print( -2, "\t creates incompletely-specified function\n" ); Abc_Print( -2, "\t-N : the percentage of on-set and off-set minterms (1 <= num <= 100) [default = %d]\n", nPerc ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandLutpack( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Lpk_Par_t Pars, * pPars = &Pars; int c; pNtk = Abc_FrameReadNtk(pAbc); // set defaults memset( pPars, 0, sizeof(Lpk_Par_t) ); pPars->nLutsMax = 4; // (N) the maximum number of LUTs in the structure pPars->nLutsOver = 3; // (Q) the maximum number of LUTs not in the MFFC pPars->nVarsShared = 0; // (S) the maximum number of shared variables (crossbars) pPars->nGrowthLevel = 0; // (L) the maximum number of increased levels pPars->fSatur = 1; pPars->fZeroCost = 0; pPars->fFirst = 0; pPars->fOldAlgo = 0; pPars->fVerbose = 0; pPars->fVeryVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "NQSLszfovwh" ) ) != EOF ) { switch ( c ) { case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nLutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nLutsMax < 2 || pPars->nLutsMax > 16 ) goto usage; break; case 'Q': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-Q\" should be followed by an integer.\n" ); goto usage; } pPars->nLutsOver = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nLutsOver < 0 || pPars->nLutsOver > 8 ) 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->nVarsShared = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nVarsShared < 0 || pPars->nVarsShared > 4 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nGrowthLevel = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nGrowthLevel < 0 || pPars->nGrowthLevel > ABC_INFINITY ) goto usage; break; case 's': pPars->fSatur ^= 1; break; case 'z': pPars->fZeroCost ^= 1; break; case 'f': pPars->fFirst ^= 1; break; case 'o': pPars->fOldAlgo ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'w': pPars->fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } if ( pPars->nVarsShared < 0 || pPars->nVarsShared > 3 ) { 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 ) ) { Abc_Print( -1, "Resynthesis has failed.\n" ); return 1; } return 0; usage: Abc_Print( -2, "usage: lutpack [-NQSL ] [-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, \"mfs2\")\n" ); Abc_Print( -2, "\t-N : the max number of LUTs in the structure (2 <= num) [default = %d]\n", pPars->nLutsMax ); Abc_Print( -2, "\t-Q : the max number of LUTs not in MFFC (0 <= num) [default = %d]\n", pPars->nLutsOver ); Abc_Print( -2, "\t-S : the max number of LUT inputs shared (0 <= num <= 3) [default = %d]\n", pPars->nVarsShared ); Abc_Print( -2, "\t-L : 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandLutmin( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkLutmin( Abc_Ntk_t * pNtk, int nLutSize, int fReorder, int fVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtkRes; int c; int nLutSize = 4; int fReorder = 1; int fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Krvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; case 'r': fReorder ^= 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; } // modify the current network pNtkRes = Abc_NtkLutmin( pNtk, nLutSize, fReorder, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: lutmin [-K ] [-rvh]\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 : the LUT size to use for the mapping (2 <= num) [default = %d]\n", nLutSize ); Abc_Print( -2, "\t-r : toggle using BDD variable reordering [default = %s]\n", fReorder? "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; } #if 0 /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandImfs( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Res_Par_t Pars, * pPars = &Pars; int c; // set defaults pPars->nWindow = 62; pPars->nCands = 5; pPars->nSimWords = 4; pPars->nGrowthLevel = 0; pPars->fArea = 0; pPars->fVerbose = 0; pPars->fVeryVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "WSCLavwh" ) ) != 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->nWindow = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nWindow < 1 || pPars->nWindow > 99 ) 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->nSimWords = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nSimWords < 1 || pPars->nSimWords > 256 ) 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->nCands = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nCands < 0 || pPars->nCands > ABC_INFINITY ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nGrowthLevel = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nGrowthLevel < 0 || pPars->nGrowthLevel > ABC_INFINITY ) goto usage; break; case 'a': pPars->fArea ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'w': pPars->fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { 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 ) ) { Abc_Print( -1, "Resynthesis has failed.\n" ); return 1; } return 0; usage: Abc_Print( -2, "usage: imfs [-W ] [-LCS ] [-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 : 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 : the max number of resub candidates (1 <= n) [default = %d]\n", pPars->nCands ); Abc_Print( -2, "\t-S : the number of simulation words (1 <= n <= 256) [default = %d]\n", pPars->nSimWords ); Abc_Print( -2, "\t-L : 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; } #endif /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMfs( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Mfs_Par_t Pars, * pPars = &Pars; int c; // set defaults Abc_NtkMfsParsDefault( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "WFDMLCdraestpgvwh" ) ) != 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->nWinTfoLevs = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nWinTfoLevs < 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->nFanoutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nFanoutsMax < 0 ) goto usage; break; case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nDepthMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nDepthMax < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nWinMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nWinMax < 0 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nGrowthLevel = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nGrowthLevel < 0 || pPars->nGrowthLevel > ABC_INFINITY ) 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->nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nBTLimit < 0 ) goto usage; break; case 'd': pPars->fRrOnly ^= 1; break; case 'r': pPars->fResub ^= 1; break; case 'a': pPars->fArea ^= 1; break; case 'e': pPars->fMoreEffort ^= 1; break; case 's': pPars->fSwapEdge ^= 1; break; case 't': pPars->fOneHotness ^= 1; break; case 'p': pPars->fPower ^= 1; break; case 'g': pPars->fGiaSat ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'w': pPars->fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { 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 ) ) { Abc_Print( -1, "Resynthesis has failed.\n" ); return 1; } return 0; usage: Abc_Print( -2, "usage: mfs [-WFDMLC ] [-draestpgvh]\n" ); Abc_Print( -2, "\t performs don't-care-based optimization of logic networks\n" ); Abc_Print( -2, "\t-W : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nWinTfoLevs ); Abc_Print( -2, "\t-F : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutsMax ); Abc_Print( -2, "\t-D : the max depth nodes to try (0 = no limit) [default = %d]\n", pPars->nDepthMax ); Abc_Print( -2, "\t-M : the max node count of windows to consider (0 = no limit) [default = %d]\n", pPars->nWinMax ); Abc_Print( -2, "\t-L : the max increase in node level after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); Abc_Print( -2, "\t-C : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit ); Abc_Print( -2, "\t-d : toggle performing redundancy removal [default = %s]\n", pPars->fRrOnly? "yes": "no" ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMfs2( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Abc_NtkPerformMfs( Abc_Ntk_t * pNtk, Sfm_Par_t * pPars ); extern int Abc_NtkMfsAfterICheck( Abc_Ntk_t * p, int nFrames, int nFramesAdd, Vec_Int_t * vFlops, Sfm_Par_t * pPars ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Sfm_Par_t Pars, * pPars = &Pars; int c, fIndDCs = 0, fUseAllFfs = 0, nFramesAdd = 0; // set defaults Sfm_ParSetDefault( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "WFDMLCZNIdaeijlvwh" ) ) != 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->nTfoLevMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nTfoLevMax < 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->nFanoutMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nFanoutMax < 0 ) goto usage; break; case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nDepthMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nDepthMax < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nWinSizeMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nWinSizeMax < 0 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nGrowthLevel = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nGrowthLevel < -ABC_INFINITY || pPars->nGrowthLevel > ABC_INFINITY ) 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->nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nBTLimit < 0 ) goto usage; break; case 'Z': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-Z\" should be followed by an integer.\n" ); goto usage; } pPars->nFirstFixed = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nFirstFixed < 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; } pPars->nNodesMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nNodesMax < 0 ) goto usage; break; case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nFramesAdd = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nFramesAdd < 0 ) goto usage; break; case 'd': pPars->fRrOnly ^= 1; break; case 'a': pPars->fArea ^= 1; break; case 'e': pPars->fMoreEffort ^= 1; break; case 'i': fIndDCs ^= 1; break; case 'j': fUseAllFfs ^= 1; break; case 'l': pPars->fUseDcs ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'w': pPars->fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } if ( fIndDCs ) { if ( fUseAllFfs ) { pAbc->nIndFrames = 1; Vec_IntFreeP( &pAbc->vIndFlops ); pAbc->vIndFlops = Vec_IntAlloc( Abc_NtkLatchNum(pNtk) ); Vec_IntFill( pAbc->vIndFlops, Abc_NtkLatchNum(pNtk), 1 ); } if ( pAbc->nIndFrames <= 0 ) { Abc_Print( -1, "The number of k-inductive frames is not specified.\n" ); return 0; } if ( pAbc->vIndFlops == NULL ) { Abc_Print( -1, "The set of k-inductive flops is not specified.\n" ); return 0; } if ( Vec_IntSize(pAbc->vIndFlops) != Abc_NtkLatchNum(pNtk) ) { Abc_Print( -1, "The saved flop count (%d) does not match that of the current network (%d).\n", Vec_IntSize(pAbc->vIndFlops), Abc_NtkLatchNum(pNtk) ); return 0; } // modify the current network if ( !Abc_NtkMfsAfterICheck( pNtk, pAbc->nIndFrames, nFramesAdd, pAbc->vIndFlops, pPars ) ) { Abc_Print( -1, "Resynthesis has failed.\n" ); return 1; } if ( fUseAllFfs ) { pAbc->nIndFrames = 0; Vec_IntFreeP( &pAbc->vIndFlops ); } } else { // modify the current network if ( !Abc_NtkPerformMfs( pNtk, pPars ) ) { Abc_Print( -1, "Resynthesis has failed.\n" ); return 1; } } return 0; usage: Abc_Print( -2, "usage: mfs2 [-WFDMLCZNI ] [-daeijlvwh]\n" ); Abc_Print( -2, "\t performs don't-care-based optimization of logic networks\n" ); Abc_Print( -2, "\t-W : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nTfoLevMax ); Abc_Print( -2, "\t-F : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutMax ); Abc_Print( -2, "\t-D : the max depth nodes to try (0 = no limit) [default = %d]\n", pPars->nDepthMax ); Abc_Print( -2, "\t-M : the max node count of windows to consider (0 = no limit) [default = %d]\n", pPars->nWinSizeMax ); Abc_Print( -2, "\t-L : the max increase in node level after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); Abc_Print( -2, "\t-C : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit ); Abc_Print( -2, "\t-Z : treat the first logic nodes as fixed (0 = none) [default = %d]\n", pPars->nFirstFixed ); Abc_Print( -2, "\t-N : the max number of nodes to try (0 = all) [default = %d]\n", pPars->nNodesMax ); Abc_Print( -2, "\t-d : toggle performing redundancy removal [default = %s]\n", pPars->fRrOnly? "yes": "no" ); 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-i : toggle using inductive don't-cares [default = %s]\n", fIndDCs? "yes": "no" ); Abc_Print( -2, "\t-j : toggle using all flops when \"-i\" is enabled [default = %s]\n", fUseAllFfs? "yes": "no" ); Abc_Print( -2, "\t-I : the number of additional frames inserted [default = %d]\n", nFramesAdd ); Abc_Print( -2, "\t-l : toggle deriving don't-cares [default = %s]\n", pPars->fUseDcs? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMfs3( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_NtkPerformMfs3( Abc_Ntk_t * pNtk, Sfm_Par_t * pPars ); extern void Sfm_ParSetDefault3( Sfm_Par_t * pPars ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Sfm_Par_t Pars, * pPars = &Pars; int c; // set defaults Sfm_ParSetDefault3( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "IOVFKLHRMCNPWDEarmzoespdlvwh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pPars->nTfiLevMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nTfiLevMax < 1 ) { Abc_Print( -1, "The number of TFI levels (switch \"-I\") should be at least 1.\n" ); goto usage; } break; case 'O': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-O\" should be followed by an integer.\n" ); goto usage; } pPars->nTfoLevMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nTfoLevMax < 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->nTfiLevMax = pPars->nTfoLevMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nTfiLevMax < 1 ) 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->nFanoutMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nFanoutMax < 0 ) goto usage; break; case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } pPars->nVarMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nVarMax < 2 || pPars->nVarMax > 8 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nMffcMin = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nMffcMin < 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->nMffcMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nMffcMax < 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->nDecMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nDecMax < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nWinSizeMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nWinSizeMax < 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->nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nBTLimit < 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; } pPars->nNodesMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nNodesMax < 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; } pPars->iNodeOne = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->iNodeOne < 0 ) goto usage; break; case 'W': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nTimeWin = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nTimeWin < 0 || pPars->nTimeWin > 100 ) goto usage; break; case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->DeltaCrit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->DeltaCrit < 0 ) goto usage; break; case 'E': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-E\" should be followed by an integer.\n" ); goto usage; } pPars->DelAreaRatio = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->DelAreaRatio < 0 ) goto usage; break; case 'a': pPars->fArea ^= 1; break; case 'r': pPars->fAreaRev ^= 1; break; case 'm': pPars->fUseAndOr ^= 1; break; case 'z': pPars->fZeroCost ^= 1; break; case 'o': pPars->fRrOnly ^= 1; break; case 'e': pPars->fMoreEffort ^= 1; break; case 's': pPars->fUseSim ^= 1; break; case 'p': pPars->fPrintDecs ^= 1; break; case 'd': pPars->fDelayVerbose ^= 1; break; case 'l': pPars->fLibVerbose ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'w': pPars->fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsMappedLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a mapped logic network.\n" ); return 1; } // modify the current network Abc_NtkPerformMfs3( pNtk, pPars ); return 0; usage: Abc_Print( -2, "usage: mfs3 [-IOVFKLHRMCNPWDE ] [-armzespdlvwh]\n" ); Abc_Print( -2, "\t performs don't-care-based optimization of mapped networks\n" ); Abc_Print( -2, "\t-I : the number of levels in the TFI cone (1 <= num) [default = %d]\n", pPars->nTfiLevMax ); Abc_Print( -2, "\t-O : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nTfoLevMax ); Abc_Print( -2, "\t-V : the number of levels in the TFI/TFO cone (1 <= num) [default = %d]\n", pPars->nTfiLevMax ); Abc_Print( -2, "\t-F : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutMax ); Abc_Print( -2, "\t-K : the max number of variables (2 <= num <= 8 ) [default = %d]\n", pPars->nVarMax ); Abc_Print( -2, "\t-L : the min size of max fanout-free cone (MFFC) (area-only) [default = %d]\n", pPars->nMffcMin ); Abc_Print( -2, "\t-H : the max size of max fanout-free cone (MFFC) (area-only) [default = %d]\n", pPars->nMffcMax ); Abc_Print( -2, "\t-R : the max number of decomposition rounds (1 <= num <= 4) [default = %d]\n", pPars->nDecMax ); Abc_Print( -2, "\t-M : the max node count of windows to consider (0 = no limit) [default = %d]\n", pPars->nWinSizeMax ); Abc_Print( -2, "\t-C : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit ); Abc_Print( -2, "\t-N : the max number of nodes to try (0 = all) [default = %d]\n", pPars->nNodesMax ); Abc_Print( -2, "\t-P : one particular node to try (0 = none) [default = %d]\n", pPars->iNodeOne ); Abc_Print( -2, "\t-W : size of timing window in percents (0 <= num <= 100) [default = %d]\n", pPars->nTimeWin ); Abc_Print( -2, "\t-D : size of critical-timing delay-delta (in picoseconds) [default = %d]\n", pPars->DeltaCrit ); Abc_Print( -2, "\t-E : delay-area tradeoff (in picoseconds per area-unit) [default = %d]\n", pPars->DelAreaRatio ); Abc_Print( -2, "\t-a : toggle area minimization [default = %s]\n", pPars->fArea? "yes": "no" ); Abc_Print( -2, "\t-r : toggle using reverse topo order for area minimization [default = %s]\n", pPars->fAreaRev? "yes": "no" ); Abc_Print( -2, "\t-m : toggle detecting multi-input AND/OR gates [default = %s]\n", pPars->fUseAndOr? "yes": "no" ); Abc_Print( -2, "\t-z : toggle zero-cost replacements [default = %s]\n", pPars->fZeroCost? "yes": "no" ); Abc_Print( -2, "\t-e : toggle using more effort [default = %s]\n", pPars->fMoreEffort? "yes": "no" ); Abc_Print( -2, "\t-s : toggle using simulation [default = %s]\n", pPars->fUseSim? "yes": "no" ); Abc_Print( -2, "\t-p : toggle printing decompositions [default = %s]\n", pPars->fPrintDecs? "yes": "no" ); Abc_Print( -2, "\t-d : toggle printing delay profile statistics [default = %s]\n", pPars->fDelayVerbose? "yes": "no" ); Abc_Print( -2, "\t-l : toggle printing library usage statistics [default = %s]\n", pPars->fLibVerbose? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMfse( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkOptMfse( Abc_Ntk_t * pNtk, Acb_Par_t * pPars ); Abc_Ntk_t * pNtkNew, * pNtk = Abc_FrameReadNtk(pAbc); Acb_Par_t Pars, * pPars = &Pars; int c; Acb_ParSetDefault( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "IOWFLCadvwh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pPars->nTfiLevMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nTfiLevMax < 0 ) goto usage; break; case 'O': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-O\" should be followed by an integer.\n" ); goto usage; } pPars->nTfoLevMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nTfoLevMax < 0 ) goto usage; break; case 'W': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } pPars->nWinNodeMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nWinNodeMax < 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->nFanoutMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nFanoutMax < 0 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nGrowthLevel = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nGrowthLevel < -ABC_INFINITY || pPars->nGrowthLevel > ABC_INFINITY ) 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->nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nBTLimit < 0 ) goto usage; break; case 'a': pPars->fArea ^= 1; break; case 'd': pPars->fUseAshen ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'w': pPars->fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } pPars->nLutSize = Abc_NtkGetFaninMax( pNtk ); if ( pPars->nLutSize > 6 ) { Abc_Print( -1, "Command is only applicable to LUT size no more than 6.\n" ); return 1; } Abc_NtkToSop( pNtk, -1, ABC_INFINITY ); pNtkNew = Abc_NtkOptMfse( pNtk, pPars ); if ( pNtkNew == NULL ) { Abc_Print( -1, "Command \"mfse\" has failed.\n" ); return 1; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkNew ); return 0; usage: Abc_Print( -2, "usage: mfse [-IOWFLC ] [-advwh]\n" ); Abc_Print( -2, "\t performs don't-care-based optimization of logic networks\n" ); Abc_Print( -2, "\t-I : the number of levels in the TFI cone (2 <= num) [default = %d]\n", pPars->nTfiLevMax ); Abc_Print( -2, "\t-O : the number of levels in the TFO cone (0 <= num) [default = %d]\n", pPars->nTfoLevMax ); Abc_Print( -2, "\t-W : the max number of nodes in the window (1 <= num) [default = %d]\n", pPars->nWinNodeMax ); Abc_Print( -2, "\t-F : the max number of fanouts to skip (1 <= num) [default = %d]\n", pPars->nFanoutMax ); Abc_Print( -2, "\t-L : the max increase in node level after resynthesis (0 <= num) [default = %d]\n", pPars->nGrowthLevel ); Abc_Print( -2, "\t-C : the max number of conflicts in one SAT run (0 = no limit) [default = %d]\n", pPars->nBTLimit ); Abc_Print( -2, "\t-a : toggle minimizing area [default = %s]\n", pPars->fArea? "area": "delay" ); Abc_Print( -2, "\t-d : toggle using Ashenhurst decomposition [default = %s]\n", pPars->fUseAshen? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandLogicPush( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkOptPush( Abc_Ntk_t * pNtk, int nLutSize, int fVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtkRes; int nLutSize = 4; int fVerbose = 0; int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Kvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by a positive integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLutSize < 0 ) goto usage; 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_NtkIsLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } nLutSize = Abc_MaxInt( nLutSize, Abc_NtkGetFaninMax(pNtk) ); Abc_NtkToSop( pNtk, -1, ABC_INFINITY ); pNtkRes = Abc_NtkOptPush( pNtk, nLutSize, fVerbose ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: logicpush [-K num] [-vh]\n" ); Abc_Print( -2, "\t performs logic pushing to reduce structural bias\n" ); Abc_Print( -2, "\t-K : the LUT size used in the mapping [default = %d]\n", nLutSize ); 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_CommandTrace( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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 ); // 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } // modify the current network Abc_NtkDelayTracePrint( pNtk, fUseLutLib, 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_CommandGlitch( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int nPats = 4000; int Prob = 8; int fVerbose = 1; int c; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "NPvh" ) ) != EOF ) { switch ( c ) { case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nPats = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nPats < 1 ) goto usage; break; case 'P': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } Prob = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( Prob < 1 ) goto usage; 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_NtkIsLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a mapped logic network.\n" ); return 1; } if ( Abc_NtkIsMappedLogic(pNtk) || Abc_NtkGetFaninMax(pNtk) <= 6 ) Abc_Print( 1, "Glitching adds %7.2f %% of signal transitions, compared to switching.\n", Abc_NtkMfsTotalGlitching(pNtk, nPats, Prob, fVerbose) ); else printf( "Currently computes glitching only for K-LUT networks with K <= 6.\n" ); return 0; usage: Abc_Print( -2, "usage: glitch [-NP ] [-vh]\n" ); Abc_Print( -2, "\t comparing glitching activity to switching activity\n" ); Abc_Print( -2, "\t-N : the number of random patterns to use (0 < num < 1000000) [default = %d]\n", nPats ); Abc_Print( -2, "\t-P : once in how many cycles an input changes its value [default = %d]\n", Prob ); 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_CommandSpeedup( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c; int fUseLutLib; int Percentage; int Degree; 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); // 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } // modify the current network pNtkRes = Abc_NtkSpeedup( pNtk, fUseLutLib, Percentage, Degree, fVerbose, fVeryVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: speedup [-PN ] [-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 : delay delta defining critical path for library model [default = %d%%]\n", Percentage ); Abc_Print( -2, "\t-N : 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPowerdown( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c; int fUseLutLib; int Percentage; int Degree; int fVerbose; int fVeryVerbose; extern Abc_Ntk_t * Abc_NtkPowerdown( Abc_Ntk_t * pNtk, int fUseLutLib, int Percentage, int Degree, int fVerbose, int fVeryVerbose ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults fUseLutLib = 0; Percentage =10; 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } // modify the current network pNtkRes = Abc_NtkPowerdown( pNtk, fUseLutLib, Percentage, Degree, fVerbose, fVeryVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: powerdown [-PN ] [-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 : 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 : 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandAddBuffs( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkAddBuffs( Abc_Ntk_t * pNtk, int fDirect, int fReverse, int nImprove, int fVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtkRes; int fDirect; int fReverse; int nImprove; int c, fVerbose; fDirect = 0; fReverse = 0; nImprove = 1000; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Idrvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" ); goto usage; } nImprove = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nImprove < 0 ) goto usage; break; case 'd': fDirect ^= 1; break; case 'r': fReverse ^= 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_NtkIsLogic(pNtk) ) { Abc_Print( -1, "This command can only be applied to a logic network.\n" ); return 1; } // modify the current network pNtkRes = Abc_NtkAddBuffs( pNtk, fDirect, fReverse, nImprove, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: addbuffs [-I num] [-drvh]\n" ); Abc_Print( -2, "\t adds buffers to create balanced CI/CO paths\n" ); Abc_Print( -2, "\t-I : the number of refinement iterations [default = %d]\n", nImprove ); Abc_Print( -2, "\t-d : toggle using only CI-to-CO levelized order [default = %s]\n", fDirect? "yes": "no" ); Abc_Print( -2, "\t-r : toggle using only CO-to-C1 levelized order [default = %s]\n", fReverse? "yes": "no" ); 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; } //#if 0 /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMerge( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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 ); // set defaults memset( pPars, 0, sizeof(Nwk_LMPars_t) ); pPars->nMaxLutSize = 5; // the max LUT size for merging (N=5) pPars->nMaxSuppSize = 5; // the max total support size after merging (S=5) pPars->nMaxDistance = 3; // the max number of nodes separating LUTs pPars->nMaxLevelDiff = 2; // the max difference in levels pPars->nMaxFanout = 100; // the max number of fanouts to traverse pPars->fUseDiffSupp = 0; // enables the use of nodes with different support pPars->fUseTfiTfo = 0; // enables the use of TFO/TFO nodes as candidates pPars->fVeryVerbose = 0; // enables additional verbose output pPars->fVerbose = 1; // enables verbose output Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "NSDLFscvwh" ) ) != EOF ) { switch ( c ) { case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nMaxLutSize < 2 ) 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->nMaxSuppSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nMaxSuppSize < 2 ) goto usage; break; case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxDistance = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nMaxDistance < 2 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } pPars->nMaxLevelDiff = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nMaxLevelDiff < 2 ) 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->nMaxFanout = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nMaxFanout < 2 ) goto usage; break; case 's': pPars->fUseDiffSupp ^= 1; break; case 'c': pPars->fUseTfiTfo ^= 1; break; case 'w': pPars->fVeryVerbose ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL || !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "Abc_CommandMerge(): There is no mapped network to merge LUTs.\n" ); return 1; } vResult = Abc_NtkLutMerge( pNtk, pPars ); Vec_IntFree( vResult ); return 0; usage: Abc_Print( -2, "usage: merge [-NSDLF ] [-scwvh]\n" ); Abc_Print( -2, "\t creates pairs of topologically-related LUTs\n" ); Abc_Print( -2, "\t-N : the max LUT size for merging (1 < num) [default = %d]\n", pPars->nMaxLutSize ); Abc_Print( -2, "\t-S : the max total support size after merging (1 < num) [default = %d]\n", pPars->nMaxSuppSize ); Abc_Print( -2, "\t-D : the max distance in terms of LUTs (0 < num) [default = %d]\n", pPars->nMaxDistance ); Abc_Print( -2, "\t-L : the max difference in levels (0 <= num) [default = %d]\n", pPars->nMaxLevelDiff ); Abc_Print( -2, "\t-F : 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; } //#endif /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTestDec( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Abc_DecTest( char * pFileName, int DecType, int nVarNum, int fVerbose ); char * pFileName; int c; int fVerbose = 0; int DecType = 0; int nVarNum = -1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ANvh" ) ) != EOF ) { switch ( c ) { case 'A': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-A\" should be followed by an integer.\n" ); goto usage; } DecType = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( DecType < 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; } nVarNum = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nVarNum < 0 ) goto usage; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc != globalUtilOptind + 1 ) { Abc_Print( 1,"Input file is not given.\n" ); return 0; } if ( nVarNum >= 0 && nVarNum < 6 ) { Abc_Print( 1,"The number of variables cannot be less than 6.\n" ); return 0; } // get the output file name pFileName = argv[globalUtilOptind]; // call the testbench Abc_DecTest( pFileName, DecType, nVarNum, fVerbose ); return 0; usage: Abc_Print( -2, "usage: testdec [-AN ] [-vh] \n" ); Abc_Print( -2, "\t testbench for Boolean decomposition algorithms\n" ); Abc_Print( -2, "\t-A : decomposition algorithm [default = %d]\n", DecType ); Abc_Print( -2, "\t 0: none (reading and writing the file)\n" ); Abc_Print( -2, "\t 1: algebraic factoring applied to ISOP\n" ); Abc_Print( -2, "\t 2: bi-decomposition with cofactoring\n" ); Abc_Print( -2, "\t 3: disjoint-support decomposition with cofactoring\n" ); Abc_Print( -2, "\t 4: updated disjoint-support decomposition with cofactoring\n" ); Abc_Print( -2, "\t 5: enumerating decomposable variable sets\n" ); Abc_Print( -2, "\t 6: disjoint-support decomposition with cofactoring and boolean difference analysis\n" ); Abc_Print( -2, "\t from V. Callegaro, F. S. Marranghello, M. G. A. Martins, R. P. Ribas and A. I. Reis,\n"); Abc_Print( -2, "\t \"Bottom-up disjoint-support decomposition based on cofactor and boolean difference analysis,\" ICCD'15.\n" ); Abc_Print( -2, "\t-N : the number of support variables (binary files only) [default = unused]\n" ); 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 : a text file with truth tables in hexadecimal, listed one per line,\n"); Abc_Print( -2, "\t or a binary file with an array of truth tables (in this case,\n"); Abc_Print( -2, "\t -N is required to determine how many functions are stored)\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTestNpn( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Abc_NpnTest( char * pFileName, int NpnType, int nVarNum, int fDumpRes, int fBinary, int fVerbose ); char * pFileName; int c; int fVerbose = 0; int NpnType = 0; int nVarNum = -1; int fDumpRes = 0; int fBinary = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ANdbvh" ) ) != EOF ) { switch ( c ) { case 'A': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-A\" should be followed by an integer.\n" ); goto usage; } NpnType = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( NpnType < 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; } nVarNum = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nVarNum < 0 ) goto usage; break; case 'd': fDumpRes ^= 1; break; case 'b': fBinary ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc != globalUtilOptind + 1 ) { Abc_Print( 1,"Input file is not given.\n" ); return 0; } if ( nVarNum >= 0 && nVarNum < 6 ) { Abc_Print( 1,"The number of variables cannot be less than 6.\n" ); return 0; } // get the output file name pFileName = argv[globalUtilOptind]; // call the testbench Abc_NpnTest( pFileName, NpnType, nVarNum, fDumpRes, fBinary, fVerbose ); return 0; usage: Abc_Print( -2, "usage: testnpn [-AN ] [-dbvh] \n" ); Abc_Print( -2, "\t testbench for computing (semi-)canonical forms\n" ); Abc_Print( -2, "\t of completely-specified Boolean functions up to 16 variables\n" ); Abc_Print( -2, "\t-A : semi-caninical form computation algorithm [default = %d]\n", NpnType ); Abc_Print( -2, "\t 0: uniqifying truth tables\n" ); Abc_Print( -2, "\t 1: exact NPN canonical form by brute-force enumeration\n" ); Abc_Print( -2, "\t 2: semi-canonical form by counting 1s in cofactors\n" ); Abc_Print( -2, "\t 3: Jake's hybrid semi-canonical form (fast)\n" ); Abc_Print( -2, "\t 4: Jake's hybrid semi-canonical form (high-effort)\n" ); Abc_Print( -2, "\t 5: new fast hybrid semi-canonical form\n" ); Abc_Print( -2, "\t 6: new phase canonical form\n" ); Abc_Print( -2, "\t 7: new hierarchical matching\n" ); Abc_Print( -2, "\t 8: hierarchical matching by XueGong Zhou at Fudan University, Shanghai\n" ); Abc_Print( -2, "\t 9: adjustable algorithm (heuristic) by XueGong Zhou at Fudan University, Shanghai\n" ); Abc_Print( -2, "\t 10: adjustable algorithm (exact) by XueGong Zhou at Fudan University, Shanghai\n" ); Abc_Print( -2, "\t 11: new cost-aware exact algorithm by XueGong Zhou at Fudan University, Shanghai\n" ); Abc_Print( -2, "\t 12: new fast hybrid semi-canonical form (permutation only)\n" ); Abc_Print( -2, "\t-N : the number of support variables (binary files only) [default = unused]\n" ); Abc_Print( -2, "\t-d : toggle dumping resulting functions into a file [default = %s]\n", fDumpRes? "yes": "no" ); Abc_Print( -2, "\t-b : toggle dumping in binary format [default = %s]\n", fBinary? "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 : a text file with truth tables in hexadecimal, listed one per line,\n"); Abc_Print( -2, "\t or a binary file with an array of truth tables (in this case,\n"); Abc_Print( -2, "\t -N is required to determine how many functions are stored)\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTestRPO(Abc_Frame_t * pAbc, int argc, char ** argv) { extern int Abc_RpoTest(char * pFileName, int nVarNum, int nThreshold, int fVerbose); char * pFileName; int c; int nVarNum = -1; int fVerbose = 0; int nThreshold = -1; Extra_UtilGetoptReset(); while ((c = Extra_UtilGetopt(argc, argv, "TNvh")) != EOF) { switch (c) { case 'N': if (globalUtilOptind >= argc) { Abc_Print(-1, "Command line switch \"-N\" should be followed by an integer.\n"); goto usage; } nVarNum = atoi(argv[globalUtilOptind]); globalUtilOptind++; if (nVarNum < 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; } nThreshold = atoi(argv[globalUtilOptind]); globalUtilOptind++; if (nThreshold < 0) goto usage; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if (argc != globalUtilOptind + 1) { Abc_Print(1, "Input file is not given.\n"); goto usage; } // get the output file name pFileName = argv[globalUtilOptind]; // call the testbench Abc_RpoTest( pFileName, nVarNum, nThreshold, fVerbose ); return 0; usage: Abc_Print(-2, "usage: testrpo [-NT ] [-vh] \n"); Abc_Print(-2, "\t RPO algorithm developed and implemented by Mayler G. A. Martins,\n"); Abc_Print(-2, "\t Vinicius Callegaro, Renato P. Ribas and Andre' I. Reis\n"); Abc_Print(-2, "\t at Federal University of Rio Grande do Sul, Porto Alegre, Brazil\n"); Abc_Print(-2, "\t-N : the number of support variables (binary files only) [default = unused]\n"); Abc_Print(-2, "\t-T : the number of recursions accepted before abort [default = INFINITE]\n"); 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 : a text file with truth tables in hexadecimal, listed one per line,\n"); Abc_Print(-2, "\t or a binary file with an array of truth tables (in this case,\n"); Abc_Print(-2, "\t -N is required to determine how many functions are stored)\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTestTruth( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int * Kit_TruthTest( char * pFileName ); int * pResult = NULL; int c, fVerbose = 0; 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 ( argc != globalUtilOptind + 1 ) { Abc_Print( 1,"Input file is not given.\n" ); return 0; } pResult = Kit_TruthTest( argv[globalUtilOptind] ); ABC_FREE( pResult ); return 0; usage: Abc_Print( -2, "usage: testtruth [-vh] \n" ); Abc_Print( -2, "\t printing truth table stats\n" ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRunSat( Abc_Frame_t * pAbc, int argc, char ** argv ) { FILE * pFile = NULL; char * pFileCnf = NULL; int c, i, fWalk = 0, fKissat = 0, nIters = 10, fVerbose = 0; abctime clk; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Ikwvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIters < 0 ) goto usage; break; case 'k': fKissat ^= 1; break; case 'w': fWalk ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( fKissat + fWalk != 1 ) { printf( "Exactly one SAT solver should be selected.\n" ); return 1; } if ( argc != globalUtilOptind + 1 ) goto usage; pFileCnf = argv[globalUtilOptind]; pFile = fopen( pFileCnf, "rb" ); if ( pFile == NULL ) { printf( "The file \"%s\" cannot be found.\n", pFileCnf ); return 1; } fclose( pFile ); clk = Abc_Clock(); for ( i = 0; i < nIters; i++ ) { char pCommand[1000]; if ( fKissat ) sprintf( pCommand, "kissat -q --seed=%d %s", i, pFileCnf ); else if ( fWalk ) sprintf( pCommand, "walk -s%d %s", i, pFileCnf ); #if defined(__wasm) if (1) { #else if (system(pCommand) == -1) { #endif fprintf(stdout, "Command \"%s\" did not succeed.\n", pCommand); return 0; } } printf( "Performed %d iterations of SAT solving. ", nIters ); Abc_PrintTime( 1, "Time", Abc_Clock() - clk ); return 0; usage: Abc_Print( -2, "usage: runsat [-I num] [-kwvh] \n" ); Abc_Print( -2, "\t performs randomized iterations of SAT solving\n" ); Abc_Print( -2, "\t-I num : the number of iterations [default = %d]\n", nIters ); Abc_Print( -2, "\t-k : toggle using Kissat (binary name \"kissat\") [default = %s]\n", fKissat? "yes": "no" ); Abc_Print( -2, "\t-w : toggle using WalkSat (binary name \"walk\") [default = %s]\n", fWalk? "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_CommandRunEco( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Acb_NtkRunEco( char * pFileNames[4], int nTimeout, int fCheck, int fRandom, int fInputs, int fUnitW, int fVerbose, int fVeryVerbose ); char * pFileNames[4] = {NULL}; int c, nTimeout = 0, fCheck = 0, fRandom = 0, fInputs = 0, fUnitW = 0, fVerbose = 0, fVeryVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Tcriuvwh" ) ) != EOF ) { switch ( c ) { case 'T': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-T\" should be followed by an integer.\n" ); goto usage; } nTimeout = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nTimeout < 0 ) goto usage; break; case 'c': fCheck ^= 1; break; case 'r': fRandom ^= 1; break; case 'i': fInputs ^= 1; break; case 'u': fUnitW ^= 1; break; case 'v': fVerbose ^= 1; break; case 'w': fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } // pArgvNew = argv + globalUtilOptind; // nArgcNew = argc - globalUtilOptind; if ( argc - globalUtilOptind < 2 || argc - globalUtilOptind > 3 ) { Abc_Print( 1, "Expecting three file names on the command line.\n" ); goto usage; } for ( c = 0; c < argc - globalUtilOptind; c++ ) { FILE * pFile = fopen( argv[globalUtilOptind+c], "rb" ); if ( pFile == NULL ) { printf( "Cannot open input file \"%s\".\n", argv[globalUtilOptind+c] ); return 0; } else fclose( pFile ); pFileNames[c] = argv[globalUtilOptind+c]; } Acb_NtkRunEco( pFileNames, nTimeout, fCheck, fRandom, fInputs, fUnitW, fVerbose, fVeryVerbose ); return 0; usage: Abc_Print( -2, "usage: runeco [-T num] [-criuvwh] \n" ); Abc_Print( -2, "\t performs computation of patch functions during ECO,\n" ); Abc_Print( -2, "\t as described in the following paper: A. Q. Dao et al\n" ); Abc_Print( -2, "\t \"Efficient computation of ECO patch functions\", Proc. DAC\'18\n" ); Abc_Print( -2, "\t https://people.eecs.berkeley.edu/~alanmi/publications/2018/dac18_eco.pdf\n" ); Abc_Print( -2, "\t (currently only applicable to benchmarks from 2017 ICCAD CAD competition\n" ); Abc_Print( -2, "\t http://cad-contest-2017.el.cycu.edu.tw/Problem_A/default.html as follows:\n" ); Abc_Print( -2, "\t \"runeco unit1/F.v unit1/G.v unit1/weight.txt; cec -n out.v unit1/G.v\")\n" ); Abc_Print( -2, "\t-T num : the timeout in seconds [default = %d]\n", nTimeout ); Abc_Print( -2, "\t-c : toggle checking that the problem has a solution [default = %s]\n", fCheck? "yes": "no" ); Abc_Print( -2, "\t-r : toggle using random permutation of support variables [default = %s]\n", fRandom? "yes": "no" ); Abc_Print( -2, "\t-i : toggle using primary inputs as support variables [default = %s]\n", fInputs? "yes": "no" ); Abc_Print( -2, "\t-u : toggle using unit weights [default = %s]\n", fUnitW? "yes": "no" ); Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-w : toggle printing more verbose information [default = %s]\n", fVeryVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRunGen( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Acb_NtkRunGen( int nInputs, int nMints, int nFuncs, int Seed, int fVerbose, char * pScript ); int c, nInputs = 10, nMints = 10, nFuncs = 10, Seed = 0, fVerbose = 0; char * pScript = NULL; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "IMRSCvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nInputs = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } nMints = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; case 'R': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } nFuncs = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; case 'S': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } Seed = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by a script.\n" ); goto usage; } pScript = argv[globalUtilOptind]; globalUtilOptind++; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pScript == NULL ) { Abc_Print( -1, "Command line switch \"-C\" should be specified and followed by a string.\n" ); goto usage; } Acb_NtkRunGen( nInputs, nMints, nFuncs, Seed, fVerbose, pScript ); return 0; usage: Abc_Print( -2, "usage: rungen [-IMRS num] [-C script] [-vh]\n" ); Abc_Print( -2, "\t running the script on a set of randomly generated functions\n" ); Abc_Print( -2, "\t-I : the number of input variables [default = %d]\n", nInputs ); Abc_Print( -2, "\t-M : the number of positive minterms in the random function [default = %d]\n", nMints ); Abc_Print( -2, "\t-R : the number of random functions to try [default = %d]\n", nFuncs ); Abc_Print( -2, "\t-S : the random seed [default = %d]\n", Seed ); Abc_Print( -2, "\t-C : the script to apply [default = provided by the user]\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_CommandRunTest( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Acb_NtkRunTest( char * pFileNames[4], int fFancy, int fVerbose ); char * pFileNames[4] = {NULL}; int c, fFancy = 0, fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "fvh" ) ) != EOF ) { switch ( c ) { case 'f': fFancy ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc - globalUtilOptind < 2 || argc - globalUtilOptind > 5 ) { Abc_Print( 1, "Expecting two or three file names on the command line.\n" ); goto usage; } for ( c = 0; c < argc - globalUtilOptind; c++ ) pFileNames[c] = argv[globalUtilOptind+c]; Acb_NtkRunTest( pFileNames, fFancy, fVerbose ); return 0; usage: Abc_Print( -2, "usage: xec [-fvh] \n" ); Abc_Print( -2, "\t combinational equivalence checking with x-values\n" ); Abc_Print( -2, "\t-f : toggle using experimental feature [default = %s]\n", fFancy? "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 [Orchestration synthesis] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandOrchestrate( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pDup; int c, RetValue; int nNodeSizeMax; int nConeSizeMax; int fUpdateLevel; int fUseZeros_rwr; int fUseZeros_ref; int fUseDcs; int RS_CUT_MIN = 4;//rs option int RS_CUT_MAX = 16;//rs option int nCutsMax; //rs option int nNodesMax; //rs option int nLevelsOdc; //rs option int fPrecompute; //rewrite option (not enabled) int fPlaceEnable; //rewrite option (not enabled) int fVerbose; //rewrite/rs/rf verbose int fVeryVerbose; //very verbose option for all //size_t NtkSize; extern void Rwr_Precompute(); //local greedy extern int Abc_NtkOrchLocal( Abc_Ntk_t * pNtk, int fUseZeros_rwr, int fUseZeros_ref, int fPlaceEnable, int nCutsMax, int nNodesMax, int nLevelsOdc, int fUpdateLevel, int fVerbose, int fVeryVerbose, int nNodeSizeMax, int nConeSizeMax, int fUseDcs ); //priority orch extern int Abc_NtkOchestration( Abc_Ntk_t * pNtk, Vec_Int_t **pGain_rwr, Vec_Int_t **pGain_res,Vec_Int_t **pGain_ref, int sOpsOrder, int fUseZeros_rwr, int fUseZeros_ref, int fPlaceEnable, int nCutsMax, int nNodesMax, int nLevelsOdc, int fUpdateLevel, int fVerbose, int fVeryVerbose, int nNodeSizeMax, int nConeSizeMax, int fUseDcs ); // set defaults nNodeSizeMax = 10; nConeSizeMax = 16; fUpdateLevel = 1; fUseZeros_rwr = 1; fUseZeros_ref = 1; fUseDcs = 0; fVerbose = 0; fVeryVerbose = 0; fPlaceEnable = 0; fPrecompute = 0; nCutsMax = 8; nNodesMax = 1; nLevelsOdc = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "KNFZzlvwh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nCutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCutsMax < 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; } nNodesMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nNodesMax < 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; } nLevelsOdc = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLevelsOdc < 0 ) goto usage; break; case 'l': fUpdateLevel ^= 1; break; case 'z': fUseZeros_rwr ^= 1; break; case 'Z': fUseZeros_ref ^= 1; break; case 'v': fVerbose ^= 1; break; case 'w': fVeryVerbose ^= 1; break; case 'h': goto usage; break; } } if ( fPrecompute ) { Rwr_Precompute(); return 0; } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( nCutsMax < RS_CUT_MIN || nCutsMax > RS_CUT_MAX ) { Abc_Print( -1, "Can only compute cuts for %d <= K <= %d.\n", RS_CUT_MIN, RS_CUT_MAX ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { Abc_Print( -1, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); return 1; } if ( nNodeSizeMax > 15 ) { Abc_Print( -1, "The cone size cannot exceed 15.\n" ); return 1; } if ( fUseDcs && nNodeSizeMax >= nConeSizeMax ) { Abc_Print( -1, "For don't-care to work, containing cone should be larger than collapsed node.\n" ); return 1; } // modify the current network pDup = Abc_NtkDup( pNtk ); RetValue = Abc_NtkOrchLocal( pNtk, fUseZeros_rwr, fUseZeros_ref, fPlaceEnable, nCutsMax, nNodesMax, nLevelsOdc, fUpdateLevel, fVerbose, fVeryVerbose, nNodeSizeMax, nConeSizeMax, fUseDcs ); if ( RetValue == -1 ) { Abc_FrameReplaceCurrentNetwork( pAbc, pDup ); printf( "An error occurred during computation. The original network is restored.\n" ); } else { Abc_NtkDelete( pDup ); if ( RetValue == 0 ) { Abc_Print( 0, "Ochestration (local greedy) has failed.\n" ); return 1; } } return 0; usage: Abc_Print( -2, "usage: orchestrate [-KNFZzlvwh]\n" ); Abc_Print( -2, "\t performs technology-independent AIG synthesis using orchestration method (currently orchestrating rw/rf/rs)\n" ); Abc_Print( -2, "\t-K : (resub)the max cut size (%d <= num <= %d) [default = %d]\n", RS_CUT_MIN, RS_CUT_MAX, nCutsMax ); Abc_Print( -2, "\t-N : (resub)the max number of nodes to add (0 <= num <= 3) [default = %d]\n", nNodesMax ); Abc_Print( -2, "\t-F : (resub)the number of fanout levels for ODC computation [default = %d]\n", nLevelsOdc ); Abc_Print( -2, "\t-l : (resub/rw/refactor)toggle preserving the number of levels [default = %s]\n", fUpdateLevel? "yes": "no" ); Abc_Print( -2, "\t-z : (rw)toggle using zero-cost replacements [default = %s]\n", fUseZeros_rwr? "yes": "no" ); Abc_Print( -2, "\t-Z : (refactor)toggle using zero-cost replacements [default = %s]\n", fUseZeros_ref? "yes": "no" ); Abc_Print( -2, "\t-v : (resub/rw/refactor)toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-w : (resub/rw/refactor)toggle detailed verbose printout [default = %s]\n", fVeryVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [AIG RTL Augmentation] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandAIGAugmentation( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pDup; int c, RetValue; int nNodeSizeMax; int nConeSizeMax; int fUpdateLevel; int fUseZeros_rwr; int fUseZeros_ref; int fUseDcs; int fVerbose; int RS_CUT_MIN = 4; int RS_CUT_MAX = 16; int fPrecompute; int fPlaceEnable; int nNodesMax; int nCutsMax; int nLevelsOdc; int fVeryVerbose; int Rand_Seed; //int sOpsOrder; size_t NtkSize; char *DecisionFile = NULL; Vec_Int_t *DecisionMask; Vec_Int_t *pGain_rwr; Vec_Int_t *pGain_res; Vec_Int_t *pGain_ref; //FILE *maskFile; extern void Rwr_Precompute(); extern int Abc_NtkOrchRand( Abc_Ntk_t * pNtk, Vec_Int_t **pGain_rwr, Vec_Int_t **pGain_res,Vec_Int_t **pGain_ref, Vec_Int_t **DecisionMask, char *DecisionFile, int Rand_Seed, int fUseZeros_rwr, int fUseZeros_ref, int fPlaceEnable, int nCutsMax, int nNodesMax, int nLevelsOdc, int fUpdateLevel, int fVerbose, int fVeryVerbose, int nNodeSizeMax, int nConeSizeMax, int fUseDcs ); // set defaults nNodeSizeMax = 10; nConeSizeMax = 16; fUpdateLevel = 1; fUseZeros_rwr = 0; fUseZeros_ref = 0; fUseDcs = 0; fVerbose = 0; fVeryVerbose = 0; fPlaceEnable = 0; fPrecompute = 0; nCutsMax = 8; nNodesMax = 1; nLevelsOdc = 0; Rand_Seed = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "zZdsh" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; break; case 'z': fUseZeros_rwr ^= 1; break; case 'Z': fUseZeros_ref ^= 1; break; case 'd': if ( globalUtilOptind >= argc ) { goto usage; } DecisionFile = argv[globalUtilOptind]; globalUtilOptind++; break; case 's': if ( globalUtilOptind >= argc ) { goto usage; } Rand_Seed = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; } } if ( fPrecompute ) { Rwr_Precompute(); return 0; } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( nCutsMax < RS_CUT_MIN || nCutsMax > RS_CUT_MAX ) { Abc_Print( -1, "Can only compute cuts for %d <= K <= %d.\n", RS_CUT_MIN, RS_CUT_MAX ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { Abc_Print( -1, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); return 1; } if ( nNodeSizeMax > 15 ) { Abc_Print( -1, "The cone size cannot exceed 15.\n" ); return 1; } if ( fUseDcs && nNodeSizeMax >= nConeSizeMax ) { Abc_Print( -1, "For don't-care to work, containing cone should be larger than collapsed node.\n" ); return 1; } NtkSize = Abc_NtkObjNumMax(pNtk); DecisionMask = Vec_IntAlloc(1); for (int i=0; inSize, DecisionList->pArray[0]); if ( RetValue == -1 ) { Abc_FrameReplaceCurrentNetwork( pAbc, pDup ); printf( "An error occurred during computation. The original network is restored.\n" ); } else { Abc_NtkDelete( pDup ); if ( RetValue == 0 ) { Abc_Print( 0, "Orchestration evaluation for RL has failed.\n" ); return 1; } } // Vec_IntPrint(pGain_rwr); return 0; usage: Abc_Print( -2, "usage: aigaug [-s ] [-d ][-zZdsh]\n" ); Abc_Print( -2, "\t performs technology-independent AIG random synthesis (node level) for RTL augmentation\n" ); Abc_Print( -2, "\t-z : toggle using zero-cost replacements for rwr for aigaug [default = %s]\n", fUseZeros_rwr? "yes": "no" ); Abc_Print( -2, "\t-Z : toggle using zero-cost replacements for ref for aigaug [default = %s]\n", fUseZeros_ref? "yes": "no" ); Abc_Print( -2, "\t-d : record random synthesis decision made during augmentation [required filename; e.g., test.csv]\n"); Abc_Print( -2, "\t-s : set the random seed for random augmentation\n"); 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, "\tExample : read i10.aig;st;aigaug -s 1 -d test.csv;write i10_arg_1.aig;cec i10.aig i10_arg_1.aig\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pDup; int c, RetValue; int fUpdateLevel; int fPrecompute; int fUseZeros; int fVerbose; int fVeryVerbose; int fPlaceEnable; // external functions extern void Rwr_Precompute(); // set defaults fUpdateLevel = 1; fPrecompute = 0; fUseZeros = 0; fVerbose = 0; fVeryVerbose = 0; fPlaceEnable = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "lxzvwh" ) ) != EOF ) { switch ( c ) { case 'l': fUpdateLevel ^= 1; break; case 'x': fPrecompute ^= 1; break; case 'z': fUseZeros ^= 1; break; case 'v': fVerbose ^= 1; break; case 'w': fVeryVerbose ^= 1; break; case 'p': fPlaceEnable ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( fPrecompute ) { Rwr_Precompute(); return 0; } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { Abc_Print( -1, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); return 1; } // modify the current network pDup = Abc_NtkDup( pNtk ); RetValue = Abc_NtkRewrite( pNtk, fUpdateLevel, fUseZeros, fVerbose, fVeryVerbose, fPlaceEnable ); if ( RetValue == -1 ) { Abc_FrameReplaceCurrentNetwork( pAbc, pDup ); printf( "An error occurred during computation. The original network is restored.\n" ); } else { Abc_NtkDelete( pDup ); if ( RetValue == 0 ) { Abc_Print( 0, "Rewriting has failed.\n" ); return 1; } } return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pDup; int c, RetValue; int nNodeSizeMax; int nMinSaved; int nConeSizeMax; int fUpdateLevel; int fUseZeros; int fUseDcs; int fVerbose; extern int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nMinSaved, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose ); // set defaults nNodeSizeMax = 10; nMinSaved = 1; nConeSizeMax = 16; fUpdateLevel = 1; fUseZeros = 0; fUseDcs = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "NMClzvh" ) ) != EOF ) { switch ( c ) { case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nNodeSizeMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nNodeSizeMax < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } nMinSaved = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nMinSaved < 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; } nConeSizeMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nConeSizeMax < 0 ) goto usage; break; case 'l': fUpdateLevel ^= 1; break; case 'z': fUseZeros ^= 1; break; case 'd': fUseDcs ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( fUseZeros ) nMinSaved = 0; if ( nMinSaved == 0 ) fUseZeros = 1; if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { Abc_Print( -1, "AIG resynthesis cannot be applied to AIGs with choice nodes.\n" ); return 1; } if ( nNodeSizeMax > 15 ) { Abc_Print( -1, "The cone size cannot exceed 15.\n" ); return 1; } if ( fUseDcs && nNodeSizeMax >= nConeSizeMax ) { Abc_Print( -1, "For don't-care to work, containing cone should be larger than collapsed node.\n" ); return 1; } // modify the current network pDup = Abc_NtkDup( pNtk ); RetValue = Abc_NtkRefactor( pNtk, nNodeSizeMax, nMinSaved, nConeSizeMax, fUpdateLevel, fUseZeros, fUseDcs, fVerbose ); if ( RetValue == -1 ) { Abc_FrameReplaceCurrentNetwork( pAbc, pDup ); printf( "An error occurred during computation. The original network is restored.\n" ); } else { Abc_NtkDelete( pDup ); if ( RetValue == 0 ) { Abc_Print( 0, "Refactoring has failed.\n" ); return 1; } } return 0; usage: Abc_Print( -2, "usage: refactor [-NM ] [-lzvh]\n" ); Abc_Print( -2, "\t performs technology-independent refactoring of the AIG\n" ); Abc_Print( -2, "\t-N : the max support of the collapsed node [default = %d]\n", nNodeSizeMax ); Abc_Print( -2, "\t-M : the min number of nodes saved after one step (0 <= num) [default = %d]\n", nMinSaved ); // Abc_Print( -2, "\t-C : 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRestructure( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nCutsMax; 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; fUpdateLevel = 0; fUseZeros = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Klzvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nCutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCutsMax < 0 ) goto usage; break; case 'l': fUpdateLevel ^= 1; break; case 'z': fUseZeros ^= 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 ( nCutsMax < 4 || nCutsMax > 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) ) { Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { 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 ) ) { Abc_Print( -1, "Refactoring has failed.\n" ); return 1; } return 0; usage: Abc_Print( -2, "usage: restructure [-K ] [-lzvh]\n" ); Abc_Print( -2, "\t performs technology-independent restructuring of the AIG\n" ); Abc_Print( -2, "\t-K : 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandResubstitute( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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; int nMinSaved; int fUpdateLevel; int fUseZeros; int fVerbose; int fVeryVerbose; extern int Abc_NtkResubstitute( Abc_Ntk_t * pNtk, int nCutsMax, int nNodesMax, int nMinSaved, int nLevelsOdc, int fUpdateLevel, int fVerbose, int fVeryVerbose ); // set defaults nCutsMax = 8; nNodesMax = 1; nLevelsOdc = 0; nMinSaved = 1; fUpdateLevel = 1; fUseZeros = 0; fVerbose = 0; fVeryVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "KNMFlzvwh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nCutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCutsMax < 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; } nNodesMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nNodesMax < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } nMinSaved = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nMinSaved < 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; } nLevelsOdc = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLevelsOdc < 0 ) goto usage; break; case 'l': fUpdateLevel ^= 1; break; case 'z': fUseZeros ^= 1; break; case 'v': fVerbose ^= 1; break; case 'w': fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( fUseZeros ) nMinSaved = 0; if ( nMinSaved == 0 ) fUseZeros = 1; if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( nCutsMax < RS_CUT_MIN || nCutsMax > 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 ) { Abc_Print( -1, "Can only resubstitute at most 3 nodes.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { 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, nMinSaved, nLevelsOdc, fUpdateLevel, fVerbose, fVeryVerbose ) ) { Abc_Print( -1, "Refactoring has failed.\n" ); return 1; } return 0; usage: Abc_Print( -2, "usage: resub [-KNMF ] [-lzvwh]\n" ); Abc_Print( -2, "\t performs technology-independent restructuring of the AIG\n" ); Abc_Print( -2, "\t-K : the max cut size (%d <= num <= %d) [default = %d]\n", RS_CUT_MIN, RS_CUT_MAX, nCutsMax ); Abc_Print( -2, "\t-N : the max number of nodes to add (0 <= num <= 3) [default = %d]\n", nNodesMax ); Abc_Print( -2, "\t-M : the min number of nodes saved after one step (0 <= num) [default = %d]\n", nMinSaved ); Abc_Print( -2, "\t-F : 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandResubUnate( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Gia_Man_t * Gia_ManResubUnateOne( char * pFileName, int nLimit, int nDivMax, int fWriteSol, int fVerbose ); Gia_Man_t * pTemp; int nLimit = 16; int nDivMax = 50; int fWriteSol = 0; int fVerbose = 0, c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "LDsvh" ) ) != EOF ) { switch ( c ) { case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLimit < 0 ) goto usage; break; case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } nDivMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nDivMax < 0 ) goto usage; break; case 's': fWriteSol ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc != globalUtilOptind + 1 ) { Abc_Print( -1, "Input file should be given on the command line.\n" ); return 1; } pTemp = Gia_ManResubUnateOne( argv[globalUtilOptind], nLimit, nDivMax, fWriteSol, fVerbose ); if ( pTemp ) { Aig_Man_t * pMan = Gia_ManToAig( pTemp, 0 ); Abc_Ntk_t * pNtk = Abc_NtkFromAigPhase( pMan ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtk ); Aig_ManStop( pMan ); Gia_ManStop( pTemp ); return 0; } Abc_Print( 0, "The networks is not generated.\n" ); return 0; usage: Abc_Print( -2, "usage: resub_unate [-LD ] [-svh] \n" ); Abc_Print( -2, "\t solves one instance of the resub problem\n" ); Abc_Print( -2, "\t-L num : the limit on the number of nodes [default = %d]\n", nLimit ); Abc_Print( -2, "\t-D num : the maximum number of binate divisors to consider [default = %d]\n", nDivMax ); Abc_Print( -2, "\t-s : toggle saving the result in the input file [default = %s]\n", fWriteSol? "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 : resub problem file name\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandResubCore( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Gia_Man_t * Supp_ManSolveOne( char * pFileName, int nIters, int nRounds, int fWriteSol, int fVerbose ); Gia_Man_t * pTemp; int nIters = 1; int nRounds = 1; int fWriteSol = 0; int fVerbose = 0, c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "IRsvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIters < 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 's': fWriteSol ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc != globalUtilOptind + 1 ) { Abc_Print( -1, "Input file should be given on the command line.\n" ); return 1; } pTemp = Supp_ManSolveOne( argv[globalUtilOptind], nIters, nRounds, fWriteSol, fVerbose ); if ( pTemp ) { Aig_Man_t * pMan = Gia_ManToAig( pTemp, 0 ); Abc_Ntk_t * pNtk = Abc_NtkFromAigPhase( pMan ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtk ); Aig_ManStop( pMan ); Gia_ManStop( pTemp ); return 0; } Abc_Print( 0, "The networks is not generated.\n" ); return 0; usage: Abc_Print( -2, "usage: resub_core [-IR ] [-svh] \n" ); Abc_Print( -2, "\t solves one instance of the resub problem\n" ); Abc_Print( -2, "\t-I num : the number of iterations [default = %d]\n", nIters ); Abc_Print( -2, "\t-R num : the number of rounds in each iteration [default = %d]\n", nRounds ); Abc_Print( -2, "\t-s : toggle saving the result in the input file [default = %s]\n", fWriteSol? "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 : resub problem file name\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandResubCheck( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Res6_ManResubCheck( char * pFileNameRes, char * pFileNameSol, int fVerbose ); extern void Res6_ManResubCheckPla( char * pFileName, int fVerbose ); char * pFileR = NULL, * pFileS = NULL; int fVerbose = 0, c; 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 ( argc == globalUtilOptind + 2 ) { pFileR = argv[globalUtilOptind]; pFileS = argv[globalUtilOptind+1]; } else if ( argc == globalUtilOptind + 1 ) { pFileR = argv[globalUtilOptind]; pFileS = NULL; } else { Abc_Print( -1, "Incorrect number of command line arguments.\n" ); return 1; } if ( !strcmp(pFileR + strlen(pFileR) - 3, "pla") ) Res6_ManResubCheckPla( pFileR, fVerbose ); else Res6_ManResubCheck( pFileR, pFileS, fVerbose ); return 0; usage: Abc_Print( -2, "usage: resub_check [-vh] \n" ); Abc_Print( -2, "\t checks solution to a resub problem\n" ); Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t : resub problem file name\n"); Abc_Print( -2, "\t : (optional) solution file name\n"); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRr( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c, Window; int nFaninLevels; int nFanoutLevels; int fUseFanouts; int fVerbose; extern int Abc_NtkRR( Abc_Ntk_t * pNtk, int nFaninLevels, int nFanoutLevels, int fUseFanouts, int fVerbose ); // set defaults nFaninLevels = 3; nFanoutLevels = 3; fUseFanouts = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Wfvh" ) ) != EOF ) { switch ( c ) { case 'W': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } Window = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( Window < 0 ) goto usage; nFaninLevels = Window / 10; nFanoutLevels = Window % 10; break; case 'f': fUseFanouts ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } printf( "This command is obsolete." ); printf( "To perform pure redudancy removal, try \"mfs -r\".\n" ); printf( "To perform something a little stronger try \"mfs2\"\n" ); printf( "When working with an AIG, use \"logic\" before and \"strash\" after this command.\n" ); return 0; if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command can only be applied to an AIG (run \"strash\").\n" ); return 1; } if ( Abc_NtkGetChoiceNum(pNtk) ) { 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 ) ) { Abc_Print( -1, "Redundancy removal has failed.\n" ); return 1; } return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandCascade( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults nLutSize = 12; fCheck = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Kcvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLutSize < 0 ) goto usage; break; case 'c': fCheck ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty neAtwork.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Can only collapse a logic network or an AIG.\n" ); return 1; } // get the new network if ( Abc_NtkIsStrash(pNtk) ) pNtkRes = Abc_NtkCascade( pNtk, nLutSize, fCheck, fVerbose ); else { pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); pNtkRes = Abc_NtkCascade( pNtk, nLutSize, fCheck, fVerbose ); Abc_NtkDelete( pNtk ); } if ( pNtkRes == NULL ) { Abc_Print( -1, "Cascade synthesis has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: cascade [-K ] [-cvh]\n" ); Abc_Print( -2, "\t performs LUT cascade synthesis for the current network\n" ); Abc_Print( -2, "\t-K : 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"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandLutCasDec( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkLutCascadeGen( int nLutSize, int nStages, int nRails, int nShared, int fVerbose ); extern Abc_Ntk_t * Abc_NtkLutCascade2( Abc_Ntk_t * pNtk, int nLutSize, int nLuts, int nRails, int nIters, int fVerbose, char * pGuide ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtkRes; char * pGuide = NULL; int c, nLutSize = 6, nStages = 8, nRails = 1, nShared = 2, nIters = 1, fGen = 0, fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "KMRSIgvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLutSize < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } nStages = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nStages < 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; } nRails = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nRails < 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; } nShared = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nShared < 0 ) goto usage; break; case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIters < 0 ) goto usage; break; case 'g': fGen ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( fGen ) { pNtkRes = Abc_NtkLutCascadeGen( nLutSize, nStages, nRails, nShared, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "LUT cascade generation failed.\n" ); return 1; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkCoNum(pNtk) != 1 ) { Abc_Print( -1, "This command is currently applicable only to single-output networks.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Run command \"strash\" to convert the network into an AIG.\n" ); return 1; } if ( Abc_NtkCiNum(pNtk) > nLutSize + (nLutSize - nRails) * (nStages - 1) ) { Abc_Print( -1, "Cannot decompose %d-input function into a %d-rail cascade of %d %d-LUTs (max suppose size = %d).\n", Abc_NtkCiNum(pNtk), nRails, nStages, nLutSize, nLutSize + (nLutSize - nRails) * (nStages - 1) ); return 1; } if ( argc == globalUtilOptind + 1 ) pGuide = argv[globalUtilOptind]; pNtkRes = Abc_NtkLutCascade2( pNtk, nLutSize, nStages, nRails, nIters, fVerbose, pGuide ); if ( pNtkRes == NULL ) { Abc_Print( -1, "LUT cascade mapping failed.\n" ); return 1; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: lutcasdec [-KMRSI ] [-vh]\n" ); Abc_Print( -2, "\t decomposes the primary output functions into LUT cascades\n" ); Abc_Print( -2, "\t-K : the number of LUT inputs [default = %d]\n", nLutSize ); Abc_Print( -2, "\t-M : the maximum delay (the number of stages) [default = %d]\n", nStages ); Abc_Print( -2, "\t-R : the number of direct connections (rails) [default = %d]\n", nRails ); Abc_Print( -2, "\t-S : the number of shared variables in each stage [default = %d]\n", nShared ); Abc_Print( -2, "\t-I : the number of iterations when looking for a solution [default = %d]\n", nIters ); Abc_Print( -2, "\t-g : toggle generating random cascade with these parameters [default = %s]\n", fGen? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandLutCas( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkLutCascadeMap( Abc_Ntk_t * pNtk, int nLutsMax, int nIters, int fDelayLut, int fDelayRoute, int fDelayDirect, int fVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtkRes; int c, nLutSize = 6, nLutsMax = 8, nIters = 1000, Seed = 0, fVerbose = 0; int fDelayLut = 10, fDelayRoute = 30, fDelayDirect = 3; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "KMISLWDfvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLutSize < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } nLutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLutsMax < 0 ) goto usage; break; case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIters < 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; } Seed = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( Seed < 0 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } fDelayLut = atof(argv[globalUtilOptind]); globalUtilOptind++; if ( fDelayLut < 0 ) goto usage; break; case 'W': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } fDelayRoute = atof(argv[globalUtilOptind]); globalUtilOptind++; if ( fDelayRoute < 0 ) goto usage; break; case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } fDelayDirect = atof(argv[globalUtilOptind]); globalUtilOptind++; if ( fDelayDirect < 0 ) goto usage; 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_NtkIsLogic(pNtk) ) { Abc_Print( -1, "Run command \"if\" or any other LUT mapper to map the current network into LUTs.\n" ); return 1; } if ( Abc_NtkGetFaninMax(pNtk) > nLutSize ) { Abc_Print( -1, "The current network contains nodes with fanin count (%d) exceeding the LUT size (%d).\n", Abc_NtkGetFaninMax(pNtk), nLutSize ); return 1; } srand( Seed ); pNtkRes = Abc_NtkLutCascadeMap( pNtk, nLutsMax, nIters, fDelayLut, fDelayRoute, fDelayDirect, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "LUT cascade mapping failed.\n" ); return 1; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: lutcas [-KMISLWD ] [-vh]\n" ); Abc_Print( -2, "\t decomposes the current network into LUT cascades\n" ); Abc_Print( -2, "\t-K : the number of LUT inputs [default = %d]\n", nLutSize ); Abc_Print( -2, "\t-M : the maximum number of LUTs in the cascade [default = %d]\n", nLutsMax ); Abc_Print( -2, "\t-I : the number of iterations when looking for a solution [default = %d]\n", nIters ); Abc_Print( -2, "\t-S : the random seed used to randimize solutions [default = %d]\n", Seed ); Abc_Print( -2, "\t-L : the intrinsic LUT delay [default = %d]\n", fDelayLut ); Abc_Print( -2, "\t-W : the routable wire delay [default = %d]\n", fDelayRoute ); Abc_Print( -2, "\t-D : the non-routable wire delay [default = %d]\n", fDelayDirect ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandBsEval( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_BSEvalOneTest( word * pT, int nVars, int nBVars, int fVerbose ); extern void Abc_BSEvalBestTest( word * pIn, int nVars, int nBVars, int fShared, int fVerbose ); extern void Abc_BSEvalBestGen( int nVars, int nBVars, int nFuncs, int nMints, int fTryAll, int fShared, int fVerbose ); int c, nVars = 0, nBVars = 0, nSVars = 0, nFuncs = 0, nMints = 0, fTryAll = 0, fVerbose = 0; char * pTtStr = NULL; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "IBSRMavh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nVars = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nVars < 2 || nVars > 16 ) goto usage; break; case 'B': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" ); goto usage; } nBVars = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nBVars < 1 || nBVars > 16 ) goto usage; break; case 'S': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } nSVars = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nSVars < 0 || nSVars > 16 ) goto usage; break; case 'R': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } nFuncs = atoi(argv[globalUtilOptind]); if ( nFuncs < 1 ) goto usage; globalUtilOptind++; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } nMints = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; case 'a': fTryAll ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc == globalUtilOptind + 1 ) pTtStr = argv[globalUtilOptind]; if ( pTtStr ) { nVars = Abc_Base2Log((int)strlen(pTtStr)) + 2; if ( (1 << (nVars-2)) != (int)strlen(pTtStr) ) { Abc_Print( -1, "Truth table is expected to have %d hex digits (instead of %d).\n", (1 << (nVars-2)), strlen(pTtStr) ); return 1; } } if ( nVars == 0 ) { Abc_Print( -1, "The number of variables should be specified on the command line.\n" ); return 1; } if ( nBVars == 0 ) { Abc_Print( -1, "The bound set size should be specified on the command line.\n" ); return 1; } if ( nFuncs ) Abc_BSEvalBestGen( nVars, nBVars, nFuncs, nMints, fTryAll, nSVars == 1, fVerbose ); else if ( pTtStr ) { word pTruth[1024] = {0}; Abc_TtReadHex( pTruth, pTtStr ); if ( fTryAll ) Abc_BSEvalBestTest( pTruth, nVars, nBVars, nSVars == 1, fVerbose ); else Abc_BSEvalOneTest( pTruth, nVars, nBVars, fVerbose ); } return 0; usage: Abc_Print( -2, "usage: bseval [-IBSRM ] [-avh] \n" ); Abc_Print( -2, "\t bound set evaluation\n" ); Abc_Print( -2, "\t-I : the number of input variables [default = %d]\n", nVars ); Abc_Print( -2, "\t-B : the number of bound set variables [default = %d]\n", nBVars ); Abc_Print( -2, "\t-S : the number of shared variables [default = %d]\n", nSVars ); Abc_Print( -2, "\t-R : the number of random functions to try [default = unused]\n" ); Abc_Print( -2, "\t-M : the number of positive minterms in the random function [default = unused]\n" ); Abc_Print( -2, "\t-a : toggle trying all bound sets of this size [default = %s]\n", fTryAll ? "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 : truth table in hex notation\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandExtract( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkShareXor( Abc_Ntk_t * pNtk, int nMultiSize, int fAnd, int fVerbose ); Abc_Ntk_t * pNtk, * pNtkRes; int c, nMultiSize, fAnd, fVerbose; pNtk = Abc_FrameReadNtk(pAbc); // set defaults nMultiSize = 3; fAnd = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Kavh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nMultiSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nMultiSize < 0 ) goto usage; break; case 'a': fAnd ^= 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Can only collapse a logic network or an AIG.\n" ); return 1; } // get the new network pNtkRes = Abc_NtkShareXor( pNtk, nMultiSize, fAnd, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Cascade synthesis has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: extract [-K ] [-avh]\n" ); Abc_Print( -2, "\t extracts shared logic from multi-input gates\n" ); Abc_Print( -2, "\t-K : the minimum gate size to consider for extraction [default = %d]\n", nMultiSize ); Abc_Print( -2, "\t-a : toggle multi-input XOR vs multi-input AND [default = %s]\n", fAnd? "AND": "XOR" ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandVarMin( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_SuppTest( int nOnes, int nVars, int fUseSimple, int fCheck, int fVerbose ); extern void Abc_SuppReadMinTest( char * pFileName ); int nOnes = 4; int nVars = 20; int fUseSimple = 0; int fCheck = 0; int fVerbose = 0; int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "MNocvh" ) ) != EOF ) { switch ( c ) { case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } nOnes = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nOnes < 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; } nVars = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nVars < 0 ) goto usage; break; case 'o': fUseSimple ^= 1; break; case 'c': fCheck ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } // get the file name if ( argc == globalUtilOptind + 1 ) { Abc_SuppReadMinTest( argv[globalUtilOptind] ); return 0; } Abc_SuppTest( nOnes, nVars, fUseSimple, fCheck, fVerbose ); return 0; usage: Abc_Print( -2, "usage: varmin [-MN ] [-ocvh]\n" ); Abc_Print( -2, "\t performs support minimization\n" ); Abc_Print( -2, "\t-M : the number of ones in the combination [default = %d]\n", nOnes ); Abc_Print( -2, "\t-N : the number of variables in the problem [default = %d]\n", nVars ); Abc_Print( -2, "\t-o : toggle computing reduced difference matrix [default = %s]\n", fUseSimple? "yes": "no" ); Abc_Print( -2, "\t-c : toggle verifying the final result [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"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandFaultClasses( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_NtkDetectClassesTest( Abc_Ntk_t * pNtk, int fSeq, int fVerbose, int fVeryVerbose ); extern void Abc_NtkGenFaultList( Abc_Ntk_t * pNtk, char * pFileName, int fStuckAt ); Abc_Ntk_t * pNtk; int c, fGen = 0, fStuckAt = 0, fSeq = 0, fVerbose = 0, fVeryVerbose = 0; pNtk = Abc_FrameReadNtk(pAbc); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "gcsvwh" ) ) != EOF ) { switch ( c ) { case 'g': fGen ^= 1; break; case 'c': fStuckAt ^= 1; break; case 's': fSeq ^= 1; break; case 'v': fVerbose ^= 1; break; case 'w': fVeryVerbose ^= 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, "Only applicable to a logic network.\n" ); return 1; } if ( fGen ) { char * pFileName = Extra_FileNameGenericAppend(Abc_NtkSpec(pNtk), "_faults.txt"); Abc_NtkGenFaultList( pNtk, pFileName, fStuckAt ); } else Abc_NtkDetectClassesTest( pNtk, fSeq, fVerbose, fVeryVerbose ); return 0; usage: Abc_Print( -2, "usage: faultclasses [-gcsvwh]\n" ); Abc_Print( -2, "\t computes equivalence classes of faults in the given mapped netlist;\n" ); Abc_Print( -2, "\t the fault list with faults in the format: \n" ); Abc_Print( -2, "\t should be read by command \"read_fins\" before calling this command\n" ); Abc_Print( -2, "\t-g : toggle generating a fault list for the current mapped network [default = %s]\n", fGen? "yes": "no" ); Abc_Print( -2, "\t-c : toggle using only stuck-at faults in the generated fault list [default = %s]\n", fStuckAt? "yes": "no" ); Abc_Print( -2, "\t-s : toggle detecting sequential equivalence classes [default = %s]\n", fSeq? "yes": "no" ); Abc_Print( -2, "\t-v : toggle verbose printout during computation [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-w : toggle printing of resulting fault equivalence classes [default = %s]\n", fVeryVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandExact( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Gia_Man_t * Gia_ManFindExact( word * pTruth, int nVars, int nFunc, int nMaxDepth, int * pArrivalTimes, int nBTLimit, int nStartGates, int fVerbose ); int c, nMaxDepth = -1, fMakeAIG = 0, fTest = 0, fVerbose = 0, nVars = 0, nVarsTmp, nFunc = 0, nStartGates = 1, nBTLimit = 400000; char * p1, * p2; word pTruth[64]; int pArrTimeProfile[8], fHasArrTimeProfile = 0; Abc_Ntk_t * pNtkRes; Gia_Man_t * pGiaRes; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "DASCatvh" ) ) != EOF ) { switch ( c ) { case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } nMaxDepth = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nMaxDepth < 0 ) goto usage; break; case 'A': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-A\" should be followed by an integer.\n" ); goto usage; } fHasArrTimeProfile = 1; p1 = p2 = argv[globalUtilOptind++]; while ( true ) { if ( *p2 == ',' ) { *p2 = '\0'; pArrTimeProfile[nVars++] = atoi( p1 ); *p2++ = ','; p1 = p2; } else if ( *p2 == '\0' ) { pArrTimeProfile[nVars++] = atoi( p1 ); break; } else ++p2; } break; case 'S': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-S\" should be followed by an integer.\n" ); goto usage; } nStartGates = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nStartGates < 1 ) goto usage; break; case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; case 'a': fMakeAIG ^= 1; break; case 't': fTest ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( fTest ) { extern void Abc_ExactTest( int fVerbose ); extern void Abc_ExactStoreTest( int fVerbose ); printf( "run test suite, ignore all other settings\n" ); Abc_ExactTest( fVerbose ); Abc_ExactStoreTest( fVerbose ); return 0; } if ( argc == globalUtilOptind ) goto usage; memset( pTruth, 0, 64 * sizeof(word) ); while ( globalUtilOptind < argc ) { if ( nFunc == 16 ) { Abc_Print( -1, "Too many functions (at most 16 supported).\n" ); goto usage; } nVarsTmp = Abc_TtReadHex( &pTruth[nFunc << 2], argv[globalUtilOptind++] ); nFunc++; if ( nVars == 0 ) nVars = nVarsTmp; else if ( nVars > 8 ) { Abc_Print( -1, "Only 8-variable functions are supported.\n" ); goto usage; } else if ( nVars != nVarsTmp ) { Abc_Print( -1, "All functions need to have the same size.\n" ); goto usage; } } if ( fMakeAIG ) { pGiaRes = Gia_ManFindExact( pTruth, nVars, nFunc, nMaxDepth, fHasArrTimeProfile ? pArrTimeProfile : NULL, nBTLimit, nStartGates - 1, fVerbose ); if ( pGiaRes ) Abc_FrameUpdateGia( pAbc, pGiaRes ); else Abc_Print( 0, "Could not find AIG within given resource constraints, retry with different value for -C.\n" ); } else { pNtkRes = Abc_NtkFindExact( pTruth, nVars, nFunc, nMaxDepth, fHasArrTimeProfile ? pArrTimeProfile : NULL, nBTLimit, nStartGates - 1, fVerbose ); if ( pNtkRes ) { Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); Abc_FrameClearVerifStatus( pAbc ); } else Abc_Print( 0, "Could not find network within given resource constraints, retry with different value for -C.\n" ); } return 0; usage: Abc_Print( -2, "usage: exact [-DSC ] [-A ] [-atvh] ...\n" ); Abc_Print( -2, "\t finds optimum networks using SAT-based exact synthesis for hex truth tables ...\n" ); Abc_Print( -2, "\t-D : constrain maximum depth (if too low, algorithm may not terminate)\n" ); Abc_Print( -2, "\t-A : input arrival times (comma separated list)\n" ); Abc_Print( -2, "\t-S : number of start gates in search [default = %d]\n", nStartGates ); Abc_Print( -2, "\t-C : the limit on the number of conflicts; turn off with 0 [default = %d]\n", nBTLimit ); Abc_Print( -2, "\t-a : toggle create AIG [default = %s]\n", fMakeAIG ? "yes" : "no" ); Abc_Print( -2, "\t-t : run test suite\n" ); 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, "\t This command was contributed by Mathias Soeken from EPFL in July 2016.\n" ); Abc_Print( -2, "\t The author can be contacted as mathias.soeken at epfl.ch\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandBmsStart( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Abc_ExactIsRunning(); extern void Abc_ExactStart( int nBTLimit, int fMakeAIG, int fVerbose, int fVeryVerbose, const char *pFilename ); int c, fMakeAIG = 0, fVerbose = 0, fVeryVerbose = 0, nBTLimit = 100; char * pFilename = NULL; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Cavwh" ) ) != EOF ) { switch ( c ) { case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; case 'a': fMakeAIG ^= 1; break; case 'v': fVerbose ^= 1; break; case 'w': fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc > globalUtilOptind ) { pFilename = argv[globalUtilOptind++]; } if ( Abc_ExactIsRunning() ) { Abc_Print( -1, "BMS manager is already started." ); return 1; } Abc_ExactStart( nBTLimit, fMakeAIG, fVerbose, fVeryVerbose, pFilename ); return 0; usage: Abc_Print( -2, "usage: bms_start [-C ] [-avwh] []\n" ); Abc_Print( -2, "\t starts BMS manager for recording optimum networks\n" ); Abc_Print( -2, "\t if is specified, store entries are read from that file\n" ); Abc_Print( -2, "\t-C : the limit on the number of conflicts [default = %d]\n", nBTLimit ); Abc_Print( -2, "\t-a : toggle create AIG [default = %s]\n", fMakeAIG ? "yes" : "no" ); Abc_Print( -2, "\t-v : toggle verbose printout [default = %s]\n", fVerbose ? "yes" : "no" ); Abc_Print( -2, "\t-w : toggle very verbose printout [default = %s]\n", fVeryVerbose ? "yes" : "no" ); Abc_Print( -2, "\t-h : print the command usage\n" ); Abc_Print( -2, "\t\n" ); Abc_Print( -2, "\t This command was contributed by Mathias Soeken from EPFL in July 2016.\n" ); Abc_Print( -2, "\t The author can be contacted as mathias.soeken at epfl.ch\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandBmsStop( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Abc_ExactIsRunning(); extern void Abc_ExactStop( const char *pFilename ); int c; char * pFilename = NULL; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( argc > globalUtilOptind ) { pFilename = argv[globalUtilOptind++]; } if ( !Abc_ExactIsRunning() ) { Abc_Print( -1, "BMS manager is not started." ); return 1; } Abc_ExactStop( pFilename ); return 0; usage: Abc_Print( -2, "usage: bms_stop [-C ] [-vh] []\n" ); Abc_Print( -2, "\t stops BMS manager for recording optimum networks\n" ); Abc_Print( -2, "\t if is specified, store entries are written to that file\n" ); Abc_Print( -2, "\t-h : print the command usage\n" ); Abc_Print( -2, "\t\n" ); Abc_Print( -2, "\t This command was contributed by Mathias Soeken from EPFL in July 2016.\n" ); Abc_Print( -2, "\t The author can be contacted as mathias.soeken at epfl.ch\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandBmsPs( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Abc_ExactIsRunning(); extern void Abc_ExactStats(); int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( !Abc_ExactIsRunning() ) { Abc_Print( -1, "BMS manager is not started." ); return 1; } Abc_ExactStats(); return 0; usage: Abc_Print( -2, "usage: bms_ps [-h]\n" ); Abc_Print( -2, "\t shows statistics about BMS manager\n" ); Abc_Print( -2, "\t-h : print the command usage\n" ); Abc_Print( -2, "\t\n" ); Abc_Print( -2, "\t This command was contributed by Mathias Soeken from EPFL in July 2016.\n" ); Abc_Print( -2, "\t The author can be contacted as mathias.soeken at epfl.ch\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMajExact( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Maj_ManExactSynthesis( int nVars, int nNodes, int fUseConst, int fUseLine, int fVerbose ); extern int Maj_ManExactSynthesis2( int nVars, int nNodes, int fUseConst, int fUseLine, int fUseRand, int nRands, int fVerbose ); int c, nVars = 3, nNodes = 1, fUseConst = 0, fUseLine = 0, fGlucose = 0, fUseRand = 0, nRands = 0, fVerbose = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "INRfcrgvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nVars = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nVars < 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; } nNodes = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nNodes < 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; } nRands = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nRands < 0 ) goto usage; break; case 'f': fUseConst ^= 1; break; case 'c': fUseLine ^= 1; break; case 'r': fUseRand ^= 1; break; case 'g': fGlucose ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( (nVars & 1) == 0 ) { Abc_Print( -1, "Cannot sythesize MAJ gate with an even number of inputs (%d).\n", nVars ); return 1; } if ( fGlucose ) Maj_ManExactSynthesis( nVars, nNodes, fUseConst, fUseLine, fVerbose ); else Maj_ManExactSynthesis2( nVars, nNodes, fUseConst, fUseLine, fUseRand, nRands, fVerbose ); return 0; usage: Abc_Print( -2, "usage: majexact [-INR ] [-fcrgvh]\n" ); Abc_Print( -2, "\t exact synthesis of multi-input MAJ using MAJ3 gates\n" ); Abc_Print( -2, "\t-I : the number of input variables [default = %d]\n", nVars ); Abc_Print( -2, "\t-N : the number of MAJ3 nodes [default = %d]\n", nNodes ); Abc_Print( -2, "\t-R : the number of additional connections [default = %d]\n", nRands ); Abc_Print( -2, "\t-f : toggle using constant fanins [default = %s]\n", fUseConst ? "yes" : "no" ); Abc_Print( -2, "\t-c : toggle using cascade topology [default = %s]\n", fUseLine ? "yes" : "no" ); Abc_Print( -2, "\t-r : toggle using random topology [default = %s]\n", fUseRand ? "yes" : "no" ); Abc_Print( -2, "\t-g : toggle using Glucose 3.0 by Gilles Audemard and Laurent Simon [default = %s]\n", fGlucose ? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTwoExact( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Exa_ManExactSynthesis( Bmc_EsPar_t * pPars ); extern void Exa_ManExactSynthesis2( Bmc_EsPar_t * pPars ); extern void Exa_ManExactSynthesis4( Bmc_EsPar_t * pPars ); extern void Exa_ManExactSynthesis5( Bmc_EsPar_t * pPars ); extern void Exa_ManExactSynthesis6( Bmc_EsPar_t * pPars, char * pFileName ); extern void Exa_ManExactSynthesis7( Bmc_EsPar_t * pPars, int GateSize ); int c, fKissat = 0, fKissat2 = 0, fUseNands = 0, GateSize = 0; Bmc_EsPar_t Pars, * pPars = &Pars; Bmc_EsParSetDefault( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "INTGabdconugklvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pPars->nVars = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nVars < 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; } pPars->nNodes = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nNodes < 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->RuntimeLim = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->RuntimeLim < 0 ) goto usage; break; case 'G': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-G\" should be followed by an integer.\n" ); goto usage; } GateSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( GateSize < 0 ) goto usage; break; case 'a': pPars->fOnlyAnd ^= 1; break; case 'b': fUseNands ^= 1; break; case 'd': pPars->fDynConstr ^= 1; break; case 'c': pPars->fDumpCnf ^= 1; break; case 'o': pPars->fFewerVars ^= 1; break; case 'n': pPars->fOrderNodes ^= 1; break; case 'u': pPars->fUniqFans ^= 1; break; case 'g': pPars->fGlucose ^= 1; break; case 'k': fKissat ^= 1; break; case 'l': fKissat2 ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc == globalUtilOptind + 1 ) { if ( strstr(argv[globalUtilOptind], ".") ) { Exa_ManExactSynthesis6( pPars, argv[globalUtilOptind] ); return 0; } pPars->pTtStr = argv[globalUtilOptind]; } if ( pPars->pTtStr == NULL ) { Abc_Print( -1, "Truth table should be given on the command line.\n" ); return 1; } if ( pPars->nVars >= 2 && (1 << (pPars->nVars-2)) != (int)strlen(pPars->pTtStr) ) { Abc_Print( -1, "Truth table is expected to have %d hex digits (instead of %d).\n", (1 << (pPars->nVars-2)), strlen(pPars->pTtStr) ); return 1; } if ( pPars->nVars > pPars->nNodes * (2 - 1) + 1 ) { Abc_Print( -1, "Function with %d variales cannot be implemented with %d two-input gates.\n", pPars->nVars, pPars->nNodes ); return 1; } if ( pPars->nVars > 10 ) { Abc_Print( -1, "Function should not have more than 10 inputs.\n" ); return 1; } if ( fUseNands ) Exa_ManExactSynthesis7( pPars, GateSize ); else if ( fKissat ) Exa_ManExactSynthesis4( pPars ); else if ( fKissat2 ) Exa_ManExactSynthesis5( pPars ); else if ( pPars->fGlucose ) Exa_ManExactSynthesis( pPars ); else Exa_ManExactSynthesis2( pPars ); return 0; usage: Abc_Print( -2, "usage: twoexact [-INTG ] [-abdconugklvh] \n" ); Abc_Print( -2, "\t exact synthesis of multi-input function using two-input gates\n" ); Abc_Print( -2, "\t-I : the number of input variables [default = %d]\n", pPars->nVars ); Abc_Print( -2, "\t-N : the number of two-input nodes [default = %d]\n", pPars->nNodes ); Abc_Print( -2, "\t-T : the runtime limit in seconds [default = %d]\n", pPars->RuntimeLim ); Abc_Print( -2, "\t-G : the largest allowed gate size (NANDs only) [default = %d]\n", GateSize ); Abc_Print( -2, "\t-a : toggle using only AND-gates (without XOR-gates) [default = %s]\n", pPars->fOnlyAnd ? "yes" : "no" ); Abc_Print( -2, "\t-b : toggle using only NAND-gates [default = %s]\n", fUseNands ? "yes" : "no" ); Abc_Print( -2, "\t-d : toggle using dynamic constraint addition [default = %s]\n", pPars->fDynConstr ? "yes" : "no" ); Abc_Print( -2, "\t-c : toggle dumping CNF into a file [default = %s]\n", pPars->fDumpCnf ? "yes" : "no" ); Abc_Print( -2, "\t-o : toggle using additional optimizations [default = %s]\n", pPars->fFewerVars ? "yes" : "no" ); Abc_Print( -2, "\t-n : toggle ordering internal nodes [default = %s]\n", pPars->fOrderNodes ? "yes" : "no" ); Abc_Print( -2, "\t-u : toggle using unique fanouts [default = %s]\n", pPars->fUniqFans ? "yes" : "no" ); Abc_Print( -2, "\t-g : toggle using Glucose 3.0 by Gilles Audemard and Laurent Simon [default = %s]\n", pPars->fGlucose ? "yes" : "no" ); Abc_Print( -2, "\t-k : toggle using Kissat by Armin Biere [default = %s]\n", fKissat ? "yes" : "no" ); Abc_Print( -2, "\t-l : toggle using Kissat by Armin Biere [default = %s]\n", fKissat2 ? "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" ); Abc_Print( -2, "\t : truth table in hex notation\n" ); Abc_Print( -2, "\t \n" ); Abc_Print( -2, "\t For example, command line \"twoexact -g -I 5 -N 12 169AE443\"\n" ); Abc_Print( -2, "\t synthesizes the smallest circuit composed of two-input gates\n" ); Abc_Print( -2, "\t for the only NPN class of 5-input functions that requires 12 gates;\n" ); Abc_Print( -2, "\t all other functions can be realized with 11 two-input gates or less\n" ); Abc_Print( -2, "\t (see Section 7.1.2 \"Boolean evaluation\" in the book The Art of Computer Programming by Donald Knuth)\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandLutExact( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Exa3_ManExactSynthesis( Bmc_EsPar_t * pPars ); extern void Exa3_ManExactSynthesis2( Bmc_EsPar_t * pPars ); extern void Exa3_ManExactSynthesisRand( Bmc_EsPar_t * pPars ); int c; Bmc_EsPar_t Pars, * pPars = &Pars; Bmc_EsParSetDefault( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "INKTSRMiaocgvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pPars->nVars = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nVars < 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; } pPars->nNodes = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nNodes < 0 ) goto usage; break; case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } pPars->nLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nLutSize < 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->RuntimeLim = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->RuntimeLim < 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->pSymStr = argv[globalUtilOptind]; globalUtilOptind++; break; case 'R': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } pPars->nRandFuncs = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nMintNum = atoi(argv[globalUtilOptind]); globalUtilOptind++; break; case 'i': pPars->fUseIncr ^= 1; break; case 'a': pPars->fOnlyAnd ^= 1; break; case 'o': pPars->fFewerVars ^= 1; break; case 'c': pPars->fLutCascade ^= 1; break; case 'g': pPars->fGlucose ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc == globalUtilOptind + 1 ) pPars->pTtStr = argv[globalUtilOptind]; if ( pPars->pTtStr == NULL && pPars->pSymStr == NULL && pPars->nRandFuncs == 0 ) { Abc_Print( -1, "Truth table should be given on the command line.\n" ); return 1; } if ( pPars->pTtStr && (1 << (pPars->nVars-2)) != (int)strlen(pPars->pTtStr) ) { Abc_Print( -1, "Truth table is expected to have %d hex digits (instead of %d).\n", (1 << (pPars->nVars-2)), strlen(pPars->pTtStr) ); return 1; } if ( pPars->pSymStr && pPars->nVars+1 != strlen(pPars->pSymStr) ) { Abc_Print( -1, "The char string of the %d-variable symmetric function should have %d zeros and ones (instead of %d).\n", pPars->nVars, pPars->nVars+1, strlen(pPars->pSymStr) ); return 1; } if ( pPars->nVars > pPars->nNodes * (pPars->nLutSize - 1) + 1 ) { Abc_Print( -1, "Function with %d variales cannot be implemented with %d %d-input LUTs.\n", pPars->nVars, pPars->nNodes, pPars->nLutSize ); return 1; } if ( pPars->nVars > 10 ) { Abc_Print( -1, "Function should not have more than 10 inputs.\n" ); return 1; } if ( pPars->nLutSize > 6 ) { Abc_Print( -1, "Node size should not be more than 6 inputs.\n" ); return 1; } if ( pPars->nRandFuncs ) { pPars->fGlucose = 1; Exa3_ManExactSynthesisRand( pPars ); } else if ( pPars->fGlucose ) Exa3_ManExactSynthesis( pPars ); else Exa3_ManExactSynthesis2( pPars ); return 0; usage: Abc_Print( -2, "usage: lutexact [-INKTRM ] [-S string] [-iaocgvh] \n" ); Abc_Print( -2, "\t exact synthesis of I-input function using N K-input gates\n" ); Abc_Print( -2, "\t-I : the number of input variables [default = %d]\n", pPars->nVars ); Abc_Print( -2, "\t-N : the number of K-input nodes [default = %d]\n", pPars->nNodes ); Abc_Print( -2, "\t-K : the number of node fanins [default = %d]\n", pPars->nLutSize ); Abc_Print( -2, "\t-T : the runtime limit in seconds [default = %d]\n", pPars->RuntimeLim ); Abc_Print( -2, "\t-R : the number of random functions to try [default = unused]\n" ); Abc_Print( -2, "\t-M : the number of positive minterms in the random function [default = unused]\n" ); Abc_Print( -2, "\t-S : charasteristic string of a symmetric function [default = %d]\n", pPars->pSymStr ); Abc_Print( -2, "\t-i : toggle using incremental solving [default = %s]\n", pPars->fUseIncr ? "yes" : "no" ); Abc_Print( -2, "\t-a : toggle using only AND-gates when K = 2 [default = %s]\n", pPars->fOnlyAnd ? "yes" : "no" ); Abc_Print( -2, "\t-o : toggle using additional optimizations [default = %s]\n", pPars->fFewerVars ? "yes" : "no" ); Abc_Print( -2, "\t-c : toggle synthesizing a single-rail cascade [default = %s]\n", pPars->fLutCascade ? "yes" : "no" ); Abc_Print( -2, "\t-g : toggle using Glucose 3.0 by Gilles Audemard and Laurent Simon [default = %s]\n", pPars->fGlucose ? "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" ); Abc_Print( -2, "\t : truth table in hex notation\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandAllExact( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Zyx_ManExactSynthesis( Bmc_EsPar_t * pPars ); int c; Bmc_EsPar_t Pars, * pPars = &Pars; Bmc_EsParSetDefault( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "MINKianegvh" ) ) != EOF ) { switch ( c ) { case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nMajSupp = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nMajSupp < 0 ) goto usage; break; case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pPars->nVars = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nVars < 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; } pPars->nNodes = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nNodes < 0 ) goto usage; break; case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } pPars->nLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nLutSize < 0 ) goto usage; break; case 'i': pPars->fUseIncr ^= 1; break; case 'a': pPars->fOnlyAnd ^= 1; break; case 'n': pPars->fOrderNodes ^= 1; break; case 'e': pPars->fEnumSols ^= 1; break; case 'g': pPars->fGlucose ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pPars->nMajSupp > 0 ) { if ( pPars->nMajSupp != 5 && pPars->nMajSupp != 7 && pPars->nMajSupp != 9 ) { Abc_Print( -1, "Currently only support majority with 5, 7 or 9 inputs.\n" ); return 1; } pPars->nVars = pPars->nMajSupp; pPars->nLutSize = 3; pPars->fMajority = 1; pPars->fUseIncr = 1; if ( pPars->nNodes == 0 ) { if ( pPars->nMajSupp == 5 ) pPars->nNodes = 4; if ( pPars->nMajSupp == 7 ) pPars->nNodes = 7; if ( pPars->nMajSupp == 9 ) pPars->nNodes = 10; } } else { if ( pPars->nVars == 0 ) { Abc_Print( -1, "The number of variables (-I num) needs to be specified on the command line.\n" ); return 1; } if ( pPars->nNodes == 0 ) { Abc_Print( -1, "The number of nodes (-N num) needs to be specified on the command line.\n" ); return 1; } if ( argc == globalUtilOptind + 1 ) pPars->pTtStr = argv[globalUtilOptind]; if ( pPars->pTtStr == NULL ) { Abc_Print( -1, "Truth table should be given on the command line.\n" ); return 1; } if ( (1 << (pPars->nVars-2)) != (int)strlen(pPars->pTtStr) ) { Abc_Print( -1, "Truth table is expected to have %d hex digits (instead of %d).\n", (1 << (pPars->nVars-2)), strlen(pPars->pTtStr) ); return 1; } } if ( pPars->nVars > pPars->nNodes * (pPars->nLutSize - 1) + 1 ) { Abc_Print( -1, "Function with %d variales cannot be implemented with %d %d-input LUTs.\n", pPars->nVars, pPars->nNodes, pPars->nLutSize ); return 1; } if ( pPars->nVars > 10 ) { Abc_Print( -1, "Function should not have more than 10 inputs.\n" ); return 1; } if ( pPars->nLutSize > 6 ) { Abc_Print( -1, "Node size should not be more than 6 inputs.\n" ); return 1; } if ( !pPars->fUseIncr ) { if ( pPars->fMajority ) { Abc_Print( -1, "Cannot synthesize majority in the non-incremental mode (use \'-i\').\n" ); return 1; } if ( pPars->nLutSize > 3 ) { Abc_Print( -1, "Cannot synthesize LUT4 and larger in non-incremental mode (use \'-i\').\n" ); return 1; } } Zyx_ManExactSynthesis( pPars ); return 0; usage: Abc_Print( -2, "usage: allexact [-MIKN ] [-ianevh] \n" ); Abc_Print( -2, "\t exact synthesis of I-input function using N K-input gates\n" ); Abc_Print( -2, "\t-M : the majority support size (overrides -I and -K) [default = %d]\n", pPars->nMajSupp ); Abc_Print( -2, "\t-I : the number of input variables [default = %d]\n", pPars->nVars ); Abc_Print( -2, "\t-K : the number of node fanins [default = %d]\n", pPars->nLutSize ); Abc_Print( -2, "\t-N : the number of K-input nodes [default = %d]\n", pPars->nNodes ); Abc_Print( -2, "\t-i : toggle using incremental solving [default = %s]\n", pPars->fUseIncr ? "yes" : "no" ); Abc_Print( -2, "\t-a : toggle using only AND-gates when K = 2 [default = %s]\n", pPars->fOnlyAnd ? "yes" : "no" ); Abc_Print( -2, "\t-n : toggle using node ordering by fanins [default = %s]\n", pPars->fOrderNodes ? "yes" : "no" ); Abc_Print( -2, "\t-e : toggle enumerating all solutions [default = %s]\n", pPars->fEnumSols ? "yes" : "no" ); // Abc_Print( -2, "\t-g : toggle using Glucose 3.0 by Gilles Audemard and Laurent Simon [default = %s]\n", pPars->fGlucose ? "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" ); Abc_Print( -2, "\t : truth table in hex notation\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTestExact( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Zyx_TestExact( char * pFileName ); char * pFileName = NULL; int c, fVerbose = 0; 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 ( argc == globalUtilOptind + 1 ) pFileName = argv[globalUtilOptind]; if ( pFileName == NULL ) { Abc_Print( -1, "File name is not given on the command line.\n" ); return 1; } Zyx_TestExact( pFileName ); return 0; usage: Abc_Print( -2, "usage: testexact \n" ); Abc_Print( -2, "\t tests solution of the exact synthesis problem\n" ); 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 : file name in the specified format\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMajGen( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Gem_Enumerate( int nVars, int fDump, int fVerbose ); int c, nVars = 8, fDump = 0, fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Ndvh" ) ) != 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 'd': fDump ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } Gem_Enumerate( nVars, fDump, fVerbose ); return 0; usage: Abc_Print( -2, "usage: majgen [-N ] [-dvh]>\n" ); Abc_Print( -2, "\t generates networks for majority gates\n" ); Abc_Print( -2, "\t-N : the maximum number of variables [default = %d]\n", nVars ); Abc_Print( -2, "\t-d : toggle dumping functions into a file [default = %s]\n", fVerbose ? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandLogic( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; 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, "This command is only applicable to strashed networks.\n" ); return 1; } // get the new network pNtkRes = Abc_NtkToLogic( pNtk ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Converting to a logic network has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandComb( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c; int fRemoveLatches; int nLatchesToAdd; extern void Abc_NtkMakeSeq( Abc_Ntk_t * pNtk, int nLatchesToAdd ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults fRemoveLatches = 0; nLatchesToAdd = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Llh" ) ) != EOF ) { switch ( c ) { case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLatchesToAdd = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLatchesToAdd < 0 ) goto usage; break; case 'l': fRemoveLatches ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) && nLatchesToAdd == 0 ) { Abc_Print( -1, "The network is already combinational.\n" ); return 0; } if ( !Abc_NtkIsComb(pNtk) && nLatchesToAdd != 0 ) { Abc_Print( -1, "The network is already combinational.\n" ); return 0; } // get the new network pNtkRes = Abc_NtkDup( pNtk ); if ( nLatchesToAdd ) Abc_NtkMakeSeq( pNtkRes, nLatchesToAdd ); else Abc_NtkMakeComb( pNtkRes, fRemoveLatches ); // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: comb [-L ] [-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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMiter( Abc_Frame_t * pAbc, int argc, char ** argv ) { char Buffer[32]; Abc_Ntk_t * pNtk, * pNtk1, * pNtk2, * pNtkRes; int fDelete1, fDelete2; char ** pArgvNew; int nArgcNew; int c; int fCheck; int fComb; int fImplic; int fMulti; int nPartSize; int fTrans; int fIgnoreNames; pNtk = Abc_FrameReadNtk(pAbc); // set defaults fComb = 0; fCheck = 1; fImplic = 0; fMulti = 0; nPartSize = 0; fTrans = 0; fIgnoreNames = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Pcmitnh" ) ) != EOF ) { switch ( c ) { case 'P': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPartSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nPartSize < 0 ) goto usage; break; case 'c': fComb ^= 1; break; case 'm': fMulti ^= 1; break; case 'i': fImplic ^= 1; break; case 't': fTrans ^= 1; break; case 'n': fIgnoreNames ^= 1; break; default: goto usage; } } if ( fTrans ) { if ( (Abc_NtkPoNum(pNtk) & 1) == 1 ) { Abc_Print( -1, "Abc_CommandMiter(): The number of outputs should be even.\n" ); return 0; } // replace the current network pNtkRes = Abc_NtkDupTransformMiter( pNtk ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); Abc_Print( 1, "The miter (current network) is transformed by XORing POs pair-wise.\n" ); return 0; } pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2, 1 ) ) return 1; if ( fIgnoreNames ) { if ( !fDelete1 ) { pNtk1 = Abc_NtkStrash( pNtk1, 0, 1, 0 ); fDelete1 = 1; } if ( !fDelete2 ) { pNtk2 = Abc_NtkStrash( pNtk2, 0, 1, 0 ); fDelete2 = 1; } Abc_NtkShortNames( pNtk1 ); Abc_NtkShortNames( pNtk2 ); } // compute the miter pNtkRes = Abc_NtkMiter( pNtk1, pNtk2, fComb, nPartSize, fImplic, fMulti ); if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); // get the new network if ( pNtkRes == NULL ) { Abc_Print( -1, "Miter computation has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: if ( nPartSize == 0 ) strcpy( Buffer, "unused" ); else sprintf(Buffer, "%d", nPartSize ); Abc_Print( -2, "usage: miter [-P ] [-cimtnh] \n" ); Abc_Print( -2, "\t computes the miter of the two circuits\n" ); Abc_Print( -2, "\t-P : 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-t : toggle XORing pair-wise POs of the miter [default = %s]\n", fTrans? "yes": "no" ); Abc_Print( -2, "\t-n : toggle ignoring names when matching CIs/COs [default = %s]\n", fIgnoreNames? "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\n"); Abc_Print( -2, "\t Please note that, when used without \"-n\", this command tries to match\n" ); Abc_Print( -2, "\t primary inputs by name and, to achieve this, it will order them alphabetically,\n" ); Abc_Print( -2, "\t which results in incorrect QBF miters and confusing counter-examples.\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMiter2( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Vec_Ptr_t * Abc_NtkReadNodeNames( Abc_Ntk_t * pNtk, char * pFileName ); extern Abc_Ntk_t * Abc_NtkSpecialMiter( Abc_Ntk_t * pNtk, Vec_Ptr_t * vNodes ); Abc_Ntk_t * pNtk, * pNtkRes; Vec_Ptr_t * vNodes; char * pFileName; int c, fVerbose = 0; pNtk = Abc_FrameReadNtk(pAbc); // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) { switch ( c ) { case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } // get the second network if ( argc != globalUtilOptind + 1 ) { Abc_Print( -1, "The file with node names is not given.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "The base network should be logic network from BLIF file.\n" ); return 1; } // read the second network pFileName = argv[globalUtilOptind]; if ( (vNodes = Abc_NtkReadNodeNames(pNtk, pFileName)) == NULL ) { Abc_Print( -1, "Cannot read node names from file \"%s\".\n", pFileName ); return 1; } pNtkRes = Abc_NtkSpecialMiter( pNtk, vNodes ); Vec_PtrFree( vNodes ); // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: miter2 [-h] \n" ); Abc_Print( -2, "\t derives specialized miter\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t : file name with node names\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDemiter( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c, fDual, fVerbose; extern int Abc_NtkDarDemiter( Abc_Ntk_t * pNtk ); extern int Abc_NtkDarDemiterDual( Abc_Ntk_t * pNtk, int fVerbose ); // set defaults fDual = 0; fVerbose = 1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dvh" ) ) != EOF ) { switch ( c ) { case 'd': fDual ^= 1; break; case 'v': fVerbose ^= 1; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "The network is not strashed.\n" ); return 1; } if ( fDual ) { if ( (Abc_NtkPoNum(pNtk) & 1) ) { Abc_Print( -1, "The number of POs should be even.\n" ); return 0; } if ( !Abc_NtkDarDemiterDual( pNtk, fVerbose ) ) { Abc_Print( -1, "Demitering has failed.\n" ); return 1; } return 0; } /* if ( Abc_NtkPoNum(pNtk) != 1 ) { Abc_Print( -1, "The network is not a single-output miter.\n" ); return 1; } if ( !Abc_NodeIsExorType(Abc_ObjFanin0(Abc_NtkPo(pNtk,0))) ) { Abc_Print( -1, "The miter's PO is not an EXOR.\n" ); return 1; } if ( !Abc_NtkDemiter( pNtk ) ) { Abc_Print( -1, "Demitering has failed.\n" ); return 1; } */ // get the new network if ( !Abc_NtkDarDemiter( pNtk ) ) { Abc_Print( -1, "Demitering has failed.\n" ); return 1; } // replace the current network // Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: demiter [-dvh]\n" ); Abc_Print( -2, "\t splits sequential miter into two circuits\n" ); Abc_Print( -2, "\t-d : expects a dual-output miter (without XORs) [default = %s]\n", fDual? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandOrPos( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);//, * pNtkRes; int fReverse = 0; int fComb = 0; int fXor = 0; int c; extern int Abc_NtkCombinePos( Abc_Ntk_t * pNtk, int fAnd, int fXor ); // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "rxh" ) ) != EOF ) { switch ( c ) { case 'r': fReverse ^= 1; break; case 'x': fXor ^= 1; break; case 'c': fComb ^= 1; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "The network is not strashed.\n" ); return 1; } // get the new network if ( fReverse ) { extern Aig_Man_t * Abc_NtkToDarBmc( Abc_Ntk_t * pNtk, Vec_Int_t ** pvMap ); Aig_Man_t * pMan = Abc_NtkToDarBmc( pNtk, NULL ); Abc_Ntk_t * pNtkRes = Abc_NtkFromAigPhase( pMan ); Aig_ManStop( pMan ); // perform expansion if ( Abc_NtkPoNum(pNtk) != Abc_NtkPoNum(pNtkRes) ) Abc_Print( 1,"Expanded %d outputs into %d outputs using OR decomposition.\n", Abc_NtkPoNum(pNtk), Abc_NtkPoNum(pNtkRes) ); else Abc_Print( 1,"The output(s) cannot be structurally decomposed.\n" ); // clear counter-example if ( pAbc->pCex ) ABC_FREE( pAbc->pCex ); // replace the current network ABC_FREE( pNtkRes->pName ); pNtkRes->pName = Extra_UtilStrsav(pNtk->pName); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } else { if ( !Abc_NtkCombinePos( pNtk, 0, fXor ) ) { Abc_Print( -1, "ORing the POs has failed.\n" ); return 1; } // update counter-example if ( pAbc->pCex ) pAbc->pCex->iPo = 0; // replace the current network // Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } return 0; usage: Abc_Print( -2, "usage: orpos [-rxh]\n" ); Abc_Print( -2, "\t creates single-output miter by ORing the POs of the current network\n" ); Abc_Print( -2, "\t-r : performs the reverse transform (OR decomposition) [default = %s]\n", fReverse? "yes": "no" ); Abc_Print( -2, "\t-x : toggles combining the PO using XOR [default = %s]\n", fXor? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandAndPos( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);//, * pNtkRes; int fComb = 0; int c; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF ) { switch ( c ) { case 'c': fComb ^= 1; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "The network is not strashed.\n" ); return 1; } if ( Abc_NtkPoNum(pNtk) == 1 ) { Abc_Print( -1, "The network already has one PO.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) ) { Abc_Print( -1, "The miter has latches. ORing is not performed.\n" ); return 1; } // get the new network if ( !Abc_NtkCombinePos( pNtk, 1, 0 ) ) { Abc_Print( -1, "ANDing the POs has failed.\n" ); return 1; } // replace the current network // Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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 = NULL; int c, iOutput = -1; int fSkipSweep = 0; int fUseConst1 = 0; extern void Abc_NtkDropOneOutput( Abc_Ntk_t * pNtk, int iOutput, int fSkipSweep, int fUseConst1 ); // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Nsoh" ) ) != 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; case 's': fSkipSweep ^= 1; break; case 'o': fUseConst1 ^= 1; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } 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 ); Abc_NtkDropOneOutput( pNtk, iOutput, fSkipSweep, fUseConst1 ); return 0; usage: Abc_Print( -2, "usage: zeropo [-N ] [-soh]\n" ); Abc_Print( -2, "\t replaces the PO driver by constant 0\n" ); Abc_Print( -2, "\t-N : the zero-based index of the PO to replace [default = %d]\n", iOutput ); Abc_Print( -2, "\t-s : performs comb sweep after removimg a PO [default = %s]\n", !fSkipSweep? "yes": "no" ); Abc_Print( -2, "\t-o : toggles using const 1 instead of const 0 [default = %s]\n", fUseConst1? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandSwapPos( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtkRes; int c, iOutput = -1; extern void Abc_NtkSwapOneOutput( 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } 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_NtkSwapOneOutput( pNtkRes, iOutput ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: swappos [-N ] [-h]\n" ); Abc_Print( -2, "\t swap the 0-th PO with the -th PO\n" ); Abc_Print( -2, "\t-N : the zero-based index of the PO to swap [default = %d]\n", iOutput ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRemovePo( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);//, * pNtkRes = NULL; int c, iOutput = -1; int fRemoveConst0 = 1; extern void Abc_NtkRemovePo( Abc_Ntk_t * pNtk, int iOutput, int fRemoveConst0 ); // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Nzh" ) ) != 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; case 'z': fRemoveConst0 ^= 1; break; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } 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_NtkRemovePo( pNtkRes, iOutput ); // Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); Abc_NtkRemovePo( pNtk, iOutput, fRemoveConst0 ); return 0; usage: Abc_Print( -2, "usage: removepo [-N ] [-zh]\n" ); Abc_Print( -2, "\t remove PO with number if it is const0\n" ); Abc_Print( -2, "\t-N : the zero-based index of the PO to remove [default = %d]\n", iOutput ); Abc_Print( -2, "\t-z : toggle removing const1 instead of const0 [default = %s]\n", fRemoveConst0? "const0": "const1" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDropSat( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_NtkDropSatOutputs( Abc_Ntk_t * pNtk, Vec_Ptr_t * vCexes, int fVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc), * pNtkRes = NULL; int fNoSweep = 0; int c, fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "svh" ) ) != EOF ) { switch ( c ) { case 's': fNoSweep ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for AIGs (run \"strash\").\n" ); return 1; } if ( pAbc->vCexVec == NULL ) { Abc_Print( -1, "CEX array is not defined. Run \"bmc3 -az\", \"sim3 -az\", or \"pdr -az\".\n" ); return 1; } if ( Vec_PtrSize(pAbc->vCexVec) != Abc_NtkPoNum(pNtk) ) { Abc_Print( -1, "CEX array size (%d) does not match the number of outputs (%d).\n", Vec_PtrSize(pAbc->vCexVec), Abc_NtkPoNum(pNtk) ); return 1; } Abc_NtkDropSatOutputs( pNtk, pAbc->vCexVec, fVerbose ); if ( !fNoSweep ) { pNtkRes = Abc_NtkDarLatchSweep( pNtk, 1, 1, 1, 0, -1, -1, 0, 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: dropsat [-sh]\n" ); Abc_Print( -2, "\t replaces satisfiable POs by constant 0 and cleans up the AIG\n" ); Abc_Print( -2, "\t-s : toggles skipping sequential sweep [default = %s]\n", fNoSweep? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandAddPi( 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': default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network if ( Abc_NtkPiNum(pNtk) == 0 ) { Abc_Ntk_t * pNtkRes = Abc_NtkDup( pNtk ); Abc_Obj_t * pObj = Abc_NtkCreatePi( pNtkRes ); Abc_ObjAssignName( pObj, "dummy_pi", NULL ); Abc_NtkOrderCisCos( pNtkRes ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } return 0; usage: Abc_Print( -2, "usage: addpi [-h]\n" ); Abc_Print( -2, "\t if the network has no PIs, add one dummy PI\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandAddFlop( 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': default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -2, "The current network is not an AIG (run \"strash\").\n"); return 0; } // get the new network if ( Abc_NtkLatchNum(pNtk) == 0 ) { Abc_Ntk_t * pNtkRes = Abc_NtkDup( pNtk ); Abc_NtkAddLatch( pNtkRes, Abc_AigConst1(pNtkRes), ABC_INIT_ONE ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } return 0; usage: Abc_Print( -2, "usage: addflop [-h]\n" ); Abc_Print( -2, "\t if the network has no flops, add one dummy flop\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandAppend( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtk2; char * FileName; int fComb = 0; int c; pNtk = Abc_FrameReadNtk(pAbc); // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF ) { switch ( c ) { case 'c': fComb ^= 1; break; default: goto usage; } } // get the second network if ( argc != globalUtilOptind + 1 ) { Abc_Print( -1, "The network to append is not given.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "The base network should be strashed for the appending to work.\n" ); return 1; } // read the second network FileName = argv[globalUtilOptind]; pNtk2 = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 ); if ( pNtk2 == NULL ) return 1; // check if the second network is combinational if ( Abc_NtkLatchNum(pNtk2) ) { Abc_NtkDelete( pNtk2 ); Abc_Print( -1, "The second network has latches. Appending does not work for such networks.\n" ); return 0; } // get the new network if ( !Abc_NtkAppend( pNtk, pNtk2, 1 ) ) { Abc_NtkDelete( pNtk2 ); Abc_Print( -1, "Appending the networks failed.\n" ); return 1; } Abc_NtkDelete( pNtk2 ); // sweep dangling logic Abc_AigCleanup( (Abc_Aig_t *)pNtk->pManFunc ); // replace the current network // Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: append [-h] \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 name with the second network\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPutOnTop( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkPutOnTop( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtk2 ); Abc_Ntk_t * pNtk, * pNtk2, * pNtkRes = NULL; char * FileName; int fComb = 0; int c; pNtk = Abc_FrameReadNtk(pAbc); // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ch" ) ) != EOF ) { switch ( c ) { case 'c': fComb ^= 1; break; default: goto usage; } } if ( argc > globalUtilOptind + 1 ) { for ( c = 1; c < argc; c++ ) { Abc_Ntk_t * pTemp, * pLogic = Io_Read( argv[c], Io_ReadFileType(argv[c]), 1, 0 ); if ( pLogic == NULL ) return 1; if ( Abc_NtkIsStrash(pLogic) ) { pLogic = Abc_NtkToLogic( pTemp = pLogic ); Abc_NtkDelete( pTemp ); } if ( pLogic == NULL ) return 1; if ( pNtkRes == NULL ) pNtkRes = pLogic; else { pNtkRes = Abc_NtkPutOnTop( pTemp = pNtkRes, pLogic ); Abc_NtkDelete( pTemp ); Abc_NtkDelete( pLogic ); if ( pNtkRes == NULL ) return 1; } } assert( Abc_NtkIsLogic(pNtkRes) ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; } // get the second network if ( argc != globalUtilOptind + 1 ) { Abc_Print( -1, "The network to append is not given.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "The base network should be in the logic form.\n" ); return 1; } // check if the second network is combinational if ( Abc_NtkLatchNum(pNtk) ) { Abc_Print( -1, "The current network has latches. This command does not work for such networks.\n" ); return 0; } // read the second network FileName = argv[globalUtilOptind]; pNtk2 = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 ); if ( pNtk2 == NULL ) return 1; // check if the second network is combinational if ( Abc_NtkLatchNum(pNtk2) ) { Abc_NtkDelete( pNtk2 ); Abc_Print( -1, "The second network has latches. This command does not work for such networks.\n" ); return 0; } // compare inputs/outputs if ( Abc_NtkPoNum(pNtk) != Abc_NtkPiNum(pNtk2) ) { Abc_NtkDelete( pNtk2 ); Abc_Print( -1, "The PO count (%d) of the first network is not equal to PI count (%d) of the second network.\n", Abc_NtkPoNum(pNtk), Abc_NtkPiNum(pNtk2) ); return 0; } // get the new network if ( Abc_NtkIsLogic(pNtk2) ) pNtkRes = Abc_NtkPutOnTop( pNtk, pNtk2 ); else if ( Abc_NtkIsStrash(pNtk2) ) { Abc_Ntk_t * pLogic = Abc_NtkToLogic( pNtk2 ); pNtkRes = Abc_NtkPutOnTop( pNtk, pLogic ); Abc_NtkDelete( pLogic ); } else assert( 0 ); Abc_NtkDelete( pNtk2 ); // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: putontop [-h] \n" ); Abc_Print( -2, "\t connects PIs of network in to POs of current network\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t : file name with the second network\n"); Abc_Print( -2, "\t : (given several files, all networks are stacked on top of each other)\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkTemp, * pNtkRes; int nFrames; int fInitial; int fVerbose; int c; pNtk = Abc_FrameReadNtk(pAbc); // set defaults nFrames = 5; fInitial = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Fivh" ) ) != 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 'i': fInitial ^= 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; } // get the new network if ( !Abc_NtkIsStrash(pNtk) ) { pNtkTemp = Abc_NtkStrash( pNtk, 0, 0, 0 ); pNtkRes = Abc_NtkFrames( pNtkTemp, nFrames, fInitial, fVerbose ); Abc_NtkDelete( pNtkTemp ); } else pNtkRes = Abc_NtkFrames( pNtk, nFrames, fInitial, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Unrolling the network has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: frames [-F ] [-ivh]\n" ); Abc_Print( -2, "\t unrolls the network for a number of time frames\n" ); Abc_Print( -2, "\t-F : 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDFrames( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkTemp, * pNtkRes; int nPrefix; int nFrames; int fInitial; int fVerbose; int c; extern Abc_Ntk_t * Abc_NtkDarFrames( Abc_Ntk_t * pNtk, int nPrefix, int nFrames, int fInitial, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults nPrefix = 5; nFrames = 5; fInitial = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "NFivh" ) ) != EOF ) { switch ( c ) { case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nPrefix = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nPrefix <= 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; } nFrames = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nFrames <= 0 ) goto usage; break; case 'i': fInitial ^= 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 ( nPrefix > nFrames ) { Abc_Print( -1, "Prefix (%d) cannot be more than the number of frames (%d).\n", nPrefix, nFrames ); return 1; } // get the new network if ( !Abc_NtkIsStrash(pNtk) ) { pNtkTemp = Abc_NtkStrash( pNtk, 0, 0, 0 ); pNtkRes = Abc_NtkDarFrames( pNtkTemp, nPrefix, nFrames, fInitial, fVerbose ); Abc_NtkDelete( pNtkTemp ); } else pNtkRes = Abc_NtkDarFrames( pNtk, nPrefix, nFrames, fInitial, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Unrolling the network has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: dframes [-NF ] [-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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandSop( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_NtkFaninSort( Abc_Ntk_t * pNtk ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c, fCubeSort = 1, fMode = -1, nCubeLimit = 1000000; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Csdnh" ) ) != EOF ) { switch ( c ) { case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nCubeLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCubeLimit < 0 ) goto usage; break; case 's': fCubeSort ^= 1; break; case 'd': fMode = 1; break; case 'n': fMode = 0; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "Converting to SOP is possible only for logic networks.\n" ); return 1; } if ( fCubeSort && Abc_NtkHasSop(pNtk) ) { Abc_NtkSortSops(pNtk); return 0; } if ( !fCubeSort && Abc_NtkHasBdd(pNtk) && !Abc_NtkBddToSop(pNtk, -1, ABC_INFINITY, 0) ) { Abc_Print( -1, "Converting to SOP has failed.\n" ); return 0; } if ( !Abc_NtkToSop(pNtk, fMode, nCubeLimit) ) { Abc_Print( -1, "Converting to SOP has failed.\n" ); return 0; } if ( !fCubeSort ) Abc_NtkFaninSort( pNtk ); return 0; usage: Abc_Print( -2, "usage: sop [-C num] [-sdnh]\n" ); Abc_Print( -2, "\t converts node functions to SOP\n" ); Abc_Print( -2, "\t-C num : the limit on the number of cubes at a node [default = %d]\n", nCubeLimit ); Abc_Print( -2, "\t-s : toggles cube sort when converting from BDDs [default = %s]\n", fCubeSort ? "yes": "no" ); Abc_Print( -2, "\t-d : toggles using only positive polarity [default = %s]\n", fMode == 1 ? "yes": "no" ); Abc_Print( -2, "\t-n : toggles using only negative polarity [default = %s]\n", fMode == 0 ? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandBdd( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int fReorder = 1, fBdd2Sop = 0; int c; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "rsh" ) ) != EOF ) { switch ( c ) { case 'r': fReorder ^= 1; break; case 's': fBdd2Sop ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "Converting to BDD is possible only for logic networks.\n" ); return 1; } if ( fBdd2Sop && Abc_NtkHasSop(pNtk) ) return !Abc_NtkSopToBdd(pNtk); if ( Abc_NtkIsBddLogic(pNtk) ) { Abc_Print( -1, "The logic network is already in the BDD form.\n" ); return 0; } if ( !Abc_NtkToBdd(pNtk) ) { Abc_Print( -1, "Converting to BDD has failed.\n" ); return 1; } return 0; usage: Abc_Print( -2, "usage: bdd [-rsh]\n" ); Abc_Print( -2, "\t converts node functions to BDD\n" ); Abc_Print( -2, "\t-r : toggles enabling dynamic variable reordering [default = %s]\n", fReorder? "yes": "no" ); Abc_Print( -2, "\t-s : toggles constructing BDDs directly from SOPs [default = %s]\n", fBdd2Sop? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandAig( 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; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "Converting to AIG is possible only for logic networks.\n" ); return 1; } if ( Abc_NtkIsAigLogic(pNtk) ) { Abc_Print( -1, "The logic network is already in the AIG form.\n" ); return 0; } if ( !Abc_NtkToAig(pNtk) ) { Abc_Print( -1, "Converting to AIG has failed.\n" ); return 1; } return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandReorder( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fVerbose; extern void Abc_NtkBddReorder( Abc_Ntk_t * pNtk, int fVerbose ); // set defaults fVerbose = 0; 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network if ( !Abc_NtkIsBddLogic(pNtk) ) { Abc_Print( -1, "Variable reordering is possible when node functions are BDDs (run \"bdd\").\n" ); return 1; } Abc_NtkBddReorder( pNtk, fVerbose ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandBidec( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fVerbose; extern void Abc_NtkBidecResyn( Abc_Ntk_t * pNtk, int fVerbose ); // set defaults fVerbose = 0; 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network if ( !Abc_NtkIsAigLogic(pNtk) ) { Abc_Print( -1, "Bi-decomposition only works when node functions are AIGs (run \"aig\").\n" ); return 1; } Abc_NtkBidecResyn( pNtk, fVerbose ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandOrder( Abc_Frame_t * pAbc, int argc, char ** argv ) { FILE * pFile; Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); char * pFileName; int c; int fReverse; int fVerbose; 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 ); // set defaults fReverse = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "rvh" ) ) != EOF ) { switch ( c ) { case 'r': fReverse ^= 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_NtkLatchNum(pNtk) > 0 ) // { // Abc_Print( -1, "Currently this procedure does not work for sequential networks.\n" ); // return 1; // } // if the var order file is given, implement this order pFileName = NULL; if ( argc == globalUtilOptind + 1 ) { pFileName = argv[globalUtilOptind]; pFile = fopen( pFileName, "r" ); if ( pFile == NULL ) { Abc_Print( -1, "Cannot open file \"%s\" with the BDD variable order.\n", pFileName ); return 1; } fclose( pFile ); } if ( pFileName ) Abc_NtkImplementCiOrder( pNtk, pFileName, fReverse, fVerbose ); else Abc_NtkFindCiOrder( pNtk, fReverse, fVerbose ); return 0; usage: Abc_Print( -2, "usage: order [-rvh] \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 : (optional) file with the given variable order\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMuxes( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c, fGlobal = 0, fUseAdd = 0, Limit = 1000000; pNtk = Abc_FrameReadNtk(pAbc); // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Bgah" ) ) != EOF ) { switch ( c ) { case 'B': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-B\" should be followed by an integer.\n" ); goto usage; } Limit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( Limit < 0 ) goto usage; break; case 'g': fGlobal ^= 1; break; case 'a': fUseAdd ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( fGlobal ) { if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "The current network should be an AIG.\n" ); return 1; } } else { if ( !Abc_NtkIsBddLogic(pNtk) ) { Abc_Print( -1, "Only a BDD logic network can be converted to MUXes.\n" ); return 1; } } // get the new network pNtkRes = Abc_NtkBddToMuxes( pNtk, fGlobal, Limit, fUseAdd ); if ( pNtkRes == NULL ) { Abc_Print( 0, "Converting to MUXes has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: muxes [-B num] [-gah]\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-B : limit on live BDD nodes during collapsing [default = %d]\n", Limit ); Abc_Print( -2, "\t-g : toggle visualizing the global BDDs of primary outputs [default = %s].\n", fGlobal? "yes": "no" ); Abc_Print( -2, "\t-a : toggle using ADDs instead of BDDs [default = %s].\n", fUseAdd? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandCubes( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkSopToCubes( Abc_Ntk_t * pNtk, int fXor ); Abc_Ntk_t * pNtk, * pNtkRes; int c, fXor = 0; pNtk = Abc_FrameReadNtk(pAbc); // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "xh" ) ) != EOF ) { switch ( c ) { case 'x': fXor ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsSopLogic(pNtk) ) { Abc_Print( -1, "Only a SOP logic network can be transformed into cubes.\n" ); return 1; } // get the new network pNtkRes = Abc_NtkSopToCubes( pNtk, fXor ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Converting to cubes has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: cubes [-xh]\n" ); Abc_Print( -2, "\t converts the current network into a network derived by creating\n" ); Abc_Print( -2, "\t a separate node for each product and sum in the local SOPs\n" ); Abc_Print( -2, "\t-x : toggle using XOR instead of OR [default = %s]\n", fXor? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandExpand( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_NtkExpandCubes( Abc_Ntk_t * pNtk, Gia_Man_t * pGia, int fVerbose ); Abc_Ntk_t * pStrash, * pNtk2, * pNtk = Abc_FrameReadNtk(pAbc); Gia_Man_t * pGia; int c, fVerbose = 0; 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsSopLogic(pNtk) ) { Abc_Print( -1, "Only a SOP logic network can be transformed into cubes.\n" ); return 1; } if ( Abc_NtkLevel(pNtk) > 1 ) { Abc_Print( -1, "The number of logic levels is more than 1 (collapse the network and try again).\n" ); return 1; } // read the offset representation if ( argc != globalUtilOptind + 1 ) { Abc_Print( 0, "Using the complement of the current network as its offset.\n" ); pNtk2 = Abc_NtkDup( pNtk ); } else { char * FileName = argv[globalUtilOptind]; pNtk2 = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 ); if ( pNtk2 == NULL ) { Abc_Print( -1, "Failed to read the current network from file \"%s\".\n", FileName ); return 1; } } // strash the network pStrash = Abc_NtkStrash( pNtk2, 0, 1, 0 ); Abc_NtkDelete( pNtk2 ); // convert it into an AIG pGia = Abc_NtkClpGia( pStrash ); //Gia_AigerWrite( pGia, "aig_dump.aig", 0, 0, 0 ); Abc_NtkDelete( pStrash ); // get the new network Abc_NtkExpandCubes( pNtk, pGia, fVerbose ); Gia_ManStop( pGia ); return 0; usage: Abc_Print( -2, "usage: expand [-vh] \n" ); Abc_Print( -2, "\t expands cubes against the offset\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"); Abc_Print( -2, "\tfile : (optional) representation of on-set plus dc-set\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandSplitSop( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkSplitSop( Abc_Ntk_t * pNtk, int nCubesMax, int fVerbose ); Abc_Ntk_t * pNtk, * pNtkRes; int c, fVerbose = 0, nCubesMax = 100; pNtk = Abc_FrameReadNtk(pAbc); // set defaults 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; } nCubesMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCubesMax < 0 ) goto usage; 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_NtkIsSopLogic(pNtk) ) { Abc_Print( -1, "Only a SOP logic network can be transformed into cubes.\n" ); return 1; } // get the new network pNtkRes = Abc_NtkSplitSop( pNtk, nCubesMax, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Converting to cubes has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: splitsop [-N num] [-vh]\n" ); Abc_Print( -2, "\t splits nodes whose SOP size is larger than the given one\n" ); Abc_Print( -2, "\t-N num : the maximum number of cubes after splitting [default = %d]\n", nCubesMax ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandExtSeqDcs( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fVerbose; extern int Abc_NtkExtractSequentialDcs( Abc_Ntk_t * pNet, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults fVerbose = 0; 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) == 0 ) { Abc_Print( -1, "The current network has no latches.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Extracting sequential don't-cares works only for AIGs (run \"strash\").\n" ); return 0; } if ( !Abc_NtkExtractSequentialDcs( pNtk, fVerbose ) ) { Abc_Print( -1, "Extracting sequential don't-cares has failed.\n" ); return 1; } return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandReach( Abc_Frame_t * pAbc, int argc, char ** argv ) { Saig_ParBbr_t Pars, * pPars = &Pars; Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; char * pLogFileName = NULL; extern int Abc_NtkDarReach( Abc_Ntk_t * pNtk, Saig_ParBbr_t * pPars ); // set defaults Bbr_ManSetDefaultParams( pPars ); Extra_UtilGetoptReset(); 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 ) { 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 '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': pPars->fPartition ^= 1; break; case 'r': pPars->fReorder ^= 1; break; case 'o': pPars->fReorderImage ^= 1; break; case 'y': pPars->fSkipOutCheck ^= 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_NtkLatchNum(pNtk) == 0 ) { Abc_Print( -1, "The current network has no latches.\n" ); return 0; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Reachability analysis works only for AIGs (run \"strash\").\n" ); return 1; } if ( pAbc->fBatchMode && (pAbc->Status == 0 || pAbc->Status == 1) ) { Abc_Print( 1, "The miters is already solved; skipping the command.\n" ); return 0; } pAbc->Status = Abc_NtkDarReach( pNtk, pPars ); pAbc->nFrames = pPars->iFrame; Abc_FrameReplaceCex( pAbc, &pNtk->pSeqModel ); if ( pLogFileName ) Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, pAbc->nFrames, "reach" ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandCone( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; Abc_Obj_t * pNode, * pNodeCo; int c; int fUseAllCis; int fUseMffc; int fSeq; int Output; int nRange; extern Abc_Ntk_t * Abc_NtkMakeOnePo( Abc_Ntk_t * pNtk, int Output, int nRange ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults fUseAllCis = 0; fUseMffc = 0; fSeq = 0; Output = -1; nRange = -1; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ORmash" ) ) != EOF ) { switch ( c ) { case 'O': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-O\" should be followed by an integer.\n" ); goto usage; } Output = atoi(argv[globalUtilOptind]); globalUtilOptind++; 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; case 'a': fUseAllCis ^= 1; break; case 's': fSeq ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Currently can only be applied to the logic network or an AIG.\n" ); return 1; } if ( argc > globalUtilOptind + 1 ) { Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } pNodeCo = NULL; if ( argc == globalUtilOptind + 1 ) { pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } if ( fUseMffc ) pNtkRes = Abc_NtkCreateMffc( pNtk, pNode, argv[globalUtilOptind] ); else pNtkRes = Abc_NtkCreateCone( pNtk, pNode, argv[globalUtilOptind], fUseAllCis ); } else { if ( Output == -1 ) { Abc_Print( -1, "The node is not specified.\n" ); return 1; } if ( 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_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 ) { Abc_NtkPo(pNtkRes, 0)->fCompl0 ^= 1; // Abc_Print( -1, "The extracted cone represents the complement function of the CO.\n" ); } if ( pNtkRes == NULL ) { Abc_Print( -1, "Writing the logic cone of one node has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: cone [-OR num] [-amsh] \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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandNode( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; Abc_Obj_t * pNode; 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_NtkIsLogic(pNtk) ) { Abc_Print( -1, "Currently can only be applied to a logic network.\n" ); return 1; } if ( argc != globalUtilOptind + 1 ) { Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } pNtkRes = Abc_NtkCreateFromNode( pNtk, pNode ); // pNtkRes = Abc_NtkDeriveFromBdd( pNtk->pManFunc, pNode->pData, NULL, NULL ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Splitting one node has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: node [-h] \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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRange( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c; pNtk = Abc_FrameReadNtk(pAbc); 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, "Currently can only be applied to an AIG.\n" ); return 1; } pNtkRes = Abc_NtkCreateFromRange( pNtk ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Deriving the network has failed.\n" ); return 1; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: range [-h]\n" ); Abc_Print( -2, "\t computes the range of output values as one node\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandCof( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk; Abc_Obj_t * pNode; int c, Const; 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_NtkIsLogic(pNtk) ) { Abc_Print( -1, "Currently can only be applied to a logic network.\n" ); return 1; } if ( argc != globalUtilOptind + 2 ) { Abc_Print( -1, "Wrong number of auguments.\n" ); goto usage; } pNode = Abc_NtkFindCi( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) pNode = Abc_NtkFindNode( pNtk, argv[globalUtilOptind] ); if ( pNode == NULL ) { Abc_Print( -1, "Cannot find node \"%s\".\n", argv[globalUtilOptind] ); return 1; } Const = atoi( argv[globalUtilOptind+1] ); if ( Const != 0 && Const != 1 ) { Abc_Print( -1, "Constant should be 0 or 1.\n", argv[globalUtilOptind+1] ); return 1; } Abc_ObjReplaceByConstant( pNode, Const ); return 0; usage: Abc_Print( -2, "usage: cof [-h] \n" ); Abc_Print( -2, "\t replaces one node in a logic network by constant 0 or 1\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t : the node to replace\n"); Abc_Print( -2, "\t : the constant to replace the node with\n"); Abc_Print( -2, "\tname : the node name\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTopmost( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c, nLevels; extern Abc_Ntk_t * Abc_NtkTopmost( Abc_Ntk_t * pNtk, int nLevels ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults nLevels = 10; 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; } nLevels = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLevels < 0 ) goto usage; 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, "Currently only works for combinational circuits.\n" ); return 0; } pNtkRes = Abc_NtkTopmost( pNtk, nLevels ); if ( pNtkRes == NULL ) { Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandBottommost( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c, nLevels; extern Abc_Ntk_t * Abc_NtkBottommost( Abc_Ntk_t * pNtk, int nLevels ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults nLevels = 10; 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; } nLevels = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLevels < 0 ) goto usage; 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, "Currently only works for combinational circuits.\n" ); return 0; } pNtkRes = Abc_NtkBottommost( pNtk, nLevels ); if ( pNtkRes == NULL ) { Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: bottommost [-N num] [-h]\n" ); Abc_Print( -2, "\t replaces the current network by several of its bottommost 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTopAnd( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c; extern Abc_Ntk_t * Abc_NtkTopAnd( Abc_Ntk_t * pNtk ); 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, "Currently only works for structurally hashed circuits.\n" ); return 0; } if ( Abc_NtkLatchNum(pNtk) > 0 ) { Abc_Print( -1, "Currently can only works for combinational circuits.\n" ); return 0; } if ( Abc_NtkPoNum(pNtk) != 1 ) { Abc_Print( -1, "Currently expects a single-output miter.\n" ); return 0; } if ( Abc_ObjFaninC0(Abc_NtkPo(pNtk, 0)) ) { Abc_Print( -1, "The PO driver is complemented. AND-decomposition is impossible.\n" ); return 0; } if ( !Abc_ObjIsNode(Abc_ObjChild0(Abc_NtkPo(pNtk, 0))) ) { Abc_Print( -1, "The PO driver is not a node. AND-decomposition is impossible.\n" ); return 0; } pNtkRes = Abc_NtkTopAnd( pNtk ); if ( pNtkRes == NULL ) { Abc_Print( -1, "The command has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTrim( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; Gia_Man_t * pGia, * pNew; Aig_Man_t * pAig; int c; pNtk = Abc_FrameReadNtk(pAbc); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Nh" ) ) != 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, "Trimming works only for AIGs (run \"strash\").\n" ); return 1; } // convert to GIA pAig = Abc_NtkToDar( pNtk, 0, 1 ); pGia = Gia_ManFromAigSimple( pAig ); Aig_ManStop( pAig ); // perform trimming pNew = Gia_ManDupTrimmed( pGia, 1, 1, 0, -1 ); Gia_ManStop( pGia ); // convert back pAig = Gia_ManToAigSimple( pNew ); Gia_ManStop( pNew ); pNtkRes = Abc_NtkFromAigPhase( pAig ); Aig_ManStop( pAig ); // duplicate the name and the spec ABC_FREE( pNtkRes->pName ); ABC_FREE( pNtkRes->pSpec ); pNtkRes->pName = Extra_UtilStrsav(pNtk->pName); pNtkRes->pSpec = Extra_UtilStrsav(pNtk->pSpec); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: trim [-h]\n" ); Abc_Print( -2, "\t removes POs fed by constants and PIs w/o fanout\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandShortNames( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c, fKeepIo = 0; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "kh" ) ) != EOF ) { switch ( c ) { case 'k': fKeepIo ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( fKeepIo ) Abc_NtkCleanNames( pNtk ); else Abc_NtkShortNames( pNtk ); return 0; usage: Abc_Print( -2, "usage: short_names [-kh]\n" ); Abc_Print( -2, "\t replaces PI/PO/latch names by short char strings\n" ); Abc_Print( -2, "\t-k : toggle keeping PI/PO names unchanged [default = %s]\n", fKeepIo? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMoveNames( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_NtkMoveNames( Abc_Ntk_t * pNtk, Abc_Ntk_t * pOld ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtk2; char * FileName; int c; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } // get the second network if ( argc != globalUtilOptind + 1 ) { Abc_Print( -1, "The network to take names from is not given.\n" ); return 1; } // read the second network FileName = argv[globalUtilOptind]; pNtk2 = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 ); if ( pNtk2 == NULL ) return 1; // compare inputs/outputs if ( Abc_NtkPiNum(pNtk) != Abc_NtkPiNum(pNtk2) ) { Abc_NtkDelete( pNtk2 ); Abc_Print( -1, "The PI count (%d) of the first network is not equal to PI count (%d) of the second network.\n", Abc_NtkPiNum(pNtk), Abc_NtkPiNum(pNtk2) ); return 0; } // compare inputs/outputs if ( Abc_NtkPoNum(pNtk) != Abc_NtkPoNum(pNtk2) ) { Abc_NtkDelete( pNtk2 ); Abc_Print( -1, "The PO count (%d) of the first network is not equal to PO count (%d) of the second network.\n", Abc_NtkPoNum(pNtk), Abc_NtkPoNum(pNtk2) ); return 0; } // compare inputs/outputs if ( Abc_NtkLatchNum(pNtk) != Abc_NtkLatchNum(pNtk2) ) { Abc_NtkDelete( pNtk2 ); Abc_Print( -1, "The flop count (%d) of the first network is not equal to flop count (%d) of the second network.\n", Abc_NtkLatchNum(pNtk), Abc_NtkLatchNum(pNtk2) ); return 0; } Abc_NtkMoveNames( pNtk, pNtk2 ); Abc_NtkDelete( pNtk2 ); return 0; usage: Abc_Print( -2, "usage: move_names [-h] \n" ); Abc_Print( -2, "\t moves PI/PO/latch names from the other network\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t : file with network that has required names\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandExdcFree( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; 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 ( pNtk->pExdc == NULL ) { Abc_Print( -1, "The network has no EXDC.\n" ); return 1; } Abc_NtkDelete( pNtk->pExdc ); pNtk->pExdc = NULL; // replace the current network pNtkRes = Abc_NtkDup( pNtk ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandExdcGet( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; 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 ( pNtk->pExdc == NULL ) { Abc_Print( -1, "The network has no EXDC.\n" ); return 1; } // replace the current network pNtkRes = Abc_NtkDup( pNtk->pExdc ); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandExdcSet( Abc_Frame_t * pAbc, int argc, char ** argv ) { FILE * pFile; Abc_Ntk_t * pNtk, * pNtkNew, * pNtkRes; char * FileName; 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 ( argc != globalUtilOptind + 1 ) { goto usage; } // get the input file name FileName = argv[globalUtilOptind]; if ( (pFile = fopen( FileName, "r" )) == NULL ) { Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); if ( (FileName = Extra_FileGetSimilarName( FileName, ".mv", ".blif", ".pla", ".eqn", ".bench" )) ) Abc_Print( 1, "Did you mean \"%s\"?", FileName ); Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); // set the new network pNtkNew = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 ); if ( pNtkNew == NULL ) { Abc_Print( -1, "Reading network from file has failed.\n" ); return 1; } // replace the EXDC if ( pNtk->pExdc ) { Abc_NtkDelete( pNtk->pExdc ); pNtk->pExdc = NULL; } pNtkRes = Abc_NtkDup( pNtk ); pNtkRes->pExdc = pNtkNew; // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: exdc_set [-h] \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 with the new EXDC network\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandCareSet( Abc_Frame_t * pAbc, int argc, char ** argv ) { FILE * pFile; Abc_Ntk_t * pNtk, * pNtkNew, * pNtkRes; char * FileName; 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 ( argc != globalUtilOptind + 1 ) { goto usage; } // get the input file name FileName = argv[globalUtilOptind]; if ( (pFile = fopen( FileName, "r" )) == NULL ) { Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); if ( (FileName = Extra_FileGetSimilarName( FileName, ".mv", ".blif", ".pla", ".eqn", ".bench" )) ) Abc_Print( 1, "Did you mean \"%s\"?", FileName ); Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); // set the new network pNtkNew = Io_Read( FileName, Io_ReadFileType(FileName), 1, 0 ); if ( pNtkNew == NULL ) { Abc_Print( -1, "Reading network from file has failed.\n" ); return 1; } // replace the EXDC if ( pNtk->pExcare ) { Abc_NtkDelete( (Abc_Ntk_t *)pNtk->pExcare ); pNtk->pExcare = NULL; } pNtkRes = Abc_NtkDup( pNtk ); pNtkRes->pExcare = pNtkNew; // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: care_set [-h] \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 with the new care network\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ 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; 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 ); // set defaults fOracle = 0; memset( pParams, 0, sizeof(Cut_Params_t) ); pParams->nVarsMax = 5; // the max cut size ("k" of the k-feasible cuts) pParams->nKeepMax = 1000; // the max number of cuts kept at a node pParams->fTruth = 1; // compute truth tables pParams->fFilter = 1; // filter dominated cuts pParams->fDrop = 0; // drop cuts on the fly pParams->fDag = 1; // compute DAG cuts pParams->fTree = 0; // compute tree cuts pParams->fGlobal = 0; // compute global cuts pParams->fLocal = 0; // compute local cuts pParams->fFancy = 0; // compute something fancy pParams->fRecordAig = 1; // compute something fancy pParams->fMap = 0; // compute mapping delay pParams->fAdjust = 0; // removes useless fanouts pParams->fNpnSave = 0; // enables dumping truth tables pParams->fVerbose = 0; // the verbosiness flag Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "KMtfdxyglzamjvosh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } pParams->nVarsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nVarsMax < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pParams->nKeepMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nKeepMax < 0 ) goto usage; break; case 't': pParams->fTruth ^= 1; break; case 'f': pParams->fFilter ^= 1; break; case 'd': pParams->fDrop ^= 1; break; case 'x': pParams->fDag ^= 1; break; case 'y': pParams->fTree ^= 1; break; case 'g': pParams->fGlobal ^= 1; break; case 'l': pParams->fLocal ^= 1; break; case 'z': pParams->fFancy ^= 1; break; case 'a': pParams->fRecordAig ^= 1; break; case 'm': pParams->fMap ^= 1; break; case 'j': pParams->fAdjust ^= 1; break; case 'v': pParams->fVerbose ^= 1; break; case 'o': fOracle ^= 1; break; case 's': pParams->fNpnSave ^= 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, "Cut computation is available only for AIGs (run \"strash\").\n" ); return 1; } if ( pParams->nVarsMax < CUT_SIZE_MIN || pParams->nVarsMax > 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 ) { Abc_Print( -1, "Cannot compute both DAG cuts and tree cuts at the same time.\n" ); return 1; } if ( pParams->fNpnSave ) { pParams->nVarsMax = 6; pParams->fTruth = 1; } if ( fOracle ) pParams->fRecord = 1; pCutMan = Abc_NtkCuts( pNtk, pParams ); if ( fOracle ) pCutOracle = Cut_OracleStart( pCutMan ); Cut_ManStop( pCutMan ); if ( fOracle ) { assert(pCutOracle); Abc_NtkCutsOracle( pNtk, pCutOracle ); Cut_OracleStop( pCutOracle ); } return 0; usage: Abc_Print( -2, "usage: cut [-K num] [-M num] [-tfdcovamjsvh]\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-s : toggle creating library of 6-var functions [default = %s]\n", pParams->fNpnSave? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandScut( Abc_Frame_t * pAbc, int argc, char ** argv ) { Cut_Params_t Params, * pParams = &Params; Cut_Man_t * pCutMan; Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; extern Cut_Man_t * Abc_NtkSeqCuts( Abc_Ntk_t * pNtk, Cut_Params_t * pParams ); // set defaults memset( pParams, 0, sizeof(Cut_Params_t) ); pParams->nVarsMax = 5; // the max cut size ("k" of the k-feasible cuts) pParams->nKeepMax = 1000; // the max number of cuts kept at a node pParams->fTruth = 0; // compute truth tables pParams->fFilter = 1; // filter dominated cuts pParams->fSeq = 1; // compute sequential cuts pParams->fVerbose = 0; // the verbosiness flag Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "KMtvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } pParams->nVarsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nVarsMax < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pParams->nKeepMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nKeepMax < 0 ) goto usage; break; case 't': pParams->fTruth ^= 1; break; case 'v': pParams->fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } /* if ( !Abc_NtkIsSeq(pNtk) ) { 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 ) { Abc_Print( -1, "Can only compute the cuts for %d <= K <= %d.\n", CUT_SIZE_MIN, CUT_SIZE_MAX ); return 1; } pCutMan = Abc_NtkSeqCuts( pNtk, pParams ); Cut_ManStop( pCutMan ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandEspresso( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fVerbose; extern void Abc_NtkEspresso( Abc_Ntk_t * pNtk, int fVerbose ); if ( argc == 2 && !strcmp(argv[1], "-h") ) { Abc_Print( -2, "The espresso command is currently disabled.\n" ); return 1; } Abc_Print( -1, "This command is currently disabled.\n" ); return 0; // set defaults fVerbose = 0; 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { Abc_Print( -1, "SOP minimization is possible for logic networks (run \"renode\").\n" ); return 1; } // Abc_NtkEspresso( pNtk, fVerbose ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandGen( Abc_Frame_t * pAbc, int argc, char ** argv ) { // Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nVars; // the number of variables int nArgs; // the number of arguments int nLutSize = -1; // the size of LUTs int nLuts = -1; // the number of LUTs int fAdder; int fAdderTree; int fSorter; int fMesh; int fMulti; int fBooth; int fFpga; int fOneHot; int fRandom; int fGraph; int fVerbose; char * FileName; char Command[1000]; extern void Abc_GenAdder( char * pFileName, int nVars ); extern void Abc_GenSorter( char * pFileName, int nVars ); extern void Abc_GenMesh( char * pFileName, int nVars ); extern void Abc_GenMulti( char * pFileName, int nVars ); extern void Abc_GenBooth( char * pFileName, int nVars ); extern void Abc_GenFpga( char * pFileName, int nLutSize, int nLuts, int nVars ); extern void Abc_GenOneHot( char * pFileName, int nVars ); extern void Abc_GenRandom( char * pFileName, int nPis ); extern void Abc_GenGraph( char * pFileName, int nPis ); extern void Abc_GenAdderTree( char * pFileName, int nArgs, int nBits ); // set defaults nVars = 8; nArgs = 8; fAdder = 0; fAdderTree = 0; fSorter = 0; fMesh = 0; fMulti = 0; fBooth = 0; fFpga = 0; fOneHot = 0; fRandom = 0; fGraph = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "NAKLatsembfnrgvh" ) ) != 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 'A': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-A\" should be followed by an integer.\n" ); goto usage; } nArgs = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nArgs < 0 ) goto usage; break; case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLutSize < 0 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLuts = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLuts < 0 ) goto usage; break; case 'a': fAdder ^= 1; break; case 't': fAdderTree ^= 1; break; case 's': fSorter ^= 1; break; case 'e': fMesh ^= 1; break; case 'm': fMulti ^= 1; break; case 'b': fBooth ^= 1; break; case 'f': fFpga ^= 1; break; case 'n': fOneHot ^= 1; break; case 'r': fRandom ^= 1; break; case 'g': fGraph ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc != globalUtilOptind + 1 ) { goto usage; } if ( nVars < 1 ) { Abc_Print( -1, "The number of variables should be a positive integer.\n" ); return 0; } // get the input file name FileName = argv[globalUtilOptind]; if ( fAdder ) Abc_GenAdder( FileName, nVars ); else if ( fSorter ) Abc_GenSorter( FileName, nVars ); else if ( fMesh ) Abc_GenMesh( FileName, nVars ); else if ( fMulti ) Abc_GenMulti( FileName, nVars ); else if ( fBooth ) Abc_GenBooth( FileName, nVars ); else if ( fFpga ) Abc_GenFpga( FileName, nLutSize, nLuts, nVars ); // Abc_GenFpga( FileName, 2, 2, 3 ); // Abc_GenFpga( FileName, 3, 2, 5 ); else if ( fOneHot ) Abc_GenOneHot( FileName, nVars ); else if ( fRandom ) Abc_GenRandom( FileName, nVars ); else if ( fGraph ) Abc_GenGraph( FileName, nVars ); else if ( fAdderTree ) { printf( "Generating adder tree with %d arguments and %d bits.\n", nArgs, nVars ); Abc_GenAdderTree( FileName, nArgs, nVars ); sprintf( Command, "%%read %s; %%blast; &put", FileName ); Cmd_CommandExecute( pAbc, Command ); return 0; } else { Abc_Print( -1, "Type of circuit is not specified.\n" ); return 0; } // read the file just produced sprintf(Command, "read %s", FileName ); Cmd_CommandExecute( pAbc, Command ); return 0; usage: Abc_Print( -2, "usage: gen [-NAKL num] [-atsembfnrgvh] \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 num : the number of arguments (for adder tree) [default = %d]\n", nArgs ); Abc_Print( -2, "\t-K num : the LUT size (to be used with switch -f) [default = %d]\n", nLutSize ); Abc_Print( -2, "\t-L num : the LUT count (to be used with switch -f) [default = %d]\n", nLuts ); Abc_Print( -2, "\t-a : generate ripple-carry adder [default = %s]\n", fAdder? "yes": "no" ); Abc_Print( -2, "\t-t : generate an adder tree [default = %s]\n", fAdderTree? "yes": "no" ); Abc_Print( -2, "\t-s : generate a sorter [default = %s]\n", fSorter? "yes": "no" ); Abc_Print( -2, "\t-e : generate a mesh [default = %s]\n", fMesh? "yes": "no" ); Abc_Print( -2, "\t-m : generate a multiplier [default = %s]\n", fMulti? "yes": "no" ); Abc_Print( -2, "\t-b : generate a signed Booth multiplier [default = %s]\n", fBooth? "yes": "no" ); Abc_Print( -2, "\t-f : generate a LUT FPGA structure [default = %s]\n", fFpga? "yes": "no" ); Abc_Print( -2, "\t-g : generate a graph structure [default = %s]\n", fGraph? "yes": "no" ); Abc_Print( -2, "\t-n : 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 : output file name\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandGenTF( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_GenThresh( char * pFileName, int nBits, Vec_Int_t * vNums, int nLutSize, char * pArch ); int c, nBits = 0, nLutSize = -1, fVerbose = 0, nSum = 0; char Command[1000], * pFileName = "out.blif", * pArch = NULL; Vec_Int_t * vNums = NULL; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "WKAvh" ) ) != EOF ) { switch ( c ) { case 'W': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-W\" should be followed by an integer.\n" ); goto usage; } nBits = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nBits < 0 ) goto usage; break; case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLutSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLutSize < 0 ) goto usage; break; case 'A': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-A\" should be followed by a file name.\n" ); goto usage; } pArch = argv[globalUtilOptind]; globalUtilOptind++; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc == globalUtilOptind ) goto usage; if ( nBits == 0 ) { Abc_Print( -1, "Bit-width should be specified.\n" ); return 0; } if ( nLutSize != -1 && nLutSize != 4 && nLutSize != 6 ) { Abc_Print( -1, "LUT size %d is not supported.\n", nLutSize ); return 0; } if ( pArch ) { int Counts[2] = {0}; for ( c = 0; c < strlen(pArch); c++ ) if ( pArch[c] == '(' ) Counts[0]++; else if ( pArch[c] == ')' ) Counts[1]++; else if ( pArch[c] >= '1' && pArch[c] <= '9' ) nSum += pArch[c] - '0'; else if ( pArch[c] >= 'A' && pArch[c] <= 'Z' ) nSum += pArch[c] - 'A' + 10; else { Abc_Print( -1, "Architecture description contains a wrong symbol (%c).\n", pArch[c] ); return 0; } if ( Counts[0] != Counts[1] ) { Abc_Print( -1, "Mismatching number of opening and closing parentheses (%d and %d).\n", Counts[0], Counts[1] ); return 0; } } vNums = Vec_IntAlloc( argc ); for ( c = globalUtilOptind; c < argc; c++ ) Vec_IntPush( vNums, atoi(argv[c]) ); if ( Vec_IntSize(vNums) < 3 ) { Abc_Print( -1, "Expecting that at least two weights and a threshold are specified on the command line.\n" ); Vec_IntFree( vNums ); return 0; } if ( pArch && nSum != Vec_IntSize(vNums)-1 ) { Abc_Print( -1, "The architecture assumes %d sum inputs while there are %d weights.\n", nSum, Vec_IntSize(vNums)-1 ); Vec_IntFree( vNums ); return 0; } printf( "Generating threshold function with %d inputs and bit-width %d.\n", Vec_IntSize(vNums)-1, nBits ); Abc_GenThresh( pFileName, nBits, vNums, nLutSize, pArch ); if ( nLutSize == 4 || nLutSize == 6 ) sprintf(Command, "read %s; strash; if -K %d -am; mfs2 -W 10 -L 10 -M 1000", pFileName, nLutSize ); else sprintf(Command, "read %s", pFileName ); Cmd_CommandExecute( pAbc, Command ); Vec_IntFree( vNums ); return 0; usage: Abc_Print( -2, "usage: gentf [-WK num] [-A str] [-vh] ... \n" ); Abc_Print( -2, "\t generates threshold function\n" ); Abc_Print( -2, "\t-W num : the bit-width [default = none]\n" ); Abc_Print( -2, "\t-K num : the LUT size [default = none]\n" ); Abc_Print( -2, "\t-A str : the circuit architecture [default = none]\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"); Abc_Print( -2, "\t : weights and threshold\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandGenAT( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_GenAT( char * pFileName, Vec_Int_t * vNums ); extern void Abc_GenATDual( char * pFileName, Vec_Int_t * vNums ); int c, fDual = 0, fVerbose = 0; char Command[1000], * pFileName = "out.blif"; Vec_Int_t * vNums = NULL; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dvh" ) ) != EOF ) { switch ( c ) { case 'd': fDual ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc == globalUtilOptind ) goto usage; vNums = Vec_IntAlloc( argc ); for ( c = globalUtilOptind; c < argc; c++ ) Vec_IntPush( vNums, atoi(argv[c]) ); if ( fDual ) Abc_GenATDual( pFileName, vNums ); else Abc_GenAT( pFileName, vNums ); sprintf(Command, "read %s", pFileName ); Cmd_CommandExecute( pAbc, Command ); Vec_IntFree( vNums ); return 0; usage: Abc_Print( -2, "usage: genat [-dvh] ... \n" ); Abc_Print( -2, "\t generates the adder tree\n" ); Abc_Print( -2, "\t-d : toggle building dual tree [default = %s]\n", fDual? "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 : input counts by rank\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandGenFsm( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_GenFsm( char * pFileName, int nIns, int nOuts, int nStates, int nLines, int ProbI, int ProbO ); int c, nIns, nOuts, nStates, nLines, ProbI, ProbO, fVerbose; char * FileName; // set defaults nIns = 30; nOuts = 1; nStates = 20; nLines = 100; ProbI = 10; ProbO = 100; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "IOSLPQvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nIns = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIns < 0 ) goto usage; break; case 'O': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-O\" should be followed by an integer.\n" ); goto usage; } nOuts = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nOuts < 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; } nStates = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nStates < 0 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLines = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLines < 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; } ProbI = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( ProbI < 0 ) goto usage; break; case 'Q': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-Q\" should be followed by an integer.\n" ); goto usage; } ProbO = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( ProbO < 0 ) goto usage; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc != globalUtilOptind + 1 ) { goto usage; } if ( nIns < 1 || nStates < 1 || nLines < 1 || ProbI < 1 || ProbO < 1 ) { Abc_Print( -1, "The number of inputs. states, lines, and probablity should be positive integers.\n" ); goto usage; } // get the input file name FileName = argv[globalUtilOptind]; Abc_GenFsm( FileName, nIns, nOuts, nStates, nLines, ProbI, ProbO ); return 0; usage: Abc_Print( -2, "usage: genfsm [-IOSLPQ num] [-vh] \n" ); Abc_Print( -2, "\t generates random FSM in KISS format\n" ); Abc_Print( -2, "\t-I num : the number of input variables [default = %d]\n", nIns ); Abc_Print( -2, "\t-O num : the number of output variables [default = %d]\n", nOuts ); Abc_Print( -2, "\t-S num : the number of state variables [default = %d]\n", nStates ); Abc_Print( -2, "\t-L num : the number of lines (product terms) [default = %d]\n", nLines ); Abc_Print( -2, "\t-P num : percentage propability of a variable present in the input cube [default = %d]\n", ProbI ); Abc_Print( -2, "\t-Q num : percentage propability of a variable present in the output cube [default = %d]\n", ProbO ); 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 : output file name\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandCover( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c; int fVerbose; int fUseSop; int fUseEsop; int fUseInvs; int nFaninMax; int nCubesMax; pNtk = Abc_FrameReadNtk(pAbc); // set defaults fUseSop = 1; fUseEsop = 0; fVerbose = 0; fUseInvs = 1; nFaninMax = 8; nCubesMax = 8; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "IPsxivh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nFaninMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nFaninMax < 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; } nCubesMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCubesMax < 0 ) goto usage; break; case 's': fUseSop ^= 1; break; case 'x': fUseEsop ^= 1; break; case 'i': fUseInvs ^= 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Only works for strashed networks.\n" ); return 1; } // run the command pNtkRes = Abc_NtkSopEsopCover( pNtk, nFaninMax, nCubesMax, fUseEsop, fUseSop, fUseInvs, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: cover [-IP num] [-sxvh]\n" ); Abc_Print( -2, "\t decomposition into a network of SOP/ESOP PLAs\n" ); Abc_Print( -2, "\t (this command is known to have bugs)\n"); Abc_Print( -2, "\t-I num : maximum number of inputs [default = %d]\n", nFaninMax ); Abc_Print( -2, "\t-P num : maximum number of products [default = %d]\n", nCubesMax ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandInter( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtk1, * pNtk2, * pNtkRes = NULL; char ** pArgvNew; int nArgcNew; int c, fDelete1, fDelete2; int fRelation; int fVerbose; extern Abc_Ntk_t * Abc_NtkInter( Abc_Ntk_t * pNtkOn, Abc_Ntk_t * pNtkOff, int fRelation, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults fRelation = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "rvh" ) ) != EOF ) { switch ( c ) { case 'r': fRelation ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; if ( !Abc_NtkPrepareTwoNtks( stdout, pNtk, pArgvNew, nArgcNew, &pNtk1, &pNtk2, &fDelete1, &fDelete2, 1 ) ) return 1; if ( nArgcNew == 0 ) { Abc_Obj_t * pObj; int i; 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 ) { 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 ); if ( fDelete1 ) Abc_NtkDelete( pNtk1 ); if ( fDelete2 ) Abc_NtkDelete( pNtk2 ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: inter [-rvh] \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 ; iprove\"\n" ); Abc_Print( -2, "\t (b) \"miter -i ; iprove\"\n" ); Abc_Print( -2, "\t where is the network derived by complementing the\n" ); Abc_Print( -2, "\t outputs of : \"r ; st -i; w \"\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDouble( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c; int nFrames; int fVerbose; extern Abc_Ntk_t * Abc_NtkDouble( Abc_Ntk_t * pNtk ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults nFrames = 50; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != 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 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsSopLogic(pNtk) ) { Abc_Print( -1, "Only works for logic SOP networks.\n" ); return 1; } pNtkRes = Abc_NtkDouble( pNtk ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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] \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 : input file with design containing black boxes\n"); Abc_Print( -2, "\t : output file with design containing white boxes\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandOutdec( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkDarOutdec( Abc_Ntk_t * pNtk, int nLits, int fVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtkRes; int c, nLits = 1; int fVerbose = 0; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Lvh" ) ) != EOF ) { switch ( c ) { case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLits = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLits < 1 || nLits > 2 ) { Abc_Print( 1,"Currently, command \"outdec\" works for 1-lit and 2-lit primes only.\n" ); goto usage; } 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Only works for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDarOutdec( pNtk, nLits, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: outdec [-Lvh]\n" ); Abc_Print( -2, "\t performs prime decomposition of the first output\n" ); Abc_Print( -2, "\t-L num : the number of literals in the primes [default = %d]\n", nLits ); 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_CommandNodeDup( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Abc_Ntk_t * Abc_NtkNodeDup( Abc_Ntk_t * pNtk, int nLimit, int fVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); Abc_Ntk_t * pNtkRes; int c, nLimit = 30; int fVerbose = 0; // set defaults 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; } nLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Only works for logic networks.\n" ); return 1; } if ( nLimit < 2 ) { Abc_Print( -1, "The fanout limit should be more than 1.\n" ); return 1; } pNtkRes = Abc_NtkNodeDup( pNtk, nLimit, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: nodedup [-Nvh]\n" ); Abc_Print( -2, "\t duplicates internal nodes with high fanout\n" ); Abc_Print( -2, "\t-N num : the number of fanouts to start duplication [default = %d]\n", nLimit ); 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_CommandWrap( Abc_Frame_t * pAbc, int argc, char ** argv ) { char * pFileName = NULL, * pFileName2 = NULL; FILE * pFile = NULL, * pFile2 = NULL; int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( argc != globalUtilOptind + 2 ) { Abc_Print( 1,"Two file names are expected on the command line.\n" ); return 0; } pFileName = argv[globalUtilOptind]; pFileName2 = argv[globalUtilOptind+1]; pFile = fopen( pFileName, "rb" ); pFile2 = fopen( pFileName2, "wb" ); if ( pFile && pFile2 ) { char Buffer[1000]; while ( fgets( Buffer, 1000, pFile ) != NULL ) { if ( Buffer[strlen(Buffer)-1] == '\n' ) Buffer[strlen(Buffer)-1] = 0; if ( Buffer[strlen(Buffer)-1] == '\r' ) Buffer[strlen(Buffer)-1] = 0; fprintf( pFile2, " printf(\"%s\\n\");\n", Buffer ); } } if ( pFile ) fclose(pFile); if ( pFile2 ) fclose(pFile2); return 0; usage: Abc_Print( -2, "usage: wrap [-h] \n" ); Abc_Print( -2, "\t wrapping lines\n" ); Abc_Print( -2, "\t : input text file\n"); Abc_Print( -2, "\t : output text file\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTestColor( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_ColorTest(); Abc_ColorTest(); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Gia_Gen2CodeTest(); extern void Dau_NetworkEnumTest(); //Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int nCutMax = 1; int nLeafMax = 4; int nDivMax = 2; int nDecMax = 3; int nNumOnes = 0; int fNewAlgo = 0; int fNewOrder = 0; int fVerbose = 0; int fVeryVerbose = 0; int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "CKDNMaovwh" ) ) != EOF ) { switch ( c ) { case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nCutMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCutMax < 0 ) goto usage; break; case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLeafMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLeafMax < 0 ) goto usage; break; case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } nDivMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nDivMax < 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; } nDecMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nDecMax < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } nNumOnes = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nNumOnes < 0 ) goto usage; break; case 'a': fNewAlgo ^= 1; break; case 'o': fNewOrder ^= 1; break; case 'v': fVerbose ^= 1; break; case 'w': fVeryVerbose ^= 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, "This command works only for logic networks.\n" ); return 1; } */ /* if ( Abc_NtkLatchNum(pNtk) == 0 ) { Abc_Print( -1, "Only works for sequential networks.\n" ); return 1; } */ /* if ( pNtk ) { extern Abc_Ntk_t * Au_ManPerformTest( Abc_Ntk_t * p, int nCutMax, int nLeafMax, int nDivMax, int nDecMax, int fVerbose, int fVeryVerbose ); Abc_Ntk_t * pNtkRes = Au_ManPerformTest( pNtk, nCutMax, nLeafMax, nDivMax, nDecMax, fVerbose, fVeryVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 1; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } */ /* if ( pNtk ) { Aig_Man_t * pAig = Abc_NtkToDar( pNtk, 0, 1 ); Saig_ManBmcTerSimTestPo( pAig ); Aig_ManStop( pAig ); } */ /* if ( !Abc_NtkIsTopo(pNtk) ) { Abc_Print( -1, "Current network is not in a topological order.\n" ); return 1; } */ // if ( pNtk ) // Abc_NtkMakeLegit( pNtk ); { // extern void Ifd_ManDsdTest(); // Ifd_ManDsdTest(); } /* { extern void Abc_EnumerateCubeStates(); extern void Abc_EnumerateCubeStatesZdd(); if ( fNewAlgo ) Abc_EnumerateCubeStatesZdd(); else Abc_EnumerateCubeStates(); return 0; } */ { // extern void Abc_EnumerateFuncs( int nDecMax, int nDivMax, int fVerbose ); // Abc_EnumerateFuncs( 4, 7, 0 ); } /* if ( fNewAlgo ) { extern void Abc_SuppTest( int nOnes, int nVars, int fUseSimple, int fCheck, int fVerbose ); Abc_SuppTest( nNumOnes, nDecMax, fNewOrder, 0, fVerbose ); } else { extern void Bmc_EcoMiterTest(); Bmc_EcoMiterTest(); } */ { // extern void Nf_ManPrepareLibraryTest(); // Nf_ManPrepareLibraryTest(); // return 0; } /* if ( pNtk ) { // extern Abc_Ntk_t * Abc_NtkBarBufsOnOffTest( Abc_Ntk_t * pNtk ); // Abc_Ntk_t * pNtkRes = Abc_NtkBarBufsOnOffTest( pNtk ); extern Abc_Ntk_t * Abc_NtkPcmTest( Abc_Ntk_t * pNtk, int fNewAlgo, int fVerbose ); // extern Abc_Ntk_t * Abc_NtkPcmTestAig( Abc_Ntk_t * pNtk, int fVerbose ); Abc_Ntk_t * pNtkRes; // if ( Abc_NtkIsLogic(pNtk) ) pNtkRes = Abc_NtkPcmTest( pNtk, fNewAlgo, fVerbose ); // else // pNtkRes = Abc_NtkPcmTestAig( pNtk, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 1; } Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } */ /* { extern void Abc_IsopTestNew(); Abc_IsopTestNew(); } */ { // extern void Cba_PrsReadBlifTest(); // Cba_PrsReadBlifTest(); } // Abc_NtkComputePaths( Abc_FrameReadNtk(pAbc) ); //Dau_NetworkEnumTest(); //Extra_SimulationTest( nDivMax, nNumOnes, fNewOrder ); //Mnist_ExperimentWithScaling( nDecMax ); //Gyx_ProblemSolveTest(); /* { extern Abc_Ntk_t * Abc_NtkFromArray(); Abc_Ntk_t * pNtkRes = Abc_NtkFromArray(); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } */ //Gia_ManTestProblem(); //Abc_ReadPlaTest( "resub2.pla" ); return 0; usage: Abc_Print( -2, "usage: test [-CKDNM] [-aovwh] \n" ); Abc_Print( -2, "\t testbench for new procedures\n" ); Abc_Print( -2, "\t-C num : the max number of cuts [default = %d]\n", nCutMax ); Abc_Print( -2, "\t-K num : the max number of leaves [default = %d]\n", nLeafMax ); Abc_Print( -2, "\t-D num : the max number of divisors [default = %d]\n", nDivMax ); Abc_Print( -2, "\t-N num : the max number of node inputs [default = %d]\n", nDecMax ); Abc_Print( -2, "\t-M num : the max number of ones in the vector [default = %d]\n", nNumOnes ); Abc_Print( -2, "\t-a : toggle using new algorithm [default = %s]\n", fNewAlgo? "yes": "no" ); Abc_Print( -2, "\t-o : toggle using new ordering [default = %s]\n", fNewOrder? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandQuaVar( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults iVar = 0; fUniv = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Iuvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } iVar = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( iVar < 0 ) goto usage; break; case 'u': fUniv ^= 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_NtkGetChoiceNum( pNtk ) ) { Abc_Print( -1, "This command cannot be applied to an AIG with choice nodes.\n" ); return 1; } // get the strashed network pNtkRes = Abc_NtkStrash( pNtk, 0, 1, 0 ); RetValue = Abc_NtkQuantify( pNtkRes, fUniv, iVar, fVerbose ); // clean temporary storage for the cofactors Abc_NtkCleanData( pNtkRes ); Abc_AigCleanup( (Abc_Aig_t *)pNtkRes->pManFunc ); // check the result if ( !RetValue ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandQuaRel( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults iVar = 0; fInputs = 1; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Iqvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } iVar = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( iVar < 0 ) goto usage; break; case 'q': fInputs ^= 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_NtkGetChoiceNum( pNtk ) ) { Abc_Print( -1, "This command cannot be applied to an AIG with choice nodes.\n" ); return 1; } if ( Abc_NtkIsComb(pNtk) ) { Abc_Print( -1, "This command works only for sequential circuits.\n" ); return 1; } // get the strashed network if ( !Abc_NtkIsStrash(pNtk) ) { pNtk = Abc_NtkStrash( pNtk, 0, 1, 0 ); pNtkRes = Abc_NtkTransRel( pNtk, fInputs, fVerbose ); Abc_NtkDelete( pNtk ); } else pNtkRes = Abc_NtkTransRel( pNtk, fInputs, fVerbose ); // check if the result is available if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandQuaReach( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults nIters = 256; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Ivh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIters < 0 ) goto usage; 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_NtkGetChoiceNum( pNtk ) ) { Abc_Print( -1, "This command cannot be applied to an AIG with choice nodes.\n" ); return 1; } if ( !Abc_NtkIsComb(pNtk) ) { Abc_Print( -1, "This command works only for combinational transition relations.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } if ( Abc_NtkPoNum(pNtk) > 1 ) { Abc_Print( -1, "The transition relation should have one output.\n" ); return 1; } if ( Abc_NtkPiNum(pNtk) % 2 != 0 ) { 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 ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandSenseInput( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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 ); // set defaults nConfLim = 1000; fVerbose = 1; Extra_UtilGetoptReset(); 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; } nConfLim = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nConfLim < 0 ) goto usage; 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_NtkGetChoiceNum( pNtk ) ) { Abc_Print( -1, "This command cannot be applied to an AIG with choice nodes.\n" ); return 1; } if ( !Abc_NtkIsComb(pNtk) ) { Abc_Print( -1, "This command works only for combinational transition relations.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } if ( Abc_NtkPoNum(pNtk) < 2 ) { Abc_Print( -1, "The network should have at least two outputs.\n" ); return 1; } vResult = Abc_NtkSensitivity( pNtk, nConfLim, fVerbose ); Vec_IntFree( vResult ); return 0; usage: 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\n" ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandIStrash( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes, * pNtkTemp; int c; extern Abc_Ntk_t * Abc_NtkIvyStrash( Abc_Ntk_t * pNtk ); 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) ) { pNtkTemp = Abc_NtkStrash( pNtk, 0, 1, 0 ); pNtkRes = Abc_NtkIvyStrash( pNtkTemp ); Abc_NtkDelete( pNtkTemp ); } else pNtkRes = Abc_NtkIvyStrash( pNtk ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandICut( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c, nInputs; extern void Abc_NtkIvyCuts( Abc_Ntk_t * pNtk, int nInputs ); // set defaults nInputs = 5; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Kh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nInputs = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nInputs < 0 ) goto usage; 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, "This command works only for strashed networks.\n" ); return 1; } Abc_NtkIvyCuts( pNtk, nInputs ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandIRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults fUpdateLevel = 1; fUseZeroCost = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "lzvh" ) ) != EOF ) { switch ( c ) { case 'l': fUpdateLevel ^= 1; break; case 'z': fUseZeroCost ^= 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkIvyRewrite( pNtk, fUpdateLevel, fUseZeroCost, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDRewrite( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; Dar_RwrPar_t Pars, * pPars = &Pars; int c; extern Abc_Ntk_t * Abc_NtkDRewrite( Abc_Ntk_t * pNtk, Dar_RwrPar_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults Dar_ManDefaultRwrParams( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "CNMflzrvwh" ) ) != EOF ) { switch ( c ) { case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nCutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nCutsMax < 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; } pPars->nSubgMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nSubgMax < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pPars->nMinSaved = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nMinSaved < 0 ) goto usage; break; case 'f': pPars->fFanout ^= 1; break; case 'l': pPars->fUpdateLevel ^= 1; break; case 'z': pPars->fUseZeros ^= 1; break; case 'r': pPars->fRecycle ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'w': pPars->fVeryVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pPars->fUseZeros ) pPars->nMinSaved = 0; if ( pPars->nMinSaved == 0 ) pPars->fUseZeros = 1; if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDRewrite( pNtk, pPars ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: drw [-C num] [-NM 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-M num : the min number of nodes saved after one step (0 <= num) [default = %d]\n", pPars->nMinSaved ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDRefactor( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; Dar_RefPar_t Pars, * pPars = &Pars; int c; extern Abc_Ntk_t * Abc_NtkDRefactor( Abc_Ntk_t * pNtk, Dar_RefPar_t * pPars ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults Dar_ManDefaultRefParams( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "MKCelzvwh" ) ) != EOF ) { switch ( c ) { case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nMffcMin = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nMffcMin < 0 ) goto usage; break; case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pPars->nLeafMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nLeafMax < 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->nCutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nCutsMax < 0 ) goto usage; break; case 'e': pPars->fExtend ^= 1; break; case 'l': pPars->fUpdateLevel ^= 1; break; case 'z': pPars->fUseZeros ^= 1; break; case 'v': pPars->fVerbose ^= 1; break; case 'w': pPars->fVeryVerbose ^= 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, "This command works only for strashed networks.\n" ); return 1; } if ( pPars->nLeafMax < 4 || pPars->nLeafMax > 15 ) { Abc_Print( -1, "This command only works for cut sizes 4 <= K <= 15.\n" ); return 1; } pNtkRes = Abc_NtkDRefactor( pNtk, pPars ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDc2( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults fBalance = 0; fVerbose = 0; fUpdateLevel = 0; fFanout = 1; fPower = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "blfpvh" ) ) != EOF ) { switch ( c ) { case 'b': fBalance ^= 1; break; case 'l': fUpdateLevel ^= 1; break; case 'f': fFanout ^= 1; break; case 'p': fPower ^= 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_NtkIsStrash(pNtk) ) { 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 ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDChoice( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int fBalance, fVerbose, fUpdateLevel, fConstruct, c; int nConfMax, nLevelMax; 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); // set defaults fBalance = 1; fUpdateLevel = 1; fConstruct = 0; nConfMax = 1000; nLevelMax = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "CLblcvh" ) ) != 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 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLevelMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLevelMax < 0 ) goto usage; break; case 'b': fBalance ^= 1; break; case 'l': fUpdateLevel ^= 1; break; case 'c': fConstruct ^= 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_NtkIsStrash(pNtk) ) { 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 ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDch( Abc_Frame_t * pAbc, int argc, char ** argv ) { Dch_Pars_t Pars, * pPars = &Pars; 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); // set defaults Dch_ManSetDefaultParams( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "WCSsptgcfrxvh" ) ) != 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 ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } pPars->nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; 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': pPars->fSynthesis ^= 1; break; case 'p': pPars->fPower ^= 1; break; case 't': pPars->fSimulateTfo ^= 1; break; case 'g': pPars->fUseGia ^= 1; break; case 'c': pPars->fUseCSat ^= 1; break; case 'f': pPars->fLightSynth ^= 1; break; case 'r': pPars->fSkipRedSupp ^= 1; break; case 'x': pPars->fUseNew ^= 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, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDch( pNtk, pPars ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: dch [-WCS num] [-sptgcfrxvh]\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-r : toggle skipping choices with redundant support [default = %s]\n", pPars->fSkipRedSupp? "yes": "no" ); Abc_Print( -2, "\t-x : toggle using new choice computation [default = %s]\n", pPars->fUseNew? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDrwsat( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults fBalance = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "bvh" ) ) != EOF ) { switch ( c ) { case 'b': fBalance ^= 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDrwsat( pNtk, fBalance, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandIRewriteSeq( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults fUpdateLevel = 0; fUseZeroCost = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "lzvh" ) ) != EOF ) { switch ( c ) { case 'l': fUpdateLevel ^= 1; break; case 'z': fUseZeroCost ^= 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkIvyRewriteSeq( pNtk, fUseZeroCost, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandIResyn( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults fUpdateLevel = 1; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "lzvh" ) ) != EOF ) { switch ( c ) { case 'l': fUpdateLevel ^= 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkIvyResyn( pNtk, fUpdateLevel, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandISat( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c, fUpdateLevel, fVerbose; int nConfLimit; extern Abc_Ntk_t * Abc_NtkIvySat( Abc_Ntk_t * pNtk, int nConfLimit, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults nConfLimit = 100000; fUpdateLevel = 1; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Clzvh" ) ) != EOF ) { switch ( c ) { case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nConfLimit < 0 ) goto usage; break; case 'l': fUpdateLevel ^= 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkIvySat( pNtk, nConfLimit, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandIFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c, fProve, fVerbose, fDoSparse; int nConfLimit; int nPartSize; int nLevelMax; extern Abc_Ntk_t * Abc_NtkIvyFraig( Abc_Ntk_t * pNtk, int nConfLimit, int fDoSparse, int fProve, int fTransfer, int fVerbose ); extern Abc_Ntk_t * Abc_NtkDarFraigPart( Abc_Ntk_t * pNtk, int nPartSize, int nConfLimit, int nLevelMax, int fVerbose ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults nPartSize = 0; nLevelMax = 0; nConfLimit = 100; fDoSparse = 1; fProve = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "PCLspvh" ) ) != EOF ) { switch ( c ) { case 'P': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPartSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nPartSize < 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; } nConfLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nConfLimit < 0 ) goto usage; break; case 'L': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-L\" should be followed by an integer.\n" ); goto usage; } nLevelMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLevelMax < 0 ) goto usage; break; case 's': fDoSparse ^= 1; break; case 'p': fProve ^= 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_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } if ( nPartSize > 0 ) pNtkRes = Abc_NtkDarFraigPart( pNtk, nPartSize, nConfLimit, nLevelMax, fVerbose ); else pNtkRes = Abc_NtkIvyFraig( pNtk, nConfLimit, fDoSparse, fProve, 0, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults nConfLimit = 100; fDoSparse = 1; fProve = 0; fSpeculate = 0; fChoicing = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Csprcvh" ) ) != EOF ) { switch ( c ) { case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nConfLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nConfLimit < 0 ) goto usage; break; case 's': fDoSparse ^= 1; break; case 'p': fProve ^= 1; break; case 'r': fSpeculate ^= 1; break; case 'c': fChoicing ^= 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_NtkIsStrash(pNtk) ) { 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 ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandCSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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); // set defaults nCutsMax = 8; nLeafMax = 6; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "CKvh" ) ) != EOF ) { switch ( c ) { case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nCutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCutsMax < 0 ) goto usage; break; case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nLeafMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nLeafMax < 0 ) goto usage; 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 ( nCutsMax < 2 ) { Abc_Print( -1, "The number of cuts cannot be less than 2.\n" ); return 1; } if ( nLeafMax < 3 || nLeafMax > 16 ) { Abc_Print( -1, "The number of leaves is infeasible.\n" ); return 1; } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkCSweep( pNtk, nCutsMax, nLeafMax, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandIProve( Abc_Frame_t * pAbc, int argc, char ** argv ) { Prove_Params_t Params, * pParams = &Params; Abc_Ntk_t * pNtk, * pNtkTemp; int c, RetValue, iOut = -1; char * pLogFileName = NULL; abctime clk; extern int Abc_NtkIvyProve( Abc_Ntk_t ** ppNtk, void * pPars ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults Prove_ParamsSetDefault( pParams ); pParams->fUseRewriting = 1; pParams->fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "NCFGMILrfbvh" ) ) != EOF ) { switch ( c ) { case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } pParams->nItersMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nItersMax < 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; } pParams->nMiteringLimitStart = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nMiteringLimitStart < 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; } pParams->nFraigingLimitStart = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nFraigingLimitStart < 0 ) goto usage; break; case 'G': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-G\" should be followed by an integer.\n" ); goto usage; } pParams->nFraigingLimitMulti = (float)atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nFraigingLimitMulti < 0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" ); goto usage; } pParams->nMiteringLimitLast = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nMiteringLimitLast < 0 ) goto usage; break; case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } pParams->nTotalInspectLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nTotalInspectLimit < 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': pParams->fUseRewriting ^= 1; break; case 'f': pParams->fUseFraiging ^= 1; break; case 'b': pParams->fUseBdds ^= 1; break; case 'v': pParams->fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( Abc_NtkLatchNum(pNtk) > 0 ) { Abc_Print( -1, "The network has registers. Use \"dprove\".\n" ); return 1; } clk = Abc_Clock(); if ( Abc_NtkIsStrash(pNtk) ) pNtkTemp = Abc_NtkDup( pNtk ); else pNtkTemp = Abc_NtkStrash( pNtk, 0, 0, 0 ); RetValue = Abc_NtkIvyProve( &pNtkTemp, pParams ); // verify that the pattern is correct if ( RetValue == 0 ) { Abc_Obj_t * pObj; int i; int * pSimInfo = Abc_NtkVerifySimulatePattern( pNtk, pNtkTemp->pModel ); Abc_NtkForEachCo( pNtk, pObj, i ) if ( pSimInfo[i] == 1 ) { iOut = i; break; } if ( i == Abc_NtkCoNum(pNtk) ) Abc_Print( 1, "ERROR in Abc_NtkMiterProve(): Generated counter-example is invalid.\n" ); ABC_FREE( pSimInfo ); } pAbc->Status = RetValue; if ( RetValue == -1 ) Abc_Print( 1, "UNDECIDED " ); else if ( RetValue == 0 ) Abc_Print( 1, "SATISFIABLE (output = %d) ", iOut ); else Abc_Print( 1, "UNSATISFIABLE " ); //Abc_Print( -1, "\n" ); Abc_PrintTime( 1, "Time", Abc_Clock() - clk ); // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkTemp ); // update counter example if ( RetValue == 0 && Abc_NtkLatchNum(pNtkTemp) == 0 ) { Abc_Cex_t * pCex = Abc_CexDeriveFromCombModel( pNtkTemp->pModel, Abc_NtkPiNum(pNtkTemp), 0, iOut ); Abc_FrameReplaceCex( pAbc, &pCex ); } if ( pLogFileName ) Abc_NtkWriteLogFile( pLogFileName, pAbc->pCex, pAbc->Status, pAbc->nFrames, "iprove" ); return 0; usage: Abc_Print( -2, "usage: iprove [-NCFGMI num] [-L file] [-rfbvh]\n" ); Abc_Print( -2, "\t performs CEC using a new method\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-G num : multiplicative coefficient for fraiging [default = %d]\n", (int)pParams->nFraigingLimitMulti ); Abc_Print( -2, "\t-M 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-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", 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ /* int Abc_CommandHaig( Abc_Frame_t * pAbc, int argc, char ** argv ) { FILE * stdout, * pErr; Abc_Ntk_t * pNtk, * pNtkRes; int c; int nIters; int nSteps; int fRetimingOnly; int fAddBugs; int fUseCnf; int fVerbose; 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); // set defaults nIters = 3; nSteps = 3000; fRetimingOnly = 0; fAddBugs = 0; fUseCnf = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ISrbcvh" ) ) != EOF ) { switch ( c ) { case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by a positive integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIters < 0 ) goto usage; break; case 'S': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-S\" should be followed by a positive integer.\n" ); goto usage; } nSteps = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nSteps < 0 ) goto usage; break; case 'r': fRetimingOnly ^= 1; break; case 'b': fAddBugs ^= 1; break; case 'c': fUseCnf ^= 1; break; case 'v': fUseCnf ^= 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, "This command works only for strashed networks.\n" ); return 1; } pNtkRes = Abc_NtkDarHaigRecord( pNtk, nIters, nSteps, fRetimingOnly, fAddBugs, fUseCnf, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); return 0; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } */ /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandQbf( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int nPars; int nIters; int fDumpCnf; int fVerbose; extern void Abc_NtkQbf( Abc_Ntk_t * pNtk, int nPars, int nIters, int fDumpCnf, int fVerbose ); // set defaults nPars = -1; nIters = 500; fDumpCnf = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "PIdvh" ) ) != EOF ) { switch ( c ) { case 'P': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-P\" should be followed by an integer.\n" ); goto usage; } nPars = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nPars < 0 ) goto usage; break; case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIters < 0 ) goto usage; break; case 'd': fDumpCnf ^= 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, "Works only for combinational networks.\n" ); return 1; } if ( Abc_NtkPoNum(pNtk) != 1 ) { Abc_Print( -1, "The miter should have one primary output.\n" ); return 1; } if ( !(nPars > 0 && nPars < Abc_NtkPiNum(pNtk)) ) { Abc_Print( -1, "The number of parameter variables is invalid (should be > 0 and < PI num).\n" ); return 1; } if ( Abc_NtkIsStrash(pNtk) ) Abc_NtkQbf( pNtk, nPars, nIters, fDumpCnf, fVerbose ); else { pNtk = Abc_NtkStrash( pNtk, 0, 1, 0 ); Abc_NtkQbf( pNtk, nPars, nIters, fDumpCnf, fVerbose ); Abc_NtkDelete( pNtk ); } return 0; usage: Abc_Print( -2, "usage: qbf [-PI num] [-dvh]\n" ); Abc_Print( -2, "\t solves QBF problem EpVxM(p,x)\n" ); Abc_Print( -2, "\t-P num : number of parameters p (should be the first PIs) [default = %d]\n", nPars ); Abc_Print( -2, "\t-I num : quit after the given iteration even if unsolved [default = %d]\n", nIters ); Abc_Print( -2, "\t-d : toggle dumping QDIMACS file instead of solving [default = %s]\n", fDumpCnf? "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\n" ); Abc_Print( -2, "\t Consider specification of the two-input XOR and its implementation in the form of a 4:1 MUX:\n\n" ); Abc_Print( -2, "\t > # file s.blif\n" ); Abc_Print( -2, "\t > .model xor2\n" ); Abc_Print( -2, "\t > .inputs d0 d1 d2 d3 a b\n" ); Abc_Print( -2, "\t > .outputs F\n" ); Abc_Print( -2, "\t > .names a b F\n" ); Abc_Print( -2, "\t > 01 1\n" ); Abc_Print( -2, "\t > 10 1\n" ); Abc_Print( -2, "\t > .end\n\n" ); Abc_Print( -2, "\t > # file i.blif\n" ); Abc_Print( -2, "\t > .model mux21\n" ); Abc_Print( -2, "\t > .inputs d0 d1 d2 d3 a b\n" ); Abc_Print( -2, "\t > .outputs F\n" ); Abc_Print( -2, "\t > .names d0 d1 d2 d3 a b F\n" ); Abc_Print( -2, "\t > 1---00 1\n" ); Abc_Print( -2, "\t > -1--10 1\n" ); Abc_Print( -2, "\t > --1-01 1\n" ); Abc_Print( -2, "\t > ---111 1\n" ); Abc_Print( -2, "\t > .end\n\n" ); Abc_Print( -2, "\t The following run shows how to assign data inputs to the MUX (the first 4 inputs of the miter) to get the XOR:\n\n" ); Abc_Print( -2, "\t > abc 51> miter -n i.blif s.blif; st -i; ps\n" ); Abc_Print( -2, "\t > i_s_miter: i/o = 6/ 1 lat = 0 and = 15 lev = 6\n\n" ); Abc_Print( -2, "\t > abc 53> qbf -P 4\n" ); Abc_Print( -2, "\t > Parameters: 0110 Statistics: 0=2 1=2\n" ); Abc_Print( -2, "\t > Solved after 1 iterations. Total runtime = 0.00 sec\n\n" ); Abc_Print( -2, "\t > abc 53> &get; &qbf -P 4\n" ); Abc_Print( -2, "\t > Parameters: 0110 Statistics: 0=2 1=2\n" ); Abc_Print( -2, "\t > The problem is SAT after 2 iterations. Time = 0.00 sec\n\n" ); Abc_Print( -2, "\t What we synthesized is the truth table of the XOR gate!\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandNpnLoad( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Npn_ManLoad( char * pFileName ); char * pFileName; int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( argc != globalUtilOptind + 1 ) goto usage; pFileName = argv[globalUtilOptind]; Npn_ManLoad( pFileName ); return 0; usage: Abc_Print( -2, "usage: npnload \n" ); Abc_Print( -2, "\t loads previously saved 6-input function library from file\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandNpnSave( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Npn_ManSave( char * pFileName ); char * pFileName; int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( argc != globalUtilOptind + 1 ) goto usage; pFileName = argv[globalUtilOptind]; Npn_ManSave( pFileName ); return 0; usage: Abc_Print( -2, "usage: npnsave \n" ); Abc_Print( -2, "\t saves current 6-input function library into file\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandSendAig( Abc_Frame_t * pAbc, int argc, char ** argv ) { // const int BRIDGE_NETLIST = 106; // const int BRIDGE_ABS_NETLIST = 107; int c, fAndSpace = 1, fAbsNetlist = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ah" ) ) != EOF ) { switch ( c ) { case 'a': fAndSpace ^= 1; break; case 'b': fAbsNetlist ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( !Abc_FrameIsBridgeMode() ) { Abc_Print( -1, "The bridge mode is not available.\n" ); return 1; } if ( fAndSpace ) { if ( pAbc->pGia == NULL ) { Abc_Print( -1, "There is no AIG in the &-space.\n" ); return 1; } Gia_ManToBridgeAbsNetlist( stdout, pAbc->pGia, fAbsNetlist ? BRIDGE_ABS_NETLIST : BRIDGE_NETLIST ); } else { Aig_Man_t * pAig; Gia_Man_t * pGia; if ( pAbc->pNtkCur == NULL ) { Abc_Print( -1, "There is no network in the main-space.\n" ); return 1; } if ( !Abc_NtkIsStrash(pAbc->pNtkCur) ) { Abc_Print( -1, "The main-space network is not an AIG.\n" ); return 1; } pAig = Abc_NtkToDar( pAbc->pNtkCur, 0, 1 ); pGia = Gia_ManFromAig( pAig ); Aig_ManStop( pAig ); Gia_ManToBridgeAbsNetlist( stdout, pGia, fAbsNetlist ? BRIDGE_ABS_NETLIST : BRIDGE_NETLIST ); Gia_ManStop( pGia ); } return 0; usage: Abc_Print( -2, "usage: send_aig -a\n" ); Abc_Print( -2, "\t sends current AIG to the bridge\n" ); Abc_Print( -2, "\t-a : toggle sending AIG from &-space [default = %s]\n", fAndSpace? "yes": "no" ); Abc_Print( -2, "\t-b : toggle sending netlist tagged as \"abstraction\". [default = %s]\n", fAbsNetlist? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandSendStatus( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern int Gia_ManToBridgeResult( FILE * pFile, int Result, Abc_Cex_t * pCex, int iPoProved ); int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "h" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( !Abc_FrameIsBridgeMode() ) { Abc_Print( -1, "The bridge mode is not available.\n" ); return 1; } if ( pAbc->Status == 0 && pAbc->pCex == NULL ) { Abc_Print( -1, "Status is \"sat\", but current CEX is not available.\n" ); return 1; } Gia_ManToBridgeResult( stdout, pAbc->Status, pAbc->pCex, 0 ); return 0; usage: Abc_Print( -2, "usage: send_status\n" ); Abc_Print( -2, "\t sends current status to the bridge\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandBackup( 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; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( pAbc->pNtkBackup ) Abc_NtkDelete( pAbc->pNtkBackup ); pAbc->pNtkBackup = Abc_NtkDup( pNtk ); return 0; usage: Abc_Print( -2, "usage: backup [-h]\n" ); Abc_Print( -2, "\t backs up the current network\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } int Abc_CommandRestore( 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->pNtkBackup == NULL ) { Abc_Print( -1, "There is no backup network.\n" ); return 1; } Abc_FrameReplaceCurrentNetwork( pAbc, Abc_NtkDup(pAbc->pNtkBackup) ); pAbc->nFrames = -1; pAbc->Status = -1; return 0; usage: Abc_Print( -2, "usage: restore [-h]\n" ); Abc_Print( -2, "\t restores the current network\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMinisat( Abc_Frame_t * pAbc, int argc, char ** argv ) { #ifdef USE_MINISAT22 extern int MainSat(int argc, char** argv); MainSat( argc, argv ); #else printf( "This command is currently disabled.\n" ); #endif return 1; } int Abc_CommandMinisimp( Abc_Frame_t * pAbc, int argc, char ** argv ) { #ifdef USE_MINISAT22 extern int MainSimp(int argc, char** argv); MainSimp( argc, argv ); #else printf( "This command is currently disabled.\n" ); #endif return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandFraig( Abc_Frame_t * pAbc, int argc, char ** argv ) { char Buffer[100]; Fraig_Params_t Params, * pParams = &Params; Abc_Ntk_t * pNtk, * pNtkRes; int fAllNodes; int fExdc; int c; int fPartition = 0; extern void Abc_NtkFraigPartitionedTime( Abc_Ntk_t * pNtk, void * pParams ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults fExdc = 0; fAllNodes = 0; memset( pParams, 0, sizeof(Fraig_Params_t) ); pParams->nPatsRand = 2048; // the number of words of random simulation info pParams->nPatsDyna = 2048; // the number of words of dynamic simulation info pParams->nBTLimit = 100; // the max number of backtracks to perform pParams->fFuncRed = 1; // performs only one level hashing pParams->fFeedBack = 1; // enables solver feedback pParams->fDist1Pats = 1; // enables distance-1 patterns pParams->fDoSparse = 1; // performs equiv tests for sparse functions pParams->fChoicing = 0; // enables recording structural choices pParams->fTryProve = 0; // tries to solve the final miter pParams->fVerbose = 0; // the verbosiness flag pParams->fVerboseP = 0; // the verbosiness flag Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "RDCrscptvaeh" ) ) != EOF ) { switch ( c ) { case 'R': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } pParams->nPatsRand = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nPatsRand < 0 ) goto usage; break; case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } pParams->nPatsDyna = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nPatsDyna < 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; } pParams->nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pParams->nBTLimit < 0 ) goto usage; break; case 'r': pParams->fFuncRed ^= 1; break; case 's': pParams->fDoSparse ^= 1; break; case 'c': pParams->fChoicing ^= 1; break; case 'p': pParams->fTryProve ^= 1; break; case 'v': pParams->fVerbose ^= 1; break; case 't': fPartition ^= 1; break; case 'a': fAllNodes ^= 1; break; case 'e': fExdc ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "Can only fraig a logic network or an AIG.\n" ); return 1; } // report the proof pParams->fVerboseP = pParams->fTryProve; // get the new network if ( fPartition ) { pNtkRes = Abc_NtkDup( pNtk ); if ( Abc_NtkIsStrash(pNtk) ) Abc_NtkFraigPartitionedTime( pNtk, &Params ); else { pNtk = Abc_NtkStrash( pNtk, fAllNodes, !fAllNodes, 0 ); Abc_NtkFraigPartitionedTime( pNtk, &Params ); Abc_NtkDelete( pNtk ); } } else { if ( Abc_NtkIsStrash(pNtk) ) pNtkRes = Abc_NtkFraig( pNtk, &Params, fAllNodes, fExdc ); else { pNtk = Abc_NtkStrash( pNtk, fAllNodes, !fAllNodes, 0 ); pNtkRes = Abc_NtkFraig( pNtk, &Params, fAllNodes, fExdc ); Abc_NtkDelete( pNtk ); } } if ( pNtkRes == NULL ) { Abc_Print( -1, "Fraiging has failed.\n" ); return 1; } if ( pParams->fTryProve ) // report the result Abc_NtkMiterReport( pNtkRes ); // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: sprintf(Buffer, "%d", pParams->nBTLimit ); 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 (known bugs: takes an UNSAT miter and returns a SAT one)\n"); Abc_Print( -2, "\t (there are 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandFraigTrust( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c; int fDuplicate; pNtk = Abc_FrameReadNtk(pAbc); // set defaults fDuplicate = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) { switch ( c ) { case 'd': fDuplicate ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network pNtkRes = Abc_NtkFraigTrust( pNtk ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Fraiging in the trust mode has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandFraigStore( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fDuplicate; // set defaults fDuplicate = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) { switch ( c ) { case 'd': fDuplicate ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network if ( !Abc_NtkFraigStore( pNtk ) ) { Abc_Print( -1, "Fraig storing has failed.\n" ); return 1; } return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandFraigRestore( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; int c; int nPatsRand = 0; // the number of words of random simulation info int nPatsDyna = 0; // the number of words of dynamic simulation info int nBTLimit = 1000; // the max number of backtracks to perform pNtk = Abc_FrameReadNtk(pAbc); // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "RDCh" ) ) != EOF ) { switch ( c ) { case 'R': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-R\" should be followed by an integer.\n" ); goto usage; } nPatsRand = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nPatsRand < 0 ) goto usage; break; case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by an integer.\n" ); goto usage; } nPatsDyna = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nPatsDyna < 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; } nBTLimit = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nBTLimit < 0 ) goto usage; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } // get the new network pNtkRes = Abc_NtkFraigRestore( nPatsRand, nPatsDyna, nBTLimit ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Fraig restoring has failed.\n" ); return 1; } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: fraig_restore [-RDC num] [-h]\n" ); Abc_Print( -2, "\t makes the current network by fraiging the AIG database\n" ); Abc_Print( -2, "\t-R num : number of random patterns (127 < num < 32769) [default = design-dependent]\n" ); Abc_Print( -2, "\t-D num : number of systematic patterns (127 < num < 32769) [default = design-dependent]\n" ); Abc_Print( -2, "\t-C num : number of backtracks for one SAT problem [default = %d]\n", nBTLimit ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandFraigClean( Abc_Frame_t * pAbc, int argc, char ** argv ) { // Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fDuplicate; // set defaults fDuplicate = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) { switch ( c ) { case 'd': fDuplicate ^= 1; break; case 'h': goto usage; default: goto usage; } } Abc_NtkFraigStoreClean(); return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandFraigSweep( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseInv; int fExdc; int fVerbose; int fVeryVerbose; extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); // set defaults fUseInv = 1; fExdc = 0; fVerbose = 0; fVeryVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ievwh" ) ) != EOF ) { switch ( c ) { case 'i': fUseInv ^= 1; break; case 'e': fExdc ^= 1; break; case 'v': fVerbose ^= 1; break; case 'w': fVeryVerbose ^= 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, "Cannot sweep AIGs (use \"fraig\").\n" ); return 1; } if ( !Abc_NtkIsLogic(pNtk) ) { 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 ) ) { Abc_Print( -1, "Sweeping has failed.\n" ); return 1; } return 0; usage: 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandFraigDress( Abc_Frame_t * pAbc, int argc, char ** argv ) { 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; // set defaults nConfs = 1000; fVerbose = 0; Extra_UtilGetoptReset(); 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; 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, "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 ) { 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 ); pNtk2 = Io_Read( pFileName, Io_ReadFileType(pFileName), 1, 0 ); Abc_NtkDress2( pNtk, pNtk2, nConfs, fVerbose ); Abc_NtkDelete( pNtk2 ); return 0; usage: Abc_Print( -2, "usage: dress [-C num] [-vh] \n" ); Abc_Print( -2, "\t transfers internal node names from file to the current network\n" ); Abc_Print( -2, "\t : 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandDumpEquiv( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_NtkDumpEquiv( Abc_Ntk_t * pNtks[2], char * pFileName, int nConfs, int fByName, int fVerbose ); Abc_Ntk_t * pNtks[2] = {NULL}; char * pFileName[2], * pFileNameOut; int c, nConfs = 1000, fByName = 1, fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "Cnvh" ) ) != 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 'n': fByName ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( argc != globalUtilOptind + 3 ) { Abc_Print( -1, "Expecting three file names on the command line.\n" ); goto usage; } pFileName[0] = argv[globalUtilOptind]; pFileName[1] = argv[globalUtilOptind+1]; pFileNameOut = argv[globalUtilOptind+2]; for ( c = 0; c < 2; c++ ) { pNtks[c] = Io_Read( pFileName[c], Io_ReadFileType(pFileName[c]), 1, 0 ); if ( pNtks[c] == NULL ) goto usage; Abc_NtkToAig( pNtks[c] ); } // if ( Abc_NtkCiNum(pNtks[0]) != Abc_NtkCiNum(pNtks[1]) ) // Abc_Print( -1, "The number of primary inputs of networks \"%s\" and \"%s\" does not match.\n", Abc_NtkName(pNtks[0]), Abc_NtkName(pNtks[1]) ); // else if ( Abc_NtkCoNum(pNtks[0]) != Abc_NtkCoNum(pNtks[1]) ) // Abc_Print( -1, "The number of primary outputs of networks \"%s\" and \"%s\" does not match.\n", Abc_NtkName(pNtks[0]), Abc_NtkName(pNtks[1]) ); // else Abc_NtkDumpEquiv( pNtks, pFileNameOut, nConfs, fByName, fVerbose ); Abc_NtkDelete( pNtks[0] ); Abc_NtkDelete( pNtks[1] ); return 0; usage: Abc_Print( -2, "usage: dump_equiv [-C num] [-nvh] \n" ); Abc_Print( -2, "\t computes equivalence classes of nodes in and \n" ); Abc_Print( -2, "\t By default this procedure performs matching of primary inputs by name.\n" ); Abc_Print( -2, "\t Those inputs that cannot be matched are treated as free variables.\n" ); Abc_Print( -2, "\t There is no effort to match primary outputs. Indeed, if two outputs\n" ); Abc_Print( -2, "\t are equivalent, they will belong to the same equivalence class in the end.\n" ); Abc_Print( -2, "\t-C num : the maximum number of conflicts at each node [default = %d]\n", nConfs ); Abc_Print( -2, "\t-n : enable matching of primary inputs by name [default = %s]\n", fByName? "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 : first network whose nodes are considered\n" ); Abc_Print( -2, "\t : second network whose nodes are considered\n" ); Abc_Print( -2, "\t : text file with node equivalence classes\n" ); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRecStart3( Abc_Frame_t * pAbc, int argc, char ** argv ) { char * FileName, * pTemp; char ** pArgvNew; int c, nArgcNew; FILE * pFile; Gia_Man_t * pGia = NULL; int nVars = 6; int nCuts = 32; int fFuncOnly = 0; int fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "KCfvh" ) ) != EOF ) { switch ( c ) { case 'K': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-K\" should be followed by an integer.\n" ); goto usage; } nVars = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nVars < 1 ) goto usage; break; case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by an integer.\n" ); goto usage; } nCuts = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nCuts < 1 ) goto usage; break; case 'f': fFuncOnly ^= 1; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( !(nVars >= 3 && nVars <= 16) ) { Abc_Print( -1, "The range of allowed values is 3 <= K <= 16.\n" ); return 0; } if ( Abc_NtkRecIsRunning3() ) { Abc_Print( -1, "The AIG subgraph recording is already started.\n" ); return 0; } pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; if ( nArgcNew != 1 ) Abc_Print( 1, "File name is not given on the command line. Starting a new record.\n" ); else { // get the input file name FileName = pArgvNew[0]; // fix the wrong symbol for ( pTemp = FileName; *pTemp; pTemp++ ) if ( *pTemp == '>' ) *pTemp = '\\'; if ( (pFile = fopen( FileName, "r" )) == NULL ) { Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); if ( (FileName = Extra_FileGetSimilarName( FileName, ".aig", NULL, NULL, NULL, NULL )) ) Abc_Print( 1, "Did you mean \"%s\"?", FileName ); Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); pGia = Gia_AigerRead( FileName, 0, 1, 0 ); if ( pGia == NULL ) { Abc_Print( -1, "Reading AIGER has failed.\n" ); return 0; } } Abc_NtkRecStart3( pGia, nVars, nCuts, fFuncOnly, fVerbose ); return 0; usage: Abc_Print( -2, "usage: rec_start3 [-K num] [-C num] [-fvh] \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-f : toggles recording functions without AIG subgraphs [default = %s]\n", fFuncOnly? "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 : AIGER file with the library\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRecStop3( Abc_Frame_t * pAbc, int argc, char ** argv ) { int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( !Abc_NtkRecIsRunning3() ) { Abc_Print( -1, "This command works only after calling \"rec_start3\".\n" ); return 0; } Abc_NtkRecStop3(); return 0; usage: Abc_Print( -2, "usage: rec_stop3 [-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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRecPs3( Abc_Frame_t * pAbc, int argc, char ** argv ) { int c, fPrintLib = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "ph" ) ) != EOF ) { switch ( c ) { case 'p': fPrintLib ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( !Abc_NtkRecIsRunning3() ) { Abc_Print( -1, "This command works for AIGs only after calling \"rec_start3\".\n" ); return 0; } Abc_NtkRecPs3(fPrintLib); return 0; usage: Abc_Print( -2, "usage: rec_ps3 [-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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRecAdd3( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; int fUseSOPB = 0; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "gh" ) ) != EOF ) { switch ( c ) { case 'g': fUseSOPB = 1; break; case 'h': goto usage; default: goto usage; } } if ( !Abc_NtkIsStrash(pNtk) ) { Abc_Print( -1, "This command works for AIGs.\n" ); return 0; } if ( !Abc_NtkRecIsRunning3() ) { Abc_Print( -1, "This command works for AIGs after calling \"rec_start3\".\n" ); return 0; } Abc_NtkRecAdd3( pNtk, fUseSOPB ); return 0; usage: Abc_Print( -2, "usage: rec_add3 [-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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRecDump3( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_NtkRecDumpTt3( char * pFileName, int fBinary ); char * FileName; char ** pArgvNew; int nArgcNew; Gia_Man_t * pGia; int fAscii = 0; int fBinary = 0; int c; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "abh" ) ) != EOF ) { switch ( c ) { case 'a': fAscii ^= 1; break; case 'b': fBinary ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( !Abc_NtkRecIsRunning3() ) { Abc_Print( -1, "The AIG subgraph recording is not started.\n" ); return 1; } pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; if ( nArgcNew != 1 ) { Abc_Print( -1, "File name is not given on the command line.\n" ); return 1; } // get the input file name FileName = pArgvNew[0]; if ( fAscii ) Abc_NtkRecDumpTt3( FileName, 0 ); else if ( fBinary ) Abc_NtkRecDumpTt3( FileName, 1 ); else { pGia = Abc_NtkRecGetGia3(); if( pGia == NULL ) { Abc_Print( 0, "Library AIG is not available.\n" ); return 1; } if( Gia_ManPoNum(pGia) == 0 ) { Abc_Print( 0, "No structure in the library.\n" ); return 1; } Gia_AigerWrite( pGia, FileName, 0, 0, 0 ); } return 0; usage: Abc_Print( -2, "usage: rec_dump3 [-abh] \n" ); Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-a : toggles dumping TTs into an ASCII file [default = %s]\n", fAscii? "yes": "no" ); Abc_Print( -2, "\t-b : toggles dumping TTs into a binary file [default = %s]\n", fBinary? "yes": "no" ); Abc_Print( -2, "\t : AIGER file to write the library\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandRecMerge3( Abc_Frame_t * pAbc, int argc, char ** argv ) { int c; char * FileName, * pTemp; char ** pArgvNew; int nArgcNew; FILE * pFile; Gia_Man_t * pGia = NULL; // set defaults Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "dh" ) ) != EOF ) { switch ( c ) { case 'h': goto usage; default: goto usage; } } if ( !Abc_NtkRecIsRunning3() ) { Abc_Print( -1, "This command works for AIGs only after calling \"rec_start3\".\n" ); return 0; } pArgvNew = argv + globalUtilOptind; nArgcNew = argc - globalUtilOptind; if ( nArgcNew != 1 ) { Abc_Print( -1, "File name is not given on the command line.\n" ); return 1; } else { // get the input file name FileName = pArgvNew[0]; // fix the wrong symbol for ( pTemp = FileName; *pTemp; pTemp++ ) if ( *pTemp == '>' ) *pTemp = '\\'; if ( (pFile = fopen( FileName, "r" )) == NULL ) { Abc_Print( -1, "Cannot open input file \"%s\". ", FileName ); if ( (FileName = Extra_FileGetSimilarName( FileName, ".aig", NULL, NULL, NULL, NULL )) ) Abc_Print( 1, "Did you mean \"%s\"?", FileName ); Abc_Print( 1, "\n" ); return 1; } fclose( pFile ); pGia = Gia_AigerRead( FileName, 0, 1, 0 ); if ( pGia == NULL ) { Abc_Print( -1, "Reading AIGER has failed.\n" ); return 0; } } Abc_NtkRecLibMerge3(pGia); Gia_ManStop( pGia ); return 0; usage: Abc_Print( -2, "usage: rec_merge3 [-h] \n" ); Abc_Print( -2, "\t merge libraries\n" ); Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t : AIGER file with the library\n"); return 1; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandMap( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk, * pNtkRes; char Buffer[100]; double DelayTarget; double AreaMulti; double DelayMulti; float LogFan = 0; float Slew = 0; // choose based on the library float Gain = 250; int nGatesMin = 0; int fAreaOnly; int fRecovery; int fSweep; int fSwitching; int fSkipFanout; int fUseProfile; int fUseBuffs; int fVerbose; int c; extern Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, Mio_Library_t* userLib, double DelayTarget, double AreaMulti, double DelayMulti, float LogFan, float Slew, float Gain, int nGatesMin, int fRecovery, int fSwitching, int fSkipFanout, int fUseProfile, int fUseBuffs, int fVerbose ); extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults DelayTarget =-1; AreaMulti = 0; DelayMulti = 0; fAreaOnly = 0; fRecovery = 1; fSweep = 0; fSwitching = 0; fSkipFanout = 0; fUseProfile = 0; fUseBuffs = 0; fVerbose = 0; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "DABFSGMarspfuovh" ) ) != EOF ) { switch ( c ) { case 'D': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-D\" should be followed by a floating point number.\n" ); goto usage; } DelayTarget = (float)atof(argv[globalUtilOptind]); globalUtilOptind++; if ( DelayTarget <= 0.0 ) goto usage; break; case 'A': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-A\" should be followed by a floating point number.\n" ); goto usage; } AreaMulti = (float)atof(argv[globalUtilOptind]); globalUtilOptind++; break; case 'B': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-B\" should be followed by a floating point number.\n" ); goto usage; } DelayMulti = (float)atof(argv[globalUtilOptind]); globalUtilOptind++; break; case 'F': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-F\" should be followed by a floating point number.\n" ); goto usage; } LogFan = (float)atof(argv[globalUtilOptind]); globalUtilOptind++; if ( LogFan < 0.0 ) goto usage; break; case 'S': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-S\" should be followed by a floating point number.\n" ); goto usage; } Slew = (float)atof(argv[globalUtilOptind]); globalUtilOptind++; if ( Slew <= 0.0 ) goto usage; break; case 'G': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-G\" should be followed by a floating point number.\n" ); goto usage; } Gain = (float)atof(argv[globalUtilOptind]); globalUtilOptind++; if ( Gain <= 0.0 ) goto usage; break; case 'M': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-M\" should be followed by a positive integer.\n" ); goto usage; } nGatesMin = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nGatesMin < 0 ) goto usage; break; case 'a': fAreaOnly ^= 1; break; case 'r': fRecovery ^= 1; break; case 's': fSweep ^= 1; break; case 'p': fSwitching ^= 1; break; case 'f': fSkipFanout ^= 1; break; case 'u': fUseProfile ^= 1; break; case 'o': fUseBuffs ^= 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 ( fAreaOnly ) DelayTarget = ABC_INFINITY; if ( !Abc_NtkIsStrash(pNtk) ) { pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtk == NULL ) { 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 ) { Abc_Print( -1, "Balancing before mapping has failed.\n" ); return 1; } Abc_Print( 0, "The network was strashed and balanced before mapping.\n" ); // get the new network pNtkRes = Abc_NtkMap( pNtk, /*userLib=*/NULL, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fUseProfile, fUseBuffs, fVerbose ); if ( pNtkRes == NULL ) { Abc_NtkDelete( pNtk ); Abc_Print( -1, "Mapping has failed.\n" ); return 1; } Abc_NtkDelete( pNtk ); } else { // get the new network pNtkRes = Abc_NtkMap( pNtk, /*userLib=*/NULL, DelayTarget, AreaMulti, DelayMulti, LogFan, Slew, Gain, nGatesMin, fRecovery, fSwitching, fSkipFanout, fUseProfile, fUseBuffs, fVerbose ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Mapping has failed.\n" ); return 1; } } if ( fSweep ) { Abc_NtkFraigSweep( pNtkRes, 0, 0, 0, 0 ); if ( Abc_NtkHasMapping(pNtkRes) ) { pNtkRes = Abc_NtkDupDfs( pNtk = pNtkRes ); Abc_NtkDelete( pNtk ); } } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: if ( DelayTarget == -1 ) sprintf(Buffer, "not used" ); else sprintf(Buffer, "%.3f", DelayTarget ); Abc_Print( -2, "usage: map [-DABFSG float] [-M num] [-arspfuovh]\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 float : \"area multiplier\" to bias gate selection [default = %.2f]\n", AreaMulti ); Abc_Print( -2, "\t-B float : \"delay multiplier\" to bias gate selection [default = %.2f]\n", DelayMulti ); Abc_Print( -2, "\t-F float : the logarithmic fanout delay parameter [default = %.2f]\n", LogFan ); Abc_Print( -2, "\t-S float : the slew parameter used to generate the library [default = %.2f]\n", Slew ); Abc_Print( -2, "\t-G float : the gain parameter used to generate the library [default = %.2f]\n", Gain ); Abc_Print( -2, "\t-M num : skip gate classes whose size is less than this [default = %d]\n", nGatesMin ); 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-f : do not use large gates to map high-fanout nodes [default = %s]\n", fSkipFanout? "yes": "no" ); Abc_Print( -2, "\t-u : use standard-cell profile [default = %s]\n", fUseProfile? "yes": "no" ); Abc_Print( -2, "\t-o : toggles using buffers to decouple combinational outputs [default = %s]\n", fUseBuffs? "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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandAmap( Abc_Frame_t * pAbc, int argc, char ** argv ) { Amap_Par_t Pars, * pPars = &Pars; Abc_Ntk_t * pNtk, * pNtkRes; int fSweep; int c; extern Abc_Ntk_t * Abc_NtkDarAmap( Abc_Ntk_t * pNtk, Amap_Par_t * pPars ); extern int Abc_NtkFraigSweep( Abc_Ntk_t * pNtk, int fUseInv, int fExdc, int fVerbose, int fVeryVerbose ); pNtk = Abc_FrameReadNtk(pAbc); // set defaults fSweep = 0; Amap_ManSetDefaultParams( pPars ); Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "FACEQmxisvh" ) ) != EOF ) { switch ( c ) { case 'F': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-F\" should be followed by a floating point number.\n" ); goto usage; } pPars->nIterFlow = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nIterFlow < 0 ) goto usage; break; case 'A': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-A\" should be followed by a floating point number.\n" ); goto usage; } pPars->nIterArea = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nIterArea < 0 ) goto usage; break; case 'C': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-C\" should be followed by a floating point number.\n" ); goto usage; } pPars->nCutsMax = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->nCutsMax < 0 ) goto usage; break; case 'E': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-E\" should be followed by a floating point number.\n" ); goto usage; } pPars->fEpsilon = (float)atof(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->fEpsilon < 0.0 || pPars->fEpsilon > 1.0 ) goto usage; break; case 'Q': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-Q\" should be followed by a floating point number.\n" ); goto usage; } pPars->fADratio = (float)atof(argv[globalUtilOptind]); globalUtilOptind++; if ( pPars->fADratio < 0.0 ) goto usage; break; case 'm': pPars->fUseMuxes ^= 1; break; case 'x': pPars->fUseXors ^= 1; break; case 'i': pPars->fFreeInvs ^= 1; break; case 's': fSweep ^= 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) ) { pNtk = Abc_NtkStrash( pNtk, 0, 0, 0 ); if ( pNtk == NULL ) { 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 ) { Abc_Print( -1, "Balancing before mapping has failed.\n" ); return 1; } 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 ); Abc_Print( -1, "Mapping has failed.\n" ); return 1; } Abc_NtkDelete( pNtk ); } else { // get the new network pNtkRes = Abc_NtkDarAmap( pNtk, pPars ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Mapping has failed.\n" ); return 1; } } if ( fSweep ) { Abc_NtkFraigSweep( pNtkRes, 0, 0, 0, 0 ); if ( Abc_NtkHasMapping(pNtkRes) ) { pNtkRes = Abc_NtkDupDfs( pNtk = pNtkRes ); Abc_NtkDelete( pNtk ); } } // replace the current network Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); return 0; usage: Abc_Print( -2, "usage: amap [-FAC ] [-EQ ] [-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-C num : the maximum number of cuts at a node [default = %d]\n", pPars->nCutsMax ); Abc_Print( -2, "\t-E float : sets epsilon used for tie-breaking [default = %f]\n", pPars->fEpsilon ); Abc_Print( -2, "\t-Q float : area/delay preference ratio [default = %.2f (area-only)] \n", pPars->fADratio ); 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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandPhaseMap( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern void Abc_NtkChangePerform( Abc_Ntk_t * pNtk, int fVerbose ); Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int fVerbose = 0, c; // set defaults 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 ( pNtk == NULL ) { Abc_Print( -1, "Empty network.\n" ); return 1; } if ( !Abc_NtkHasMapping(pNtk) ) { Abc_Print( -1, "Cannot unmap the network that is not mapped.\n" ); return 1; } Abc_NtkChangePerform( pNtk, fVerbose ); return 0; usage: Abc_Print( -2, "usage: phase_map [-vh]\n" ); Abc_Print( -2, "\t tries to replace each gate by its complement (area-only)\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; } /**Function************************************************************* Synopsis [] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_CommandStochMap( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); extern void Abc_NtkStochMap( int nSuppMax, int nIters, int TimeOut, int Seed, int fVerbose, char * pScript, int nProcs ); int c, nMaxSize = 10000, nIters = 1, TimeOut = 0, Seed = 0, nProcs = 1, fVerbose = 0; char * pScript; Extra_UtilGetoptReset(); while ( ( c = Extra_UtilGetopt( argc, argv, "NITSPvh" ) ) != EOF ) { switch ( c ) { case 'N': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-N\" should be followed by an integer.\n" ); goto usage; } nMaxSize = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nMaxSize < 0 ) goto usage; break; case 'I': if ( globalUtilOptind >= argc ) { Abc_Print( -1, "Command line switch \"-I\" should be followed by an integer.\n" ); goto usage; } nIters = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nIters < 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; } TimeOut = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( TimeOut < 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; } Seed = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( Seed < 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; } nProcs = atoi(argv[globalUtilOptind]); globalUtilOptind++; if ( nProcs < 0 ) goto usage; break; case 'v': fVerbose ^= 1; break; case 'h': goto usage; default: goto usage; } } if ( pNtk == NULL ) { Abc_Print( -1, "Abc_CommandStochMap(): There is no AIG.\n" ); return 0; } if ( !Abc_NtkIsMappedLogic(pNtk) ) { Abc_Print( -1, "Abc_CommandStochMap(): Expecting a mapped current newtork as input.\n" ); return 0; } if ( argc != globalUtilOptind + 1 ) { printf( "Expecting a synthesis script in quotes on the command line (for example: \"&st; &dch; &if\").\n" ); goto usage; } pScript = Abc_UtilStrsav( argv[globalUtilOptind] ); Abc_NtkStochMap( nMaxSize, nIters, TimeOut, Seed, fVerbose, pScript, nProcs ); ABC_FREE( pScript ); return 0; usage: Abc_Print( -2, "usage: stochmap [-NITSP ] [-tvh]