summaryrefslogtreecommitdiffstats
path: root/src/aig
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-06-26 09:51:53 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-06-26 09:51:53 -0700
commita68ec38df1cbe557a46d53cf28bbe74a00bc979a (patch)
tree57c4dd063b078d355df8a55ba62780157cf896d2 /src/aig
parent2edf2a970ee3663ef0725f22972a10083ed81fbf (diff)
downloadabc-a68ec38df1cbe557a46d53cf28bbe74a00bc979a.tar.gz
abc-a68ec38df1cbe557a46d53cf28bbe74a00bc979a.tar.bz2
abc-a68ec38df1cbe557a46d53cf28bbe74a00bc979a.zip
Changes and improvements to different packages.
Diffstat (limited to 'src/aig')
-rw-r--r--src/aig/gia/gia.h49
1 files changed, 35 insertions, 14 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index 0dd657aa..46e20a5b 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -609,11 +609,20 @@ static inline int Gia_ManAppendXorReal( Gia_Man_t * p, int iLit0, int iLit1 )
assert( Abc_Lit2Var(iLit0) != Abc_Lit2Var(iLit1) );
assert( !Abc_LitIsCompl(iLit0) );
assert( !Abc_LitIsCompl(iLit1) );
- assert( Abc_Lit2Var(iLit0) > Abc_Lit2Var(iLit1) );
- pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
- pObj->fCompl0 = Abc_LitIsCompl(iLit0);
- pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
- pObj->fCompl1 = Abc_LitIsCompl(iLit1);
+ if ( Abc_Lit2Var(iLit0) > Abc_Lit2Var(iLit1) )
+ {
+ pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
+ pObj->fCompl0 = Abc_LitIsCompl(iLit0);
+ pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
+ pObj->fCompl1 = Abc_LitIsCompl(iLit1);
+ }
+ else
+ {
+ pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
+ pObj->fCompl1 = Abc_LitIsCompl(iLit0);
+ pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
+ pObj->fCompl0 = Abc_LitIsCompl(iLit1);
+ }
p->nXors++;
return Gia_ObjId( p, pObj ) << 1;
}
@@ -627,13 +636,23 @@ static inline int Gia_ManAppendMuxReal( Gia_Man_t * p, int iLitC, int iLit1, int
assert( Abc_Lit2Var(iLit0) != Abc_Lit2Var(iLit1) );
assert( Abc_Lit2Var(iLitC) != Abc_Lit2Var(iLit0) );
assert( Abc_Lit2Var(iLitC) != Abc_Lit2Var(iLit1) );
- assert( Abc_Lit2Var(iLit0) < Abc_Lit2Var(iLit1) );
- assert( !Abc_LitIsCompl(iLit1) );
- pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
- pObj->fCompl0 = Abc_LitIsCompl(iLit0);
- pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
- pObj->fCompl1 = Abc_LitIsCompl(iLit1);
- p->pMuxes[Gia_ObjId(p, pObj)] = iLitC;
+ assert( !p->pHTable || !Abc_LitIsCompl(iLit1) );
+ if ( Abc_Lit2Var(iLit0) < Abc_Lit2Var(iLit1) )
+ {
+ pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
+ pObj->fCompl0 = Abc_LitIsCompl(iLit0);
+ pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
+ pObj->fCompl1 = Abc_LitIsCompl(iLit1);
+ p->pMuxes[Gia_ObjId(p, pObj)] = iLitC;
+ }
+ else
+ {
+ pObj->iDiff1 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit0);
+ pObj->fCompl1 = Abc_LitIsCompl(iLit0);
+ pObj->iDiff0 = Gia_ObjId(p, pObj) - Abc_Lit2Var(iLit1);
+ pObj->fCompl0 = Abc_LitIsCompl(iLit1);
+ p->pMuxes[Gia_ObjId(p, pObj)] = Abc_LitNot(iLitC);
+ }
p->nMuxes++;
return Gia_ObjId( p, pObj ) << 1;
}
@@ -916,13 +935,15 @@ static inline int Gia_ObjLutFanin( Gia_Man_t * p, int Id, int i ) { re
for ( i = 0; (i < Vec_IntSize(vVec)) && ((pObj) = Gia_ManObj(p, Abc_Lit2Var(Vec_IntEntry(vVec,i)))) && (((fCompl) = Abc_LitIsCompl(Vec_IntEntry(vVec,i))),1); i++ )
#define Gia_ManForEachObjReverse( p, pObj, i ) \
for ( i = p->nObjs - 1; (i >= 0) && ((pObj) = Gia_ManObj(p, i)); i-- )
-#define Gia_ManForEachObjReverse1( p, pObj, i ) \
+#define Gia_ManForEachObjReverse1( p, pObj, i ) \
for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- )
#define Gia_ManForEachAnd( p, pObj, i ) \
for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsAnd(pObj) ) {} else
#define Gia_ManForEachAndId( p, i ) \
for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsAnd(Gia_ManObj(p, i)) ) {} else
-#define Gia_ManForEachCand( p, pObj, i ) \
+#define Gia_ManForEachMuxId( p, i ) \
+ for ( i = 0; (i < p->nObjs); i++ ) if ( !Gia_ObjIsMuxId(p, i) ) {} else
+#define Gia_ManForEachCand( p, pObj, i ) \
for ( i = 0; (i < p->nObjs) && ((pObj) = Gia_ManObj(p, i)); i++ ) if ( !Gia_ObjIsCand(pObj) ) {} else
#define Gia_ManForEachAndReverse( p, pObj, i ) \
for ( i = p->nObjs - 1; (i > 0) && ((pObj) = Gia_ManObj(p, i)); i-- ) if ( !Gia_ObjIsAnd(pObj) ) {} else