Commit 96d76996 by Alan Mishchenko

Updated code for lazy man's synthesis.

parent 1ca94c10
...@@ -1360,12 +1360,17 @@ unsigned * Gia_ManComputePoTruthTables( Gia_Man_t * p, int nBytesMax ) ...@@ -1360,12 +1360,17 @@ unsigned * Gia_ManComputePoTruthTables( Gia_Man_t * p, int nBytesMax )
int Gia_ObjComputeTruthTable_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; word * pTruth0, * pTruth1, * pTruth, * pTruthL;
int Value0, Value1;
if ( Gia_ObjIsTravIdCurrent(p, pObj) ) if ( Gia_ObjIsTravIdCurrent(p, pObj) )
return pObj->Value; return pObj->Value;
Gia_ObjSetTravIdCurrent(p, pObj); Gia_ObjSetTravIdCurrent(p, pObj);
assert( Gia_ObjIsAnd(pObj) ); assert( Gia_ObjIsAnd(pObj) );
pTruth0 = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Gia_ObjComputeTruthTable_rec( p, Gia_ObjFanin0(pObj) ); Value0 = Gia_ObjComputeTruthTable_rec( p, Gia_ObjFanin0(pObj) );
pTruth1 = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Gia_ObjComputeTruthTable_rec( p, Gia_ObjFanin1(pObj) ); Value1 = Gia_ObjComputeTruthTable_rec( p, Gia_ObjFanin1(pObj) );
assert( Value0 < Vec_WrdSize(p->vTtMemory) );
assert( Value1 < Vec_WrdSize(p->vTtMemory) );
pTruth0 = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Value0;
pTruth1 = Vec_WrdArray(p->vTtMemory) + p->nTtWords * Value1;
assert( p->nTtWords * p->iTtNum < Vec_WrdSize(p->vTtMemory) ); assert( p->nTtWords * p->iTtNum < Vec_WrdSize(p->vTtMemory) );
pTruth = Vec_WrdArray(p->vTtMemory) + p->nTtWords * p->iTtNum++; pTruth = Vec_WrdArray(p->vTtMemory) + p->nTtWords * p->iTtNum++;
pTruthL = Vec_WrdArray(p->vTtMemory) + p->nTtWords * p->iTtNum; pTruthL = Vec_WrdArray(p->vTtMemory) + p->nTtWords * p->iTtNum;
...@@ -1387,7 +1392,7 @@ int Gia_ObjComputeTruthTable_rec( Gia_Man_t * p, Gia_Obj_t * pObj ) ...@@ -1387,7 +1392,7 @@ int Gia_ObjComputeTruthTable_rec( Gia_Man_t * p, Gia_Obj_t * pObj )
while ( pTruth < pTruthL ) while ( pTruth < pTruthL )
*pTruth++ = *pTruth0++ & *pTruth1++; *pTruth++ = *pTruth0++ & *pTruth1++;
} }
return p->iTtNum-1; return (pObj->Value = p->iTtNum-1);
} }
unsigned * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj ) unsigned * Gia_ObjComputeTruthTable( Gia_Man_t * p, Gia_Obj_t * pObj )
{ {
......
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "misc/vec/vec.h" #include "misc/vec/vec.h"
#include "aig/hop/hop.h" #include "aig/hop/hop.h"
#include "aig/gia/gia.h"
#include "misc/st/st.h" #include "misc/st/st.h"
#include "misc/st/stmm.h" #include "misc/st/stmm.h"
#include "misc/nm/nm.h" #include "misc/nm/nm.h"
...@@ -783,6 +784,16 @@ extern ABC_DLL int Abc_NtkRecIsInTrimMode(); ...@@ -783,6 +784,16 @@ extern ABC_DLL int Abc_NtkRecIsInTrimMode();
extern ABC_DLL int Abc_NtkRecVarNum(); extern ABC_DLL int Abc_NtkRecVarNum();
extern ABC_DLL Vec_Int_t * Abc_NtkRecMemory(); extern ABC_DLL Vec_Int_t * Abc_NtkRecMemory();
extern ABC_DLL int Abc_NtkRecStrashNode( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, unsigned * pTruth, int nVars ); extern ABC_DLL int Abc_NtkRecStrashNode( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pObj, unsigned * pTruth, int nVars );
/*=== abcRec2.c ==========================================================*/
extern ABC_DLL void Abc_NtkRecStart2( Gia_Man_t *p, int nVars, int nCuts, int fTrim );
extern ABC_DLL void Abc_NtkRecStop2();
extern ABC_DLL void Abc_NtkRecAdd2( Abc_Ntk_t * pNtk, int fUseSOPB );
extern ABC_DLL void Abc_NtkRecPs2(int fPrintLib);
extern ABC_DLL Gia_Man_t * Abc_NtkRecGetGia();
extern ABC_DLL void Abc_NtkRecLibMerge2(Gia_Man_t * pGia);
extern ABC_DLL int Abc_NtkRecIsRunning2();
extern ABC_DLL int Abc_NtkRecIsInTrimMode2();
extern ABC_DLL void Abc_NtkRecFilter2(int nLimit);
/*=== abcReconv.c ==========================================================*/ /*=== abcReconv.c ==========================================================*/
extern ABC_DLL Abc_ManCut_t * Abc_NtkManCutStart( int nNodeSizeMax, int nConeSizeMax, int nNodeFanStop, int nConeFanStop ); extern ABC_DLL Abc_ManCut_t * Abc_NtkManCutStart( int nNodeSizeMax, int nConeSizeMax, int nNodeFanStop, int nConeFanStop );
extern ABC_DLL void Abc_NtkManCutStop( Abc_ManCut_t * p ); extern ABC_DLL void Abc_NtkManCutStop( Abc_ManCut_t * p );
......
...@@ -494,7 +494,12 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t ...@@ -494,7 +494,12 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
else if ( pIfMan->pPars->fUserRecLib ) else if ( pIfMan->pPars->fUserRecLib )
{ {
extern Hop_Obj_t * Abc_RecToHop( Hop_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut, If_Obj_t * pIfObj ); extern Hop_Obj_t * Abc_RecToHop( Hop_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut, If_Obj_t * pIfObj );
pNodeNew->pData = Abc_RecToHop( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest, pIfObj); extern Hop_Obj_t * Abc_RecToHop2( Hop_Man_t * pMan, If_Man_t * pIfMan, If_Cut_t * pCut, If_Obj_t * pIfObj );
if(Abc_NtkRecIsRunning())
pNodeNew->pData = Abc_RecToHop( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest, pIfObj);
else
pNodeNew->pData = Abc_RecToHop2( (Hop_Man_t *)pNtkNew->pManFunc, pIfMan, pCutBest, pIfObj);
} }
else else
{ {
......
struct Abc_Obj_t_ // 6 words
{
Abc_Obj_t * pCopy; // the copy of this object
Abc_Ntk_t * pNtk; // the host network
int Id; // the object ID
int TravId; // the traversal ID
int nRefs; // the number of fanouts
unsigned Type : 4; // the object type
unsigned fMarkA : 1; // the multipurpose mark
unsigned fMarkB : 1; // the multipurpose mark
unsigned fPhase : 1; // the flag to mark the phase of equivalent node
unsigned fPersist: 1; // marks the persistant AIG node
unsigned nFanins : 24; // the level of the node
Abc_Obj_t * Fanins[0]; // the array of fanins
};
struct Abc_Pin_t_ // 4 words
{
Abc_Pin_t * pNext;
Abc_Pin_t * pPrev;
Abc_Obj_t * pFanin;
Abc_Obj_t * pFanout;
};
...@@ -525,9 +525,13 @@ extern int If_ManCountSpecialPos( If_Man_t * p ); ...@@ -525,9 +525,13 @@ extern int If_ManCountSpecialPos( If_Man_t * p );
/*=== abcRec.c ============================================================*/ /*=== abcRec.c ============================================================*/
extern int If_CutDelayRecCost(If_Man_t* p, If_Cut_t* pCut, If_Obj_t * pObj); extern int If_CutDelayRecCost(If_Man_t* p, If_Cut_t* pCut, If_Obj_t * pObj);
extern int If_CutDelayRecCost2(If_Man_t* p, If_Cut_t* pCut, If_Obj_t * pObj);
/*=== abcRec2.c ============================================================*/
extern int Abc_NtkRecIsRunning();
extern int Abc_NtkRecIsRunning2();
// othe packages // othe packages
extern int Bat_ManCellFuncLookup( unsigned * pTruth, int nVars, int nLeaves ); extern int Bat_ManCellFuncLookup( unsigned * pTruth, int nVars, int nLeaves );
ABC_NAMESPACE_HEADER_END ABC_NAMESPACE_HEADER_END
......
...@@ -156,7 +156,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -156,7 +156,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
/// if ( p->pPars->pLutStruct ) /// if ( p->pPars->pLutStruct )
/// pCut->Delay = If_CutDelayLutStruct( p, pCut, p->pPars->pLutStruct, p->pPars->WireDelay ); /// pCut->Delay = If_CutDelayLutStruct( p, pCut, p->pPars->pLutStruct, p->pPars->WireDelay );
if ( p->pPars->fUserRecLib ) if ( p->pPars->fUserRecLib )
pCut->Delay = If_CutDelayRecCost(p, pCut, pObj); {
if((Abc_NtkRecIsRunning2()&& Abc_NtkRecIsRunning()) || (!Abc_NtkRecIsRunning2()&& !Abc_NtkRecIsRunning()))
assert(0);
else if(Abc_NtkRecIsRunning())
pCut->Delay = If_CutDelayRecCost(p, pCut, pObj);
else
pCut->Delay = If_CutDelayRecCost2(p, pCut, pObj);
}
else if(p->pPars->fDelayOpt) else if(p->pPars->fDelayOpt)
pCut->Delay = If_CutDelaySopCost(p,pCut); pCut->Delay = If_CutDelaySopCost(p,pCut);
else if(p->pPars->nGateSize > 0) else if(p->pPars->nGateSize > 0)
...@@ -228,7 +235,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep ...@@ -228,7 +235,14 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
/// if ( p->pPars->pLutStruct ) /// if ( p->pPars->pLutStruct )
/// pCut->Delay = If_CutDelayLutStruct( p, pCut, p->pPars->pLutStruct, p->pPars->WireDelay ); /// pCut->Delay = If_CutDelayLutStruct( p, pCut, p->pPars->pLutStruct, p->pPars->WireDelay );
if ( p->pPars->fUserRecLib ) if ( p->pPars->fUserRecLib )
pCut->Delay = If_CutDelayRecCost(p, pCut, pObj); {
if((Abc_NtkRecIsRunning2()&& Abc_NtkRecIsRunning()) || (!Abc_NtkRecIsRunning2()&& !Abc_NtkRecIsRunning()))
assert(0);
else if(Abc_NtkRecIsRunning())
pCut->Delay = If_CutDelayRecCost(p, pCut, pObj);
else
pCut->Delay = If_CutDelayRecCost2(p, pCut, pObj);
}
else if (p->pPars->fDelayOpt) else if (p->pPars->fDelayOpt)
pCut->Delay = If_CutDelaySopCost(p, pCut); pCut->Delay = If_CutDelaySopCost(p, pCut);
else if(p->pPars->nGateSize > 0) else if(p->pPars->nGateSize > 0)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment