Commit ae037e45 by Alan Mishchenko

Version abc61210

parent b9abf9c0
...@@ -1854,10 +1854,6 @@ SOURCE=.\src\map\if\ifCut.c ...@@ -1854,10 +1854,6 @@ SOURCE=.\src\map\if\ifCut.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\map\if\ifLib.c
# End Source File
# Begin Source File
SOURCE=.\src\map\if\ifMan.c SOURCE=.\src\map\if\ifMan.c
# End Source File # End Source File
# Begin Source File # Begin Source File
...@@ -1878,6 +1874,10 @@ SOURCE=.\src\map\if\ifSeq.c ...@@ -1878,6 +1874,10 @@ SOURCE=.\src\map\if\ifSeq.c
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=.\src\map\if\ifTime.c
# End Source File
# Begin Source File
SOURCE=.\src\map\if\ifTruth.c SOURCE=.\src\map\if\ifTruth.c
# End Source File # End Source File
# Begin Source File # Begin Source File
......
...@@ -30,6 +30,7 @@ alias fs fraig_sweep ...@@ -30,6 +30,7 @@ alias fs fraig_sweep
alias fsto fraig_store alias fsto fraig_store
alias fres fraig_restore alias fres fraig_restore
alias ft fraig_trust alias ft fraig_trust
alias ifs if -s
alias pex print_exdc -d alias pex print_exdc -d
alias pf print_factor alias pf print_factor
alias pfan print_fanio alias pfan print_fanio
......
...@@ -111,7 +111,7 @@ bool Abc_NtkDoCheck( Abc_Ntk_t * pNtk ) ...@@ -111,7 +111,7 @@ bool Abc_NtkDoCheck( Abc_Ntk_t * pNtk )
return 0; return 0;
} }
} }
/*
// check CI/CO numbers // check CI/CO numbers
if ( Abc_NtkPiNum(pNtk) + Abc_NtkLatchNum(pNtk) != Abc_NtkCiNum(pNtk) ) if ( Abc_NtkPiNum(pNtk) + Abc_NtkLatchNum(pNtk) != Abc_NtkCiNum(pNtk) )
{ {
...@@ -127,7 +127,7 @@ bool Abc_NtkDoCheck( Abc_Ntk_t * pNtk ) ...@@ -127,7 +127,7 @@ bool Abc_NtkDoCheck( Abc_Ntk_t * pNtk )
fprintf( stdout, "in procedure Abc_NtkCreateObj() and in the user's code.\n" ); fprintf( stdout, "in procedure Abc_NtkCreateObj() and in the user's code.\n" );
return 0; return 0;
} }
*/
// check the names // check the names
if ( !Abc_NtkCheckNames( pNtk ) ) if ( !Abc_NtkCheckNames( pNtk ) )
return 0; return 0;
......
...@@ -7529,25 +7529,26 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -7529,25 +7529,26 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
memset( pPars, 0, sizeof(If_Par_t) ); memset( pPars, 0, sizeof(If_Par_t) );
// user-controlable paramters // user-controlable paramters
pPars->nLutSize = 4; pPars->nLutSize = 4;
pPars->nCutsMax = 10; pPars->nCutsMax = 8;
pPars->DelayTarget = -1; pPars->DelayTarget = -1;
pPars->fPreprocess = 1; pPars->fPreprocess = 1;
pPars->fArea = 0; pPars->fArea = 0;
pPars->fFancy = 0; pPars->fFancy = 0;
pPars->fExpRed = 1; pPars->fExpRed = 1;
pPars->fLatchPaths = 0; pPars->fLatchPaths = 0;
pPars->fSeq = 0; pPars->fSeqMap = 0;
pPars->fVerbose = 0; pPars->fVerbose = 0;
// internal parameters // internal parameters
pPars->fTruth = 0; pPars->fTruth = 0;
pPars->nLatches = pNtk? Abc_NtkLatchNum(pNtk) : 0; pPars->nLatches = pNtk? Abc_NtkLatchNum(pNtk) : 0;
pPars->fLiftLeaves = 0;
pPars->pLutLib = NULL; // Abc_FrameReadLibLut(); pPars->pLutLib = NULL; // Abc_FrameReadLibLut();
pPars->pTimesArr = NULL; pPars->pTimesArr = NULL;
pPars->pTimesArr = NULL; pPars->pTimesArr = NULL;
pPars->pFuncCost = NULL; pPars->pFuncCost = NULL;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "KCDpaflrsvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "KCDpaflrstvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
...@@ -7600,7 +7601,10 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -7600,7 +7601,10 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
pPars->fExpRed ^= 1; pPars->fExpRed ^= 1;
break; break;
case 's': case 's':
pPars->fSeq ^= 1; pPars->fSeqMap ^= 1;
break;
case 't':
pPars->fLiftLeaves ^= 1;
break; break;
case 'v': case 'v':
pPars->fVerbose ^= 1; pPars->fVerbose ^= 1;
...@@ -7616,12 +7620,18 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -7616,12 +7620,18 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
fprintf( pErr, "Empty network.\n" ); fprintf( pErr, "Empty network.\n" );
return 1; return 1;
} }
/*
if ( pPars->fSeq ) if ( pPars->fSeq )
{ {
fprintf( pErr, "Sequential mapping is currently being implemented.\n" ); fprintf( pErr, "Sequential mapping is currently being implemented.\n" );
return 1; return 1;
} }
*/
if ( pPars->fSeqMap && pPars->nLatches == 0 )
{
fprintf( pErr, "The network has no latches. Use combinational mapping instead of sequential.\n" );
return 1;
}
if ( pPars->nLutSize < 3 || pPars->nLutSize > IF_MAX_LUTSIZE ) if ( pPars->nLutSize < 3 || pPars->nLutSize > IF_MAX_LUTSIZE )
{ {
...@@ -7649,13 +7659,6 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -7649,13 +7659,6 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1; return 1;
} }
// set the latch paths
if ( pPars->fLatchPaths )
{
for ( c = 0; c < Abc_NtkPiNum(pNtk); c++ )
pPars->pTimesArr[c] = -ABC_INFINITY;
}
if ( !Abc_NtkIsStrash(pNtk) ) if ( !Abc_NtkIsStrash(pNtk) )
{ {
// strash and balance the network // strash and balance the network
...@@ -7679,7 +7682,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -7679,7 +7682,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
{ {
Abc_NtkDelete( pNtk ); Abc_NtkDelete( pNtk );
fprintf( pErr, "FPGA mapping has failed.\n" ); fprintf( pErr, "FPGA mapping has failed.\n" );
return 1; return 0;
} }
Abc_NtkDelete( pNtk ); Abc_NtkDelete( pNtk );
} }
...@@ -7690,7 +7693,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv ) ...@@ -7690,7 +7693,7 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pNtkRes == NULL ) if ( pNtkRes == NULL )
{ {
fprintf( pErr, "FPGA mapping has failed.\n" ); fprintf( pErr, "FPGA mapping has failed.\n" );
return 1; return 0;
} }
} }
// replace the current network // replace the current network
...@@ -7706,17 +7709,18 @@ usage: ...@@ -7706,17 +7709,18 @@ usage:
sprintf( LutSize, "library" ); sprintf( LutSize, "library" );
else else
sprintf( LutSize, "%d", pPars->nLutSize ); sprintf( LutSize, "%d", pPars->nLutSize );
fprintf( pErr, "usage: if [-K num] [-C num] [-D float] [-pafrsvh]\n" ); fprintf( pErr, "usage: if [-K num] [-C num] [-D float] [-pafrstvh]\n" );
fprintf( pErr, "\t performs FPGA technology mapping of the network\n" ); fprintf( pErr, "\t performs FPGA technology mapping of the network\n" );
fprintf( pErr, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize ); fprintf( pErr, "\t-K num : the number of LUT inputs (2 < num < %d) [default = %s]\n", IF_MAX_LUTSIZE+1, LutSize );
fprintf( pErr, "\t-C num : the max number of cuts to use (1 < num < 2^12) [default = %d]\n", pPars->nCutsMax ); fprintf( pErr, "\t-C num : the max number of cuts to use (1 < num < 2^12) [default = %d]\n", pPars->nCutsMax );
fprintf( pErr, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer ); fprintf( pErr, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer );
fprintf( pErr, "\t-p : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" ); fprintf( pErr, "\t-p : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" );
fprintf( pErr, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" ); fprintf( pErr, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" );
fprintf( pErr, "\t-f : toggles one fancy feature [default = %s]\n", pPars->fFancy? "yes": "no" ); // fprintf( pErr, "\t-f : toggles one fancy feature [default = %s]\n", pPars->fFancy? "yes": "no" );
fprintf( pErr, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" ); fprintf( pErr, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" );
fprintf( pErr, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" ); fprintf( pErr, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" );
fprintf( pErr, "\t-s : toggles sequential mapping [default = %s]\n", pPars->fSeq? "yes": "no" ); fprintf( pErr, "\t-s : toggles sequential mapping [default = %s]\n", pPars->fSeqMap? "yes": "no" );
fprintf( pErr, "\t-t : toggles the use of true sequential cuts [default = %s]\n", pPars->fLiftLeaves? "yes": "no" );
fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" ); fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" );
fprintf( pErr, "\t-h : prints the command usage\n"); fprintf( pErr, "\t-h : prints the command usage\n");
return 1; return 1;
......
...@@ -117,7 +117,7 @@ void * Abc_NtkToFraig( Abc_Ntk_t * pNtk, void * pParams, int fAllNodes, int fExd ...@@ -117,7 +117,7 @@ void * Abc_NtkToFraig( Abc_Ntk_t * pNtk, void * pParams, int fAllNodes, int fExd
// create PIs and remember them in the old nodes // create PIs and remember them in the old nodes
Abc_NtkForEachCi( pNtk, pNode, i ) Abc_NtkForEachCi( pNtk, pNode, i )
pNode->pCopy = (Abc_Obj_t *)Fraig_ManReadIthVar(pMan, i); pNode->pCopy = (Abc_Obj_t *)Fraig_ManReadIthVar(pMan, i);
// perform strashing // perform strashing
vNodes = Abc_AigDfs( pNtk, fAllNodes, 0 ); vNodes = Abc_AigDfs( pNtk, fAllNodes, 0 );
if ( !fInternal ) if ( !fInternal )
......
...@@ -58,6 +58,14 @@ Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars ) ...@@ -58,6 +58,14 @@ Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars )
pPars->pTimesArr = Abc_NtkGetCiArrivalFloats(pNtk); pPars->pTimesArr = Abc_NtkGetCiArrivalFloats(pNtk);
pPars->pTimesReq = NULL; pPars->pTimesReq = NULL;
// set the latch paths
if ( pPars->fLatchPaths && pPars->pTimesArr )
{
int c;
for ( c = 0; c < Abc_NtkPiNum(pNtk); c++ )
pPars->pTimesArr[c] = -ABC_INFINITY;
}
// perform FPGA mapping // perform FPGA mapping
pIfMan = Abc_NtkToIf( pNtk, pPars ); pIfMan = Abc_NtkToIf( pNtk, pPars );
if ( pIfMan == NULL ) if ( pIfMan == NULL )
...@@ -117,7 +125,10 @@ If_Man_t * Abc_NtkToIf( Abc_Ntk_t * pNtk, If_Par_t * pPars ) ...@@ -117,7 +125,10 @@ If_Man_t * Abc_NtkToIf( Abc_Ntk_t * pNtk, If_Par_t * pPars )
// create PIs and remember them in the old nodes // create PIs and remember them in the old nodes
Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)If_ManConst1( pIfMan ); Abc_AigConst1(pNtk)->pCopy = (Abc_Obj_t *)If_ManConst1( pIfMan );
Abc_NtkForEachCi( pNtk, pNode, i ) Abc_NtkForEachCi( pNtk, pNode, i )
pNode->pCopy = (Abc_Obj_t *)If_ManCreatePi( pIfMan ); {
pNode->pCopy = (Abc_Obj_t *)If_ManCreateCi( pIfMan );
//printf( "AIG CI %2d -> IF CI %2d\n", pNode->Id, ((If_Obj_t *)pNode->pCopy)->Id );
}
// load the AIG into the mapper // load the AIG into the mapper
pProgress = Extra_ProgressBarStart( stdout, Abc_NtkObjNumMax(pNtk) ); pProgress = Extra_ProgressBarStart( stdout, Abc_NtkObjNumMax(pNtk) );
...@@ -136,13 +147,14 @@ If_Man_t * Abc_NtkToIf( Abc_Ntk_t * pNtk, If_Par_t * pPars ) ...@@ -136,13 +147,14 @@ If_Man_t * Abc_NtkToIf( Abc_Ntk_t * pNtk, If_Par_t * pPars )
If_ObjSetChoice( (If_Obj_t *)pPrev->pCopy, (If_Obj_t *)pFanin->pCopy ); If_ObjSetChoice( (If_Obj_t *)pPrev->pCopy, (If_Obj_t *)pFanin->pCopy );
If_ManCreateChoice( pIfMan, (If_Obj_t *)pNode->pCopy ); If_ManCreateChoice( pIfMan, (If_Obj_t *)pNode->pCopy );
} }
//printf( "AIG node %2d -> IF node %2d\n", pNode->Id, ((If_Obj_t *)pNode->pCopy)->Id );
} }
Extra_ProgressBarStop( pProgress ); Extra_ProgressBarStop( pProgress );
Vec_PtrFree( vNodes ); Vec_PtrFree( vNodes );
// set the primary outputs without copying the phase // set the primary outputs without copying the phase
Abc_NtkForEachCo( pNtk, pNode, i ) Abc_NtkForEachCo( pNtk, pNode, i )
If_ManCreatePo( pIfMan, (If_Obj_t *)Abc_ObjFanin0(pNode)->pCopy, Abc_ObjFaninC0(pNode) ); If_ManCreateCo( pIfMan, (If_Obj_t *)Abc_ObjFanin0(pNode)->pCopy, Abc_ObjFaninC0(pNode) );
return pIfMan; return pIfMan;
} }
...@@ -177,15 +189,15 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk ) ...@@ -177,15 +189,15 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk )
// make the mapper point to the new network // make the mapper point to the new network
If_ObjSetCopy( If_ManConst1(pIfMan), Abc_NtkCreateNodeConst1(pNtkNew) ); If_ObjSetCopy( If_ManConst1(pIfMan), Abc_NtkCreateNodeConst1(pNtkNew) );
Abc_NtkForEachCi( pNtk, pNode, i ) Abc_NtkForEachCi( pNtk, pNode, i )
If_ObjSetCopy( If_ManPi(pIfMan, i), pNode->pCopy ); If_ObjSetCopy( If_ManCi(pIfMan, i), pNode->pCopy );
// process the nodes in topological order // process the nodes in topological order
vCover = Vec_IntAlloc( 1 << 16 ); vCover = Vec_IntAlloc( 1 << 16 );
pProgress = Extra_ProgressBarStart( stdout, Abc_NtkCoNum(pNtk) ); pProgress = Extra_ProgressBarStart( stdout, Abc_NtkCoNum(pNtk) );
Abc_NtkForEachCo( pNtk, pNode, i ) Abc_NtkForEachCo( pNtk, pNode, i )
{ {
Extra_ProgressBarUpdate( pProgress, i, "Final" ); Extra_ProgressBarUpdate( pProgress, i, "Final" );
pNodeNew = Abc_NodeFromIf_rec( pNtkNew, pIfMan, If_ObjFanin0(If_ManPo(pIfMan, i)), vCover ); pNodeNew = Abc_NodeFromIf_rec( pNtkNew, pIfMan, If_ObjFanin0(If_ManCo(pIfMan, i)), vCover );
pNodeNew = Abc_ObjNotCond( pNodeNew, If_ObjFaninC0(If_ManPo(pIfMan, i)) ); pNodeNew = Abc_ObjNotCond( pNodeNew, If_ObjFaninC0(If_ManCo(pIfMan, i)) );
Abc_ObjAddFanin( pNode->pCopy, pNodeNew ); Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
} }
Extra_ProgressBarStop( pProgress ); Extra_ProgressBarStop( pProgress );
......
...@@ -118,15 +118,19 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored ) ...@@ -118,15 +118,19 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored )
fprintf( pFile, " lev = %3d", Abc_NtkLevel(pNtk) ); fprintf( pFile, " lev = %3d", Abc_NtkLevel(pNtk) );
fprintf( pFile, "\n" ); fprintf( pFile, "\n" );
// print the statistic into a file // print the statistic into a file
/* /*
{ {
FILE * pTable; FILE * pTable;
pTable = fopen( "stats.txt", "a+" ); pTable = fopen( "a/seqmap__stats.txt", "a+" );
fprintf( pTable, "%s ", pNtk->pName ); fprintf( pTable, "%s ", pNtk->pName );
fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) ); fprintf( pTable, "%d ", Abc_NtkPiNum(pNtk) );
fprintf( pTable, "%d ", Abc_NtkPoNum(pNtk) );
fprintf( pTable, "%d ", Abc_NtkLatchNum(pNtk) );
fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) ); fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
fprintf( pTable, "%d ", Abc_AigLevel(pNtk) ); fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
fprintf( pTable, "\n" ); fprintf( pTable, "\n" );
fclose( pTable ); fclose( pTable );
} }
......
...@@ -56,6 +56,9 @@ Abc_Ntk_t * Abc_NtkRenode( Abc_Ntk_t * pNtk, int nFaninMax, int nCubeMax, int fA ...@@ -56,6 +56,9 @@ Abc_Ntk_t * Abc_NtkRenode( Abc_Ntk_t * pNtk, int nFaninMax, int nCubeMax, int fA
If_Par_t Pars, * pPars = &Pars; If_Par_t Pars, * pPars = &Pars;
Abc_Ntk_t * pNtkNew; Abc_Ntk_t * pNtkNew;
if ( Abc_NtkGetChoiceNum( pNtk ) )
printf( "Performing renoding with choices.\n" );
// set defaults // set defaults
memset( pPars, 0, sizeof(If_Par_t) ); memset( pPars, 0, sizeof(If_Par_t) );
// user-controlable paramters // user-controlable paramters
...@@ -67,11 +70,11 @@ Abc_Ntk_t * Abc_NtkRenode( Abc_Ntk_t * pNtk, int nFaninMax, int nCubeMax, int fA ...@@ -67,11 +70,11 @@ Abc_Ntk_t * Abc_NtkRenode( Abc_Ntk_t * pNtk, int nFaninMax, int nCubeMax, int fA
pPars->fFancy = 0; pPars->fFancy = 0;
pPars->fExpRed = 0; // pPars->fExpRed = 0; //
pPars->fLatchPaths = 0; pPars->fLatchPaths = 0;
pPars->fSeq = 0; pPars->fSeqMap = 0;
pPars->fVerbose = fVerbose; pPars->fVerbose = fVerbose;
// internal parameters // internal parameters
pPars->fTruth = 1; pPars->fTruth = 1;
pPars->fUsePerm = 1; //!fUseSops; pPars->fUsePerm = 1;
pPars->nLatches = 0; pPars->nLatches = 0;
pPars->pLutLib = NULL; // Abc_FrameReadLibLut(); pPars->pLutLib = NULL; // Abc_FrameReadLibLut();
pPars->pTimesArr = NULL; pPars->pTimesArr = NULL;
......
...@@ -151,7 +151,8 @@ Abc_Ntk_t * Abc_NtkStrash( Abc_Ntk_t * pNtk, bool fAllNodes, bool fCleanup ) ...@@ -151,7 +151,8 @@ Abc_Ntk_t * Abc_NtkStrash( Abc_Ntk_t * pNtk, bool fAllNodes, bool fCleanup )
int Abc_NtkAppend( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fAddPos ) int Abc_NtkAppend( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fAddPos )
{ {
Abc_Obj_t * pObj; Abc_Obj_t * pObj;
int i; char * pName;
int i, nNewCis;
// the first network should be an AIG // the first network should be an AIG
assert( Abc_NtkIsStrash(pNtk1) ); assert( Abc_NtkIsStrash(pNtk1) );
assert( Abc_NtkIsLogic(pNtk2) || Abc_NtkIsStrash(pNtk2) ); assert( Abc_NtkIsLogic(pNtk2) || Abc_NtkIsStrash(pNtk2) );
...@@ -165,13 +166,20 @@ int Abc_NtkAppend( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fAddPos ) ...@@ -165,13 +166,20 @@ int Abc_NtkAppend( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fAddPos )
if ( !Abc_NtkCompareSignals( pNtk1, pNtk2, 1, 1 ) ) if ( !Abc_NtkCompareSignals( pNtk1, pNtk2, 1, 1 ) )
printf( "Abc_NtkAppend(): The union of the network PIs is computed (warning).\n" ); printf( "Abc_NtkAppend(): The union of the network PIs is computed (warning).\n" );
// perform strashing // perform strashing
nNewCis = 0;
Abc_NtkCleanCopy( pNtk2 ); Abc_NtkCleanCopy( pNtk2 );
Abc_NtkForEachCi( pNtk2, pObj, i ) Abc_NtkForEachCi( pNtk2, pObj, i )
{ {
pName = Abc_ObjName(pObj);
pObj->pCopy = Abc_NtkFindCi(pNtk1, Abc_ObjName(pObj)); pObj->pCopy = Abc_NtkFindCi(pNtk1, Abc_ObjName(pObj));
if ( pObj->pCopy == NULL ) if ( pObj->pCopy == NULL )
{
pObj->pCopy = Abc_NtkDupObj(pNtk1, pObj, 1); pObj->pCopy = Abc_NtkDupObj(pNtk1, pObj, 1);
nNewCis++;
}
} }
if ( nNewCis )
printf( "Warning: Procedure Abc_NtkAppend() added %d new CIs.\n", nNewCis );
// add pNtk2 to pNtk1 while strashing // add pNtk2 to pNtk1 while strashing
if ( Abc_NtkIsLogic(pNtk2) ) if ( Abc_NtkIsLogic(pNtk2) )
Abc_NtkStrashPerform( pNtk2, pNtk1, 1 ); Abc_NtkStrashPerform( pNtk2, pNtk1, 1 );
......
...@@ -45,13 +45,25 @@ int If_ManPerformMapping( If_Man_t * p ) ...@@ -45,13 +45,25 @@ int If_ManPerformMapping( If_Man_t * p )
int nItersFlow = 1; int nItersFlow = 1;
int nItersArea = 2; int nItersArea = 2;
int clkTotal = clock(); int clkTotal = clock();
int i; int RetValue, i;
// try sequential mapping
if ( p->pPars->fSeqMap )
{
RetValue = If_ManPerformMappingSeq( p );
if ( p->pPars->fVerbose )
{
PRT( "Total time", clock() - clkTotal );
}
return RetValue;
}
// set arrival times and trivial cuts at const 1 and PIs // set arrival times and trivial cuts at const 1 and PIs
If_ManConst1(p)->Cuts[0].Delay = 0.0; If_ManConst1(p)->Cuts[0].Delay = 0.0;
If_ManForEachPi( p, pObj, i ) If_ManForEachCi( p, pObj, i )
pObj->Cuts[0].Delay = p->pPars->pTimesArr[i]; pObj->Cuts[0].Delay = p->pPars->pTimesArr[i];
// set the fanout estimates of the PIs // set the fanout estimates of the PIs
If_ManForEachPi( p, pObj, i ) If_ManForEachCi( p, pObj, i )
pObj->EstRefs = (float)1.0; pObj->EstRefs = (float)1.0;
// delay oriented mapping // delay oriented mapping
if ( p->pPars->fPreprocess && !p->pPars->fArea && p->pPars->nCutsMax >= 4 ) if ( p->pPars->fPreprocess && !p->pPars->fArea && p->pPars->nCutsMax >= 4 )
......
...@@ -423,13 +423,15 @@ float If_CutFlow( If_Man_t * p, If_Cut_t * pCut ) ...@@ -423,13 +423,15 @@ float If_CutFlow( If_Man_t * p, If_Cut_t * pCut )
If_Obj_t * pLeaf; If_Obj_t * pLeaf;
float Flow; float Flow;
int i; int i;
assert( pCut->nLeaves > 1 ); assert( p->pPars->fSeqMap || pCut->nLeaves > 1 );
Flow = If_CutLutArea(p, pCut); Flow = If_CutLutArea(p, pCut);
If_CutForEachLeaf( p, pCut, pLeaf, i ) If_CutForEachLeaf( p, pCut, pLeaf, i )
{ {
if ( pLeaf->nRefs == 0 ) if ( pLeaf->nRefs == 0 )
Flow += If_ObjCutBest(pLeaf)->Area; Flow += If_ObjCutBest(pLeaf)->Area;
else else if ( p->pPars->fSeqMap ) // seq
Flow += If_ObjCutBest(pLeaf)->Area / pLeaf->nRefs;
else
{ {
assert( pLeaf->EstRefs > p->fEpsilon ); assert( pLeaf->EstRefs > p->fEpsilon );
Flow += If_ObjCutBest(pLeaf)->Area / pLeaf->EstRefs; Flow += If_ObjCutBest(pLeaf)->Area / pLeaf->EstRefs;
...@@ -453,7 +455,7 @@ float If_CutAverageRefs( If_Man_t * p, If_Cut_t * pCut ) ...@@ -453,7 +455,7 @@ float If_CutAverageRefs( If_Man_t * p, If_Cut_t * pCut )
{ {
If_Obj_t * pLeaf; If_Obj_t * pLeaf;
int nRefsTotal, i; int nRefsTotal, i;
assert( pCut->nLeaves > 1 ); assert( p->pPars->fSeqMap || pCut->nLeaves > 1 );
nRefsTotal = 0; nRefsTotal = 0;
If_CutForEachLeaf( p, pCut, pLeaf, i ) If_CutForEachLeaf( p, pCut, pLeaf, i )
nRefsTotal += pLeaf->nRefs; nRefsTotal += pLeaf->nRefs;
...@@ -569,7 +571,7 @@ void If_CutPrintTiming( If_Man_t * p, If_Cut_t * pCut ) ...@@ -569,7 +571,7 @@ void If_CutPrintTiming( If_Man_t * p, If_Cut_t * pCut )
float If_CutAreaDerefed( If_Man_t * p, If_Cut_t * pCut, int nLevels ) float If_CutAreaDerefed( If_Man_t * p, If_Cut_t * pCut, int nLevels )
{ {
float aResult, aResult2; float aResult, aResult2;
assert( pCut->nLeaves > 1 ); assert( p->pPars->fSeqMap || pCut->nLeaves > 1 );
aResult2 = If_CutRef( p, pCut, nLevels ); aResult2 = If_CutRef( p, pCut, nLevels );
aResult = If_CutDeref( p, pCut, nLevels ); aResult = If_CutDeref( p, pCut, nLevels );
assert( aResult == aResult2 ); assert( aResult == aResult2 );
...@@ -590,7 +592,7 @@ float If_CutAreaDerefed( If_Man_t * p, If_Cut_t * pCut, int nLevels ) ...@@ -590,7 +592,7 @@ float If_CutAreaDerefed( If_Man_t * p, If_Cut_t * pCut, int nLevels )
float If_CutAreaRefed( If_Man_t * p, If_Cut_t * pCut, int nLevels ) float If_CutAreaRefed( If_Man_t * p, If_Cut_t * pCut, int nLevels )
{ {
float aResult, aResult2; float aResult, aResult2;
assert( pCut->nLeaves > 1 ); assert( p->pPars->fSeqMap || pCut->nLeaves > 1 );
aResult2 = If_CutDeref( p, pCut, nLevels ); aResult2 = If_CutDeref( p, pCut, nLevels );
aResult = If_CutRef( p, pCut, nLevels ); aResult = If_CutRef( p, pCut, nLevels );
assert( aResult == aResult2 ); assert( aResult == aResult2 );
...@@ -599,6 +601,27 @@ float If_CutAreaRefed( If_Man_t * p, If_Cut_t * pCut, int nLevels ) ...@@ -599,6 +601,27 @@ float If_CutAreaRefed( If_Man_t * p, If_Cut_t * pCut, int nLevels )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Moves the cut over the latch.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void If_CutLift( If_Cut_t * pCut )
{
unsigned i;
for ( i = 0; i < pCut->nLeaves; i++ )
{
assert( (pCut->pLeaves[i] & 255) < 255 );
pCut->pLeaves[i]++;
}
}
/**Function*************************************************************
Synopsis [Computes area of the first level.] Synopsis [Computes area of the first level.]
Description [The cut need to be derefed.] Description [The cut need to be derefed.]
......
...@@ -51,8 +51,8 @@ If_Man_t * If_ManStart( If_Par_t * pPars ) ...@@ -51,8 +51,8 @@ If_Man_t * If_ManStart( If_Par_t * pPars )
p->pPars = pPars; p->pPars = pPars;
p->fEpsilon = (float)0.001; p->fEpsilon = (float)0.001;
// allocate arrays for nodes // allocate arrays for nodes
p->vPis = Vec_PtrAlloc( 100 ); p->vCis = Vec_PtrAlloc( 100 );
p->vPos = Vec_PtrAlloc( 100 ); p->vCos = Vec_PtrAlloc( 100 );
p->vObjs = Vec_PtrAlloc( 100 ); p->vObjs = Vec_PtrAlloc( 100 );
p->vMapped = Vec_PtrAlloc( 100 ); p->vMapped = Vec_PtrAlloc( 100 );
p->vTemp = Vec_PtrAlloc( 100 ); p->vTemp = Vec_PtrAlloc( 100 );
...@@ -96,11 +96,13 @@ void If_ManStop( If_Man_t * p ) ...@@ -96,11 +96,13 @@ void If_ManStop( If_Man_t * p )
{ {
If_Cut_t * pTemp; If_Cut_t * pTemp;
int i; int i;
Vec_PtrFree( p->vPis ); Vec_PtrFree( p->vCis );
Vec_PtrFree( p->vPos ); Vec_PtrFree( p->vCos );
Vec_PtrFree( p->vObjs ); Vec_PtrFree( p->vObjs );
Vec_PtrFree( p->vMapped ); Vec_PtrFree( p->vMapped );
Vec_PtrFree( p->vTemp ); Vec_PtrFree( p->vTemp );
if ( p->vLatchOrder ) Vec_PtrFree( p->vLatchOrder );
if ( p->vLags ) Vec_IntFree( p->vLags );
Mem_FixedStop( p->pMem, 0 ); Mem_FixedStop( p->pMem, 0 );
// free pars memory // free pars memory
if ( p->pPars->pTimesArr ) if ( p->pPars->pTimesArr )
...@@ -129,13 +131,13 @@ void If_ManStop( If_Man_t * p ) ...@@ -129,13 +131,13 @@ void If_ManStop( If_Man_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
If_Obj_t * If_ManCreatePi( If_Man_t * p ) If_Obj_t * If_ManCreateCi( If_Man_t * p )
{ {
If_Obj_t * pObj; If_Obj_t * pObj;
pObj = If_ManSetupObj( p ); pObj = If_ManSetupObj( p );
pObj->Type = IF_PI; pObj->Type = IF_CI;
Vec_PtrPush( p->vPis, pObj ); Vec_PtrPush( p->vCis, pObj );
p->nObjs[IF_PI]++; p->nObjs[IF_CI]++;
return pObj; return pObj;
} }
...@@ -150,15 +152,15 @@ If_Obj_t * If_ManCreatePi( If_Man_t * p ) ...@@ -150,15 +152,15 @@ If_Obj_t * If_ManCreatePi( If_Man_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
If_Obj_t * If_ManCreatePo( If_Man_t * p, If_Obj_t * pDriver, int fCompl0 ) If_Obj_t * If_ManCreateCo( If_Man_t * p, If_Obj_t * pDriver, int fCompl0 )
{ {
If_Obj_t * pObj; If_Obj_t * pObj;
pObj = If_ManSetupObj( p ); pObj = If_ManSetupObj( p );
pObj->Type = IF_PO; pObj->Type = IF_CO;
pObj->fCompl0 = fCompl0; pObj->fCompl0 = fCompl0;
Vec_PtrPush( p->vPos, pObj ); Vec_PtrPush( p->vCos, pObj );
pObj->pFanin0 = pDriver; pDriver->nRefs++; pObj->pFanin0 = pDriver; pDriver->nRefs++;
p->nObjs[IF_PO]++; p->nObjs[IF_CO]++;
return pObj; return pObj;
} }
...@@ -251,7 +253,7 @@ If_Obj_t * If_ManSetupObj( If_Man_t * p ) ...@@ -251,7 +253,7 @@ If_Obj_t * If_ManSetupObj( If_Man_t * p )
// assign elementary cut // assign elementary cut
pCut = pObj->Cuts; pCut = pObj->Cuts;
pCut->nLeaves = 1; pCut->nLeaves = 1;
pCut->pLeaves[0] = p->pPars->fSeq? (pObj->Id << 8) : pObj->Id; pCut->pLeaves[0] = p->pPars->fLiftLeaves? (pObj->Id << 8) : pObj->Id;
pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] ); pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] );
// set the number of cuts // set the number of cuts
pObj->nCuts = 1; pObj->nCuts = 1;
......
...@@ -69,27 +69,31 @@ static inline int If_WordCountOnes( unsigned uWord ) ...@@ -69,27 +69,31 @@ static inline int If_WordCountOnes( unsigned uWord )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void If_ObjPerformMapping( If_Man_t * p, If_Obj_t * pObj, int Mode ) void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode )
{ {
If_Cut_t * pCut0, * pCut1, * pCut; If_Cut_t * pCut0, * pCut1, * pCut;
int i, k, iCut; int i, k, iCut;
assert( !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->nCuts > 1 ); assert( p->pPars->fSeqMap || !If_ObjIsAnd(pObj->pFanin0) || pObj->pFanin0->nCuts > 1 );
assert( !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->nCuts > 1 ); assert( p->pPars->fSeqMap || !If_ObjIsAnd(pObj->pFanin1) || pObj->pFanin1->nCuts > 1 );
// prepare // prepare
if ( Mode == 0 ) if ( !p->pPars->fSeqMap )
pObj->EstRefs = (float)pObj->nRefs; {
else if ( Mode == 1 ) if ( Mode == 0 )
pObj->EstRefs = (float)((2.0 * pObj->EstRefs + pObj->nRefs) / 3.0); pObj->EstRefs = (float)pObj->nRefs;
else if ( Mode == 2 && pObj->nRefs > 0 ) else if ( Mode == 1 )
pObj->EstRefs = (float)((2.0 * pObj->EstRefs + pObj->nRefs) / 3.0);
}
if ( Mode && pObj->nRefs > 0 )
If_CutDeref( p, If_ObjCutBest(pObj), 100 ); If_CutDeref( p, If_ObjCutBest(pObj), 100 );
// recompute the parameters of the best cut // save the best cut as one of the candidate cuts
p->nCuts = 0; p->nCuts = 0;
p->nCutsMerged++; p->nCutsMerged++;
if ( Mode ) if ( Mode )
{ {
// recompute the parameters of the best cut
pCut = If_ObjCutBest(pObj); pCut = If_ObjCutBest(pObj);
pCut->Delay = If_CutDelay( p, pCut ); pCut->Delay = If_CutDelay( p, pCut );
assert( pCut->Delay <= pObj->Required + p->fEpsilon ); assert( pCut->Delay <= pObj->Required + p->fEpsilon );
...@@ -114,12 +118,12 @@ void If_ObjPerformMapping( If_Man_t * p, If_Obj_t * pObj, int Mode ) ...@@ -114,12 +118,12 @@ void If_ObjPerformMapping( If_Man_t * p, If_Obj_t * pObj, int Mode )
continue; continue;
// check if this cut is contained in any of the available cuts // check if this cut is contained in any of the available cuts
pCut->uSign = pCut0->uSign | pCut1->uSign; pCut->uSign = pCut0->uSign | pCut1->uSign;
pCut->fCompl = 0;
// if ( p->pPars->pFuncCost == NULL && If_CutFilter( p, pCut ) ) // do not filter functionality cuts // if ( p->pPars->pFuncCost == NULL && If_CutFilter( p, pCut ) ) // do not filter functionality cuts
if ( If_CutFilter( p, pCut ) ) if ( If_CutFilter( p, pCut ) )
continue; continue;
// the cuts have been successfully merged // the cuts have been successfully merged
// compute the truth table // compute the truth table
pCut->fCompl = 0;
if ( p->pPars->fTruth ) if ( p->pPars->fTruth )
If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 ); If_CutComputeTruth( p, pCut, pCut0, pCut1, pObj->fCompl0, pObj->fCompl1 );
// compute the application-specific cost and depth // compute the application-specific cost and depth
...@@ -149,16 +153,14 @@ void If_ObjPerformMapping( If_Man_t * p, If_Obj_t * pObj, int Mode ) ...@@ -149,16 +153,14 @@ void If_ObjPerformMapping( If_Man_t * p, If_Obj_t * pObj, int Mode )
If_ManSortCuts( p, Mode ); If_ManSortCuts( p, Mode );
// decide how many cuts to use // decide how many cuts to use
pObj->nCuts = IF_MIN( p->nCuts + 1, p->nCutsUsed ); pObj->nCuts = IF_MIN( p->nCuts + 1, p->nCutsUsed );
//printf( "%d(%d) ", p->nCuts, pObj->nCuts );
// take the first // take the first
If_ObjForEachCutStart( pObj, pCut, i, 1 ) If_ObjForEachCutStart( pObj, pCut, i, 1 )
If_CutCopy( pCut, p->ppCuts[i-1] ); If_CutCopy( pCut, p->ppCuts[i-1] );
assert( If_ObjCutBest(pObj)->nLeaves > 1 ); assert( p->pPars->fSeqMap || If_ObjCutBest(pObj)->nLeaves > 1 );
// ref the selected cut // ref the selected cut
if ( Mode == 2 && pObj->nRefs > 0 ) if ( Mode && pObj->nRefs > 0 )
If_CutRef( p, If_ObjCutBest(pObj), 100 ); If_CutRef( p, If_ObjCutBest(pObj), 100 );
// find the largest cut
if ( p->nCutsMax < pObj->nCuts )
p->nCutsMax = pObj->nCuts;
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -172,14 +174,14 @@ void If_ObjPerformMapping( If_Man_t * p, If_Obj_t * pObj, int Mode ) ...@@ -172,14 +174,14 @@ void If_ObjPerformMapping( If_Man_t * p, If_Obj_t * pObj, int Mode )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void If_ObjMergeChoice( If_Man_t * p, If_Obj_t * pObj, int Mode ) void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode )
{ {
If_Obj_t * pTemp; If_Obj_t * pTemp;
If_Cut_t * pCutTemp, * pCut; If_Cut_t * pCutTemp, * pCut;
int i, iCut; int i, iCut;
assert( pObj->pEquiv != NULL ); assert( pObj->pEquiv != NULL );
// prepare // prepare
if ( Mode == 2 && pObj->nRefs > 0 ) if ( Mode && pObj->nRefs > 0 )
If_CutDeref( p, If_ObjCutBest(pObj), 100 ); If_CutDeref( p, If_ObjCutBest(pObj), 100 );
// prepare room for the next cut // prepare room for the next cut
p->nCuts = 0; p->nCuts = 0;
...@@ -227,13 +229,10 @@ void If_ObjMergeChoice( If_Man_t * p, If_Obj_t * pObj, int Mode ) ...@@ -227,13 +229,10 @@ void If_ObjMergeChoice( If_Man_t * p, If_Obj_t * pObj, int Mode )
// take the first // take the first
If_ObjForEachCutStart( pObj, pCut, i, 1 ) If_ObjForEachCutStart( pObj, pCut, i, 1 )
If_CutCopy( pCut, p->ppCuts[i-1] ); If_CutCopy( pCut, p->ppCuts[i-1] );
assert( If_ObjCutBest(pObj)->nLeaves > 1 ); assert( p->pPars->fSeqMap || If_ObjCutBest(pObj)->nLeaves > 1 );
// ref the selected cut // ref the selected cut
if ( Mode == 2 && pObj->nRefs > 0 ) if ( Mode && pObj->nRefs > 0 )
If_CutRef( p, If_ObjCutBest(pObj), 100 ); If_CutRef( p, If_ObjCutBest(pObj), 100 );
// find the largest cut
if ( p->nCutsMax < pObj->nCuts )
p->nCutsMax = pObj->nCuts;
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -249,25 +248,23 @@ void If_ObjMergeChoice( If_Man_t * p, If_Obj_t * pObj, int Mode ) ...@@ -249,25 +248,23 @@ void If_ObjMergeChoice( If_Man_t * p, If_Obj_t * pObj, int Mode )
***********************************************************************/ ***********************************************************************/
int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fRequired, char * pLabel ) int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fRequired, char * pLabel )
{ {
ProgressBar * pProgress; // ProgressBar * pProgress;
If_Obj_t * pObj; If_Obj_t * pObj;
int i, clk = clock(); int i, clk = clock();
assert( Mode >= 0 && Mode <= 2 ); assert( Mode >= 0 && Mode <= 2 );
// set the cut number // set the cut number
p->nCutsUsed = nCutsUsed; p->nCutsUsed = nCutsUsed;
p->nCutsMerged = 0; p->nCutsMerged = 0;
p->nCutsSaved = 0;
p->nCutsMax = 0;
// map the internal nodes // map the internal nodes
pProgress = Extra_ProgressBarStart( stdout, If_ManObjNum(p) ); // pProgress = Extra_ProgressBarStart( stdout, If_ManObjNum(p) );
If_ManForEachNode( p, pObj, i ) If_ManForEachNode( p, pObj, i )
{ {
Extra_ProgressBarUpdate( pProgress, i, pLabel ); // Extra_ProgressBarUpdate( pProgress, i, pLabel );
If_ObjPerformMapping( p, pObj, Mode ); If_ObjPerformMappingAnd( p, pObj, Mode );
if ( pObj->fRepr ) if ( pObj->fRepr )
If_ObjMergeChoice( p, pObj, Mode ); If_ObjPerformMappingChoice( p, pObj, Mode );
} }
Extra_ProgressBarStop( pProgress ); // Extra_ProgressBarStop( pProgress );
// compute required times and stats // compute required times and stats
if ( fRequired ) if ( fRequired )
{ {
...@@ -278,7 +275,6 @@ int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fRequi ...@@ -278,7 +275,6 @@ int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fRequi
printf( "%c: Del = %6.2f. Area = %8.2f. Cuts = %8d. Lim = %2d. Ave = %5.2f. ", printf( "%c: Del = %6.2f. Area = %8.2f. Cuts = %8d. Lim = %2d. Ave = %5.2f. ",
Symb, p->RequiredGlo, p->AreaGlo, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) ); Symb, p->RequiredGlo, p->AreaGlo, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
PRT( "T", clock() - clk ); PRT( "T", clock() - clk );
// printf( "Saved cuts = %d.\n", p->nCutsSaved );
// printf( "Max number of cuts = %d. Average number of cuts = %5.2f.\n", // printf( "Max number of cuts = %d. Average number of cuts = %5.2f.\n",
// p->nCutsMax, 1.0 * p->nCutsMerged / If_ManAndNum(p) ); // p->nCutsMax, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
} }
......
...@@ -52,7 +52,7 @@ void If_ManPerformMappingPreprocess( If_Man_t * p ) ...@@ -52,7 +52,7 @@ void If_ManPerformMappingPreprocess( If_Man_t * p )
p->pPars->fArea = 1; p->pPars->fArea = 1;
If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 0, "Start delay" ); If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 0, "Start delay" );
p->pPars->fArea = 0; p->pPars->fArea = 0;
delayArea = If_ManDelayMax( p ); delayArea = If_ManDelayMax( p, 0 );
if ( p->pPars->DelayTarget != -1 && delayArea < p->pPars->DelayTarget - p->fEpsilon ) if ( p->pPars->DelayTarget != -1 && delayArea < p->pPars->DelayTarget - p->fEpsilon )
delayArea = p->pPars->DelayTarget; delayArea = p->pPars->DelayTarget;
If_ManPerformMappingMoveBestCut( p, p->pPars->nCutsMax - 1, 1 ); If_ManPerformMappingMoveBestCut( p, p->pPars->nCutsMax - 1, 1 );
...@@ -61,14 +61,14 @@ void If_ManPerformMappingPreprocess( If_Man_t * p ) ...@@ -61,14 +61,14 @@ void If_ManPerformMappingPreprocess( If_Man_t * p )
p->pPars->fFancy = 1; p->pPars->fFancy = 1;
If_ManPerformMappingRound( p, p->pPars->nCutsMax - 1, 0, 0, "Start delay-2" ); If_ManPerformMappingRound( p, p->pPars->nCutsMax - 1, 0, 0, "Start delay-2" );
p->pPars->fFancy = 0; p->pPars->fFancy = 0;
delayDelay = If_ManDelayMax( p ); delayDelay = If_ManDelayMax( p, 0 );
if ( p->pPars->DelayTarget != -1 && delayDelay < p->pPars->DelayTarget - p->fEpsilon ) if ( p->pPars->DelayTarget != -1 && delayDelay < p->pPars->DelayTarget - p->fEpsilon )
delayDelay = p->pPars->DelayTarget; delayDelay = p->pPars->DelayTarget;
If_ManPerformMappingMoveBestCut( p, p->pPars->nCutsMax - 2, 1 ); If_ManPerformMappingMoveBestCut( p, p->pPars->nCutsMax - 2, 1 );
// perform min-delay mapping // perform min-delay mapping
If_ManPerformMappingRound( p, p->pPars->nCutsMax - 2, 0, 0, "Start flow" ); If_ManPerformMappingRound( p, p->pPars->nCutsMax - 2, 0, 0, "Start flow" );
delayPure = If_ManDelayMax( p ); delayPure = If_ManDelayMax( p, 0 );
if ( p->pPars->DelayTarget != -1 && delayPure < p->pPars->DelayTarget - p->fEpsilon ) if ( p->pPars->DelayTarget != -1 && delayPure < p->pPars->DelayTarget - p->fEpsilon )
delayPure = p->pPars->DelayTarget; delayPure = p->pPars->DelayTarget;
......
...@@ -361,7 +361,7 @@ int If_ManImproveNodeFaninCompact0( If_Man_t * p, If_Obj_t * pObj, int nLimit, V ...@@ -361,7 +361,7 @@ int If_ManImproveNodeFaninCompact0( If_Man_t * p, If_Obj_t * pObj, int nLimit, V
int i; int i;
Vec_PtrForEachEntry( vFront, pFanin, i ) Vec_PtrForEachEntry( vFront, pFanin, i )
{ {
if ( If_ObjIsPi(pFanin) ) if ( If_ObjIsCi(pFanin) )
continue; continue;
if ( If_ManImproveNodeWillGrow(p, pFanin) ) if ( If_ManImproveNodeWillGrow(p, pFanin) )
continue; continue;
...@@ -391,7 +391,7 @@ int If_ManImproveNodeFaninCompact1( If_Man_t * p, If_Obj_t * pObj, int nLimit, V ...@@ -391,7 +391,7 @@ int If_ManImproveNodeFaninCompact1( If_Man_t * p, If_Obj_t * pObj, int nLimit, V
int i; int i;
Vec_PtrForEachEntry( vFront, pFanin, i ) Vec_PtrForEachEntry( vFront, pFanin, i )
{ {
if ( If_ObjIsPi(pFanin) ) if ( If_ObjIsCi(pFanin) )
continue; continue;
if ( If_ManImproveNodeFaninCost(p, pFanin) < 0 ) if ( If_ManImproveNodeFaninCost(p, pFanin) < 0 )
{ {
...@@ -419,7 +419,7 @@ int If_ManImproveNodeFaninCompact2( If_Man_t * p, If_Obj_t * pObj, int nLimit, V ...@@ -419,7 +419,7 @@ int If_ManImproveNodeFaninCompact2( If_Man_t * p, If_Obj_t * pObj, int nLimit, V
int i; int i;
Vec_PtrForEachEntry( vFront, pFanin, i ) Vec_PtrForEachEntry( vFront, pFanin, i )
{ {
if ( If_ObjIsPi(pFanin) ) if ( If_ObjIsCi(pFanin) )
continue; continue;
if ( If_ManImproveNodeFaninCost(p, pFanin) <= 0 ) if ( If_ManImproveNodeFaninCost(p, pFanin) <= 0 )
{ {
...@@ -498,8 +498,8 @@ void If_ManImproveNodeReduce( If_Man_t * p, If_Obj_t * pObj, int nLimit ) ...@@ -498,8 +498,8 @@ void If_ManImproveNodeReduce( If_Man_t * p, If_Obj_t * pObj, int nLimit )
pFanin1 = If_ObjFanin1(pObj); pFanin1 = If_ObjFanin1(pObj);
// get the cuts // get the cuts
pCut = If_ObjCutBest(pObj); pCut = If_ObjCutBest(pObj);
pCut0 = If_ObjIsPi(pFanin0) ? If_ObjCutTriv(pFanin0) : If_ObjCutBest(pFanin0); pCut0 = If_ObjIsCi(pFanin0) ? If_ObjCutTriv(pFanin0) : If_ObjCutBest(pFanin0);
pCut1 = If_ObjIsPi(pFanin1) ? If_ObjCutTriv(pFanin1) : If_ObjCutBest(pFanin1); pCut1 = If_ObjIsCi(pFanin1) ? If_ObjCutTriv(pFanin1) : If_ObjCutBest(pFanin1);
assert( pCut->Delay <= pObj->Required + p->fEpsilon ); assert( pCut->Delay <= pObj->Required + p->fEpsilon );
// deref the cut if the node is refed // deref the cut if the node is refed
......
/**CFile**************************************************************** /**CFile****************************************************************
FileName [ifLib.c] FileName [ifTime.c]
SystemName [ABC: Logic synthesis and verification system.] SystemName [ABC: Logic synthesis and verification system.]
PackageName [FPGA mapping based on priority cuts.] PackageName [FPGA mapping based on priority cuts.]
Synopsis [Computation of LUT paramters depending on the library.] Synopsis [Computation of delay paramters depending on the library.]
Author [Alan Mishchenko] Author [Alan Mishchenko]
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
Date [Ver. 1.0. Started - November 21, 2006.] Date [Ver. 1.0. Started - November 21, 2006.]
Revision [$Id: ifLib.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $] Revision [$Id: ifTime.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $]
***********************************************************************/ ***********************************************************************/
...@@ -48,11 +48,12 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut ) ...@@ -48,11 +48,12 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut )
If_Obj_t * pLeaf; If_Obj_t * pLeaf;
float Delay, DelayCur; float Delay, DelayCur;
float * pLutDelays; float * pLutDelays;
int i; int i, Shift;
assert( pCut->nLeaves > 1 ); assert( p->pPars->fSeqMap || pCut->nLeaves > 1 );
Delay = -IF_FLOAT_LARGE; Delay = -IF_FLOAT_LARGE;
if ( p->pPars->pLutLib ) if ( p->pPars->pLutLib )
{ {
assert( !p->pPars->fLiftLeaves );
pLutDelays = p->pPars->pLutLib->pLutDelays[pCut->nLeaves]; pLutDelays = p->pPars->pLutLib->pLutDelays[pCut->nLeaves];
if ( p->pPars->pLutLib->fVarPinDelays ) if ( p->pPars->pLutLib->fVarPinDelays )
{ {
...@@ -77,6 +78,7 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut ) ...@@ -77,6 +78,7 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut )
{ {
if ( pCut->fUser ) if ( pCut->fUser )
{ {
assert( !p->pPars->fLiftLeaves );
If_CutForEachLeaf( p, pCut, pLeaf, i ) If_CutForEachLeaf( p, pCut, pLeaf, i )
{ {
DelayCur = If_ObjCutBest(pLeaf)->Delay + (float)pCut->pPerm[i]; DelayCur = If_ObjCutBest(pLeaf)->Delay + (float)pCut->pPerm[i];
...@@ -85,10 +87,21 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut ) ...@@ -85,10 +87,21 @@ float If_CutDelay( If_Man_t * p, If_Cut_t * pCut )
} }
else else
{ {
If_CutForEachLeaf( p, pCut, pLeaf, i ) if ( p->pPars->fLiftLeaves )
{ {
DelayCur = If_ObjCutBest(pLeaf)->Delay; If_CutForEachLeafSeq( p, pCut, pLeaf, Shift, i )
Delay = IF_MAX( Delay, DelayCur ); {
DelayCur = If_ObjCutBest(pLeaf)->Delay - Shift * p->Period;
Delay = IF_MAX( Delay, DelayCur );
}
}
else
{
If_CutForEachLeaf( p, pCut, pLeaf, i )
{
DelayCur = If_ObjCutBest(pLeaf)->Delay;
Delay = IF_MAX( Delay, DelayCur );
}
} }
Delay += 1.0; Delay += 1.0;
} }
...@@ -115,6 +128,7 @@ void If_CutPropagateRequired( If_Man_t * p, If_Cut_t * pCut, float ObjRequired ) ...@@ -115,6 +128,7 @@ void If_CutPropagateRequired( If_Man_t * p, If_Cut_t * pCut, float ObjRequired )
float * pLutDelays; float * pLutDelays;
float Required; float Required;
int i; int i;
assert( !p->pPars->fLiftLeaves );
// compute the pins // compute the pins
if ( p->pPars->pLutLib ) if ( p->pPars->pLutLib )
{ {
......
...@@ -30,6 +30,65 @@ ...@@ -30,6 +30,65 @@
/**Function************************************************************* /**Function*************************************************************
Synopsis [Sets all the node copy to NULL.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void If_ManCleanNodeCopy( If_Man_t * p )
{
If_Obj_t * pObj;
int i;
If_ManForEachObj( p, pObj, i )
If_ObjSetCopy( pObj, NULL );
}
/**Function*************************************************************
Synopsis [Sets all the cut data to NULL.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void If_ManCleanCutData( If_Man_t * p )
{
If_Obj_t * pObj;
If_Cut_t * pCut;
int i, k;
If_ManForEachObj( p, pObj, i )
If_ObjForEachCut( pObj, pCut, k )
If_CutSetData( pCut, NULL );
}
/**Function*************************************************************
Synopsis [Sets all visited marks to 0.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void If_ManCleanMarkV( If_Man_t * p )
{
If_Obj_t * pObj;
int i;
If_ManForEachObj( p, pObj, i )
pObj->fVisit = 0;
}
/**Function*************************************************************
Synopsis [Returns the max delay of the POs.] Synopsis [Returns the max delay of the POs.]
Description [] Description []
...@@ -39,7 +98,7 @@ ...@@ -39,7 +98,7 @@
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
float If_ManDelayMax( If_Man_t * p ) float If_ManDelayMax( If_Man_t * p, int fSeq )
{ {
If_Obj_t * pObj; If_Obj_t * pObj;
float DelayBest; float DelayBest;
...@@ -50,15 +109,22 @@ float If_ManDelayMax( If_Man_t * p ) ...@@ -50,15 +109,22 @@ float If_ManDelayMax( If_Man_t * p )
p->pPars->fLatchPaths = 0; p->pPars->fLatchPaths = 0;
} }
DelayBest = -IF_FLOAT_LARGE; DelayBest = -IF_FLOAT_LARGE;
if ( p->pPars->fLatchPaths ) if ( fSeq )
{
assert( p->pPars->nLatches > 0 );
If_ManForEachPo( p, pObj, i )
if ( DelayBest < If_ObjCutBest( If_ObjFanin0(pObj) )->Delay )
DelayBest = If_ObjCutBest( If_ObjFanin0(pObj) )->Delay;
}
else if ( p->pPars->fLatchPaths )
{ {
If_ManForEachLatch( p, pObj, i ) If_ManForEachLatch( p, pObj, i )
if ( DelayBest < If_ObjCutBest( If_ObjFanin0(pObj) )->Delay ) if ( DelayBest < If_ObjCutBest( If_ObjFanin0(pObj) )->Delay )
DelayBest = If_ObjCutBest( If_ObjFanin0(pObj) )->Delay; DelayBest = If_ObjCutBest( If_ObjFanin0(pObj) )->Delay;
} }
else else
{ {
If_ManForEachPo( p, pObj, i ) If_ManForEachCo( p, pObj, i )
if ( DelayBest < If_ObjCutBest( If_ObjFanin0(pObj) )->Delay ) if ( DelayBest < If_ObjCutBest( If_ObjFanin0(pObj) )->Delay )
DelayBest = If_ObjCutBest( If_ObjFanin0(pObj) )->Delay; DelayBest = If_ObjCutBest( If_ObjFanin0(pObj) )->Delay;
} }
...@@ -67,7 +133,7 @@ float If_ManDelayMax( If_Man_t * p ) ...@@ -67,7 +133,7 @@ float If_ManDelayMax( If_Man_t * p )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Sets all the node copy to NULL.] Synopsis [Computes the required times of all nodes.]
Description [] Description []
...@@ -76,33 +142,43 @@ float If_ManDelayMax( If_Man_t * p ) ...@@ -76,33 +142,43 @@ float If_ManDelayMax( If_Man_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void If_ManCleanNodeCopy( If_Man_t * p ) void If_ManComputeRequired( If_Man_t * p, int fFirstTime )
{ {
If_Obj_t * pObj; If_Obj_t * pObj;
int i; int i;
If_ManForEachObj( p, pObj, i ) // compute area, clean required times, collect nodes used in the mapping
If_ObjSetCopy( pObj, NULL ); p->AreaGlo = If_ManScanMapping( p );
} // get the global required times
p->RequiredGlo = If_ManDelayMax( p, 0 );
/**Function************************************************************* // update the required times according to the target
if ( p->pPars->DelayTarget != -1 )
Synopsis [Sets all the cut data to NULL.] {
if ( p->RequiredGlo > p->pPars->DelayTarget + p->fEpsilon )
Description [] {
if ( fFirstTime )
SideEffects [] printf( "Cannot meet the target required times (%4.2f). Mapping continues anyway.\n", p->pPars->DelayTarget );
}
SeeAlso [] else if ( p->RequiredGlo < p->pPars->DelayTarget - p->fEpsilon )
{
***********************************************************************/ if ( fFirstTime )
void If_ManCleanCutData( If_Man_t * p ) printf( "Relaxing the required times from (%4.2f) to the target (%4.2f).\n", p->RequiredGlo, p->pPars->DelayTarget );
{ p->RequiredGlo = p->pPars->DelayTarget;
If_Obj_t * pObj; }
If_Cut_t * pCut; }
int i, k; // set the required times for the POs
If_ManForEachObj( p, pObj, i ) if ( p->pPars->fLatchPaths )
If_ObjForEachCut( pObj, pCut, k ) {
If_CutSetData( pCut, NULL ); If_ManForEachLatch( p, pObj, i )
If_ObjFanin0(pObj)->Required = p->RequiredGlo;
}
else
{
If_ManForEachCo( p, pObj, i )
If_ObjFanin0(pObj)->Required = p->RequiredGlo;
}
// go through the nodes in the reverse topological order
Vec_PtrForEachEntry( p->vMapped, pObj, i )
If_CutPropagateRequired( p, If_ObjCutBest(pObj), pObj->Required );
} }
/**Function************************************************************* /**Function*************************************************************
...@@ -122,7 +198,7 @@ float If_ManScanMapping_rec( If_Man_t * p, If_Obj_t * pObj, If_Obj_t ** ppStore ...@@ -122,7 +198,7 @@ float If_ManScanMapping_rec( If_Man_t * p, If_Obj_t * pObj, If_Obj_t ** ppStore
If_Cut_t * pCutBest; If_Cut_t * pCutBest;
float aArea; float aArea;
int i; int i;
if ( pObj->nRefs++ || If_ObjIsPi(pObj) || If_ObjIsConst1(pObj) ) if ( pObj->nRefs++ || If_ObjIsCi(pObj) || If_ObjIsConst1(pObj) )
return 0.0; return 0.0;
// store the node in the structure by level // store the node in the structure by level
assert( If_ObjIsAnd(pObj) ); assert( If_ObjIsAnd(pObj) );
...@@ -153,6 +229,7 @@ float If_ManScanMapping( If_Man_t * p ) ...@@ -153,6 +229,7 @@ float If_ManScanMapping( If_Man_t * p )
If_Obj_t * pObj, ** ppStore; If_Obj_t * pObj, ** ppStore;
float aArea; float aArea;
int i; int i;
assert( !p->pPars->fLiftLeaves );
// clean all references // clean all references
If_ManForEachObj( p, pObj, i ) If_ManForEachObj( p, pObj, i )
{ {
...@@ -164,7 +241,7 @@ float If_ManScanMapping( If_Man_t * p ) ...@@ -164,7 +241,7 @@ float If_ManScanMapping( If_Man_t * p )
memset( ppStore, 0, sizeof(If_Obj_t *) * (p->nLevelMax + 1) ); memset( ppStore, 0, sizeof(If_Obj_t *) * (p->nLevelMax + 1) );
// collect nodes reachable from POs in the DFS order through the best cuts // collect nodes reachable from POs in the DFS order through the best cuts
aArea = 0; aArea = 0;
If_ManForEachPo( p, pObj, i ) If_ManForEachCo( p, pObj, i )
aArea += If_ManScanMapping_rec( p, If_ObjFanin0(pObj), ppStore ); aArea += If_ManScanMapping_rec( p, If_ObjFanin0(pObj), ppStore );
// reconnect the nodes in reverse topological order // reconnect the nodes in reverse topological order
Vec_PtrClear( p->vMapped ); Vec_PtrClear( p->vMapped );
...@@ -177,7 +254,7 @@ float If_ManScanMapping( If_Man_t * p ) ...@@ -177,7 +254,7 @@ float If_ManScanMapping( If_Man_t * p )
/**Function************************************************************* /**Function*************************************************************
Synopsis [Computes the required times of all nodes.] Synopsis [Computes area, references, and nodes used in the mapping.]
Description [] Description []
...@@ -186,46 +263,55 @@ float If_ManScanMapping( If_Man_t * p ) ...@@ -186,46 +263,55 @@ float If_ManScanMapping( If_Man_t * p )
SeeAlso [] SeeAlso []
***********************************************************************/ ***********************************************************************/
void If_ManComputeRequired( If_Man_t * p, int fFirstTime ) float If_ManScanMappingSeq_rec( If_Man_t * p, If_Obj_t * pObj, Vec_Ptr_t * vMapped )
{
If_Obj_t * pLeaf;
If_Cut_t * pCutBest;
float aArea;
int i, Shift;
if ( pObj->nRefs++ || If_ObjIsCi(pObj) || If_ObjIsConst1(pObj) )
return 0.0;
// store the node in the structure by level
assert( If_ObjIsAnd(pObj) );
// visit the transitive fanin of the selected cut
pCutBest = If_ObjCutBest(pObj);
aArea = If_ObjIsAnd(pObj)? If_CutLutArea(p, pCutBest) : (float)0.0;
If_CutForEachLeafSeq( p, pCutBest, pLeaf, Shift, i )
aArea += If_ManScanMappingSeq_rec( p, pLeaf, vMapped );
// add the node
Vec_PtrPush( vMapped, pObj );
return aArea;
}
/**Function*************************************************************
Synopsis [Computes area, references, and nodes used in the mapping.]
Description [Collects the nodes in reverse topological order in array
p->vMapping.]
SideEffects []
SeeAlso []
***********************************************************************/
float If_ManScanMappingSeq( If_Man_t * p )
{ {
If_Obj_t * pObj; If_Obj_t * pObj;
float aArea;
int i; int i;
// compute area, clean required times, collect nodes used in the mapping assert( p->pPars->fLiftLeaves );
p->AreaGlo = If_ManScanMapping( p ); // clean all references
// get the global required times If_ManForEachObj( p, pObj, i )
p->RequiredGlo = If_ManDelayMax( p ); pObj->nRefs = 0;
// update the required times according to the target // collect nodes reachable from POs in the DFS order through the best cuts
if ( p->pPars->DelayTarget != -1 ) aArea = 0;
{ Vec_PtrClear( p->vMapped );
if ( p->RequiredGlo > p->pPars->DelayTarget + p->fEpsilon ) If_ManForEachPo( p, pObj, i )
{ aArea += If_ManScanMappingSeq_rec( p, If_ObjFanin0(pObj), p->vMapped );
if ( fFirstTime ) return aArea;
printf( "Cannot meet the target required times (%4.2f). Mapping continues anyway.\n", p->pPars->DelayTarget );
}
else if ( p->RequiredGlo < p->pPars->DelayTarget - p->fEpsilon )
{
if ( fFirstTime )
printf( "Relaxing the required times from (%4.2f) to the target (%4.2f).\n", p->RequiredGlo, p->pPars->DelayTarget );
p->RequiredGlo = p->pPars->DelayTarget;
}
}
// set the required times for the POs
if ( p->pPars->fLatchPaths )
{
If_ManForEachLatch( p, pObj, i )
If_ObjFanin0(pObj)->Required = p->RequiredGlo;
}
else
{
If_ManForEachPo( p, pObj, i )
If_ObjFanin0(pObj)->Required = p->RequiredGlo;
}
// go through the nodes in the reverse topological order
Vec_PtrForEachEntry( p->vMapped, pObj, i )
If_CutPropagateRequired( p, If_ObjCutBest(pObj), pObj->Required );
} }
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
/// END OF FILE /// /// END OF FILE ///
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
......
SRC += src/map/if/ifCore.c \ SRC += src/map/if/ifCore.c \
src/map/if/ifCut.c \ src/map/if/ifCut.c \
src/map/if/ifLib.c \
src/map/if/ifMan.c \ src/map/if/ifMan.c \
src/map/if/ifMap.c \ src/map/if/ifMap.c \
src/map/if/ifPrepro.c \ src/map/if/ifPrepro.c \
src/map/if/ifReduce.c \ src/map/if/ifReduce.c \
src/map/if/ifSeq.c \ src/map/if/ifSeq.c \
src/map/if/ifTime.c \
src/map/if/ifTruth.c \ src/map/if/ifTruth.c \
src/map/if/ifUtil.c src/map/if/ifUtil.c
...@@ -187,12 +187,22 @@ Nm_Entry_t * Nm_ManTableLookupId( Nm_Man_t * p, int ObjId ) ...@@ -187,12 +187,22 @@ Nm_Entry_t * Nm_ManTableLookupId( Nm_Man_t * p, int ObjId )
***********************************************************************/ ***********************************************************************/
Nm_Entry_t * Nm_ManTableLookupName( Nm_Man_t * p, char * pName, int Type ) Nm_Entry_t * Nm_ManTableLookupName( Nm_Man_t * p, char * pName, int Type )
{ {
Nm_Entry_t * pEntry; Nm_Entry_t * pEntry, * pTemp;
int Counter = 0; int Counter = 0;
for ( pEntry = p->pBinsN2I[ Nm_HashString(pName, p->nBins) ]; pEntry; pEntry = pEntry->pNextN2I ) for ( pEntry = p->pBinsN2I[ Nm_HashString(pName, p->nBins) ]; pEntry; pEntry = pEntry->pNextN2I )
{
// check the entry itself
if ( !strcmp(pEntry->Name, pName) && (Type == -1 || pEntry->Type == (unsigned)Type) ) if ( !strcmp(pEntry->Name, pName) && (Type == -1 || pEntry->Type == (unsigned)Type) )
return pEntry; return pEntry;
return pEntry; // if there is no namesakes, continue
if ( pEntry->pNameSake == NULL )
continue;
// check the list of namesakes
for ( pTemp = pEntry->pNameSake; pTemp != pEntry; pTemp = pTemp->pNameSake )
if ( !strcmp(pTemp->Name, pName) && (Type == -1 || pTemp->Type == (unsigned)Type) )
return pTemp;
}
return NULL;
} }
/**Function************************************************************* /**Function*************************************************************
......
...@@ -84,7 +84,7 @@ int Abc_NtkRetime( Abc_Ntk_t * pNtk, int Mode, int fForwardOnly, int fBackwardOn ...@@ -84,7 +84,7 @@ int Abc_NtkRetime( Abc_Ntk_t * pNtk, int Mode, int fForwardOnly, int fBackwardOn
RetValue += Abc_NtkRetimeIncremental( pNtk, 0, 1, fVerbose ); RetValue += Abc_NtkRetimeIncremental( pNtk, 0, 1, fVerbose );
break; break;
case 6: // Pan's algorithm case 6: // Pan's algorithm
RetValue = Abc_NtkRetimeLValue( pNtk, 200, fVerbose ); RetValue = Abc_NtkRetimeLValue( pNtk, 500, fVerbose );
break; break;
default: default:
printf( "Unknown retiming option.\n" ); printf( "Unknown retiming option.\n" );
......
...@@ -90,13 +90,9 @@ int Abc_NtkRetimeMinDelayTry( Abc_Ntk_t * pNtk, int fForward, int fInitial, int ...@@ -90,13 +90,9 @@ int Abc_NtkRetimeMinDelayTry( Abc_Ntk_t * pNtk, int fForward, int fInitial, int
pNtkNew = Abc_NtkRetimeBackwardInitialStart( pNtk ); pNtkNew = Abc_NtkRetimeBackwardInitialStart( pNtk );
} }
} }
if ( fVerbose )
{ if ( fVerbose && !fInitial )
if ( !fInitial ) printf( "Performing analysis:\n" );
printf( "Performing analysis:\n" );
else
printf( "Moving latches to the best position:\n" );
}
// find the best iteration // find the best iteration
DelayBest = ABC_INFINITY; IterBest = 0; LatchesBest = Abc_NtkLatchNum(pNtk); DelayBest = ABC_INFINITY; IterBest = 0; LatchesBest = Abc_NtkLatchNum(pNtk);
vCritical = Vec_PtrAlloc( 100 ); vCritical = Vec_PtrAlloc( 100 );
...@@ -109,7 +105,7 @@ if ( fVerbose ) ...@@ -109,7 +105,7 @@ if ( fVerbose )
// record this position if it has the best delay // record this position if it has the best delay
if ( DelayBest > DelayCur ) if ( DelayBest > DelayCur )
{ {
if ( fVerbose ) if ( fVerbose && !fInitial )
printf( "%s Iter = %3d. Delay = %3d. Latches = %5d. Delta = %6.2f. Ratio = %4.2f %%\n", printf( "%s Iter = %3d. Delay = %3d. Latches = %5d. Delta = %6.2f. Ratio = %4.2f %%\n",
fForward ? "Fwd": "Bwd", i, DelayCur, Abc_NtkLatchNum(pNtk), fForward ? "Fwd": "Bwd", i, DelayCur, Abc_NtkLatchNum(pNtk),
1.0*(Abc_NtkLatchNum(pNtk)-LatchesBest)/(DelayBest-DelayCur), 1.0*(Abc_NtkLatchNum(pNtk)-LatchesBest)/(DelayBest-DelayCur),
...@@ -146,9 +142,9 @@ if ( fVerbose ) ...@@ -146,9 +142,9 @@ if ( fVerbose )
Vec_IntFree( vValues ); Vec_IntFree( vValues );
} }
} }
if ( !fInitial && fVerbose ) if ( fVerbose && !fInitial )
printf( "%s : Starting delay = %3d. Final delay = %3d. IterBest = %2d (out of %2d).\n", printf( "%s : Starting delay = %3d. Final delay = %3d. IterBest = %2d (out of %2d).\n",
fForward? "Forward " : "Backward", DelayStart, DelayBest, IterBest, nIterLimit ); fForward? "Forward " : "Backward", DelayStart, DelayBest, IterBest, nIterLimit );
*pIterBest = IterBest; *pIterBest = IterBest;
return DelayBest; return DelayBest;
} }
......
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