summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-07-19 08:41:38 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2012-07-19 08:41:38 -0700
commita8f4d4e6bc19974ae31aa8a2981c53f849981f4e (patch)
treeaadd7aedf86e3e672bba95982a5ed84d3d8f0e9b /src
parent72c09b86a0b6280c1472cc6cf09a31a9a336ef87 (diff)
downloadabc-a8f4d4e6bc19974ae31aa8a2981c53f849981f4e.tar.gz
abc-a8f4d4e6bc19974ae31aa8a2981c53f849981f4e.tar.bz2
abc-a8f4d4e6bc19974ae31aa8a2981c53f849981f4e.zip
Making GIA use independent truth table number storage when computing truth tables.
Diffstat (limited to 'src')
-rw-r--r--src/aig/gia/gia.h1
-rw-r--r--src/aig/gia/giaMan.c1
-rw-r--r--src/aig/gia/giaUtil.c14
3 files changed, 10 insertions, 6 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h
index c537a31b..7efad774 100644
--- a/src/aig/gia/gia.h
+++ b/src/aig/gia/gia.h
@@ -154,6 +154,7 @@ struct Gia_Man_t_
word nHashHit; // hash table hit
word nHashMiss; // hash table miss
int fVerbose; // verbose reports
+ Vec_Int_t * vObjNums; // object numbers
Vec_Wrd_t * vTtMemory; // truth table memory
int nTtVars; // truth table variables
int nTtWords; // truth table words
diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c
index 556ddb9a..037edc78 100644
--- a/src/aig/gia/giaMan.c
+++ b/src/aig/gia/giaMan.c
@@ -87,6 +87,7 @@ void Gia_ManStop( Gia_Man_t * p )
Vec_IntFreeP( &p->vLevels );
Vec_IntFreeP( &p->vTruths );
Vec_WrdFreeP( &p->vTtMemory );
+ Vec_IntFreeP( &p->vObjNums );
Vec_IntFree( p->vCis );
Vec_IntFree( p->vCos );
ABC_FREE( p->pTravIds );
diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c
index 0dec3bd9..c0e5b9ab 100644
--- a/src/aig/gia/giaUtil.c
+++ b/src/aig/gia/giaUtil.c
@@ -1358,11 +1358,11 @@ unsigned * Gia_ManComputePoTruthTables( Gia_Man_t * p, int nBytesMax )
***********************************************************************/
int Gia_ObjComputeTruthTable_rec( Gia_Man_t * p, Gia_Obj_t * pObj )
-{
+{
word * pTruth0, * pTruth1, * pTruth, * pTruthL;
int Value0, Value1;
if ( Gia_ObjIsTravIdCurrent(p, pObj) )
- return pObj->Value;
+ return Vec_IntGetEntry(p->vObjNums, Gia_ObjId(p, pObj));
Gia_ObjSetTravIdCurrent(p, pObj);
assert( Gia_ObjIsAnd(pObj) );
Value0 = Gia_ObjComputeTruthTable_rec( p, Gia_ObjFanin0(pObj) );
@@ -1392,14 +1392,14 @@ int Gia_ObjComputeTruthTable_rec( Gia_Man_t * p, Gia_Obj_t * pObj )
while ( pTruth < pTruthL )
*pTruth++ = *pTruth0++ & *pTruth1++;
}
- return (pObj->Value = p->iTtNum-1);
+ Vec_IntSetEntry(p->vObjNums, Gia_ObjId(p, pObj), p->iTtNum-1);
+ return p->iTtNum-1;
}
unsigned * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj )
{
Gia_Obj_t * pTemp;
word * pTruth;
int i, k;
- // this procedure works only for primary outputs
if ( p->vTtMemory == NULL )
{
word Truth6[7] = {
@@ -1417,6 +1417,8 @@ unsigned * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj )
for ( i = 0; i < 7; i++ )
for ( k = 0; k < p->nTtWords; k++ )
Vec_WrdWriteEntry( p->vTtMemory, i * p->nTtWords + k, Truth6[i] );
+ assert( p->vObjNums == NULL );
+ p->vObjNums = Vec_IntAlloc( Gia_ManObjNum(p) + 1000 );
}
else
{
@@ -1427,11 +1429,11 @@ unsigned * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj )
// mark const and PIs
Gia_ManIncrementTravId( p );
Gia_ObjSetTravIdCurrent( p, Gia_ManConst0(p) );
- Gia_ManConst0(p)->Value = 0;
+ Vec_IntSetEntry(p->vObjNums,0, 0);
Gia_ManForEachPi( p, pTemp, i )
{
Gia_ObjSetTravIdCurrent( p, pTemp );
- pTemp->Value = i+1;
+ Vec_IntSetEntry(p->vObjNums, Gia_ObjId(p, pTemp), i+1);
}
p->iTtNum = 7;
// compute truth table for the fanin node