diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2012-07-08 14:04:52 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2012-07-08 14:04:52 -0700 |
commit | 21b847a8db06267db0f44d991236e20efe327a03 (patch) | |
tree | dcea21a9acab121fef56a04f1c00c263f862d206 /src | |
parent | ff0ec52d4d0f26b786d9c1f5b02f76ea9d436894 (diff) | |
download | abc-21b847a8db06267db0f44d991236e20efe327a03.tar.gz abc-21b847a8db06267db0f44d991236e20efe327a03.tar.bz2 abc-21b847a8db06267db0f44d991236e20efe327a03.zip |
Updating truth table computation for GIA to work for internal nodes as well.
Diffstat (limited to 'src')
-rw-r--r-- | src/aig/gia/gia.h | 2 | ||||
-rw-r--r-- | src/aig/gia/giaUtil.c | 34 |
2 files changed, 20 insertions, 16 deletions
diff --git a/src/aig/gia/gia.h b/src/aig/gia/gia.h index f427b670..aebcc7eb 100644 --- a/src/aig/gia/gia.h +++ b/src/aig/gia/gia.h @@ -945,7 +945,7 @@ extern Vec_Int_t * Gia_VtaConvertToGla( Gia_Man_t * p, Vec_Int_t * vVta extern Vec_Int_t * Gia_VtaConvertFromGla( Gia_Man_t * p, Vec_Int_t * vGla, int nFrames ); extern Vec_Int_t * Gia_FlaConvertToGla( Gia_Man_t * p, Vec_Int_t * vFla ); extern Vec_Int_t * Gia_GlaConvertToFla( Gia_Man_t * p, Vec_Int_t * vGla ); -extern unsigned * Gia_ManComputePoTt( Gia_Man_t * p, Gia_Obj_t * pObj ); +extern unsigned * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj ); /*=== giaCTas.c ===========================================================*/ typedef struct Tas_Man_t_ Tas_Man_t; diff --git a/src/aig/gia/giaUtil.c b/src/aig/gia/giaUtil.c index bef6c229..6e2c49ff 100644 --- a/src/aig/gia/giaUtil.c +++ b/src/aig/gia/giaUtil.c @@ -1510,15 +1510,15 @@ unsigned * Gia_ManComputePoTruthTables( Gia_Man_t * p, int nBytesMax ) SeeAlso [] ***********************************************************************/ -int Gia_ManComputePoTt_rec( Gia_Man_t * p, Gia_Obj_t * pObj ) +int Gia_ObjComputeTruthTable_rec( Gia_Man_t * p, Gia_Obj_t * pObj ) { word * pTruth0, * pTruth1, * pTruth, * pTruthL; if ( Gia_ObjIsTravIdCurrent(p, pObj) ) return pObj->Value; Gia_ObjSetTravIdCurrent(p, pObj); assert( Gia_ObjIsAnd(pObj) ); - pTruth0 = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Gia_ManComputePoTt_rec( p, Gia_ObjFanin0(pObj) ); - pTruth1 = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Gia_ManComputePoTt_rec( p, Gia_ObjFanin1(pObj) ); + pTruth0 = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Gia_ObjComputeTruthTable_rec( p, Gia_ObjFanin0(pObj) ); + pTruth1 = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Gia_ObjComputeTruthTable_rec( p, Gia_ObjFanin1(pObj) ); assert( p->nTtWords * p->iTtNum < Vec_WrdSize(p->vTtMemory) ); pTruth = Vec_WrdArray(p->vTtMemory) + p->nTtWords * p->iTtNum++; pTruthL = Vec_WrdArray(p->vTtMemory) + p->nTtWords * p->iTtNum; @@ -1542,13 +1542,12 @@ int Gia_ManComputePoTt_rec( Gia_Man_t * p, Gia_Obj_t * pObj ) } return p->iTtNum-1; } -unsigned * Gia_ManComputePoTt( Gia_Man_t * p, Gia_Obj_t * pObj ) +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 - assert( Gia_ObjIsCo(pObj) ); if ( p->vTtMemory == NULL ) { word Truth6[7] = { @@ -1584,16 +1583,21 @@ unsigned * Gia_ManComputePoTt( Gia_Man_t * p, Gia_Obj_t * pObj ) } p->iTtNum = 7; // compute truth table for the fanin node - pTruth = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Gia_ManComputePoTt_rec(p, Gia_ObjFanin0(pObj)); - // complement if needed - if ( Gia_ObjFaninC0(pObj) ) + if ( Gia_ObjIsCo(pObj) ) { - word * pTemp = pTruth; - assert( p->nTtWords * p->iTtNum < Vec_WrdSize(p->vTtMemory) ); - pTruth = Vec_WrdArray(p->vTtMemory) + p->nTtWords * p->iTtNum; - for ( k = 0; k < p->nTtWords; k++ ) - pTruth[k] = ~pTemp[k]; + pTruth = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Gia_ObjComputeTruthTable_rec(p, Gia_ObjFanin0(pObj)); + // complement if needed + if ( Gia_ObjFaninC0(pObj) ) + { + word * pTemp = pTruth; + assert( p->nTtWords * p->iTtNum < Vec_WrdSize(p->vTtMemory) ); + pTruth = Vec_WrdArray(p->vTtMemory) + p->nTtWords * p->iTtNum; + for ( k = 0; k < p->nTtWords; k++ ) + pTruth[k] = ~pTemp[k]; + } } + else + pTruth = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Gia_ObjComputeTruthTable_rec(p, pObj); return (unsigned *)pTruth; } @@ -1608,7 +1612,7 @@ unsigned * Gia_ManComputePoTt( Gia_Man_t * p, Gia_Obj_t * pObj ) SeeAlso [] ***********************************************************************/ -void Gia_ManComputePoTtTest( Gia_Man_t * p ) +void Gia_ObjComputeTruthTableTest( Gia_Man_t * p ) { Gia_Obj_t * pObj; unsigned * pTruth; @@ -1616,7 +1620,7 @@ void Gia_ManComputePoTtTest( Gia_Man_t * p ) int i; Gia_ManForEachPo( p, pObj, i ) { - pTruth = Gia_ManComputePoTt( p, pObj ); + pTruth = Gia_ObjComputeTruthTable( p, pObj ); // Extra_PrintHex( stdout, pTruth, Gia_ManPiNum(p) ); printf( "\n" ); } Abc_PrintTime( 1, "Time", clock() - clk ); |