summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2022-08-30 12:00:33 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2022-08-30 12:00:33 -0700
commitc3c643820e714cf1ad392a2a84276c7c168cffda (patch)
tree77d83dc01ce73074fc0296cb224671162128c1be
parent1b0439d128be83914825ed097f4b42201d531213 (diff)
downloadabc-c3c643820e714cf1ad392a2a84276c7c168cffda.tar.gz
abc-c3c643820e714cf1ad392a2a84276c7c168cffda.tar.bz2
abc-c3c643820e714cf1ad392a2a84276c7c168cffda.zip
Various changes.
-rw-r--r--src/aig/gia/giaCut.c215
-rw-r--r--src/aig/gia/giaSimBase.c257
-rw-r--r--src/base/abci/abc.c8
-rw-r--r--src/base/wlc/wlcNdr.c13
-rw-r--r--src/sat/bmc/bmcMaj.c10
5 files changed, 490 insertions, 13 deletions
diff --git a/src/aig/gia/giaCut.c b/src/aig/gia/giaCut.c
index 7ee795b6..19e2d8fc 100644
--- a/src/aig/gia/giaCut.c
+++ b/src/aig/gia/giaCut.c
@@ -20,6 +20,7 @@
#include "gia.h"
#include "misc/util/utilTruth.h"
+#include "misc/vec/vecHsh.h"
ABC_NAMESPACE_IMPL_START
@@ -29,7 +30,7 @@ ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
#define GIA_MAX_CUTSIZE 8
-#define GIA_MAX_CUTNUM 51
+#define GIA_MAX_CUTNUM 65
#define GIA_MAX_TT_WORDS ((GIA_MAX_CUTSIZE > 6) ? 1 << (GIA_MAX_CUTSIZE-6) : 1)
#define GIA_CUT_NO_LEAF 0xF
@@ -778,6 +779,218 @@ void Gia_ManExtractTest( Gia_Man_t * pGia )
Abc_PrintTime( 0, "Creating windows", Abc_Clock() - clk );
}
+/**Function*************************************************************
+
+ Synopsis [Extract a given number of cuts.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Gia_StoCutPrint( int * pCut )
+{
+ int v;
+ printf( "{" );
+ for ( v = 1; v <= pCut[0]; v++ )
+ printf( " %d", pCut[v] );
+ printf( " }\n" );
+}
+void Gia_StoPrintCuts( Vec_Int_t * vThis, int iObj, int nCutSize )
+{
+ int i, * pCut;
+ printf( "Cuts of node %d (size = %d):\n", iObj, nCutSize );
+ Sdb_ForEachCut( Vec_IntArray(vThis), pCut, i )
+ if ( !nCutSize || pCut[0] == nCutSize )
+ Gia_StoCutPrint( pCut );
+}
+Vec_Wec_t * Gia_ManFilterCuts( Gia_Man_t * pGia, Vec_Wec_t * vStore, int nCutSize, int nCuts )
+{
+ abctime clkStart = Abc_Clock();
+ Vec_Wec_t * vCutsSel = Vec_WecAlloc( nCuts );
+ Vec_Int_t * vLevel, * vCut = Vec_IntAlloc( 10 );
+ Vec_Wec_t * vCuts = Vec_WecAlloc( 1000 );
+ Hsh_VecMan_t * p = Hsh_VecManStart( 1000 ); int i, s;
+ Vec_WecForEachLevel( vStore, vLevel, i ) if ( Vec_IntSize(vLevel) )
+ {
+ int v, k, * pCut, Value;
+ Sdb_ForEachCut( Vec_IntArray(vLevel), pCut, k )
+ {
+ if ( pCut[0] < 2 )
+ continue;
+
+ for ( v = 1; v <= pCut[0]; v++ )
+ if ( pCut[v] < 9 )
+ break;
+ if ( v <= pCut[0] )
+ continue;
+
+ Vec_IntClear( vCut );
+ Vec_IntPushArray( vCut, pCut+1, pCut[0] );
+ Value = Hsh_VecManAdd( p, vCut );
+ if ( Value == Vec_WecSize(vCuts) )
+ {
+ Vec_Int_t * vTemp = Vec_WecPushLevel(vCuts);
+ Vec_IntPush( vTemp, 0 );
+ Vec_IntAppend( vTemp, vCut );
+ }
+ Vec_IntAddToEntry( Vec_WecEntry(vCuts, Value), 0, 1 );
+ }
+ }
+ printf( "Collected cuts = %d.\n", Vec_WecSize(vCuts) );
+ for ( s = 3; s <= nCutSize; s++ )
+ Vec_WecForEachLevel( vCuts, vLevel, i )
+ if ( Vec_IntSize(vLevel) - 1 == s )
+ {
+ int * pCut = Vec_IntEntryP(vLevel, 1);
+ int u, v, Value;
+ for ( u = 0; u < s; u++ )
+ {
+ Vec_IntClear( vCut );
+ for ( v = 0; v < s; v++ ) if ( v != u )
+ Vec_IntPush( vCut, pCut[v] );
+ assert( Vec_IntSize(vCut) == s-1 );
+ Value = Hsh_VecManAdd( p, vCut );
+ if ( Value < Vec_WecSize(vCuts) )
+ Vec_IntAddToEntry( vLevel, 0, Vec_IntEntry(Vec_WecEntry(vCuts, Value), 0) );
+ }
+ }
+ Hsh_VecManStop( p );
+ Vec_IntFree( vCut );
+ // collect
+ Vec_WecSortByFirstInt( vCuts, 1 );
+ Vec_WecForEachLevelStop( vCuts, vLevel, i, Abc_MinInt(Vec_WecSize(vCuts), nCuts) )
+ Vec_IntAppend( Vec_WecPushLevel(vCutsSel), vLevel );
+ Abc_PrintTime( 0, "Cut filtering time", Abc_Clock() - clkStart );
+ return vCutsSel;
+}
+int Gia_ManCountRefs( Gia_Man_t * pGia, Vec_Int_t * vLevel )
+{
+ int i, iObj, nRefs = 0;
+ Vec_IntForEachEntry( vLevel, iObj, i )
+ nRefs += Gia_ObjRefNumId(pGia, iObj);
+ return nRefs;
+}
+Vec_Wrd_t * Gia_ManGenSims( Gia_Man_t * pGia )
+{
+ Vec_Wrd_t * vSims;
+ Vec_WrdFreeP( &pGia->vSimsPi );
+ pGia->vSimsPi = Vec_WrdStartTruthTables( Gia_ManCiNum(pGia) );
+ vSims = Gia_ManSimPatSim( pGia );
+ return vSims;
+}
+int Gia_ManFindSatDcs( Gia_Man_t * pGia, Vec_Wrd_t * vSims, Vec_Int_t * vLevel )
+{
+ int nWords = Vec_WrdSize(pGia->vSimsPi) / Gia_ManCiNum(pGia);
+ int i, w, iObj, Res = 0, Pres[256] = {0}, nMints = 1 << Vec_IntSize(vLevel);
+ for ( w = 0; w < 64*nWords; w++ )
+ {
+ int iInMint = 0;
+ Vec_IntForEachEntry( vLevel, iObj, i )
+ if ( Abc_TtGetBit( Vec_WrdEntryP(vSims, iObj*nWords), w ) )
+ iInMint |= 1 << i;
+ Pres[iInMint]++;
+ }
+ for ( i = 0; i < nMints; i++ )
+ Res += Pres[i] == 0;
+ return Res;
+}
+
+
+int Gia_ManCollectCutDivs( Gia_Man_t * p, Vec_Int_t * vIns )
+{
+ Gia_Obj_t * pObj; int i, Res = 0;
+ Vec_Int_t * vRes = Vec_IntAlloc( 100 );
+ Vec_IntSort( vIns, 0 );
+
+ Vec_IntPush( vRes, 0 );
+ Vec_IntAppend( vRes, vIns );
+
+ Gia_ManIncrementTravId( p );
+ Gia_ManIncrementTravId( p );
+ Gia_ManForEachObjVec( vIns, p, pObj, i )
+ Gia_ObjSetTravIdCurrent( p, pObj );
+
+ Gia_ManForEachAnd( p, pObj, i )
+ if ( Gia_ObjIsTravIdCurrent(p, pObj) )
+ continue;
+ else if ( Gia_ObjIsTravIdCurrent(p, Gia_ObjFanin0(pObj)) && Gia_ObjIsTravIdCurrent(p, Gia_ObjFanin1(pObj)) )
+ {
+ if ( !Gia_ObjIsTravIdPrevious(p, pObj) )
+ Vec_IntPush( vRes, i );
+ Gia_ObjSetTravIdCurrent( p, pObj );
+ }
+// printf( "Divisors: " );
+// Vec_IntPrint( vRes );
+ Res = Vec_IntSize(vRes);
+ Vec_IntFree( vRes );
+ return Res;
+}
+
+void Gia_ManConsiderCuts( Gia_Man_t * pGia, Vec_Wec_t * vCuts )
+{
+ Vec_Wrd_t * vSims = Gia_ManGenSims( pGia );
+ Vec_Int_t * vLevel; int i;
+ Gia_ManCreateRefs( pGia );
+ Vec_WecForEachLevel( vCuts, vLevel, i )
+ {
+ printf( "Cut %3d ", i );
+ printf( "Ref = %3d : ", Vec_IntEntry(vLevel, 0) );
+
+ Vec_IntShift( vLevel, 1 );
+ printf( "Ref = %3d : ", Gia_ManCountRefs(pGia, vLevel) );
+ printf( "SDC = %3d : ", Gia_ManFindSatDcs(pGia, vSims, vLevel) );
+ printf( "Div = %3d : ", Gia_ManCollectCutDivs(pGia, vLevel) );
+ Vec_IntPrint( vLevel );
+ Vec_IntShift( vLevel, -1 );
+ }
+ Vec_WrdFree( vSims );
+}
+
+
+Vec_Wec_t * Gia_ManExploreCuts( Gia_Man_t * pGia, int nCutSize0, int nCuts0, int fVerbose0 )
+{
+ int nCutSize = nCutSize0;
+ int nCutNum = 64;
+ int fCutMin = 0;
+ int fTruthMin = 0;
+ int fVerbose = fVerbose0;
+ Vec_Wec_t * vCutsSel;
+ Gia_Sto_t * p = Gia_StoAlloc( pGia, nCutSize, nCutNum, fCutMin, fTruthMin, fVerbose );
+ Gia_Obj_t * pObj; int i, iObj;
+ assert( nCutSize <= GIA_MAX_CUTSIZE );
+ assert( nCutNum < GIA_MAX_CUTNUM );
+ // prepare references
+ Gia_ManForEachObj( p->pGia, pObj, iObj )
+ Gia_StoRefObj( p, iObj );
+ // compute cuts
+ Gia_StoComputeCutsConst0( p, 0 );
+ Gia_ManForEachCiId( p->pGia, iObj, i )
+ Gia_StoComputeCutsCi( p, iObj );
+ Gia_ManForEachAnd( p->pGia, pObj, iObj )
+ Gia_StoComputeCutsNode( p, iObj );
+ if ( p->fVerbose )
+ {
+ printf( "Running cut computation with CutSize = %d CutNum = %d CutMin = %s TruthMin = %s\n",
+ p->nCutSize, p->nCutNum, p->fCutMin ? "yes":"no", p->fTruthMin ? "yes":"no" );
+ printf( "CutPair = %.0f ", p->CutCount[0] );
+ printf( "Merge = %.0f (%.2f %%) ", p->CutCount[1], 100.0*p->CutCount[1]/p->CutCount[0] );
+ printf( "Eval = %.0f (%.2f %%) ", p->CutCount[2], 100.0*p->CutCount[2]/p->CutCount[0] );
+ printf( "Cut = %.0f (%.2f %%) ", p->CutCount[3], 100.0*p->CutCount[3]/p->CutCount[0] );
+ printf( "Cut/Node = %.2f ", p->CutCount[3] / Gia_ManAndNum(p->pGia) );
+ printf( "\n" );
+ printf( "The number of nodes with cut count over the limit (%d cuts) = %d nodes (out of %d). ",
+ p->nCutNum, p->nCutsOver, Gia_ManAndNum(pGia) );
+ Abc_PrintTime( 0, "Time", Abc_Clock() - p->clkStart );
+ }
+ vCutsSel = Gia_ManFilterCuts( pGia, p->vCuts, nCutSize0, nCuts0 );
+ Gia_ManConsiderCuts( pGia, vCutsSel );
+ Gia_StoFree( p );
+ return vCutsSel;
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/aig/gia/giaSimBase.c b/src/aig/gia/giaSimBase.c
index 3d103574..6f825549 100644
--- a/src/aig/gia/giaSimBase.c
+++ b/src/aig/gia/giaSimBase.c
@@ -2943,7 +2943,7 @@ Vec_Wrd_t * Gia_ManRelDerive( Gia_Man_t * p, Vec_Int_t * vObjs, Vec_Wrd_t * vSim
Vec_Wrd_t * Gia_ManRelDerive2( Gia_Man_t * p, Vec_Int_t * vObjs, Vec_Wrd_t * vSims )
{
int nWords = Vec_WrdSize(p->vSimsPi) / Gia_ManCiNum(p); Gia_Obj_t * pObj;
- int i, Id, m, Index, iMint = 0, nMints = 1 << Vec_IntSize(vObjs);
+ int i, Id, m, Index, nMints = 1 << Vec_IntSize(vObjs);
Vec_Wrd_t * vPos, * vRel = Vec_WrdStart( Gia_ManCoNum(p) * nWords * nMints );
for ( m = 0; m < nMints; m++ )
{
@@ -2991,15 +2991,83 @@ void Gia_ManRelPrint( Gia_Man_t * p, Vec_Int_t * vObjs, Vec_Wrd_t * vSims, Vec_W
printf( "\n" );
}
}
+void Gia_ManRelPrint2( Gia_Man_t * p, Vec_Int_t * vObjs, Vec_Wrd_t * vSims, Vec_Wrd_t * vRel )
+{
+ int w, nWords = Vec_WrdSize(p->vSimsPi) / Gia_ManCiNum(p);
+ int i, Id, m, nMints = 1 << Vec_IntSize(vObjs);
+ int nWordsM = Abc_Truth6WordNum(Vec_IntSize(vObjs));
+ Vec_Wrd_t * vRes = Vec_WrdStart( 64*nWords * nWordsM );
+ printf( "Relation has %d inputs and %d outputs:\n", Gia_ManCiNum(p), Vec_IntSize(vObjs) );
+ for ( w = 0; w < 64*nWords; w++ )
+ {
+ int iMint = 0;
+ int nValid = 0;
+ Gia_ManForEachCiId( p, Id, i )
+ printf( "%d", Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*nWords), w) );
+ printf( " " );
+ Vec_IntForEachEntry( vObjs, Id, i )
+ {
+ printf( "%d", Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*nWords), w) );
+ if ( Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*nWords), w) )
+ iMint |= 1 << i;
+ }
+ printf( " " );
+ Gia_ManForEachCoId( p, Id, i )
+ printf( "%d", Abc_TtGetBit(Vec_WrdEntryP(vSims, Id*nWords), w) );
+ printf( " " );
+ for ( m = 0; m < nMints; m++ )
+ {
+ int Count = 0;
+ Gia_ManForEachCoId( p, Id, i )
+ Count += Abc_TtGetBit(Vec_WrdEntryP(vRel, (m*Gia_ManCoNum(p)+i)*nWords), w);
+ printf( "%d", Count == 0 );
+ nValid += Count > 0;
+ if ( Count == 0 )
+ Abc_TtSetBit( Vec_WrdEntryP(vRes, w*nWordsM), m );
+ }
+ printf( " " );
+ for ( m = 0; m < nMints; m++ )
+ printf( "%d", Abc_TtGetBit(Vec_WrdEntryP(vRes, w*nWordsM), m) );
+ printf( " " );
+ assert( Abc_TtGetBit(Vec_WrdEntryP(vRes, w*nWordsM), iMint) );
+ for ( i = 0; i < Vec_IntSize(vObjs); i++ )
+ if ( Abc_TtGetBit(Vec_WrdEntryP(vRes, w*nWordsM), iMint ^ (1 << i)) )
+ printf( "-" );
+ else
+ printf( "%d", (iMint >> i) & 1 );
+ printf( " %d", nMints-nValid );
+ printf( "\n" );
+ }
+ Vec_WrdFree( vRes );
+}
Vec_Int_t * Gia_ManRelInitObjs()
{
- Vec_Int_t * vRes = Vec_IntAlloc( 3 );
- Vec_IntPush( vRes, 41 );
- Vec_IntPush( vRes, 46 );
+ Vec_Int_t * vRes = Vec_IntAlloc( 10 );
+ /*
+ Vec_IntPush( vRes, 33 );
+ Vec_IntPush( vRes, 52 );
Vec_IntPush( vRes, 53 );
+ Vec_IntPush( vRes, 65 );
+ Vec_IntPush( vRes, 79 );
+ Vec_IntPush( vRes, 81 );
+ */
+ /*
+ Vec_IntPush( vRes, 60 );
+ Vec_IntPush( vRes, 61 );
+ Vec_IntPush( vRes, 71 );
+ Vec_IntPush( vRes, 72 );
+ */
+ /*
+ Vec_IntPush( vRes, 65 );
+ Vec_IntPush( vRes, 79 );
+ Vec_IntPush( vRes, 81 );
+ */
+ Vec_IntPush( vRes, 52 );
+ Vec_IntPush( vRes, 54 );
+ Vec_IntPrint( vRes );
return vRes;
}
-void Gia_ManRelDeriveTest( Gia_Man_t * p )
+void Gia_ManRelDeriveTest2( Gia_Man_t * p )
{
Vec_Int_t * vObjs = Gia_ManRelInitObjs();
Vec_Wrd_t * vSims, * vRel, * vRel2; int nWords;
@@ -3009,14 +3077,189 @@ void Gia_ManRelDeriveTest( Gia_Man_t * p )
vSims = Gia_ManSimPatSim( p );
vRel = Gia_ManRelDerive( p, vObjs, vSims );
vRel2 = Gia_ManRelDerive2( p, vObjs, vSims );
- assert( !memcmp(vRel2->pArray, vRel->pArray, sizeof(word)*Vec_WrdSize(vRel)) );
- Gia_ManRelPrint( p, vObjs, vSims, vRel );
+ //assert( !memcmp(vRel2->pArray, vRel->pArray, sizeof(word)*Vec_WrdSize(vRel)) );
+ Gia_ManRelPrint2( p, vObjs, vSims, vRel );
Vec_WrdFree( vRel2 );
Vec_WrdFree( vRel );
Vec_WrdFree( vSims );
Vec_IntFree( vObjs );
}
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Vec_Int_t * Gia_ManRelInitIns()
+{
+ Vec_Int_t * vRes = Vec_IntAlloc( 10 );
+ Vec_IntPush( vRes, 12 );
+ Vec_IntPush( vRes, 18 );
+ Vec_IntPush( vRes, 21 );
+ Vec_IntPush( vRes, 34 );
+ Vec_IntPush( vRes, 45 );
+ Vec_IntPush( vRes, 59 );
+ return vRes;
+}
+Vec_Int_t * Gia_ManRelInitOuts()
+{
+ Vec_Int_t * vRes = Vec_IntAlloc( 10 );
+ Vec_IntPush( vRes, 65 );
+ Vec_IntPush( vRes, 66 );
+ return vRes;
+}
+Vec_Int_t * Gia_ManRelInitMffc( Gia_Man_t * p, Vec_Int_t * vOuts )
+{
+ Gia_Obj_t * pObj; int i;
+ Vec_Int_t * vRes = Vec_IntAlloc( 100 );
+ Vec_IntSort( vOuts, 0 );
+ Gia_ManIncrementTravId( p );
+ Gia_ManForEachObjVec( vOuts, p, pObj, i )
+ Gia_ObjSetTravIdCurrent( p, pObj );
+ Gia_ManIncrementTravId( p );
+ Gia_ManForEachCo( p, pObj, i )
+ if ( !Gia_ObjIsTravIdPrevious(p, Gia_ObjFanin0(pObj)) )
+ Gia_ObjSetTravIdCurrent( p, Gia_ObjFanin0(pObj) );
+ Gia_ManForEachAndReverse( p, pObj, i )
+ if ( Gia_ObjIsTravIdPrevious(p, pObj) )
+ continue;
+ else if ( Gia_ObjIsTravIdCurrent(p, pObj) )
+ {
+ if ( !Gia_ObjIsTravIdPrevious(p, Gia_ObjFanin0(pObj)) )
+ Gia_ObjSetTravIdCurrent( p, Gia_ObjFanin0(pObj) );
+ if ( !Gia_ObjIsTravIdPrevious(p, Gia_ObjFanin1(pObj)) )
+ Gia_ObjSetTravIdCurrent( p, Gia_ObjFanin1(pObj) );
+ }
+ Gia_ManForEachAnd( p, pObj, i )
+ if ( !Gia_ObjIsTravIdCurrent(p, pObj) )
+ Vec_IntPush( vRes, i );
+ printf( "MFFC: " );
+ Vec_IntPrint( vRes );
+ return vRes;
+}
+Vec_Int_t * Gia_ManRelInitDivs( Gia_Man_t * p, Vec_Int_t * vIns, Vec_Int_t * vOuts )
+{
+ Gia_Obj_t * pObj; int i;
+ Vec_Int_t * vMffc = Gia_ManRelInitMffc( p, vOuts );
+ Vec_Int_t * vRes = Vec_IntAlloc( 100 );
+ Vec_IntSort( vIns, 0 );
+
+ Gia_ManIncrementTravId( p );
+ Gia_ManForEachObjVec( vMffc, p, pObj, i )
+ Gia_ObjSetTravIdCurrent( p, pObj );
+ Vec_IntFree( vMffc );
+
+ Vec_IntPush( vRes, 0 );
+ Vec_IntAppend( vRes, vIns );
+
+ Gia_ManIncrementTravId( p );
+ Gia_ManForEachObjVec( vIns, p, pObj, i )
+ Gia_ObjSetTravIdCurrent( p, pObj );
+
+ Gia_ManForEachAnd( p, pObj, i )
+ if ( Gia_ObjIsTravIdCurrent(p, pObj) )
+ continue;
+ else if ( Gia_ObjIsTravIdCurrent(p, Gia_ObjFanin0(pObj)) && Gia_ObjIsTravIdCurrent(p, Gia_ObjFanin1(pObj)) )
+ {
+ if ( !Gia_ObjIsTravIdPrevious(p, pObj) )
+ Vec_IntPush( vRes, i );
+ Gia_ObjSetTravIdCurrent( p, pObj );
+ }
+ printf( "Divisors: " );
+ Vec_IntPrint( vRes );
+ return vRes;
+}
+
+Vec_Int_t * Gia_ManRelDeriveSimple( Gia_Man_t * p, Vec_Wrd_t * vSims, Vec_Int_t * vIns, Vec_Int_t * vOuts )
+{
+ Vec_Int_t * vRes = Vec_IntStartFull( 1 << Vec_IntSize(vIns) );
+ int w, nWords = Vec_WrdSize(p->vSimsPi) / Gia_ManCiNum(p);
+ for ( w = 0; w < 64*nWords; w++ )
+ {
+ int i, iObj, iMint = 0, iMint2 = 0;
+ Vec_IntForEachEntry( vIns, iObj, i )
+ if ( Abc_TtGetBit(Vec_WrdEntryP(vSims, iObj*nWords), w) )
+ iMint |= 1 << i;
+ if ( Vec_IntEntry(vRes, iMint) >= 0 )
+ continue;
+ Vec_IntForEachEntry( vOuts, iObj, i )
+ if ( Abc_TtGetBit(Vec_WrdEntryP(vSims, iObj*nWords), w) )
+ iMint2 |= 1 << i;
+ Vec_IntWriteEntry( vRes, iMint, iMint2 );
+ }
+ return vRes;
+}
+
+void Gia_ManRelSolve( Gia_Man_t * p, Vec_Wrd_t * vSims, Vec_Int_t * vIns, Vec_Int_t * vOuts, Vec_Int_t * vRel, Vec_Int_t * vDivs )
+{
+ extern void Exa4_ManGenTest( Vec_Wrd_t * vSimsIn, Vec_Wrd_t * vSimsOut, int nIns, int nDivs, int nOuts, int nNodes, int TimeOut, int fOnlyAnd, int fFancy, int fOrderNodes, int fVerbose );
+
+ int i, m, iObj, Entry, iMint = 0, nMints = Vec_IntSize(vRel) - Vec_IntCountEntry(vRel, -1);
+ Vec_Wrd_t * vSimsIn = Vec_WrdStart( nMints );
+ Vec_Wrd_t * vSimsOut = Vec_WrdStart( nMints );
+ int Entry0 = Vec_IntEntry( vRel, 0 );
+
+ word Value, Phase = 0;
+ int nWords = Vec_WrdSize(p->vSimsPi) / Gia_ManCiNum(p);
+ Vec_IntForEachEntry( vDivs, iObj, i )
+ if ( Vec_WrdEntry(vSims, iObj*nWords) & 1 )
+ Phase |= 1 << i;
+
+ assert( Entry0 >= 0 );
+ printf( "Entry0 = %d\n", Entry0 );
+ Entry0 ^= 1;
+// for ( m = 0; m < nMints; m++ )
+ Vec_IntForEachEntry( vRel, Entry, m )
+ {
+ if ( Entry == -1 )
+ continue;
+ Abc_TtSetBit( Vec_WrdEntryP(vSimsOut, iMint), Entry0 ^ Entry );
+
+ Value = 0;
+ Vec_IntForEachEntry( vDivs, iObj, i )
+ if ( Abc_TtGetBit(Vec_WrdEntryP(vSims, iObj*nWords), m) )
+ Abc_TtSetBit( &Value, i );
+ Vec_WrdEntryP(vSimsOut, iMint)[0] = Value ^ Phase;
+
+ iMint++;
+ }
+ assert( iMint == nMints );
+ printf( "Created %d minterms.\n", iMint );
+ Exa4_ManGenTest( vSimsIn, vSimsOut, Vec_IntSize(vIns), Vec_IntSize(vDivs), Vec_IntSize(vOuts), 10, 0, 0, 0, 0, 1 );
+ Vec_WrdFree( vSimsIn );
+ Vec_WrdFree( vSimsOut );
+}
+void Gia_ManRelDeriveTest( Gia_Man_t * p )
+{
+ Vec_Int_t * vIns = Gia_ManRelInitIns();
+ Vec_Int_t * vOuts = Gia_ManRelInitOuts();
+ Vec_Wrd_t * vSims; Vec_Int_t * vRel, * vDivs; int nWords;
+ Vec_WrdFreeP( &p->vSimsPi );
+ p->vSimsPi = Vec_WrdStartTruthTables( Gia_ManCiNum(p) );
+ nWords = Vec_WrdSize(p->vSimsPi) / Gia_ManCiNum(p);
+ vSims = Gia_ManSimPatSim( p );
+ vRel = Gia_ManRelDeriveSimple( p, vSims, vIns, vOuts );
+ vDivs = Gia_ManRelInitDivs( p, vIns, vOuts );
+ //printf( "Neg = %d\n", Vec_IntCountEntry(vRel, -1) );
+
+ Gia_ManRelSolve( p, vSims, vIns, vOuts, vRel, vDivs );
+
+ Vec_IntFree( vDivs );
+ Vec_IntPrint( vRel );
+ Vec_IntFree( vRel );
+ Vec_WrdFree( vSims );
+ Vec_IntFree( vIns );
+ Vec_IntFree( vOuts );
+}
+
+
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
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 <num>] [-iaoevh] <hex>\n" );
+ Abc_Print( -2, "usage: allexact [-MIKN <num>] [-ianevh] <hex>\n" );
Abc_Print( -2, "\t exact synthesis of I-input function using N K-input gates\n" );
Abc_Print( -2, "\t-M <num> : the majority support size (overrides -I and -K) [default = %d]\n", pPars->nMajSupp );
Abc_Print( -2, "\t-I <num> : the number of input variables [default = %d]\n", pPars->nVars );
@@ -9219,7 +9219,7 @@ usage:
Abc_Print( -2, "\t-N <num> : 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 );
diff --git a/src/sat/bmc/bmcMaj.c b/src/sat/bmc/bmcMaj.c
index d408c702..2525f943 100644
--- a/src/sat/bmc/bmcMaj.c
+++ b/src/sat/bmc/bmcMaj.c
@@ -27,6 +27,13 @@
ABC_NAMESPACE_IMPL_START
+#ifdef WIN32
+#include <process.h>
+#define unlink _unlink
+#else
+#include <unistd.h>
+#endif
+
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
@@ -1252,7 +1259,7 @@ static int Exa3_ManAddCnfStart( Exa3_Man_t * p, int fOnlyAnd )
}
//#ifdef USE_NODE_ORDER
// node ordering
- if ( p->pPars->fUseIncr )
+ if ( p->pPars->fOrderNodes )
{
for ( j = p->nVars; j < i; j++ )
for ( n = 0; n < p->nObjs; n++ ) if ( p->VarMarks[i][0][n] )
@@ -1616,6 +1623,7 @@ Vec_Int_t * Exa4_ManParse( char * pFileName )
assert( 0 );
}
fclose( pFile );
+ unlink( pFileName );
return vRes;
}
Vec_Int_t * Exa4_ManSolve( char * pFileNameIn, char * pFileNameOut, int TimeOut, int fVerbose )