summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/aig/ntl/ntl.h6
-rw-r--r--src/aig/ntl/ntlExtract.c15
-rw-r--r--src/aig/ntl/ntlFraig.c26
-rw-r--r--src/aig/ntl/ntlMan.c2
-rw-r--r--src/aig/ntl/ntlObj.c12
-rw-r--r--src/aig/ntl/ntlUtil.c6
-rw-r--r--src/base/abci/abc.c27
7 files changed, 53 insertions, 41 deletions
diff --git a/src/aig/ntl/ntl.h b/src/aig/ntl/ntl.h
index 0955214e..0df0f512 100644
--- a/src/aig/ntl/ntl.h
+++ b/src/aig/ntl/ntl.h
@@ -137,14 +137,14 @@ struct Ntl_Reg_t_
struct Ntl_Obj_t_
{
- Ntl_Mod_t * pModel; // the model
+// Ntl_Mod_t * pModel; // the model
void * pCopy; // the copy of this object
unsigned Type : 3; // object type
unsigned fMark : 1; // temporary mark
unsigned Id : 28; // object ID
int nFanins; // the number of fanins
int nFanouts; // the number of fanouts
- int Reset; // reset of the flop
+// int Reset; // reset of the flop
union { // functionality
Ntl_Mod_t * pImplem; // model (for boxes)
char * pSop; // SOP (for logic nodes)
@@ -165,7 +165,7 @@ struct Ntl_Net_t_
union {
void * pCopy2; // the copy of this object
float dTemp; // other data
- int iTemp; // other data
+// int iTemp; // other data
};
Ntl_Obj_t * pDriver; // driver of the net
unsigned NetId : 27; // unique ID of the net
diff --git a/src/aig/ntl/ntlExtract.c b/src/aig/ntl/ntlExtract.c
index 55a961df..ae278585 100644
--- a/src/aig/ntl/ntlExtract.c
+++ b/src/aig/ntl/ntlExtract.c
@@ -116,13 +116,12 @@ Aig_Obj_t * Ntl_GraphToNetworkAig( Aig_Man_t * pMan, Dec_Graph_t * pGraph )
SeeAlso []
***********************************************************************/
-Aig_Obj_t * Ntl_ManBuildNodeAig( Ntl_Obj_t * pNode )
+Aig_Obj_t * Ntl_ManBuildNodeAig( Ntl_Man_t * p, Ntl_Obj_t * pNode )
{
- Aig_Man_t * pMan = pNode->pModel->pMan->pAig;
int fUseFactor = 1;
// consider the constant node
if ( Kit_PlaGetVarNum(pNode->pSop) == 0 )
- return Aig_NotCond( Aig_ManConst1(pMan), Kit_PlaIsConst0(pNode->pSop) );
+ return Aig_NotCond( Aig_ManConst1(p->pAig), Kit_PlaIsConst0(pNode->pSop) );
// decide when to use factoring
if ( fUseFactor && Kit_PlaGetVarNum(pNode->pSop) > 2 && Kit_PlaGetCubeNum(pNode->pSop) > 1 )
{
@@ -136,11 +135,11 @@ Aig_Obj_t * Ntl_ManBuildNodeAig( Ntl_Obj_t * pNode )
Dec_GraphForEachLeaf( pFForm, pFFNode, i )
pFFNode->pFunc = Ntl_ObjFanin(pNode, i)->pCopy;
// perform strashing
- pFunc = Ntl_GraphToNetworkAig( pMan, pFForm );
+ pFunc = Ntl_GraphToNetworkAig( p->pAig, pFForm );
Dec_GraphFree( pFForm );
return pFunc;
}
- return Ntl_ConvertSopToAigInternal( pMan, pNode, pNode->pSop );
+ return Ntl_ConvertSopToAigInternal( p->pAig, pNode, pNode->pSop );
}
/**Function*************************************************************
@@ -198,7 +197,7 @@ int Ntl_ManExtract_rec( Ntl_Man_t * p, Ntl_Net_t * pNet )
}
Vec_PtrPush( p->vVisNodes, pObj );
if ( Ntl_ObjIsNode(pObj) )
- pNet->pCopy = Ntl_ManBuildNodeAig( pObj );
+ pNet->pCopy = Ntl_ManBuildNodeAig( p, pObj );
pNet->nVisits = 2;
return 1;
}
@@ -371,7 +370,7 @@ int Ntl_ManCollapseBoxSeq1_rec( Ntl_Man_t * p, Ntl_Obj_t * pBox, int fSeq )
pNet->nVisits = 2;
// remember the class of this register
Vec_IntPush( p->vRegClasses, p->pNal ? pBox->iTemp : pObj->LatchId.regClass );
- Vec_IntPush( p->vRstClasses, p->pNal ? pBox->Reset : -1 );
+// Vec_IntPush( p->vRstClasses, p->pNal ? pBox->Reset : -1 );
}
// compute AIG for the internal nodes
Ntl_ModelForEachPo( pModel, pObj, i )
@@ -478,7 +477,7 @@ int Ntl_ManCollapse_rec( Ntl_Man_t * p, Ntl_Net_t * pNet, int fSeq )
return 0;
}
if ( Ntl_ObjIsNode(pObj) )
- pNet->pCopy = Ntl_ManBuildNodeAig( pObj );
+ pNet->pCopy = Ntl_ManBuildNodeAig( p, pObj );
pNet->nVisits = 2;
return 1;
}
diff --git a/src/aig/ntl/ntlFraig.c b/src/aig/ntl/ntlFraig.c
index 64af98f4..3ca8dfd7 100644
--- a/src/aig/ntl/ntlFraig.c
+++ b/src/aig/ntl/ntlFraig.c
@@ -373,7 +373,7 @@ if ( fVerbose )
Synopsis [Returns AIG with WB after fraiging.]
- Description []
+ Description [Consumes the input NTL to save memory.]
SideEffects []
@@ -386,11 +386,12 @@ Ntl_Man_t * Ntl_ManFraig( Ntl_Man_t * p, int nPartSize, int nConfLimit, int nLev
Aig_Man_t * pAig, * pAigCol, * pTemp;
if ( Ntl_ModelNodeNum(Ntl_ManRootModel(p)) == 0 )
- return Ntl_ManDup(p);
+ return p;
// collapse the AIG
pAig = Ntl_ManExtract( p );
pNew = Ntl_ManInsertAig( p, pAig );
+ Ntl_ManFree( p );
pAigCol = Ntl_ManCollapseComb( pNew );
if ( pAigCol == NULL )
{
@@ -434,12 +435,15 @@ Ntl_Man_t * Ntl_ManFraig( Ntl_Man_t * p, int nPartSize, int nConfLimit, int nLev
***********************************************************************/
int Ntl_ManAigCountResets( Ntl_Man_t * pNtl )
{
+/*
Ntl_Mod_t * pModel = Ntl_ManRootModel(pNtl);
Ntl_Obj_t * pBox;
int i, Counter = -1;
Ntl_ModelForEachObj( pModel, pBox, i )
Counter = ABC_MAX( Counter, pBox->Reset );
return Counter + 1;
+*/
+ return -1;
}
/**Function*************************************************************
@@ -590,7 +594,7 @@ void Ntl_ManRemapClassesScorr( Ntl_Man_t * pNtl, Aig_Man_t * p, Aig_Man_t * pNew
Synopsis [Performs sequential cleanup.]
- Description []
+ Description [Consumes the input NTL to save memory.]
SideEffects []
@@ -607,6 +611,7 @@ Ntl_Man_t * Ntl_ManScl( Ntl_Man_t * p, int fLatchConst, int fLatchEqual, int fVe
//Ntl_ManPrintStats( p );
//Aig_ManPrintStats( pAig );
pNew = Ntl_ManInsertAig( p, pAig );
+ Ntl_ManFree( p );
pAigCol = Ntl_ManCollapseSeq( pNew, 0, fVerbose );
if ( pAigCol == NULL )
{
@@ -617,7 +622,7 @@ Ntl_Man_t * Ntl_ManScl( Ntl_Man_t * p, int fLatchConst, int fLatchEqual, int fVe
//Aig_ManPrintStats( pAigCol );
// perform SCL
- if ( p->pNal )
+ if ( pNew->pNal )
{
Aig_Man_t * pAigRst;
pAigRst = Ntl_ManAigToRst( pNew, pAigCol );
@@ -644,7 +649,7 @@ Ntl_Man_t * Ntl_ManScl( Ntl_Man_t * p, int fLatchConst, int fLatchEqual, int fVe
Synopsis [Returns AIG with WB after fraiging.]
- Description []
+ Description [Consumes the input NTL to save memory.]
SideEffects []
@@ -663,6 +668,7 @@ Ntl_Man_t * Ntl_ManLcorr( Ntl_Man_t * p, int nConfMax, int fScorrGia, int fUseCS
// collapse the AIG
pAig = Ntl_ManExtract( p );
pNew = Ntl_ManInsertAig( p, pAig );
+ Ntl_ManFree( p );
pAigCol = Ntl_ManCollapseSeq( pNew, pPars->nMinDomSize, pPars->fVerbose );
if ( pAigCol == NULL )
{
@@ -673,7 +679,7 @@ Ntl_Man_t * Ntl_ManLcorr( Ntl_Man_t * p, int nConfMax, int fScorrGia, int fUseCS
// perform LCORR
pPars->fScorrGia = fScorrGia;
pPars->fUseCSat = fUseCSat;
- if ( p->pNal )
+ if ( pNew->pNal )
{
Aig_Man_t * pAigRst;
pAigRst = Ntl_ManAigToRst( pNew, pAigCol );
@@ -700,7 +706,7 @@ Ntl_Man_t * Ntl_ManLcorr( Ntl_Man_t * p, int nConfMax, int fScorrGia, int fUseCS
Synopsis [Returns AIG with WB after fraiging.]
- Description []
+ Description [Consumes the input NTL to save memory.]
SideEffects []
@@ -716,6 +722,7 @@ Ntl_Man_t * Ntl_ManSsw( Ntl_Man_t * p, Fra_Ssw_t * pPars )
// collapse the AIG
pAig = Ntl_ManExtract( p );
pNew = Ntl_ManInsertAig( p, pAig );
+ Ntl_ManFree( p );
pAigCol = Ntl_ManCollapseSeq( pNew, pPars->nMinDomSize, pPars->fVerbose );
if ( pAigCol == NULL )
{
@@ -739,7 +746,7 @@ Ntl_Man_t * Ntl_ManSsw( Ntl_Man_t * p, Fra_Ssw_t * pPars )
Synopsis [Returns AIG with WB after fraiging.]
- Description []
+ Description [Consumes the input NTL to save memory.]
SideEffects []
@@ -754,6 +761,7 @@ Ntl_Man_t * Ntl_ManScorr( Ntl_Man_t * p, Ssw_Pars_t * pPars )
// collapse the AIG
pAig = Ntl_ManExtract( p );
pNew = Ntl_ManInsertAig( p, pAig );
+ Ntl_ManFree( p );
pAigCol = Ntl_ManCollapseSeq( pNew, pPars->nMinDomSize, pPars->fVerbose );
if ( pAigCol == NULL )
{
@@ -762,7 +770,7 @@ Ntl_Man_t * Ntl_ManScorr( Ntl_Man_t * p, Ssw_Pars_t * pPars )
}
// perform SCL
- if ( p->pNal )
+ if ( pNew->pNal )
{
Aig_Man_t * pAigRst;
pAigRst = Ntl_ManAigToRst( pNew, pAigCol );
diff --git a/src/aig/ntl/ntlMan.c b/src/aig/ntl/ntlMan.c
index a95c2352..ec3e34bb 100644
--- a/src/aig/ntl/ntlMan.c
+++ b/src/aig/ntl/ntlMan.c
@@ -124,7 +124,7 @@ Ntl_Man_t * Ntl_ManStartFrom( Ntl_Man_t * pOld )
{
((Ntl_Obj_t *)pBox->pCopy)->pImplem = pBox->pImplem->pCopy;
((Ntl_Obj_t *)pBox->pCopy)->iTemp = pBox->iTemp;
- ((Ntl_Obj_t *)pBox->pCopy)->Reset = pBox->Reset;
+// ((Ntl_Obj_t *)pBox->pCopy)->Reset = pBox->Reset;
}
Ntl_ManForEachCiNet( pOld, pNet, i )
Vec_PtrPush( pNew->vCis, pNet->pCopy );
diff --git a/src/aig/ntl/ntlObj.c b/src/aig/ntl/ntlObj.c
index 4946c4e3..1915d650 100644
--- a/src/aig/ntl/ntlObj.c
+++ b/src/aig/ntl/ntlObj.c
@@ -47,7 +47,7 @@ Ntl_Obj_t * Ntl_ModelCreatePi( Ntl_Mod_t * pModel )
p->Id = Vec_PtrSize( pModel->vObjs );
Vec_PtrPush( pModel->vObjs, p );
Vec_PtrPush( pModel->vPis, p );
- p->pModel = pModel;
+// p->pModel = pModel;
p->Type = NTL_OBJ_PI;
p->nFanins = 0;
p->nFanouts = 1;
@@ -74,7 +74,7 @@ Ntl_Obj_t * Ntl_ModelCreatePo( Ntl_Mod_t * pModel, Ntl_Net_t * pNet )
p->Id = Vec_PtrSize( pModel->vObjs );
Vec_PtrPush( pModel->vObjs, p );
Vec_PtrPush( pModel->vPos, p );
- p->pModel = pModel;
+// p->pModel = pModel;
p->Type = NTL_OBJ_PO;
p->nFanins = 1;
p->nFanouts = 0;
@@ -101,7 +101,7 @@ Ntl_Obj_t * Ntl_ModelCreateLatch( Ntl_Mod_t * pModel )
memset( p, 0, sizeof(Ntl_Obj_t) + sizeof(Ntl_Net_t *) * 3 );
p->Id = Vec_PtrSize( pModel->vObjs );
Vec_PtrPush( pModel->vObjs, p );
- p->pModel = pModel;
+// p->pModel = pModel;
p->Type = NTL_OBJ_LATCH;
p->nFanins = 1;
p->nFanouts = 1;
@@ -127,7 +127,7 @@ Ntl_Obj_t * Ntl_ModelCreateNode( Ntl_Mod_t * pModel, int nFanins )
memset( p, 0, sizeof(Ntl_Obj_t) + sizeof(Ntl_Net_t *) * (nFanins + 1) );
p->Id = Vec_PtrSize( pModel->vObjs );
Vec_PtrPush( pModel->vObjs, p );
- p->pModel = pModel;
+// p->pModel = pModel;
p->Type = NTL_OBJ_NODE;
p->nFanins = nFanins;
p->nFanouts = 1;
@@ -156,11 +156,11 @@ Ntl_Obj_t * Ntl_ModelCreateBox( Ntl_Mod_t * pModel, int nFanins, int nFanouts )
memset( p, 0, sizeof(Ntl_Obj_t) + sizeof(Ntl_Net_t *) * (nFanins + nFanouts) );
p->Id = Vec_PtrSize( pModel->vObjs );
Vec_PtrPush( pModel->vObjs, p );
- p->pModel = pModel;
+// p->pModel = pModel;
p->Type = NTL_OBJ_BOX;
p->nFanins = nFanins;
p->nFanouts = nFanouts;
- p->Reset = -1;
+// p->Reset = -1;
pModel->nObjs[NTL_OBJ_BOX]++;
return p;
}
diff --git a/src/aig/ntl/ntlUtil.c b/src/aig/ntl/ntlUtil.c
index 6a4b18d5..0bd86247 100644
--- a/src/aig/ntl/ntlUtil.c
+++ b/src/aig/ntl/ntlUtil.c
@@ -247,10 +247,10 @@ void Ntl_ManSetZeroInitValues( Ntl_Man_t * p )
SeeAlso []
***********************************************************************/
-void Ntl_ManAddInverters( Ntl_Obj_t * pObj )
+void Ntl_ManAddInverters( Ntl_Mod_t * pRoot, Ntl_Obj_t * pObj )
{
char * pStore;
- Ntl_Mod_t * pRoot = pObj->pModel;
+// Ntl_Mod_t * pRoot = pObj->pModel;
Ntl_Man_t * pMan = pRoot->pMan;
Ntl_Net_t * pNetLo, * pNetLi, * pNetLoInv, * pNetLiInv;
Ntl_Obj_t * pNode;
@@ -322,7 +322,7 @@ void Ntl_ManTransformInitValues( Ntl_Man_t * p )
Ntl_ModelForEachLatch( pRoot, pObj, i )
{
if ( Ntl_ObjIsInit1( pObj ) )
- Ntl_ManAddInverters( pObj );
+ Ntl_ManAddInverters( pRoot, pObj );
pObj->LatchId.regInit = 0;
}
}
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 9d04c0bf..e1cdadac 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -20963,7 +20963,7 @@ usage:
***********************************************************************/
int Abc_CommandAbc8Fraig( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- void * pNtlNew;
+ void * pNtlNew, * pNtlOld;
int c, fVerbose;
int nPartSize;
int nConfLimit;
@@ -21037,7 +21037,8 @@ int Abc_CommandAbc8Fraig( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// get the input file name
- pNtlNew = Ntl_ManFraig( pAbc->pAbc8Ntl, nPartSize, nConfLimit, nLevelMax, fUseCSat, fVerbose );
+ pNtlOld = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL;
+ pNtlNew = Ntl_ManFraig( pNtlOld, nPartSize, nConfLimit, nLevelMax, fUseCSat, fVerbose );
if ( pNtlNew == NULL )
{
printf( "Abc_CommandAbc8Fraig(): Tranformation of the AIG has failed.\n" );
@@ -21084,7 +21085,7 @@ usage:
***********************************************************************/
int Abc_CommandAbc8Scl( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- void * pNtlNew;
+ void * pNtlNew, * pNtlOld;
int c;
int fLatchConst;
int fLatchEqual;
@@ -21131,7 +21132,8 @@ int Abc_CommandAbc8Scl( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// get the input file name
- pNtlNew = Ntl_ManScl( pAbc->pAbc8Ntl, fLatchConst, fLatchEqual, fVerbose );
+ pNtlOld = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL;
+ pNtlNew = Ntl_ManScl( pNtlOld, fLatchConst, fLatchEqual, fVerbose );
if ( pNtlNew == NULL )
{
printf( "Abc_CommandAbc8Scl(): Tranformation of the AIG has failed.\n" );
@@ -21177,7 +21179,7 @@ usage:
***********************************************************************/
int Abc_CommandAbc8Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- void * pNtlNew;
+ void * pNtlNew, * pNtlOld;
int c;
int fScorrGia;
int fUseCSat;
@@ -21248,9 +21250,10 @@ int Abc_CommandAbc8Lcorr( Abc_Frame_t * pAbc, int argc, char ** argv )
fprintf( stdout, "Abc_CommandAbc8Lcorr(): The network is combinational.\n" );
return 0;
}
-
+
// get the input file name
- pNtlNew = Ntl_ManLcorr( pAbc->pAbc8Ntl, nConfMax, fScorrGia, fUseCSat, fVerbose );
+ pNtlOld = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL;
+ pNtlNew = Ntl_ManLcorr( pNtlOld, nConfMax, fScorrGia, fUseCSat, fVerbose );
if ( pNtlNew == NULL )
{
printf( "Abc_CommandAbc8Lcorr(): Tranformation of the AIG has failed.\n" );
@@ -21297,7 +21300,7 @@ usage:
***********************************************************************/
int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- void * pNtlNew;
+ void * pNtlNew, * pNtlOld;
Fra_Ssw_t Pars, * pPars = &Pars;
int c;
extern Aig_Man_t * Ntl_ManExtract( void * p );
@@ -21455,7 +21458,8 @@ int Abc_CommandAbc8Ssw( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// get the input file name
- pNtlNew = Ntl_ManSsw( pAbc->pAbc8Ntl, pPars );
+ pNtlOld = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL;
+ pNtlNew = Ntl_ManSsw( pNtlOld, pPars );
if ( pNtlNew == NULL )
{
printf( "Abc_CommandAbc8Ssw(): Tranformation of the AIG has failed.\n" );
@@ -21511,7 +21515,7 @@ usage:
***********************************************************************/
int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- void * pNtlNew;
+ void * pNtlNew, * pNtlOld;
Ssw_Pars_t Pars, * pPars = &Pars;
int c;
extern Aig_Man_t * Ntl_ManExtract( void * p );
@@ -21683,7 +21687,8 @@ int Abc_CommandAbc8Scorr( Abc_Frame_t * pAbc, int argc, char ** argv )
}
// get the input file name
- pNtlNew = Ntl_ManScorr( pAbc->pAbc8Ntl, pPars );
+ pNtlOld = pAbc->pAbc8Ntl; pAbc->pAbc8Ntl = NULL;
+ pNtlNew = Ntl_ManScorr( pNtlOld, pPars );
if ( pNtlNew == NULL )
{
printf( "Abc_CommandAbc8Scorr(): Tranformation of the AIG has failed.\n" );