summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/aig/gia/gia.h9
-rw-r--r--src/aig/gia/giaDup.c5
-rw-r--r--src/aig/gia/giaMan.c1
-rw-r--r--src/aig/gia/giaSimBase.c27
-rw-r--r--src/base/abci/abc.c8
-rw-r--r--src/base/acb/acbUtil.c38
-rw-r--r--src/misc/util/utilTruth.h7
-rw-r--r--src/misc/vec/vecWrd.h7
8 files changed, 69 insertions, 33 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index 0e281b7c..f75d873c 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -238,6 +238,7 @@ struct Gia_Man_t_
Gia_Man_t * pUserAig;
Vec_Ptr_t * vUserNames;
Vec_Wec_t * vUserNodes;
+ Vec_Wec_t * vUserSupps;
Vec_Int_t * vUserArray;
};
@@ -726,8 +727,8 @@ static inline int Gia_ManAppendXorReal( Gia_Man_t * p, int iLit0, int iLit1 )
assert( iLit0 >= 0 && Abc_Lit2Var(iLit0) < Gia_ManObjNum(p) );
assert( iLit1 >= 0 && Abc_Lit2Var(iLit1) < Gia_ManObjNum(p) );
assert( Abc_Lit2Var(iLit0) != Abc_Lit2Var(iLit1) );
- assert( !Abc_LitIsCompl(iLit0) );
- assert( !Abc_LitIsCompl(iLit1) );
+ //assert( !Abc_LitIsCompl(iLit0) );
+ //assert( !Abc_LitIsCompl(iLit1) );
if ( Abc_Lit2Var(iLit0) > Abc_Lit2Var(iLit1) )
{
pObj->iDiff0 = (unsigned)(Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0));
@@ -860,7 +861,6 @@ static inline int Gia_ManAppendXor2( Gia_Man_t * p, int iLit0, int iLit1 )
static inline int Gia_ManAppendXorReal2( Gia_Man_t * p, int iLit0, int iLit1 )
{
- int fCompl;
if ( !p->fGiaSimple )
{
if ( iLit0 < 2 )
@@ -872,8 +872,7 @@ static inline int Gia_ManAppendXorReal2( Gia_Man_t * p, int iLit0, int iLit1 )
if ( iLit0 == Abc_LitNot(iLit1) )
return 1;
}
- fCompl = Abc_LitIsCompl(iLit0) ^ Abc_LitIsCompl(iLit1);
- return Abc_LitNotCond( Gia_ManAppendXorReal( p, Abc_LitRegular(iLit0), Abc_LitRegular(iLit1) ), fCompl );
+ return Gia_ManAppendXorReal( p, iLit0, iLit1 );
}
static inline void Gia_ManPatchCoDriver( Gia_Man_t * p, int iCoIndex, int iLit0 )
diff --git a/src/aig/gia/giaDup.c b/src/aig/gia/giaDup.c
index e05380d5..a1aaadf3 100644
--- a/src/aig/gia/giaDup.c
+++ b/src/aig/gia/giaDup.c
@@ -3471,7 +3471,10 @@ Gia_Man_t * Gia_ManDupCones( Gia_Man_t * p, int * pPos, int nPos, int fTrimPis )
Gia_ObjRiToRo(p, pObj)->Value = Gia_ManAppendCi( pNew );
// create internal nodes
Vec_PtrForEachEntry( Gia_Obj_t *, vNodes, pObj, i )
- pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
+ if ( Gia_ObjIsXor(pObj) )
+ pObj->Value = Gia_ManAppendXor( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
+ else
+ pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
// create COs
Vec_PtrForEachEntry( Gia_Obj_t *, vRoots, pObj, i )
Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c
index 2c10bedf..bb8851ec 100644
--- a/src/aig/gia/giaMan.c
+++ b/src/aig/gia/giaMan.c
@@ -93,6 +93,7 @@ void Gia_ManStop( Gia_Man_t * p )
Gia_ManStopP( &p->pUserAig );
Vec_PtrFreeFree( p->vUserNames );
Vec_WecFreeP( &p->vUserNodes );
+ Vec_WecFreeP( &p->vUserSupps );
Vec_IntFreeP( &p->vUserArray );
Vec_IntFreeP( &p->vSwitching );
Vec_IntFreeP( &p->vSuper );
diff --git a/src/aig/gia/giaSimBase.c b/src/aig/gia/giaSimBase.c
index ff658eff..95508d70 100644
--- a/src/aig/gia/giaSimBase.c
+++ b/src/aig/gia/giaSimBase.c
@@ -78,13 +78,6 @@ struct Gia_SimAbsMan_t_
SeeAlso []
***********************************************************************/
-Vec_Wrd_t * Gia_ManSimPatGenRandom( int nWords )
-{
- Vec_Wrd_t * vSims = Vec_WrdAlloc( nWords ); int i;
- for ( i = 0; i < nWords; i++ )
- Vec_WrdPush( vSims, Gia_ManRandomW(0) );
- return vSims;
-}
void Gia_ManSimPatAssignInputs( Gia_Man_t * p, int nWords, Vec_Wrd_t * vSims, Vec_Wrd_t * vSimsIn )
{
int i, Id;
@@ -102,8 +95,12 @@ static inline void Gia_ManSimPatSimAnd( Gia_Man_t * p, int i, Gia_Obj_t * pObj,
word * pSims0 = pSims + nWords*Gia_ObjFaninId0(pObj, i);
word * pSims1 = pSims + nWords*Gia_ObjFaninId1(pObj, i);
word * pSims2 = pSims + nWords*i; int w;
- for ( w = 0; w < nWords; w++ )
- pSims2[w] = (pSims0[w] ^ Diff0) & (pSims1[w] ^ Diff1);
+ if ( Gia_ObjIsXor(pObj) )
+ for ( w = 0; w < nWords; w++ )
+ pSims2[w] = (pSims0[w] ^ Diff0) ^ (pSims1[w] ^ Diff1);
+ else
+ for ( w = 0; w < nWords; w++ )
+ pSims2[w] = (pSims0[w] ^ Diff0) & (pSims1[w] ^ Diff1);
}
static inline void Gia_ManSimPatSimPo( Gia_Man_t * p, int i, Gia_Obj_t * pObj, int nWords, Vec_Wrd_t * vSims )
{
@@ -173,7 +170,7 @@ Vec_Wrd_t * Gia_ManSimPatValues( Gia_Man_t * p )
SeeAlso []
-***********************************************************************/\
+***********************************************************************/
Vec_Wrd_t * Gia_ManSimCombine( int nInputs, Vec_Wrd_t * vBase, Vec_Wrd_t * vAddOn, int nWordsUse )
{
int nWordsBase = Vec_WrdSize(vBase) / nInputs;
@@ -226,7 +223,7 @@ Vec_Wrd_t * Gia_ManSimBitPacking( Gia_Man_t * p, Vec_Int_t * vCexStore, int nCex
{
int c, iCur = 0, iPat = 0;
int nWordsMax = Abc_Bit6WordNum( nCexes );
- Vec_Wrd_t * vSimsIn = Gia_ManSimPatGenRandom( Gia_ManCiNum(p) * nWordsMax );
+ Vec_Wrd_t * vSimsIn = Vec_WrdStartRandom( Gia_ManCiNum(p) * nWordsMax );
Vec_Wrd_t * vSimsCare = Vec_WrdStart( Gia_ManCiNum(p) * nWordsMax );
Vec_Wrd_t * vSimsRes = NULL;
for ( c = 0; c < nCexes; c++ )
@@ -586,8 +583,12 @@ static inline void Gia_SimRsbSimAndCareSet( Gia_Man_t * p, int i, Gia_Obj_t * pO
word * pSims0 = Vec_WrdEntryP( vSims0, nWords*Gia_ObjFaninId0(pObj, i) );
word * pSims1 = Vec_WrdEntryP( vSims1, nWords*Gia_ObjFaninId1(pObj, i) );
word * pSims2 = Vec_WrdEntryP( vSims2, nWords*i ); int w;
- for ( w = 0; w < nWords; w++ )
- pSims2[w] = (pSims0[w] ^ Diff0) & (pSims1[w] ^ Diff1);
+ if ( Gia_ObjIsXor(pObj) )
+ for ( w = 0; w < nWords; w++ )
+ pSims2[w] = (pSims0[w] ^ Diff0) ^ (pSims1[w] ^ Diff1);
+ else
+ for ( w = 0; w < nWords; w++ )
+ pSims2[w] = (pSims0[w] ^ Diff0) & (pSims1[w] ^ Diff1);
}
word * Gia_SimRsbCareSet( Gia_SimRsbMan_t * p, int iObj, Vec_Int_t * vTfo )
{
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index da4127cd..e6d9a986 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -32719,7 +32719,6 @@ usage:
***********************************************************************/
int Abc_CommandAbc9ReadSim( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- extern Vec_Wrd_t * Gia_ManSimPatGenRandom( int nWords );
extern Vec_Wrd_t * Gia_ManSimPatRead( char * pFileName );
int c, nWords = 4, fVerbose = 0;
char ** pArgvNew;
@@ -32765,7 +32764,7 @@ int Abc_CommandAbc9ReadSim( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( nArgcNew == 0 )
{
Gia_ManRandom( 1 );
- pAbc->pGia->vSimsPi = Gia_ManSimPatGenRandom( Gia_ManCiNum(pAbc->pGia) * nWords );
+ pAbc->pGia->vSimsPi = Vec_WrdStartRandom( Gia_ManCiNum(pAbc->pGia) * nWords );
printf( "Generated %d random patterns (%d 64-bit words) for each input of the AIG.\n", 64*nWords, nWords );
return 0;
}
@@ -47593,8 +47592,9 @@ int Abc_CommandAbc9Test( Abc_Frame_t * pAbc, int argc, char ** argv )
// pTemp = Slv_ManToAig( pAbc->pGia );
// Abc_FrameUpdateGia( pAbc, pTemp );
// Extra_TestGia2( pAbc->pGia );
- pTemp = Dau_ConstructAigFromFile( "lib4var2.txt" );
- Abc_FrameUpdateGia( pAbc, pTemp );
+ //pTemp = Dau_ConstructAigFromFile( "lib4var2.txt" );
+ //Abc_FrameUpdateGia( pAbc, pTemp );
+ Gia_Sim5TestPolarities( pAbc->pGia );
return 0;
usage:
Abc_Print( -2, "usage: &test [-FW num] [-svh]\n" );
diff --git a/src/base/acb/acbUtil.c b/src/base/acb/acbUtil.c
index 9e5c9457..d82c270d 100644
--- a/src/base/acb/acbUtil.c
+++ b/src/base/acb/acbUtil.c
@@ -502,7 +502,7 @@ Vec_Int_t * Acb_NtkFindNodes2( Acb_Ntk_t * p )
Acb_NtkFindNodes2_rec( p, Acb_ObjFanin(p, iObj, 0), vNodes );
return vNodes;
}
-int Acb_ObjToGia2( Gia_Man_t * pNew, Acb_Ntk_t * p, int iObj, Vec_Int_t * vTemp )
+int Acb_ObjToGia2( Gia_Man_t * pNew, Acb_Ntk_t * p, int iObj, Vec_Int_t * vTemp, int fUseXors )
{
//char * pName = Abc_NamStr( p->pDesign->pStrs, Acb_ObjName(p, iObj) );
int * pFanin, iFanin, k, Type, Res;
@@ -540,13 +540,13 @@ int Acb_ObjToGia2( Gia_Man_t * pNew, Acb_Ntk_t * p, int iObj, Vec_Int_t * vTemp
{
Res = 0;
Vec_IntForEachEntry( vTemp, iFanin, k )
- Res = Gia_ManAppendXor2( pNew, Res, iFanin );
+ Res = fUseXors ? Gia_ManAppendXorReal(pNew, Res, iFanin) : Gia_ManAppendXor2(pNew, Res, iFanin);
return Abc_LitNotCond( Res, Type == ABC_OPER_BIT_NXOR );
}
assert( 0 );
return -1;
}
-Gia_Man_t * Acb_NtkToGia2( Acb_Ntk_t * p )
+Gia_Man_t * Acb_NtkToGia2( Acb_Ntk_t * p, int fUseXors, Vec_Int_t * vTargets, int nTargets )
{
Gia_Man_t * pNew, * pOne;
Vec_Int_t * vFanins, * vNodes;
@@ -556,10 +556,17 @@ Gia_Man_t * Acb_NtkToGia2( Acb_Ntk_t * p )
Acb_NtkCleanObjCopies( p );
Acb_NtkForEachCi( p, iObj, i )
Acb_ObjSetCopy( p, iObj, Gia_ManAppendCi(pNew) );
+ if ( vTargets )
+ Vec_IntForEachEntry( vTargets, iObj, i )
+ Acb_ObjSetCopy( p, iObj, Gia_ManAppendCi(pNew) );
+ else
+ for ( i = 0; i < nTargets; i++ )
+ Gia_ManAppendCi(pNew);
vFanins = Vec_IntAlloc( 4 );
vNodes = Acb_NtkFindNodes2( p );
Vec_IntForEachEntry( vNodes, iObj, i )
- Acb_ObjSetCopy( p, iObj, Acb_ObjToGia2(pNew, p, iObj, vFanins) );
+ if ( Acb_ObjCopy(p, iObj) == -1 ) // skip targets assigned above
+ Acb_ObjSetCopy( p, iObj, Acb_ObjToGia2(pNew, p, iObj, vFanins, fUseXors) );
Vec_IntFree( vNodes );
Vec_IntFree( vFanins );
Acb_NtkForEachCo( p, iObj, i )
@@ -583,13 +590,16 @@ Gia_Man_t * Acb_NtkToGia2( Acb_Ntk_t * p )
***********************************************************************/
Vec_Int_t * Acb_NtkCollectCopies( Acb_Ntk_t * p, Gia_Man_t * pGia, Vec_Ptr_t ** pvNodesR )
{
- int i, iObj, iLit;
+ int i, iObj, iLit, nTargets = Vec_IntSize(&p->vTargets);
Vec_Int_t * vObjs = Acb_NtkFindNodes2( p );
Vec_Int_t * vNodes = Vec_IntAlloc( Acb_NtkObjNum(p) );
Vec_Ptr_t * vNodesR = Vec_PtrStart( Gia_ManObjNum(pGia) );
Vec_Bit_t * vDriver = Vec_BitStart( Gia_ManObjNum(pGia) );
Gia_ManForEachCiId( pGia, iObj, i )
- Vec_PtrWriteEntry( vNodesR, iObj, Abc_UtilStrsav(Acb_ObjNameStr(p, Acb_NtkCi(p, i))) );
+ if ( i < Gia_ManCiNum(pGia) - nTargets )
+ Vec_PtrWriteEntry( vNodesR, iObj, Abc_UtilStrsav(Acb_ObjNameStr(p, Acb_NtkCi(p, i))) );
+ else
+ Vec_PtrWriteEntry( vNodesR, iObj, Abc_UtilStrsav(Acb_ObjNameStr(p, Vec_IntEntry(&p->vTargets, i-(Gia_ManCiNum(pGia) - nTargets)))) );
Gia_ManForEachCoId( pGia, iObj, i )
{
Vec_BitWriteEntry( vDriver, Gia_ObjFaninId0(Gia_ManObj(pGia, iObj), iObj), 1 );
@@ -644,23 +654,31 @@ Vec_Int_t * Acb_NtkCollectUser( Acb_Ntk_t * p, Vec_Ptr_t * vUser )
SeeAlso []
***********************************************************************/
-int Acb_NtkExtract( char * pFileName0, char * pFileName1, int fVerbose,
+int Acb_NtkExtract( char * pFileName0, char * pFileName1, int fUseXors, int fVerbose,
Gia_Man_t ** ppGiaF, Gia_Man_t ** ppGiaG, Vec_Int_t ** pvNodes, Vec_Ptr_t ** pvNodesR )
{
extern Acb_Ntk_t * Acb_VerilogSimpleRead( char * pFileName, char * pFileNameW );
Acb_Ntk_t * pNtkF = Acb_VerilogSimpleRead( pFileName0, NULL );
Acb_Ntk_t * pNtkG = Acb_VerilogSimpleRead( pFileName1, NULL );
- int RetValue = 0;
+ int i, RetValue = 0;
if ( pNtkF && pNtkG )
{
- Gia_Man_t * pGiaF = Acb_NtkToGia2( pNtkF );
- Gia_Man_t * pGiaG = Acb_NtkToGia2( pNtkG );
+ int nTargets = Vec_IntSize(&pNtkF->vTargets);
+ Gia_Man_t * pGiaF = Acb_NtkToGia2( pNtkF, fUseXors, &pNtkF->vTargets, 0 );
+ Gia_Man_t * pGiaG = Acb_NtkToGia2( pNtkG, 0, NULL, nTargets );
assert( Acb_NtkCiNum(pNtkF) == Acb_NtkCiNum(pNtkG) );
assert( Acb_NtkCoNum(pNtkF) == Acb_NtkCoNum(pNtkG) );
*ppGiaF = pGiaF;
*ppGiaG = pGiaG;
*pvNodes = Acb_NtkCollectCopies( pNtkF, pGiaF, pvNodesR );
RetValue = 1;
+ if ( nTargets > 0 )
+ {
+ assert( pGiaF->vUserNodes == NULL );
+ pGiaF->vUserNodes = Vec_WecStart( nTargets );
+ for ( i = 0; i < nTargets; i++ )
+ Vec_WecPush( pGiaF->vUserNodes, i, 1 + Gia_ManCiNum(pGiaF) - nTargets + i );
+ }
}
if ( pNtkF ) Acb_ManFree( pNtkF->pDesign );
if ( pNtkG ) Acb_ManFree( pNtkG->pDesign );
diff --git a/src/misc/util/utilTruth.h b/src/misc/util/utilTruth.h
index 10196959..d913eda7 100644
--- a/src/misc/util/utilTruth.h
+++ b/src/misc/util/utilTruth.h
@@ -1835,6 +1835,13 @@ static inline int Abc_TtCountOnesVecMask( word * x, word * pMask, int nWords, in
Count += Abc_TtCountOnes( pMask[w] & x[w] );
return Count;
}
+static inline int Abc_TtCountOnesVecXor( word * x, word * y, int nWords )
+{
+ int w, Count = 0;
+ for ( w = 0; w < nWords; w++ )
+ Count += Abc_TtCountOnes( x[w] ^ y[w] );
+ return Count;
+}
/**Function*************************************************************
diff --git a/src/misc/vec/vecWrd.h b/src/misc/vec/vecWrd.h
index 45df1c97..e123c054 100644
--- a/src/misc/vec/vecWrd.h
+++ b/src/misc/vec/vecWrd.h
@@ -160,6 +160,13 @@ static inline Vec_Wrd_t * Vec_WrdStartNatural( int nSize )
p->pArray[i] = i;
return p;
}
+static inline Vec_Wrd_t * Vec_WrdStartRandom( int nSize )
+{
+ Vec_Wrd_t * vSims = Vec_WrdStart( nSize ); int i;
+ for ( i = 0; i < nSize; i++ )
+ vSims->pArray[i] = Abc_RandomW(0);
+ return vSims;
+}
/**Function*************************************************************