From ddb22f3bed7cb457576b4b80e55d47eabf3a1308 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sat, 30 Jul 2022 14:21:47 -0700 Subject: Various changes. --- src/base/abci/abc.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 33a8315c..2ae994e3 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -561,6 +561,7 @@ static int Abc_CommandAbc9Exorcism ( Abc_Frame_t * pAbc, int argc, cha 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_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 ); @@ -1310,6 +1311,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) 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", "&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 ); @@ -48299,6 +48301,96 @@ usage: return 1; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9SatSyn( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern Gia_Man_t * Gia_ManSyn( Gia_Man_t * p, int nNodes, int nOuts, int TimeOut, int fUseXor, int fFancy, int fVerbose ); + Gia_Man_t * pTemp; int c, nNodes = 0, nOuts = 0, TimeOut = 0, fUseXor = 0, fFancy = 0, fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "NTafvh" ) ) != EOF ) + { + switch ( c ) + { + 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 '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 '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 'a': + fUseXor ^= 1; + break; + case 'f': + fFancy ^= 1; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + goto usage; + default: + goto usage; + } + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9SatSyn(): There is no AIG.\n" ); + return 0; + } + pTemp = Gia_ManSyn( pAbc->pGia, nNodes, nOuts, TimeOut, fUseXor, fFancy, fVerbose ); + Abc_FrameUpdateGia( pAbc, pTemp ); + return 0; + +usage: + Abc_Print( -2, "usage: &satsyn [-NOT ] [-afvh]\n" ); + Abc_Print( -2, "\t performs synthesis\n" ); + Abc_Print( -2, "\t-N : the number of window nodes [default = %d]\n", nNodes ); + Abc_Print( -2, "\t-O : the number of window outputs [default = %d]\n", nOuts ); + Abc_Print( -2, "\t-T : the timeout in seconds (0 = no timeout) [default = %d]\n", TimeOut ); + Abc_Print( -2, "\t-a : toggle using xor-nodes [default = %s]\n", fUseXor? "yes": "no" ); + Abc_Print( -2, "\t-f : toggle using additional feature [default = %s]\n", fFancy? "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; +} + /**Function************************************************************* Synopsis [] -- cgit v1.2.3 From a9237f50ea01efdd62f86d334a38ffbe80a3d141 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 31 Jul 2022 19:12:55 -0700 Subject: New switch in command &st for adding buffers. --- src/base/abci/abc.c | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 2ae994e3..cc5de8cd 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -32396,13 +32396,14 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) Gia_Man_t * pTemp; int c, Limit = 2; int Multi = 0; + int fAddBuffs = 0; int fAddStrash = 0; - int fCollapse = 0; - int fAddMuxes = 0; - int fStrMuxes = 0; + int fCollapse = 0; + int fAddMuxes = 0; + int fStrMuxes = 0; int fRehashMap = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "LMacmrsh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "LMbacmrsh" ) ) != EOF ) { switch ( c ) { @@ -32428,6 +32429,9 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( Multi <= 0 ) goto usage; break; + case 'b': + fAddBuffs ^= 1; + break; case 'a': fAddStrash ^= 1; break; @@ -32454,6 +32458,13 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Abc_CommandAbc9Strash(): There is no AIG.\n" ); return 1; } + if ( fAddBuffs ) + { + extern Gia_Man_t * Gia_ManDupAddBufs( Gia_Man_t * p ); + pTemp = Gia_ManDupAddBufs( pAbc->pGia ); + Abc_FrameUpdateGia( pAbc, pTemp ); + return 0; + } if ( Multi > 0 ) { extern Gia_Man_t * Gia_ManDupAddPis( Gia_Man_t * p, int nMulti ); @@ -32528,8 +32539,9 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: &st [-LM num] [-acmrsh]\n" ); + Abc_Print( -2, "usage: &st [-LM num] [-bacmrsh]\n" ); Abc_Print( -2, "\t performs structural hashing\n" ); + Abc_Print( -2, "\t-b : toggle adding buffers at the inputs and outputs [default = %s]\n", fAddBuffs? "yes": "no" ); Abc_Print( -2, "\t-a : toggle additional hashing [default = %s]\n", fAddStrash? "yes": "no" ); Abc_Print( -2, "\t-c : toggle collapsing hierarchical AIG [default = %s]\n", fCollapse? "yes": "no" ); Abc_Print( -2, "\t-m : toggle converting to larger gates [default = %s]\n", fAddMuxes? "yes": "no" ); -- cgit v1.2.3 From 132b8939219553341a8a45bae58dc777993bd807 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 3 Aug 2022 10:09:44 -0700 Subject: Investigating complex miters. --- src/base/abci/abc.c | 8 +++++ src/base/wln/wlnCom.c | 14 ++++++--- src/base/wln/wlnRead.c | 83 +++++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 99 insertions(+), 6 deletions(-) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index cc5de8cd..0414687e 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -50235,6 +50235,14 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Abc_CommandAbc9Test(): There is no AIG.\n" ); return 1; } + if ( argc == globalUtilOptind + 1 ) + { + extern void Gia_ManUpdateCoPhase( Gia_Man_t * pNew, Gia_Man_t * pOld ); + Gia_Man_t * pTemp = Gia_AigerRead( argv[globalUtilOptind], 0, 0, 0 ); + Gia_ManUpdateCoPhase( pAbc->pGia, pTemp ); + Gia_ManStop( pTemp ); + return 0; + } Abc_FrameUpdateGia( pAbc, Gia_ManPerformNewResub(pAbc->pGia, 100, 6, 1, 1) ); // printf( "AIG in \"%s\" has the sum of output support sizes equal to %d.\n", pAbc->pGia->pSpec, Gia_ManSumTotalOfSupportSizes(pAbc->pGia) ); return 0; diff --git a/src/base/wln/wlnCom.c b/src/base/wln/wlnCom.c index eb96132b..c5411607 100644 --- a/src/base/wln/wlnCom.c +++ b/src/base/wln/wlnCom.c @@ -330,13 +330,13 @@ usage: ******************************************************************************/ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fVerbose ); + extern Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fRev, int fVerbose ); Gia_Man_t * pNew = NULL; Rtl_Lib_t * pLib = Wln_AbcGetRtl(pAbc); char * pTopModule = NULL; - int c, fInv = 0, fVerbose = 0; + int c, fInv = 0, fRev = 0, fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Tcvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "Tcrvh" ) ) != EOF ) { switch ( c ) { @@ -352,6 +352,9 @@ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'c': fInv ^= 1; break; + case 'r': + fRev ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -366,16 +369,17 @@ int Abc_CommandCollapse( Abc_Frame_t * pAbc, int argc, char ** argv ) printf( "The design is not entered.\n" ); return 1; } - pNew = Rtl_LibCollapse( pLib, pTopModule, fVerbose ); + pNew = Rtl_LibCollapse( pLib, pTopModule, fRev, fVerbose ); if ( fInv ) Gia_ManInvertPos( pNew ); Abc_FrameUpdateGia( pAbc, pNew ); return 0; usage: - Abc_Print( -2, "usage: %%collapse [-T ] [-cvh] \n" ); + Abc_Print( -2, "usage: %%collapse [-T ] [-crvh] \n" ); Abc_Print( -2, "\t collapse hierarchical design into an AIG\n" ); Abc_Print( -2, "\t-T : specify the top module of the design [default = none]\n" ); Abc_Print( -2, "\t-c : toggle complementing miter outputs after collapsing [default = %s]\n", fInv? "yes": "no" ); + Abc_Print( -2, "\t-r : toggle bit order reversal in the word-level IO [default = %s]\n", fRev? "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; diff --git a/src/base/wln/wlnRead.c b/src/base/wln/wlnRead.c index a27d38d2..b45e51f2 100644 --- a/src/base/wln/wlnRead.c +++ b/src/base/wln/wlnRead.c @@ -1725,6 +1725,42 @@ int Rtl_NtkInsertSignalRange( Rtl_Ntk_t * p, int Sig, int * pLits, int nLits ) return nBits; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Vec_Int_t * Rtl_NtkRevPermInput( Rtl_Ntk_t * p ) +{ + Vec_Int_t * vNew = Vec_IntAlloc( 100 ); int b, i, Count = 0; + for ( i = 0; i < p->nInputs; i++ ) + { + int Width = Rtl_WireWidth( p, i ); + for ( b = 0; b < Width; b++ ) + Vec_IntPush( vNew, Count + Width-1-b ); + Count += Width; + } + return vNew; +} +Vec_Int_t * Rtl_NtkRevPermOutput( Rtl_Ntk_t * p ) +{ + Vec_Int_t * vNew = Vec_IntAlloc( 100 ); int b, i, Count = 0; + for ( i = 0; i < p->nOutputs; i++ ) + { + int Width = Rtl_WireWidth( p, p->nInputs + i ); + for ( b = 0; b < Width; b++ ) + Vec_IntPush( vNew, Count + Width-1-b ); + Count += Width; + } + return vNew; +} + /**Function************************************************************* Synopsis [] @@ -2693,6 +2729,41 @@ Gia_Man_t * Rtl_ReduceInverse( Rtl_Lib_t * pLib, Gia_Man_t * p ) return pNew; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +Gia_Man_t * Gia_ManDupPermIO( Gia_Man_t * p, Vec_Int_t * vPermI, Vec_Int_t * vPermO ) +{ + Gia_Man_t * pNew; + Gia_Obj_t * pObj; + int i; + assert( Vec_IntSize(vPermI) == Gia_ManCiNum(p) ); + assert( Vec_IntSize(vPermO) == Gia_ManCoNum(p) ); + pNew = Gia_ManStart( Gia_ManObjNum(p) ); + Gia_ManConst0(p)->Value = 0; + Gia_ManForEachCi( p, pObj, i ) + Gia_ManCi(p, Vec_IntEntry(vPermI, i))->Value = Gia_ManAppendCi(pNew); + Gia_ManForEachAnd( p, pObj, i ) + { + if ( Gia_ObjIsBuf(pObj) ) + pObj->Value = Gia_ManAppendBuf( pNew, Gia_ObjFanin0Copy(pObj) ); + else + pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) ); + assert( Abc_Lit2Var(pObj->Value) == i ); + } + Gia_ManForEachCo( p, pObj, i ) + Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(Gia_ManCo(p, Vec_IntEntry(vPermO, i))) ); + return pNew; +} + /**Function************************************************************* Synopsis [] @@ -2715,7 +2786,7 @@ int Rtl_LibReturnNtk( Rtl_Lib_t * p, char * pModule ) } return iNtk; } -Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fVerbose ) +Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fRev, int fVerbose ) { Gia_Man_t * pGia = NULL; int NameId = Wln_ReadFindToken( pTopModule, p->pManName ); @@ -2733,6 +2804,16 @@ Gia_Man_t * Rtl_LibCollapse( Rtl_Lib_t * p, char * pTopModule, int fVerbose ) Vec_IntPush( vRoots, iNtk ); Rtl_LibBlast2( p, vRoots, 1 ); pGia = Gia_ManDup( pTop->pGia ); + if ( fRev ) + { + Gia_Man_t * pTemp; + Vec_Int_t * vPermI = Rtl_NtkRevPermInput( pTop ); + Vec_Int_t * vPermO = Rtl_NtkRevPermOutput( pTop ); + pGia = Gia_ManDupPermIO( pTemp = pGia, vPermI, vPermO ); + Vec_IntFree( vPermI ); + Vec_IntFree( vPermO ); + Gia_ManStop( pTemp ); + } //Gia_AigerWrite( pGia, "temp_miter.aig", 0, 0, 0 ); if ( pTop->pGia->vBarBufs ) pGia->vBarBufs = Vec_IntDup( pTop->pGia->vBarBufs ); -- cgit v1.2.3 From 89e1ee8bc94651f91d6262a5d5f2db7f2cd1f5e6 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Wed, 3 Aug 2022 20:59:44 -0700 Subject: Improvements to command 'twoexact'. --- src/base/abci/abc.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 0414687e..eb6f6145 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -8770,7 +8770,7 @@ int Abc_CommandTwoExact( Abc_Frame_t * pAbc, int argc, char ** argv ) Bmc_EsPar_t Pars, * pPars = &Pars; Bmc_EsParSetDefault( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "INTaogvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "INTadcogvh" ) ) != EOF ) { switch ( c ) { @@ -8810,6 +8810,12 @@ int Abc_CommandTwoExact( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'a': pPars->fOnlyAnd ^= 1; break; + case 'd': + pPars->fDynConstr ^= 1; + break; + case 'c': + pPars->fDumpCnf ^= 1; + break; case 'o': pPars->fFewerVars ^= 1; break; @@ -8854,12 +8860,14 @@ int Abc_CommandTwoExact( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: twoexact [-INT ] [-aogvh] \n" ); + Abc_Print( -2, "usage: twoexact [-INT ] [-adcogvh] \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-a : toggle using only AND-gates (without XOR-gates) [default = %s]\n", pPars->fOnlyAnd ? "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-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" ); -- cgit v1.2.3 From 30ddf14c9093d88a04c8347e031411350572235e Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 7 Aug 2022 12:24:44 -0700 Subject: Improvements to command 'twoexact'. --- src/base/abci/abc.c | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index eb6f6145..775172e7 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -8766,11 +8766,13 @@ 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 ); - int c; + extern void Exa_ManExactSynthesis4( Bmc_EsPar_t * pPars ); + extern void Exa_ManExactSynthesis5( Bmc_EsPar_t * pPars ); + int c, fKissat = 0, fKissat2 = 0; Bmc_EsPar_t Pars, * pPars = &Pars; Bmc_EsParSetDefault( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "INTadcogvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "INTadconugklvh" ) ) != EOF ) { switch ( c ) { @@ -8819,9 +8821,21 @@ int Abc_CommandTwoExact( Abc_Frame_t * pAbc, int argc, char ** argv ) 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; @@ -8853,14 +8867,18 @@ int Abc_CommandTwoExact( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_Print( -1, "Function should not have more than 10 inputs.\n" ); return 1; } - if ( pPars->fGlucose ) + 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 [-INT ] [-adcogvh] \n" ); + Abc_Print( -2, "usage: twoexact [-INT ] [-adconugklvh] \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 ); @@ -8869,7 +8887,11 @@ usage: 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" ); -- cgit v1.2.3 From c3c643820e714cf1ad392a2a84276c7c168cffda Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 30 Aug 2022 12:00:33 -0700 Subject: Various changes. --- src/base/abci/abc.c | 8 ++++---- src/base/wlc/wlcNdr.c | 13 +++++++++++++ 2 files changed, 17 insertions(+), 4 deletions(-) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 775172e7..0c1407eb 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -9061,7 +9061,7 @@ int Abc_CommandAllExact( Abc_Frame_t * pAbc, int argc, char ** argv ) Bmc_EsPar_t Pars, * pPars = &Pars; Bmc_EsParSetDefault( pPars ); Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "MINKiaoegvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "MINKianegvh" ) ) != EOF ) { switch ( c ) { @@ -9115,7 +9115,7 @@ int Abc_CommandAllExact( Abc_Frame_t * pAbc, int argc, char ** argv ) case 'a': pPars->fOnlyAnd ^= 1; break; - case 'o': + case 'n': pPars->fOrderNodes ^= 1; break; case 'e': @@ -9211,7 +9211,7 @@ int Abc_CommandAllExact( Abc_Frame_t * pAbc, int argc, char ** argv ) return 0; usage: - Abc_Print( -2, "usage: allexact [-MIKN ] [-iaoevh] \n" ); + 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 ); @@ -9219,7 +9219,7 @@ usage: 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-o : toggle using node ordering by fanins [default = %s]\n", pPars->fOrderNodes ? "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" ); diff --git a/src/base/wlc/wlcNdr.c b/src/base/wlc/wlcNdr.c index d401281a..a7615c2d 100644 --- a/src/base/wlc/wlcNdr.c +++ b/src/base/wlc/wlcNdr.c @@ -535,10 +535,23 @@ Wlc_Ntk_t * Wlc_NtkFromNdr( void * pData ) SeeAlso [] ***********************************************************************/ +void Ndr_DumpNdr( void * pDesign ) +{ + int i; + char ** pNames = ABC_CALLOC( char *, 10000 ); + for ( i = 0; i < 10000; i++ ) + { + char Buffer[100]; + sprintf( Buffer, "s%d", i ); + pNames[i] = Abc_UtilStrsav( Buffer ); + } + Ndr_WriteVerilog( "temp.v", pDesign, pNames, 0 ); +} Wlc_Ntk_t * Wlc_ReadNdr( char * pFileName ) { void * pData = Ndr_Read( pFileName ); Wlc_Ntk_t * pNtk = Wlc_NtkFromNdr( pData ); + //Ndr_DumpNdr( pData ); //char * ppNames[10] = { NULL, "a", "b", "c", "d", "e", "f", "g", "h", "i" }; //Ndr_WriteVerilog( NULL, pData, ppNames, 0 ); //Ndr_Delete( pData ); -- cgit v1.2.3 From 138c381f76bcc1106a2fd3dcd40fcaee89c84e81 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 30 Aug 2022 13:19:14 -0700 Subject: Testing utility code. --- src/base/abc/abcUtil.c | 85 ++++++++++++++++++++++++++++++++++++++++++++++++++ src/base/abci/abc.c | 7 ++++- 2 files changed, 91 insertions(+), 1 deletion(-) (limited to 'src/base') diff --git a/src/base/abc/abcUtil.c b/src/base/abc/abcUtil.c index 29753210..88a16e7b 100644 --- a/src/base/abc/abcUtil.c +++ b/src/base/abc/abcUtil.c @@ -3267,6 +3267,91 @@ Gia_Man_t * Abc_SopSynthesizeOne( char * pSop, int fClp ) return Abc_NtkStrashToGia( pNtkNew ); } + +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static int s_ArraySize = 145; +static int s_ArrayData[290] = { + 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 10, 6, 14, 12, 10, 2, 22, 20, 2, 24, 16, 4, 28, 18, 16, 10, 8, 4, 34, 32, 30, 36, 38, 26, 16, 6, 36, 20, 44, 42, 46, 40, 42, 44, 14, 6, 52, 34, 32, 54, 56, 50, 58, 48, 32, 24, 20, 2, 12, 6, 66, 34, 68, 64, 62, 70, 28, 68, 74, 72, 76, 58, 70, 62, 80, 78, 68, 28, 84, 74, 4, 2, 88, 20, 64, 90, 92, 86, 66, 32, 18, 96, 98, 56, 100, 94, 52, 36, 104, 38, 90, 42, 36, 2, 108, 110, 112, 106, 114, 100, 102, 116, 118, 82, 116, 60, 120, 122, 124, 60, 118, 60, 102, 82, 128, 130, 132, 82, 134, 126, 82, 116, 122, 138, 122, 118, 142, 140, 60, 102, 130, 146, 130, 118, 150, 148, 152, 144, 154, 136, 18, 156, 144, 126, 68, 160, 32, 136, 164, 162, 166, 158, 28, 160, 70, 126, 90, 144, 174, 172, 176, 170, 152, 134, 36, 180, 2, 134, 184, 182, 186, 178, 188, 168, 64, 144, 164, 158, 194, 192, 96, 156, 44, 154, 200, 170, 202, 198, 204, 176, 206, 196, 204, 168, 62, 126, 212, 186, 24, 134, 108, 152, 218, 192, 220, 216, 222, 214, 224, 210, 220, 194, 110, 152, 30, 180, 232, 230, 184, 172, 236, 234, 238, 228, 234, 182, 242, 220, 244, 168, 42, 154, 248, 202, 54, 136, 252, 164, 254, 214, 256, 250, 218, 194, 252, 198, 262, 242, 264, 260, 232, 220, 268, 262, 270, 168, + 191, 191, 209, 209, 226, 226, 240, 240, 246, 246, 259, 259, 267, 267, 272, 272, +}; +int Abc_NtkHasConstNode() +{ + int i; + for ( i = 1; i < s_ArraySize; i++ ) + if ( s_ArrayData[2*i] || s_ArrayData[2*i+1] ) + break; + for ( ; i < s_ArraySize; i++ ) + if ( s_ArrayData[2*i] < 2 && s_ArrayData[2*i+1] < 2 ) + return 1; + return 0; +} +Abc_Ntk_t * Abc_NtkFromArray() +{ + Vec_Ptr_t * vNodes = Vec_PtrAlloc( s_ArraySize ); int i, nPos = 0; + Abc_Ntk_t * pNtkNew = Abc_NtkAlloc( ABC_NTK_LOGIC, ABC_FUNC_SOP, 1 ); + Abc_Obj_t * pObjNew = Abc_NtkHasConstNode() ? Abc_NtkCreateNode(pNtkNew) : NULL; + if ( pObjNew ) pObjNew->pData = Abc_SopCreateConst0((Mem_Flex_t *)pNtkNew->pManFunc); + Vec_PtrPush( vNodes, pObjNew ); + for ( i = 1; i < s_ArraySize; i++ ) + if ( !s_ArrayData[2*i] && !s_ArrayData[2*i+1] ) + Vec_PtrPush( vNodes, Abc_NtkCreatePi(pNtkNew) ); + else + break; + for ( ; i < s_ArraySize; i++ ) + { + char * pSop = NULL; + if ( s_ArrayData[2*i] > s_ArrayData[2*i+1] ) + pSop = Abc_SopCreateXor( (Mem_Flex_t *)pNtkNew->pManFunc, 2 ); + else if ( s_ArrayData[2*i] < s_ArrayData[2*i+1] ) + pSop = Abc_SopCreateAnd( (Mem_Flex_t *)pNtkNew->pManFunc, 2, NULL ); + else + break; + pObjNew = Abc_NtkCreateNode( pNtkNew ); + Abc_ObjAddFanin( pObjNew, (Abc_Obj_t *)Vec_PtrEntry(vNodes, Abc_Lit2Var(s_ArrayData[2*i])) ); + Abc_ObjAddFanin( pObjNew, (Abc_Obj_t *)Vec_PtrEntry(vNodes, Abc_Lit2Var(s_ArrayData[2*i+1])) ); + if ( Abc_LitIsCompl(s_ArrayData[2*i]) ) Abc_SopComplementVar( pSop, 0 ); + if ( Abc_LitIsCompl(s_ArrayData[2*i+1]) ) Abc_SopComplementVar( pSop, 1 ); + pObjNew->pData = pSop; + Vec_PtrPush( vNodes, pObjNew ); + } + for ( ; i < s_ArraySize; i++ ) + { + char * pSop = NULL; + assert( s_ArrayData[2*i] == s_ArrayData[2*i+1] ); + pObjNew = Abc_NtkCreateNode( pNtkNew ); + Abc_ObjAddFanin( pObjNew, (Abc_Obj_t *)Vec_PtrEntry(vNodes, Abc_Lit2Var(s_ArrayData[2*i])) ); + if ( Abc_LitIsCompl(s_ArrayData[2*i]) ) + pSop = Abc_SopCreateInv( (Mem_Flex_t *)pNtkNew->pManFunc ); + else + pSop = Abc_SopCreateBuf( (Mem_Flex_t *)pNtkNew->pManFunc ); + pObjNew->pData = pSop; + Vec_PtrPush( vNodes, pObjNew ); + nPos++; + } + for ( i = 0; i < nPos; i++ ) + Abc_ObjAddFanin( Abc_NtkCreatePo(pNtkNew), (Abc_Obj_t *)Vec_PtrEntry(vNodes, s_ArraySize-nPos+i) ); + Vec_PtrFree( vNodes ); + pNtkNew->pName = Extra_UtilStrsav("test"); + Abc_NtkAddDummyPiNames( pNtkNew ); + Abc_NtkAddDummyPoNames( pNtkNew ); + Abc_NtkAddDummyBoxNames( pNtkNew ); + if ( !Abc_NtkCheck( pNtkNew ) ) + Abc_Print( 1, "Abc_NtkFromArray(): Network check has failed.\n" ); + return pNtkNew; +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 0c1407eb..56f91670 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -14097,6 +14097,10 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) //Extra_SimulationTest( nDivMax, nNumOnes, fNewOrder ); //Mnist_ExperimentWithScaling( nDecMax ); //Gyx_ProblemSolveTest(); + { + Abc_Ntk_t * pNtkRes = Abc_NtkFromArray(); + Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); + } return 0; usage: Abc_Print( -2, "usage: test [-CKDNM] [-aovwh] \n" ); @@ -50273,7 +50277,8 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) Gia_ManStop( pTemp ); return 0; } - Abc_FrameUpdateGia( pAbc, Gia_ManPerformNewResub(pAbc->pGia, 100, 6, 1, 1) ); + //Abc_FrameUpdateGia( pAbc, Gia_ManPerformNewResub(pAbc->pGia, 100, 6, 1, 1) ); + Gia_ManPrintArray( pAbc->pGia ); // printf( "AIG in \"%s\" has the sum of output support sizes equal to %d.\n", pAbc->pGia->pSpec, Gia_ManSumTotalOfSupportSizes(pAbc->pGia) ); return 0; usage: -- cgit v1.2.3 From 0ed81b34f1048a10aa1b6785c2fb65b526c77b5a Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Tue, 30 Aug 2022 13:28:59 -0700 Subject: Compiler warnings. --- src/base/abci/abc.c | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 56f91670..b789be1f 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -14098,6 +14098,7 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) //Mnist_ExperimentWithScaling( nDecMax ); //Gyx_ProblemSolveTest(); { + extern Abc_Ntk_t * Abc_NtkFromArray(); Abc_Ntk_t * pNtkRes = Abc_NtkFromArray(); Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } @@ -50205,6 +50206,7 @@ usage: ***********************************************************************/ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv ) { + extern void Gia_ManPrintArray( Gia_Man_t * p ); extern Gia_Man_t * Gia_ManPerformNewResub( Gia_Man_t * p, int nWinCount, int nCutSize, int nProcs, int fVerbose ); extern void Gia_RsbEnumerateWindows( Gia_Man_t * p, int nInputsMax, int nLevelsMax ); extern int Gia_ManSumTotalOfSupportSizes( Gia_Man_t * p ); -- cgit v1.2.3 From 96b9ef2ce5347f380c1a07e1de1887a177f7e37e Mon Sep 17 00:00:00 2001 From: Yukio Miyasaka Date: Sat, 17 Sep 2022 15:42:36 -0700 Subject: import ttopt --- src/base/abci/abc.c | 109 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 109 insertions(+) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index b789be1f..ac8a97fc 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -499,6 +499,7 @@ static int Abc_CommandAbc9LNetRead ( Abc_Frame_t * pAbc, int argc, cha 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 ); +static int Abc_CommandAbc9Ttopt ( Abc_Frame_t * pAbc, int argc, char ** argv ); 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 ); @@ -1249,6 +1250,7 @@ void Abc_Init( Abc_Frame_t * pAbc ) Cmd_CommandAdd( pAbc, "ABC9", "&lnetsim", Abc_CommandAbc9LNetSim, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&lneteval", Abc_CommandAbc9LNetEval, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&lnetopt", Abc_CommandAbc9LNetOpt, 0 ); + Cmd_CommandAdd( pAbc, "ABC9", "&ttopt", Abc_CommandAbc9Ttopt, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&lnetmap", Abc_CommandAbc9LNetMap, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&unmap", Abc_CommandAbc9Unmap, 0 ); Cmd_CommandAdd( pAbc, "ABC9", "&struct", Abc_CommandAbc9Struct, 0 ); @@ -42191,6 +42193,113 @@ usage: return 1; } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +int Abc_CommandAbc9Ttopt( Abc_Frame_t * pAbc, int argc, char ** argv ) +{ + extern Gia_Man_t * Gia_ManTtopt( Gia_Man_t * p, int nIns, int nOuts, int nRounds ); + extern Gia_Man_t * Gia_ManTtoptCare( Gia_Man_t * p, int nIns, int nOuts, int nRounds, char * pFileName, int nRarity ); + Gia_Man_t * pTemp; + char * pFileName = NULL; + int c, nIns = 6, nOuts = 2, Limit = 0, nRounds = 20, fVerbose = 0; + Extra_UtilGetoptReset(); + while ( ( c = Extra_UtilGetopt( argc, argv, "IORXvh" ) ) != 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; + } + nIns = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + break; + case 'O': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-O\" should be followed by a positive integer.\n" ); + goto usage; + } + nOuts = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + break; + case 'R': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-R\" should be followed by a positive integer.\n" ); + goto usage; + } + Limit = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + break; + case 'X': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-X\" should be followed by a positive integer.\n" ); + goto usage; + } + nRounds = atoi(argv[globalUtilOptind]); + globalUtilOptind++; + break; + case 'v': + fVerbose ^= 1; + break; + case 'h': + default: + goto usage; + } + } + if ( argc > globalUtilOptind + 1 ) + { + return 0; + } + if ( pAbc->pGia == NULL ) + { + Abc_Print( -1, "Empty GIA network.\n" ); + return 1; + } + if ( argc == globalUtilOptind + 1 ) + { + FILE * pFile = fopen( argv[globalUtilOptind], "rb" ); + if ( pFile == NULL ) + { + Abc_Print( -1, "Abc_CommandAbc9BCore(): Cannot open file \"%s\" for reading the simulation information.\n", argv[globalUtilOptind] ); + return 0; + } + fclose( pFile ); + pFileName = argv[globalUtilOptind]; + } + if ( pFileName ) + pTemp = Gia_ManTtoptCare( pAbc->pGia, nIns, nOuts, nRounds, pFileName, Limit ); + else + pTemp = Gia_ManTtopt( pAbc->pGia, nIns, nOuts, nRounds ); + Abc_FrameUpdateGia( pAbc, pTemp ); + return 0; + +usage: + Abc_Print( -2, "usage: &ttopt [-IORX num] [-vh] \n" ); + Abc_Print( -2, "\t performs specialized AIG optimization\n" ); + Abc_Print( -2, "\t-I num : the input support size [default = %d]\n", nIns ); + Abc_Print( -2, "\t-O num : the output group size [default = %d]\n", nOuts ); + Abc_Print( -2, "\t-R num : patterns are cares starting this value [default = %d]\n", Limit ); + Abc_Print( -2, "\t-X num : the number of optimization rounds [default = %d]\n", nRounds ); + Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); + Abc_Print( -2, "\t-h : prints the command usage\n"); + Abc_Print( -2, "\t : file name with simulation information\n"); + return 1; +} + /**Function************************************************************* Synopsis [] -- cgit v1.2.3 From b69f439609c248db1f17408d550693fec30cbea5 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 19 Sep 2022 10:48:41 -0700 Subject: Adding args to command %yosys. --- src/base/wln/wlnBlast.c | 13 ++++++++++++- src/base/wln/wlnCom.c | 33 ++++++++++++++++++++++----------- src/base/wln/wlnRtl.c | 13 ++++++++----- 3 files changed, 42 insertions(+), 17 deletions(-) (limited to 'src/base') diff --git a/src/base/wln/wlnBlast.c b/src/base/wln/wlnBlast.c index a3ac73c0..887412d6 100644 --- a/src/base/wln/wlnBlast.c +++ b/src/base/wln/wlnBlast.c @@ -289,9 +289,17 @@ void Rtl_NtkBlastNode( Gia_Man_t * pNew, int Type, int nIns, Vec_Int_t * vDatas, { int fBooth = 1; int fCla = 0; - int fSigned = fSign0 && fSign1; + int fSigned = fSign0 && fSign1; + //int i, iObj; Vec_IntShrink( vArg0, nSizeArg0 ); Vec_IntShrink( vArg1, nSizeArg1 ); + + //printf( "Adding %d + %d + %d buffers\n", nSizeArg0, nSizeArg1, nRange ); + //Vec_IntForEachEntry( vArg0, iObj, i ) + // Vec_IntWriteEntry( vArg0, i, Gia_ManAppendBuf(pNew, iObj) ); + //Vec_IntForEachEntry( vArg1, iObj, i ) + // Vec_IntWriteEntry( vArg1, i, Gia_ManAppendBuf(pNew, iObj) ); + if ( Wlc_NtkCountConstBits(Vec_IntArray(vArg0), Vec_IntSize(vArg0)) < Wlc_NtkCountConstBits(Vec_IntArray(vArg1), Vec_IntSize(vArg1)) ) ABC_SWAP( Vec_Int_t, *vArg0, *vArg1 ) if ( fBooth ) @@ -303,6 +311,9 @@ void Rtl_NtkBlastNode( Gia_Man_t * pNew, int Type, int nIns, Vec_Int_t * vDatas, else Vec_IntShrink( vRes, nRange ); assert( Vec_IntSize(vRes) == nRange ); + + //Vec_IntForEachEntry( vRes, iObj, i ) + // Vec_IntWriteEntry( vRes, i, Gia_ManAppendBuf(pNew, iObj) ); return; } if ( Type == ABC_OPER_ARI_DIV || Type == ABC_OPER_ARI_MOD ) diff --git a/src/base/wln/wlnCom.c b/src/base/wln/wlnCom.c index c5411607..09cbe90f 100644 --- a/src/base/wln/wlnCom.c +++ b/src/base/wln/wlnCom.c @@ -92,12 +92,13 @@ void Wln_End( Abc_Frame_t * pAbc ) ******************************************************************************/ int Abc_CommandYosys( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern Gia_Man_t * Wln_BlastSystemVerilog( char * pFileName, char * pTopModule, int fSkipStrash, int fInvert, int fTechMap, int fVerbose ); - extern Rtl_Lib_t * Wln_ReadSystemVerilog( char * pFileName, char * pTopModule, int fCollapse, int fVerbose ); + extern Gia_Man_t * Wln_BlastSystemVerilog( char * pFileName, char * pTopModule, char * pDefines, int fSkipStrash, int fInvert, int fTechMap, int fVerbose ); + extern Rtl_Lib_t * Wln_ReadSystemVerilog( char * pFileName, char * pTopModule, char * pDefines, int fCollapse, int fVerbose ); FILE * pFile; char * pFileName = NULL; char * pTopModule= NULL; + char * pDefines = NULL; int fBlast = 0; int fInvert = 0; int fTechMap = 1; @@ -105,7 +106,7 @@ int Abc_CommandYosys( Abc_Frame_t * pAbc, int argc, char ** argv ) int fCollapse = 0; int c, fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "Tbismcvh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "TDbismcvh" ) ) != EOF ) { switch ( c ) { @@ -118,6 +119,15 @@ int Abc_CommandYosys( Abc_Frame_t * pAbc, int argc, char ** argv ) pTopModule = argv[globalUtilOptind]; globalUtilOptind++; break; + case 'D': + if ( globalUtilOptind >= argc ) + { + Abc_Print( -1, "Command line switch \"-D\" should be followed by a file name.\n" ); + goto usage; + } + pDefines = argv[globalUtilOptind]; + globalUtilOptind++; + break; case 'b': fBlast ^= 1; break; @@ -164,11 +174,11 @@ int Abc_CommandYosys( Abc_Frame_t * pAbc, int argc, char ** argv ) { Gia_Man_t * pNew = NULL; if ( !strcmp( Extra_FileNameExtension(pFileName), "v" ) ) - pNew = Wln_BlastSystemVerilog( pFileName, pTopModule, fSkipStrash, fInvert, fTechMap, fVerbose ); + pNew = Wln_BlastSystemVerilog( pFileName, pTopModule, pDefines, fSkipStrash, fInvert, fTechMap, fVerbose ); else if ( !strcmp( Extra_FileNameExtension(pFileName), "sv" ) ) - pNew = Wln_BlastSystemVerilog( pFileName, pTopModule, fSkipStrash, fInvert, fTechMap, fVerbose ); + pNew = Wln_BlastSystemVerilog( pFileName, pTopModule, pDefines, fSkipStrash, fInvert, fTechMap, fVerbose ); else if ( !strcmp( Extra_FileNameExtension(pFileName), "rtlil" ) ) - pNew = Wln_BlastSystemVerilog( pFileName, pTopModule, fSkipStrash, fInvert, fTechMap, fVerbose ); + pNew = Wln_BlastSystemVerilog( pFileName, pTopModule, pDefines, fSkipStrash, fInvert, fTechMap, fVerbose ); else { printf( "Abc_CommandYosys(): Unknown file extension.\n" ); @@ -180,11 +190,11 @@ int Abc_CommandYosys( Abc_Frame_t * pAbc, int argc, char ** argv ) { Rtl_Lib_t * pLib = NULL; if ( !strcmp( Extra_FileNameExtension(pFileName), "v" ) ) - pLib = Wln_ReadSystemVerilog( pFileName, pTopModule, fCollapse, fVerbose ); + pLib = Wln_ReadSystemVerilog( pFileName, pTopModule, pDefines, fCollapse, fVerbose ); else if ( !strcmp( Extra_FileNameExtension(pFileName), "sv" ) ) - pLib = Wln_ReadSystemVerilog( pFileName, pTopModule, fCollapse, fVerbose ); + pLib = Wln_ReadSystemVerilog( pFileName, pTopModule, pDefines, fCollapse, fVerbose ); else if ( !strcmp( Extra_FileNameExtension(pFileName), "rtlil" ) ) - pLib = Wln_ReadSystemVerilog( pFileName, pTopModule, fCollapse, fVerbose ); + pLib = Wln_ReadSystemVerilog( pFileName, pTopModule, pDefines, fCollapse, fVerbose ); else { printf( "Abc_CommandYosys(): Unknown file extension.\n" ); @@ -194,11 +204,12 @@ int Abc_CommandYosys( Abc_Frame_t * pAbc, int argc, char ** argv ) } return 0; usage: - Abc_Print( -2, "usage: %%yosys [-T ] [-bismcvh] \n" ); + Abc_Print( -2, "usage: %%yosys [-T ] [-D ] [-bismcvh] \n" ); Abc_Print( -2, "\t reads Verilog or SystemVerilog using Yosys\n" ); Abc_Print( -2, "\t-T : specify the top module name (default uses \"-auto-top\"\n" ); + Abc_Print( -2, "\t-D : specify defines to be used by Yosys (default \"not used\")\n" ); Abc_Print( -2, "\t-b : toggle bit-blasting the design into an AIG using Yosys [default = %s]\n", fBlast? "yes": "no" ); - Abc_Print( -2, "\t-i : toggle interting the outputs (useful for miters) [default = %s]\n", fInvert? "yes": "no" ); + Abc_Print( -2, "\t-i : toggle inverting the outputs (useful for miters) [default = %s]\n", fInvert? "yes": "no" ); Abc_Print( -2, "\t-s : toggle no structural hashing during bit-blasting [default = %s]\n", fSkipStrash? "no strash": "strash" ); Abc_Print( -2, "\t-m : toggle using \"techmap\" to blast operators [default = %s]\n", fTechMap? "yes": "no" ); Abc_Print( -2, "\t-c : toggle collapsing design hierarchy using Yosys [default = %s]\n", fCollapse? "yes": "no" ); diff --git a/src/base/wln/wlnRtl.c b/src/base/wln/wlnRtl.c index fa0f0cd5..51e00eb6 100644 --- a/src/base/wln/wlnRtl.c +++ b/src/base/wln/wlnRtl.c @@ -135,7 +135,7 @@ int Wln_ConvertToRtl( char * pCommand, char * pFileTemp ) fclose( pFile ); return 1; } -Rtl_Lib_t * Wln_ReadSystemVerilog( char * pFileName, char * pTopModule, int fCollapse, int fVerbose ) +Rtl_Lib_t * Wln_ReadSystemVerilog( char * pFileName, char * pTopModule, char * pDefines, int fCollapse, int fVerbose ) { Rtl_Lib_t * pNtk = NULL; char Command[1000]; @@ -143,8 +143,10 @@ Rtl_Lib_t * Wln_ReadSystemVerilog( char * pFileName, char * pTopModule, int fCol int fSVlog = strstr(pFileName, ".sv") != NULL; if ( strstr(pFileName, ".rtl") ) return Rtl_LibReadFile( pFileName, pFileName ); - sprintf( Command, "%s -qp \"read_verilog %s%s; hierarchy %s%s; %sproc; write_rtlil %s\"", - Wln_GetYosysName(), fSVlog ? "-sv ":"", pFileName, + sprintf( Command, "%s -qp \"read_verilog %s %s%s; hierarchy %s%s; %sproc; write_rtlil %s\"", + Wln_GetYosysName(), + pDefines ? pDefines : "", + fSVlog ? "-sv ":"", pFileName, pTopModule ? "-top " : "", pTopModule ? pTopModule : "", fCollapse ? "flatten; " : "", @@ -163,16 +165,17 @@ Rtl_Lib_t * Wln_ReadSystemVerilog( char * pFileName, char * pTopModule, int fCol unlink( pFileTemp ); return pNtk; } -Gia_Man_t * Wln_BlastSystemVerilog( char * pFileName, char * pTopModule, int fSkipStrash, int fInvert, int fTechMap, int fVerbose ) +Gia_Man_t * Wln_BlastSystemVerilog( char * pFileName, char * pTopModule, char * pDefines, int fSkipStrash, int fInvert, int fTechMap, int fVerbose ) { Gia_Man_t * pGia = NULL; char Command[1000]; char * pFileTemp = "_temp_.aig"; int fRtlil = strstr(pFileName, ".rtl") != NULL; int fSVlog = strstr(pFileName, ".sv") != NULL; - sprintf( Command, "%s -qp \"%s%s%s; hierarchy %s%s; flatten; proc; %saigmap; write_aiger %s\"", + sprintf( Command, "%s -qp \"%s %s%s%s; hierarchy %s%s; flatten; proc; %saigmap; write_aiger %s\"", Wln_GetYosysName(), fRtlil ? "read_rtlil" : "read_verilog", + pDefines ? pDefines : "", fSVlog ? " -sv ":" ", pFileName, pTopModule ? "-top " : "-auto-top", -- cgit v1.2.3 From a6c9e997bdd866908cee3812e71e90db76f617df Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 19 Sep 2022 11:17:15 -0700 Subject: Temporarily disabling &ttopt in the Windows version. --- src/base/abci/abc.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index ac8a97fc..9b4aff78 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -499,7 +499,9 @@ static int Abc_CommandAbc9LNetRead ( Abc_Frame_t * pAbc, int argc, cha 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 ); +#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 ); @@ -1250,7 +1252,9 @@ void Abc_Init( Abc_Frame_t * pAbc ) 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 ); +#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 ); @@ -42204,6 +42208,7 @@ usage: SeeAlso [] ***********************************************************************/ +#ifndef _WIN32 int Abc_CommandAbc9Ttopt( Abc_Frame_t * pAbc, int argc, char ** argv ) { extern Gia_Man_t * Gia_ManTtopt( Gia_Man_t * p, int nIns, int nOuts, int nRounds ); @@ -42299,6 +42304,7 @@ usage: Abc_Print( -2, "\t : file name with simulation information\n"); return 1; } +#endif /**Function************************************************************* -- cgit v1.2.3 From 4d183efe48dfef9b992ff46c2636973b36ccb7f4 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 19 Sep 2022 16:07:29 -0700 Subject: Compiler warnings. --- src/base/abci/abc.c | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 9b4aff78..a5f466a4 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -42211,8 +42211,6 @@ usage: #ifndef _WIN32 int Abc_CommandAbc9Ttopt( Abc_Frame_t * pAbc, int argc, char ** argv ) { - extern Gia_Man_t * Gia_ManTtopt( Gia_Man_t * p, int nIns, int nOuts, int nRounds ); - extern Gia_Man_t * Gia_ManTtoptCare( Gia_Man_t * p, int nIns, int nOuts, int nRounds, char * pFileName, int nRarity ); Gia_Man_t * pTemp; char * pFileName = NULL; int c, nIns = 6, nOuts = 2, Limit = 0, nRounds = 20, fVerbose = 0; -- cgit v1.2.3 From 6325e41681a259cf63de3aabe10b4b0930e77e56 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 19 Sep 2022 16:13:54 -0700 Subject: Compiler warnings. --- src/base/abci/abc.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index a5f466a4..42761fc7 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -499,9 +499,9 @@ static int Abc_CommandAbc9LNetRead ( Abc_Frame_t * pAbc, int argc, cha 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 +//#ifndef _WIN32 static int Abc_CommandAbc9Ttopt ( Abc_Frame_t * pAbc, int argc, char ** argv ); -#endif +//#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 ); @@ -1252,9 +1252,9 @@ void Abc_Init( Abc_Frame_t * pAbc ) 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 +//#ifndef _WIN32 Cmd_CommandAdd( pAbc, "ABC9", "&ttopt", Abc_CommandAbc9Ttopt, 0 ); -#endif +//#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 ); @@ -42208,7 +42208,7 @@ usage: SeeAlso [] ***********************************************************************/ -#ifndef _WIN32 +//#ifndef _WIN32 int Abc_CommandAbc9Ttopt( Abc_Frame_t * pAbc, int argc, char ** argv ) { Gia_Man_t * pTemp; @@ -42302,7 +42302,7 @@ usage: Abc_Print( -2, "\t : file name with simulation information\n"); return 1; } -#endif +//#endif /**Function************************************************************* -- cgit v1.2.3 From 1bd7550378752ba3957ffe4a2af58a74de8c7c51 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 19 Sep 2022 16:30:52 -0700 Subject: Compiler warnings. --- src/base/abci/abc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index 42761fc7..cddf0b51 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -42208,7 +42208,6 @@ usage: SeeAlso [] ***********************************************************************/ -//#ifndef _WIN32 int Abc_CommandAbc9Ttopt( Abc_Frame_t * pAbc, int argc, char ** argv ) { Gia_Man_t * pTemp; @@ -42300,9 +42299,13 @@ usage: Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : prints the command usage\n"); Abc_Print( -2, "\t : file name with simulation information\n"); + Abc_Print( -2, "\t\n" ); + Abc_Print( -2, "\t This command was contributed by Yukio Miyasaka.\n" ); + Abc_Print( -2, "\t The paper describing the method: Y. Miyasaka et al. \"Synthesizing\n" ); + Abc_Print( -2, "\t a class of practical Boolean functions using truth tables\". Proc. IWLS 2022.\n" ); + Abc_Print( -2, "\t https://people.eecs.berkeley.edu/~alanmi/publications/2022/iwls22_reo.pdf\n" ); return 1; } -//#endif /**Function************************************************************* -- cgit v1.2.3 From 813a0f1ff1ae7512cb7947f54cd3f2ab252848c8 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 9 Oct 2022 23:51:40 -0700 Subject: Updating features of &if mapper. --- src/base/abci/abc.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'src/base') diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index cddf0b51..a65b37e2 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -39554,7 +39554,8 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) pPars->fUse34Spec ^= 1; break; case 'b': - pPars->fUseBat ^= 1; + //pPars->fUseBat ^= 1; + pPars->fUseCheck1 ^= 1; break; case 'g': pPars->fDelayOpt ^= 1; @@ -39575,7 +39576,8 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) pPars->fEnableCheck75u ^= 1; break; case 'i': - pPars->fUseCofVars ^= 1; + //pPars->fUseCofVars ^= 1; + pPars->fUseCheck2 ^= 1; break; // case 'j': // pPars->fEnableCheck07 ^= 1; @@ -39688,6 +39690,16 @@ int Abc_CommandAbc9If( Abc_Frame_t * pAbc, int argc, char ** argv ) pPars->pFuncCell = If_CutPerformCheck07; pPars->fCutMin = 1; } + if ( pPars->fUseCheck1 || pPars->fUseCheck2 ) + { + if ( pPars->nLutSize > 6 ) + { + Abc_Print( -1, "This feature only works for no more than 6-LUTs.\n" ); + return 1; + } + pPars->pFuncCell = pPars->fUseCheck2 ? If_MatchCheck2 : If_MatchCheck1; + pPars->fCutMin = 1; + } if ( pPars->fUseCofVars ) { if ( !(pPars->nLutSize & 1) ) -- cgit v1.2.3