Commit b2470dd3 by Alan Mishchenko

Version abc70901

parent 9f5ef0d6
......@@ -1542,7 +1542,7 @@ SOURCE=.\src\opt\lpk\lpk.h
# End Source File
# Begin Source File
SOURCE=.\src\opt\lpk\lpkAbcCore.c
SOURCE=.\src\opt\lpk\lpkAbcDec.c
# End Source File
# Begin Source File
......@@ -1550,11 +1550,11 @@ SOURCE=.\src\opt\lpk\lpkAbcDsd.c
# End Source File
# Begin Source File
SOURCE=.\src\opt\lpk\lpkAbcFun.c
SOURCE=.\src\opt\lpk\lpkAbcMux.c
# End Source File
# Begin Source File
SOURCE=.\src\opt\lpk\lpkAbcMux.c
SOURCE=.\src\opt\lpk\lpkAbcUtil.c
# End Source File
# Begin Source File
......
......@@ -425,9 +425,9 @@ extern void Aig_ObjOrderInsert( Aig_Man_t * p, int ObjId );
extern void Aig_ObjOrderRemove( Aig_Man_t * p, int ObjId );
extern void Aig_ObjOrderAdvance( Aig_Man_t * p );
/*=== aigPart.c =========================================================*/
extern Vec_Vec_t * Aig_ManSupports( Aig_Man_t * pMan );
extern Vec_Vec_t * Aig_ManPartitionSmart( Aig_Man_t * p, int nPartSizeLimit, int fVerbose, Vec_Vec_t ** pvPartSupps );
extern Vec_Vec_t * Aig_ManPartitionNaive( Aig_Man_t * p, int nPartSize );
extern Vec_Ptr_t * Aig_ManSupports( Aig_Man_t * pMan );
extern Vec_Ptr_t * Aig_ManPartitionSmart( Aig_Man_t * p, int nPartSizeLimit, int fVerbose, Vec_Ptr_t ** pvPartSupps );
extern Vec_Ptr_t * Aig_ManPartitionNaive( Aig_Man_t * p, int nPartSize );
/*=== aigRepr.c =========================================================*/
extern void Aig_ManReprStart( Aig_Man_t * p, int nIdMax );
extern void Aig_ManReprStop( Aig_Man_t * p );
......
......@@ -58,7 +58,7 @@ void Fra_ManPartitionTest( Aig_Man_t * p, int nComLim )
// compute supports
clk = clock();
vSupps = Aig_ManSupports( p );
vSupps = (Vec_Vec_t *)Aig_ManSupports( p );
PRT( "Supports", clock() - clk );
// remove last entry
Aig_ManForEachPo( p, pObj, i )
......@@ -192,7 +192,7 @@ void Fra_ManPartitionTest2( Aig_Man_t * p )
// compute supports
clk = clock();
vSupps = Aig_ManSupports( p );
vSupps = (Vec_Vec_t *)Aig_ManSupports( p );
PRT( "Supports", clock() - clk );
// remove last entry
Aig_ManForEachPo( p, pObj, i )
......
......@@ -729,6 +729,7 @@ extern void Abc_NtkFinalizeRead( Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkDup( Abc_Ntk_t * pNtk );
extern Abc_Ntk_t * Abc_NtkCreateCone( Abc_Ntk_t * pNtk, Abc_Obj_t * pNode, char * pNodeName, int fUseAllCis );
extern Abc_Ntk_t * Abc_NtkCreateConeArray( Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots, int fUseAllCis );
extern void Abc_NtkAppendToCone( Abc_Ntk_t * pNtkNew, Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots );
extern Abc_Ntk_t * Abc_NtkCreateMffc( Abc_Ntk_t * pNtk, Abc_Obj_t * pNode, char * pNodeName );
extern Abc_Ntk_t * Abc_NtkCreateTarget( Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots, Vec_Int_t * vValues );
extern Abc_Ntk_t * Abc_NtkCreateFromNode( Abc_Ntk_t * pNtk, Abc_Obj_t * pNode );
......
......@@ -623,7 +623,7 @@ Abc_Ntk_t * Abc_NtkCreateConeArray( Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots, int fU
}
Vec_PtrFree( vNodes );
// add the PO corresponding to the nodes
// add the POs corresponding to the root nodes
Vec_PtrForEachEntry( vRoots, pObj, i )
{
// create the PO node
......@@ -644,6 +644,59 @@ Abc_Ntk_t * Abc_NtkCreateConeArray( Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots, int fU
/**Function*************************************************************
Synopsis [Adds new nodes to the cone.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_NtkAppendToCone( Abc_Ntk_t * pNtkNew, Abc_Ntk_t * pNtk, Vec_Ptr_t * vRoots )
{
Vec_Ptr_t * vNodes;
Abc_Obj_t * pObj;
int i, iNodeId;
assert( Abc_NtkIsStrash(pNtkNew) );
assert( Abc_NtkIsStrash(pNtk) );
// collect the nodes in the TFI of the output (mark the TFI)
vNodes = Abc_NtkDfsNodes( pNtk, (Abc_Obj_t **)Vec_PtrArray(vRoots), Vec_PtrSize(vRoots) );
// establish connection between the constant nodes
Abc_AigConst1(pNtk)->pCopy = Abc_AigConst1(pNtkNew);
// create the PIs
Abc_NtkForEachCi( pNtk, pObj, i )
{
// skip CIs that are not used
if ( !Abc_NodeIsTravIdCurrent(pObj) )
continue;
// find the corresponding CI in the new network
iNodeId = Nm_ManFindIdByNameTwoTypes( pNtkNew->pManName, Abc_ObjName(pObj), ABC_OBJ_PI, ABC_OBJ_BO );
if ( iNodeId == -1 )
{
pObj->pCopy = Abc_NtkCreatePi(pNtkNew);
Abc_ObjAssignName( pObj->pCopy, Abc_ObjName(pObj), NULL );
}
else
pObj->pCopy = Abc_NtkObj( pNtkNew, iNodeId );
}
// copy the nodes
Vec_PtrForEachEntry( vNodes, pObj, i )
pObj->pCopy = Abc_AigAnd( pNtkNew->pManFunc, Abc_ObjChild0Copy(pObj), Abc_ObjChild1Copy(pObj) );
Vec_PtrFree( vNodes );
// do not add the COs
if ( !Abc_NtkCheck( pNtkNew ) )
fprintf( stdout, "Abc_NtkAppendToCone(): Network check has failed.\n" );
}
/**Function*************************************************************
Synopsis [Creates the network composed of MFFC of one node.]
Description []
......
......@@ -2977,6 +2977,9 @@ int Abc_CommandLutpack( Abc_Frame_t * pAbc, int argc, char ** argv )
pOut = Abc_FrameReadOut(pAbc);
pErr = Abc_FrameReadErr(pAbc);
printf("This command will be available soon\n");
return 0;
// set defaults
memset( pPars, 0, sizeof(Lpk_Par_t) );
pPars->nLutsMax = 4; // (N) the maximum number of LUTs in the structure
......
......@@ -648,46 +648,32 @@ Abc_Obj_t * Abc_NodeFraigTrust( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pNode )
SeeAlso []
***********************************************************************/
int Abc_NtkFraigStore( Abc_Ntk_t * pNtk )
int Abc_NtkFraigStore( Abc_Ntk_t * pNtkAdd )
{
Abc_Ntk_t * pStore;
int nAndsOld;
if ( !Abc_NtkIsLogic(pNtk) && !Abc_NtkIsStrash(pNtk) )
Vec_Ptr_t * vStore;
Abc_Ntk_t * pNtk;
// create the network to be stored
pNtk = Abc_NtkStrash( pNtkAdd, 0, 0, 0 );
if ( pNtk == NULL )
{
printf( "The netlist need to be converted into a logic network before adding it to storage.\n" );
printf( "Abc_NtkFraigStore: Initial strashing has failed.\n" );
return 0;
}
// get the network currently stored
pStore = Abc_FrameReadNtkStore();
if ( pStore == NULL )
vStore = Abc_FrameReadStore();
if ( Vec_PtrSize(vStore) > 0 )
{
// start the stored network
pStore = Abc_NtkStrash( pNtk, 0, 0, 0 );
if ( pStore == NULL )
// check that the networks have the same PIs
// reorder PIs of pNtk2 according to pNtk1
if ( !Abc_NtkCompareSignals( pNtk, Vec_PtrEntry(vStore, 0), 1, 1 ) )
{
printf( "Abc_NtkFraigStore: Initial strashing has failed.\n" );
return 0;
printf( "Trying to store the network with different primary inputs.\n" );
printf( "The previously stored networks are deleted and this one is added.\n" );
Abc_NtkFraigStoreClean();
}
// save the parameters
Abc_FrameSetNtkStore( pStore );
Abc_FrameSetNtkStoreSize( 1 );
nAndsOld = 0;
}
else
{
// add the new network to storage
nAndsOld = Abc_NtkNodeNum( pStore );
if ( !Abc_NtkAppend( pStore, pNtk, 0 ) )
{
printf( "The current network cannot be appended to the stored network.\n" );
return 0;
}
// set the number of networks stored
Abc_FrameSetNtkStoreSize( Abc_FrameReadNtkStoreSize() + 1 );
}
printf( "The number of AIG nodes added to storage = %5d.\n", Abc_NtkNodeNum(pStore) - nAndsOld );
Vec_PtrPush( vStore, pNtk );
printf( "The number of AIG nodes added to storage = %5d.\n", Abc_NtkNodeNum(pNtk) );
return 1;
}
......@@ -704,54 +690,48 @@ int Abc_NtkFraigStore( Abc_Ntk_t * pNtk )
***********************************************************************/
Abc_Ntk_t * Abc_NtkFraigRestore()
{
extern Abc_Ntk_t * Abc_NtkFraigPartitioned( Abc_Ntk_t * pNtk, void * pParams );
extern Abc_Ntk_t * Abc_NtkFraigPartitioned( Vec_Ptr_t * vStore, void * pParams );
Fraig_Params_t Params;
Abc_Ntk_t * pStore, * pFraig;
Vec_Ptr_t * vStore;
Abc_Ntk_t * pNtk, * pFraig;
int nWords1, nWords2, nWordsMin;
int clk = clock();
// get the stored network
pStore = Abc_FrameReadNtkStore();
Abc_FrameSetNtkStore( NULL );
if ( pStore == NULL )
vStore = Abc_FrameReadStore();
if ( Vec_PtrSize(vStore) == 0 )
{
printf( "There are no network currently in storage.\n" );
return NULL;
}
printf( "Currently stored %d networks with %d nodes will be fraiged.\n",
Abc_FrameReadNtkStoreSize(), Abc_NtkNodeNum(pStore) );
printf( "Currently stored %d networks will be fraiged.\n", Vec_PtrSize(vStore) );
pNtk = Vec_PtrEntry( vStore, 0 );
// to determine the number of simulation patterns
// use the following strategy
// at least 64 words (32 words random and 32 words dynamic)
// no more than 256M for one circuit (128M + 128M)
nWords1 = 32;
nWords2 = (1<<27) / (Abc_NtkNodeNum(pStore) + Abc_NtkCiNum(pStore));
nWords2 = (1<<27) / (Abc_NtkNodeNum(pNtk) + Abc_NtkCiNum(pNtk));
nWordsMin = ABC_MIN( nWords1, nWords2 );
// set parameters for fraiging
Fraig_ParamsSetDefault( &Params );
Params.nPatsRand = nWordsMin * 32; // the number of words of random simulation info
Params.nPatsDyna = nWordsMin * 32; // the number of words of dynamic simulation info
Params.nBTLimit = 999999; // the max number of backtracks to perform
Params.fFuncRed = 1; // performs only one level hashing
Params.fFeedBack = 1; // enables solver feedback
Params.fDist1Pats = 1; // enables distance-1 patterns
Params.fDoSparse = 1; // performs equiv tests for sparse functions
Params.fChoicing = 1; // enables recording structural choices
Params.fTryProve = 0; // tries to solve the final miter
Params.fVerbose = 0; // the verbosiness flag
// Fraig_ManReportChoices( p );
// transform it into FRAIG
// pFraig = Abc_NtkFraig( pStore, &Params, 1, 0 );
pFraig = Abc_NtkFraigPartitioned( pStore, &Params );
PRT( "Total fraiging time", clock() - clk );
if ( pFraig == NULL )
return NULL;
Abc_NtkDelete( pStore );
Params.nPatsRand = nWordsMin * 32; // the number of words of random simulation info
Params.nPatsDyna = nWordsMin * 32; // the number of words of dynamic simulation info
Params.nBTLimit = 1000; // the max number of backtracks to perform
Params.fFuncRed = 1; // performs only one level hashing
Params.fFeedBack = 1; // enables solver feedback
Params.fDist1Pats = 1; // enables distance-1 patterns
Params.fDoSparse = 1; // performs equiv tests for sparse functions
Params.fChoicing = 1; // enables recording structural choices
Params.fTryProve = 0; // tries to solve the final miter
Params.fVerbose = 0; // the verbosiness flag
// perform partitioned computation of structural choices
pFraig = Abc_NtkFraigPartitioned( vStore, &Params );
Abc_NtkFraigStoreClean();
PRT( "Total choicing time", clock() - clk );
return pFraig;
}
......@@ -768,12 +748,13 @@ PRT( "Total fraiging time", clock() - clk );
***********************************************************************/
void Abc_NtkFraigStoreClean()
{
Abc_Ntk_t * pStore;
// get the stored network
pStore = Abc_FrameReadNtkStore();
if ( pStore )
Abc_NtkDelete( pStore );
Abc_FrameSetNtkStore( NULL );
Vec_Ptr_t * vStore;
Abc_Ntk_t * pNtk;
int i;
vStore = Abc_FrameReadStore();
Vec_PtrForEachEntry( vStore, pNtk, i )
Abc_NtkDelete( pNtk );
Vec_PtrClear( vStore );
}
/**Function*************************************************************
......@@ -794,7 +775,7 @@ void Abc_NtkFraigStoreCheck( Abc_Ntk_t * pFraig )
int i, k;
// check that the PO functions are correct
nPoFinal = Abc_NtkPoNum(pFraig);
nStored = Abc_FrameReadNtkStoreSize();
nStored = Abc_FrameReadStoreSize();
assert( nPoFinal % nStored == 0 );
nPoOrig = nPoFinal / nStored;
for ( i = 0; i < nPoOrig; i++ )
......
......@@ -314,7 +314,7 @@ void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNt
Abc_ObjAddFanin( pNode, pMiter );
// assign the name to the node
if ( nPartSize == 1 )
sprintf( Buffer, "%s", Abc_ObjName(Abc_NtkPo(pNtk1,i)) );
sprintf( Buffer, "%s", Abc_ObjName(Abc_NtkCo(pNtk1,i)) );
else
sprintf( Buffer, "%d", i );
Abc_ObjAssignName( pNode, "miter_", Buffer );
......
......@@ -293,7 +293,7 @@ void Abc_NtkCecFraigPart( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, in
}
else
{
printf( "Finished part %d (out of %d)\r", i+1, Abc_NtkPoNum(pMiter) );
printf( "Finished part %5d (out of %5d)\r", i+1, Abc_NtkPoNum(pMiter) );
nOutputs += nPartSize;
}
// if ( pMiter->pModel )
......@@ -301,7 +301,7 @@ void Abc_NtkCecFraigPart( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, in
if ( pMiterPart )
Abc_NtkDelete( pMiterPart );
}
Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "set progressbar" );
if ( Status == 1 )
......@@ -325,12 +325,13 @@ void Abc_NtkCecFraigPart( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, in
void Abc_NtkCecFraigPartAuto( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds, int fVerbose )
{
extern int Abc_NtkCombinePos( Abc_Ntk_t * pNtk, int fAnd );
extern Vec_Vec_t * Abc_NtkPartitionSmart( Abc_Ntk_t * pNtk, int nPartSizeLimit, int fVerbose );
extern Vec_Ptr_t * Abc_NtkPartitionSmart( Abc_Ntk_t * pNtk, int nPartSizeLimit, int fVerbose );
extern void Abc_NtkConvertCos( Abc_Ntk_t * pNtk, Vec_Int_t * vOuts, Vec_Ptr_t * vOnePtr );
extern int Cmd_CommandExecute( void * pAbc, char * sCommand );
extern void * Abc_FrameGetGlobalFrame();
Vec_Vec_t * vParts;
Vec_Ptr_t * vOne;
Vec_Ptr_t * vParts, * vOnePtr;
Vec_Int_t * vOne;
Prove_Params_t Params, * pParams = &Params;
Abc_Ntk_t * pMiter, * pMiterPart;
int i, RetValue, Status, nOutputs;
......@@ -368,15 +369,17 @@ void Abc_NtkCecFraigPartAuto( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds
Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "unset progressbar" );
// partition the outputs
vParts = Abc_NtkPartitionSmart( pMiter, 50, 1 );
vParts = Abc_NtkPartitionSmart( pMiter, 300, 0 );
// fraig each partition
Status = 1;
nOutputs = 0;
Vec_VecForEachLevel( vParts, vOne, i )
vOnePtr = Vec_PtrAlloc( 1000 );
Vec_PtrForEachEntry( vParts, vOne, i )
{
// get this part of the miter
pMiterPart = Abc_NtkCreateConeArray( pMiter, vOne, 0 );
Abc_NtkConvertCos( pMiter, vOne, vOnePtr );
pMiterPart = Abc_NtkCreateConeArray( pMiter, vOnePtr, 0 );
Abc_NtkCombinePos( pMiterPart, 0 );
// check the miter for being constant
RetValue = Abc_NtkMiterIsConstant( pMiterPart );
......@@ -391,6 +394,9 @@ void Abc_NtkCecFraigPartAuto( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds
Abc_NtkDelete( pMiterPart );
continue;
}
printf( "Verifying part %4d (out of %4d) PI = %5d. PO = %5d. And = %6d. Lev = %4d.\r",
i+1, Vec_PtrSize(vParts), Abc_NtkPiNum(pMiterPart), Abc_NtkPoNum(pMiterPart),
Abc_NtkNodeNum(pMiterPart), Abc_AigLevel(pMiterPart) );
// solve the problem
RetValue = Abc_NtkIvyProve( &pMiterPart, pParams );
if ( RetValue == -1 )
......@@ -412,12 +418,14 @@ void Abc_NtkCecFraigPartAuto( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int nSeconds
}
else
{
printf( "Finished part %d (out of %d)\r", i+1, Vec_VecSize(vParts) );
nOutputs += Vec_PtrSize(vOne);
// printf( "Finished part %5d (out of %5d)\r", i+1, Vec_PtrSize(vParts) );
nOutputs += Vec_IntSize(vOne);
}
Abc_NtkDelete( pMiterPart );
}
Vec_VecFree( vParts );
printf( " \r" );
Vec_VecFree( (Vec_Vec_t *)vParts );
Vec_PtrFree( vOnePtr );
Cmd_CommandExecute( Abc_FrameGetGlobalFrame(), "set progressbar" );
......
......@@ -92,8 +92,8 @@ extern void Abc_FrameDeleteAllNetworks( Abc_Frame_t * p );
extern void Abc_FrameSetGlobalFrame( Abc_Frame_t * p );
extern Abc_Frame_t * Abc_FrameGetGlobalFrame();
extern Abc_Ntk_t * Abc_FrameReadNtkStore();
extern int Abc_FrameReadNtkStoreSize();
extern Vec_Ptr_t * Abc_FrameReadStore();
extern int Abc_FrameReadStoreSize();
extern void * Abc_FrameReadLibLut();
extern void * Abc_FrameReadLibGen();
extern void * Abc_FrameReadLibSuper();
......
......@@ -43,8 +43,8 @@ static Abc_Frame_t * s_GlobalFrame = NULL;
SeeAlso []
***********************************************************************/
Abc_Ntk_t * Abc_FrameReadNtkStore() { return s_GlobalFrame->pStored; }
int Abc_FrameReadNtkStoreSize() { return s_GlobalFrame->nStored; }
Vec_Ptr_t * Abc_FrameReadStore() { return s_GlobalFrame->vStore; }
int Abc_FrameReadStoreSize() { return Vec_PtrSize(s_GlobalFrame->vStore); }
void * Abc_FrameReadLibLut() { return s_GlobalFrame->pLibLut; }
void * Abc_FrameReadLibGen() { return s_GlobalFrame->pLibGen; }
void * Abc_FrameReadLibSuper() { return s_GlobalFrame->pLibSuper; }
......@@ -53,8 +53,6 @@ void * Abc_FrameReadManDd() { if ( s_GlobalFrame->dd ==
void * Abc_FrameReadManDec() { if ( s_GlobalFrame->pManDec == NULL ) s_GlobalFrame->pManDec = Dec_ManStart(); return s_GlobalFrame->pManDec; }
char * Abc_FrameReadFlag( char * pFlag ) { return Cmd_FlagReadByName( s_GlobalFrame, pFlag ); }
void Abc_FrameSetNtkStore( Abc_Ntk_t * pNtk ) { s_GlobalFrame->pStored = pNtk; }
void Abc_FrameSetNtkStoreSize( int nStored ) { s_GlobalFrame->nStored = nStored; }
void Abc_FrameSetLibLut( void * pLib ) { s_GlobalFrame->pLibLut = pLib; }
void Abc_FrameSetLibGen( void * pLib ) { s_GlobalFrame->pLibGen = pLib; }
void Abc_FrameSetLibSuper( void * pLib ) { s_GlobalFrame->pLibSuper = pLib; }
......@@ -113,6 +111,8 @@ Abc_Frame_t * Abc_FrameAllocate()
// set the starting step
p->nSteps = 1;
p->fBatchMode = 0;
// networks to be used by choice
p->vStore = Vec_PtrAlloc( 16 );
// initialize decomposition manager
define_cube_size(20);
set_espresso_flags();
......@@ -145,6 +145,7 @@ void Abc_FrameDeallocate( Abc_Frame_t * p )
if ( p->pLibVer ) Abc_LibFree( p->pLibVer, NULL );
if ( p->pManDec ) Dec_ManStop( p->pManDec );
if ( p->dd ) Extra_StopManager( p->dd );
if ( p->vStore ) Vec_PtrFree( p->vStore );
Abc_FrameDeleteAllNetworks( p );
free( p );
s_GlobalFrame = NULL;
......
......@@ -63,8 +63,7 @@ struct Abc_Frame_t_
int TimeCommand; // the runtime of the last command
int TimeTotal; // the total runtime of all commands
// temporary storage for structural choices
Abc_Ntk_t * pStored; // the stored networks
int nStored; // the number of stored networks
Vec_Ptr_t * vStore; // networks to be used by choice
// decomposition package
void * pManDec; // decomposition manager
DdManager * dd; // temporary BDD package
......
/**CFile****************************************************************
FileName [lpkAbcCore.c]
FileName [lpkAbcDec.c]
SystemName [ABC: Logic synthesis and verification system.]
......@@ -14,7 +14,7 @@
Date [Ver. 1.0. Started - April 28, 2007.]
Revision [$Id: lpkAbcCore.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
Revision [$Id: lpkAbcDec.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
***********************************************************************/
......@@ -39,7 +39,7 @@
SeeAlso []
***********************************************************************/
Abc_Obj_t * Lpk_FunImplement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, Lpk_Fun_t * p )
Abc_Obj_t * Lpk_ImplementFun( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, Lpk_Fun_t * p )
{
Abc_Obj_t * pObjNew;
int i;
......@@ -73,7 +73,7 @@ Abc_Obj_t * Lpk_FunImplement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, Lpk_Fun_t *
SeeAlso []
***********************************************************************/
Abc_Obj_t * Lpk_LptImplement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, int nLeavesOld )
Abc_Obj_t * Lpk_Implement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, int nLeavesOld )
{
Lpk_Fun_t * pFun;
Abc_Obj_t * pRes;
......@@ -81,7 +81,7 @@ Abc_Obj_t * Lpk_LptImplement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, int nLeaves
for ( i = Vec_PtrSize(vLeaves) - 1; i >= nLeavesOld; i-- )
{
pFun = Vec_PtrEntry( vLeaves, i );
pRes = Lpk_FunImplement( pNtk, vLeaves, pFun );
pRes = Lpk_ImplementFun( pNtk, vLeaves, pFun );
Vec_PtrWriteEntry( vLeaves, i, pRes );
Lpk_FunFree( pFun );
}
......@@ -99,7 +99,7 @@ Abc_Obj_t * Lpk_LptImplement( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, int nLeaves
SeeAlso []
***********************************************************************/
int Lpk_LpkDecompose_rec( Lpk_Fun_t * p )
int Lpk_Decompose_rec( Lpk_Fun_t * p )
{
Lpk_Fun_t * p2;
int VarPol;
......@@ -107,14 +107,14 @@ int Lpk_LpkDecompose_rec( Lpk_Fun_t * p )
if ( p->nVars <= p->nLutK )
return 1;
// check if decomposition exists
VarPol = Lpk_FunAnalizeMux( p );
VarPol = Lpk_MuxAnalize( p );
if ( VarPol == -1 )
return 0;
// split and call recursively
p2 = Lpk_FunSplitMux( p, VarPol );
if ( !Lpk_LpkDecompose_rec( p2 ) )
p2 = Lpk_MuxSplit( p, VarPol );
if ( !Lpk_Decompose_rec( p2 ) )
return 0;
return Lpk_LpkDecompose_rec( p );
return Lpk_Decompose_rec( p );
}
......@@ -129,7 +129,7 @@ int Lpk_LpkDecompose_rec( Lpk_Fun_t * p )
SeeAlso []
***********************************************************************/
Abc_Obj_t * Lpk_LpkDecompose( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * pTruth, int nLutK, int AreaLim, int DelayLim )
Abc_Obj_t * Lpk_Decompose( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * pTruth, int nLutK, int AreaLim, int DelayLim )
{
Lpk_Fun_t * p;
Abc_Obj_t * pObjNew = NULL;
......@@ -139,8 +139,8 @@ Abc_Obj_t * Lpk_LpkDecompose( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned *
p = Lpk_FunCreate( pNtk, vLeaves, pTruth, nLutK, AreaLim, DelayLim );
Lpk_FunSuppMinimize( p );
// decompose the function
if ( Lpk_LpkDecompose_rec(p) )
pObjNew = Lpk_LptImplement( pNtk, vLeaves, nLeaves );
if ( Lpk_Decompose_rec(p) )
pObjNew = Lpk_Implement( pNtk, vLeaves, nLeaves );
else
{
for ( i = Vec_PtrSize(vLeaves) - 1; i >= nLeaves; i-- )
......
......@@ -6,7 +6,7 @@
PackageName [Fast Boolean matching for LUT structures.]
Synopsis []
Synopsis [LUT-decomposition based on recursive DSD.]
Author [Alan Mishchenko]
......@@ -266,7 +266,7 @@ void Lpk_FunFreeTruthTables( Lpk_Fun_t * p, int nCofDepth, unsigned * ppTruths[5
SeeAlso []
***********************************************************************/
Lpk_Res_t * Lpk_FunAnalizeDsd( Lpk_Fun_t * p, int nCofDepth )
Lpk_Res_t * Lpk_DsdAnalize( Lpk_Fun_t * p, int nCofDepth )
{
static Lpk_Res_t Res, * pRes = &Res;
unsigned * ppTruths[5][16];
......@@ -330,7 +330,7 @@ Lpk_Res_t * Lpk_FunAnalizeDsd( Lpk_Fun_t * p, int nCofDepth )
SeeAlso []
***********************************************************************/
Lpk_Fun_t * Lpk_FunSplitDsd( Lpk_Fun_t * p, char * pCofVars, int nCofVars, unsigned uBoundSet )
Lpk_Fun_t * Lpk_DsdSplit( Lpk_Fun_t * p, char * pCofVars, int nCofVars, unsigned uBoundSet )
{
Kit_DsdMan_t * pDsdMan;
Kit_DsdNtk_t * pNtkDec, * pTemp;
......
......@@ -6,7 +6,7 @@
PackageName [Fast Boolean matching for LUT structures.]
Synopsis [Iterative MUX decomposition.]
Synopsis [LUT-decomposition based on recursive MUX decomposition.]
Author [Alan Mishchenko]
......@@ -85,7 +85,7 @@ void Lpk_FunComputeCofSupps( Lpk_Fun_t * p, unsigned * puSupps )
SeeAlso []
***********************************************************************/
int Lpk_FunAnalizeMux( Lpk_Fun_t * p )
int Lpk_MuxAnalize( Lpk_Fun_t * p )
{
unsigned puSupps[32] = {0};
int nSuppSize0, nSuppSize1, Delay, Delay0, Delay1, DelayA, DelayB;
......@@ -193,7 +193,7 @@ int Lpk_FunAnalizeMux( Lpk_Fun_t * p )
SeeAlso []
***********************************************************************/
Lpk_Fun_t * Lpk_FunSplitMux( Lpk_Fun_t * p, int VarPol )
Lpk_Fun_t * Lpk_MuxSplit( Lpk_Fun_t * p, int VarPol )
{
Lpk_Fun_t * pNew;
unsigned * pTruth = Lpk_FunTruth( p, 0 );
......
/**CFile****************************************************************
FileName [lpkAbcFun.c]
FileName [lpkAbcUtil.c]
SystemName [ABC: Logic synthesis and verification system.]
......@@ -14,7 +14,7 @@
Date [Ver. 1.0. Started - April 28, 2007.]
Revision [$Id: lpkAbcFun.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
Revision [$Id: lpkAbcUtil.c,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
***********************************************************************/
......
......@@ -378,7 +378,7 @@ p->timeTruth += clock() - clk;
// update the network
clk = clock();
pObjNew = Lpk_LpkDecompose( p->pNtk, vLeaves, pTruth, p->pPars->nLutSize,
pObjNew = Lpk_Decompose( p->pNtk, vLeaves, pTruth, p->pPars->nLutSize,
(int)pCut->nNodes - (int)pCut->nNodesDup - 1, Abc_ObjRequiredLevel(p->pObj) );
p->timeEval += clock() - clk;
......
......@@ -118,21 +118,7 @@ struct Lpk_Man_t_
};
// preliminary decomposition result
typedef struct Lpk_Res_t_ Lpk_Res_t;
struct Lpk_Res_t_
{
int nBSVars;
unsigned BSVars;
int nCofVars;
char pCofVars[4];
int nSuppSizeS;
int nSuppSizeL;
int DelayEst;
int AreaEst;
};
// function to be decomposed
// internal representation of the function to be decomposed
typedef struct Lpk_Fun_t_ Lpk_Fun_t;
struct Lpk_Fun_t_
{
......@@ -148,15 +134,23 @@ struct Lpk_Fun_t_
unsigned pTruth[0]; // the truth table (contains room for three truth tables)
};
#define Lpk_SuppForEachVar( Supp, Var )\
for ( Var = 0; Var < 16; Var++ )\
if ( !(Supp & (1<<Var)) ) {} else
static inline int Lpk_LutNumVars( int nLutsLim, int nLutK ) { return nLutsLim * (nLutK - 1) + 1; }
static inline int Lpk_LutNumLuts( int nVarsMax, int nLutK ) { return (nVarsMax - 1) / (nLutK - 1) + (int)((nVarsMax - 1) % (nLutK - 1) > 0); }
static inline unsigned * Lpk_FunTruth( Lpk_Fun_t * p, int Num ) { assert( Num < 3 ); return p->pTruth + Kit_TruthWordNum(p->nVars) * Num; }
// preliminary decomposition result
typedef struct Lpk_Res_t_ Lpk_Res_t;
struct Lpk_Res_t_
{
int nBSVars; // the number of bound set variables
unsigned BSVars; // the bound set
int nCofVars; // the number of cofactoring variables
char pCofVars[4]; // the cofactoring variables
int nSuppSizeS; // support size of the smaller (decomposed) function
int nSuppSizeL; // support size of the larger (composition) function
int DelayEst; // estimated delay of the decomposition
int AreaEst; // estimated area of the decomposition
};
static inline int Lpk_LutNumVars( int nLutsLim, int nLutK ) { return nLutsLim * (nLutK - 1) + 1; }
static inline int Lpk_LutNumLuts( int nVarsMax, int nLutK ) { return (nVarsMax - 1) / (nLutK - 1) + (int)((nVarsMax - 1) % (nLutK - 1) > 0); }
static inline unsigned * Lpk_FunTruth( Lpk_Fun_t * p, int Num ) { assert( Num < 3 ); return p->pTruth + Kit_TruthWordNum(p->nVars) * Num; }
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
......@@ -172,14 +166,23 @@ static inline unsigned * Lpk_FunTruth( Lpk_Fun_t * p, int Num ) { assert( Num <
for ( i = 0; (i < (int)(pCut)->nNodes) && (((pObj) = Abc_NtkObj(pNtk, (pCut)->pNodes[i])), 1); i++ )
#define Lpk_CutForEachNodeReverse( pNtk, pCut, pObj, i ) \
for ( i = (int)(pCut)->nNodes - 1; (i >= 0) && (((pObj) = Abc_NtkObj(pNtk, (pCut)->pNodes[i])), 1); i-- )
#define Lpk_SuppForEachVar( Supp, Var )\
for ( Var = 0; Var < 16; Var++ )\
if ( !(Supp & (1<<Var)) ) {} else
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/*=== lpkAbcCore.c ============================================================*/
extern Abc_Obj_t * Lpk_LpkDecompose( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * pTruth, int nLutK, int AreaLim, int DelayLim );
/*=== lpkAbcFun.c ============================================================*/
/*=== lpkAbcDec.c ============================================================*/
extern Abc_Obj_t * Lpk_Decompose( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * pTruth, int nLutK, int AreaLim, int DelayLim );
/*=== lpkAbcDsd.c ============================================================*/
extern Lpk_Res_t * Lpk_DsdAnalize( Lpk_Fun_t * p, int nCofDepth );
extern Lpk_Fun_t * Lpk_DsdSplit( Lpk_Fun_t * p, char * pCofVars, int nCofVars, unsigned uBoundSet );
/*=== lpkAbcMux.c ============================================================*/
extern int Lpk_MuxAnalize( Lpk_Fun_t * p );
extern Lpk_Fun_t * Lpk_MuxSplit( Lpk_Fun_t * p, int VarPol );
/*=== lpkAbcUtil.c ============================================================*/
extern Lpk_Fun_t * Lpk_FunAlloc( int nVars );
extern void Lpk_FunFree( Lpk_Fun_t * p );
extern Lpk_Fun_t * Lpk_FunCreate( Abc_Ntk_t * pNtk, Vec_Ptr_t * vLeaves, unsigned * pTruth, int nLutK, int AreaLim, int DelayLim );
......@@ -187,12 +190,6 @@ extern Lpk_Fun_t * Lpk_FunDup( Lpk_Fun_t * p, unsigned * pTruth );
extern void Lpk_FunSuppMinimize( Lpk_Fun_t * p );
extern int Lpk_SuppDelay( unsigned uSupp, char * pDelays );
extern int Lpk_SuppToVars( unsigned uBoundSet, char * pVars );
/*=== lpkAbcDsd.c ============================================================*/
extern Lpk_Res_t * Lpk_FunAnalizeDsd( Lpk_Fun_t * p, int nCofDepth );
extern Lpk_Fun_t * Lpk_FunSplitDsd( Lpk_Fun_t * p, char * pCofVars, int nCofVars, unsigned uBoundSet );
/*=== lpkAbcMux.c ============================================================*/
extern int Lpk_FunAnalizeMux( Lpk_Fun_t * p );
extern Lpk_Fun_t * Lpk_FunSplitMux( Lpk_Fun_t * p, int VarPol );
/*=== lpkCut.c =========================================================*/
......
SRC += src/opt/lpk/lpkCore.c \
src/opt/lpk/lpkAbcDec.c \
src/opt/lpk/lpkAbcMux.c \
src/opt/lpk/lpkAbcDsd.c \
src/opt/lpk/lpkAbcUtil.c \
src/opt/lpk/lpkCut.c \
src/opt/lpk/lpkMan.c \
src/opt/lpk/lpkMap.c \
......
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