Commit 50e0d1de by Alan Mishchenko

Version abc70217

parent 607c253c
......@@ -8,7 +8,7 @@ PROG := abc
MODULES := src/base/abc src/base/abci src/base/cmd src/base/io src/base/main src/base/ver \
src/aig/ivy src/aig/hop src/aig/rwt src/aig/deco src/aig/mem src/aig/ec \
src/bdd/cudd src/bdd/dsd src/bdd/epd src/bdd/mtr src/bdd/parse src/bdd/reo \
src/bdd/cudd src/bdd/dsd src/bdd/epd src/bdd/mtr src/bdd/parse src/bdd/reo src/bdd/cas \
src/map/fpga src/map/mapper src/map/mio src/map/super src/map/if \
src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/espresso src/misc/nm src/misc/vec src/misc/hash \
src/opt/cut src/opt/dec src/opt/fxu src/opt/rwr src/opt/sim src/opt/ret src/opt/res src/opt/kit \
......
......@@ -50,7 +50,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib lib/libhmetis.lib /nologo /subsystem:console /profile /machine:I386 /out:"_TEST/abc.exe"
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib lib/libhmetis.lib /nologo /subsystem:console /profile /machine:I386 /out:"_TEST/abc.exe"
!ELSEIF "$(CFG)" == "abc - Win32 Debug"
......@@ -75,7 +75,7 @@ BSC32=bscmake.exe
# ADD BSC32 /nologo
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib lib/libhmetis.lib /nologo /subsystem:console /debug /machine:I386 /out:"_TEST/abc.exe" /pdbtype:sept
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib lib/libhmetis.lib /nologo /subsystem:console /debug /machine:I386 /out:"_TEST/abc.exe" /pdbtype:sept
!ENDIF
......@@ -194,6 +194,10 @@ SOURCE=.\src\base\abci\abcBmc.c
# End Source File
# Begin Source File
SOURCE=.\src\base\abci\abcCas.c
# End Source File
# Begin Source File
SOURCE=.\src\base\abci\abcClpBdd.c
# End Source File
# Begin Source File
......@@ -302,6 +306,10 @@ SOURCE=.\src\base\abci\abcProve.c
# End Source File
# Begin Source File
SOURCE=.\src\base\abci\abcQuant.c
# End Source File
# Begin Source File
SOURCE=.\src\base\abci\abcReconv.c
# End Source File
# Begin Source File
......@@ -1153,6 +1161,22 @@ SOURCE=.\src\bdd\reo\reoTransfer.c
SOURCE=.\src\bdd\reo\reoUnits.c
# End Source File
# End Group
# Begin Group "cas"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\src\bdd\cas\cas.h
# End Source File
# Begin Source File
SOURCE=.\src\bdd\cas\casCore.c
# End Source File
# Begin Source File
SOURCE=.\src\bdd\cas\casDec.c
# End Source File
# End Group
# End Group
# Begin Group "sat"
......@@ -2006,6 +2030,10 @@ SOURCE=.\src\misc\extra\extraBddAuto.c
# End Source File
# Begin Source File
SOURCE=.\src\misc\extra\extraBddCas.c
# End Source File
# Begin Source File
SOURCE=.\src\misc\extra\extraBddKmap.c
# End Source File
# Begin Source File
......
......@@ -122,4 +122,6 @@ alias tt "rh a/quip_opt/nut_001_opt.blif"
alias ttb "wh a/quip_opt/nut_001_opt.blif 1.blif"
alias ttv "wh a/quip_opt/nut_001_opt.blif 1.v"
alias reach "st; ps; compress2; ps; qrel; ps; qreach -v; ps"
......@@ -393,6 +393,8 @@ static inline Abc_Obj_t * Abc_ObjChild1( Abc_Obj_t * pObj ) { return Ab
static inline Abc_Obj_t * Abc_ObjChildCopy( Abc_Obj_t * pObj, int i ){ return Abc_ObjNotCond( Abc_ObjFanin(pObj,i)->pCopy, Abc_ObjFaninC(pObj,i) ); }
static inline Abc_Obj_t * Abc_ObjChild0Copy( Abc_Obj_t * pObj ) { return Abc_ObjNotCond( Abc_ObjFanin0(pObj)->pCopy, Abc_ObjFaninC0(pObj) ); }
static inline Abc_Obj_t * Abc_ObjChild1Copy( Abc_Obj_t * pObj ) { return Abc_ObjNotCond( Abc_ObjFanin1(pObj)->pCopy, Abc_ObjFaninC1(pObj) ); }
static inline Abc_Obj_t * Abc_ObjChild0Data( Abc_Obj_t * pObj ) { return Abc_ObjNotCond( Abc_ObjFanin0(pObj)->pData, Abc_ObjFaninC0(pObj) ); }
static inline Abc_Obj_t * Abc_ObjChild1Data( Abc_Obj_t * pObj ) { return Abc_ObjNotCond( Abc_ObjFanin1(pObj)->pData, Abc_ObjFaninC1(pObj) ); }
// checking the AIG node types
static inline bool Abc_AigNodeIsConst( Abc_Obj_t * pNode ) { assert(Abc_NtkIsStrash(Abc_ObjRegular(pNode)->pNtk)); return Abc_ObjRegular(pNode)->Type == ABC_OBJ_CONST1; }
......@@ -527,11 +529,9 @@ extern void Abc_AigPrintNode( Abc_Obj_t * pNode );
extern bool Abc_AigNodeIsAcyclic( Abc_Obj_t * pNode, Abc_Obj_t * pRoot );
extern void Abc_AigCheckFaninOrder( Abc_Aig_t * pMan );
extern void Abc_AigSetNodePhases( Abc_Ntk_t * pNtk );
extern Vec_Ptr_t * Abc_AigUpdateStart( Abc_Aig_t * pMan );
extern Vec_Ptr_t * Abc_AigUpdateStart( Abc_Aig_t * pMan, Vec_Ptr_t ** pvUpdatedNets );
extern void Abc_AigUpdateStop( Abc_Aig_t * pMan );
extern void Abc_AigUpdateReset( Abc_Aig_t * pMan );
extern void Abc_AigUpdateAdd( Abc_Aig_t * pMan, Abc_Obj_t * pObj );
extern Vec_Ptr_t * Abc_AigUpdateRead( Abc_Aig_t * pMan );
/*=== abcAttach.c ==========================================================*/
extern int Abc_NtkAttach( Abc_Ntk_t * pNtk );
/*=== abcBalance.c ==========================================================*/
......@@ -555,6 +555,7 @@ extern void Abc_NodeFreeCuts( void * p, Abc_Obj_t * pObj );
extern Vec_Ptr_t * Abc_NtkDfs( Abc_Ntk_t * pNtk, int fCollectAll );
extern Vec_Ptr_t * Abc_NtkDfsNodes( Abc_Ntk_t * pNtk, Abc_Obj_t ** ppNodes, int nNodes );
extern Vec_Ptr_t * Abc_NtkDfsReverse( Abc_Ntk_t * pNtk );
extern Vec_Ptr_t * Abc_NtkDfsReverseNodes( Abc_Ntk_t * pNtk, Abc_Obj_t ** ppNodes, int nNodes );
extern Vec_Ptr_t * Abc_NtkDfsSeq( Abc_Ntk_t * pNtk );
extern Vec_Ptr_t * Abc_NtkDfsSeqReverse( Abc_Ntk_t * pNtk );
extern Vec_Ptr_t * Abc_NtkDfsIter( Abc_Ntk_t * pNtk, int fCollectAll );
......@@ -623,7 +624,7 @@ extern int Abc_NodeRemoveDupFanins( Abc_Obj_t * pNode );
/*=== abcMiter.c ==========================================================*/
extern Abc_Ntk_t * Abc_NtkMiter( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fComb );
extern void Abc_NtkMiterAddCone( Abc_Ntk_t * pNtk, Abc_Ntk_t * pNtkMiter, Abc_Obj_t * pNode );
extern Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 );
extern Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fOr, int fCompl2 );
extern Abc_Ntk_t * Abc_NtkMiterCofactor( Abc_Ntk_t * pNtk, Vec_Int_t * vPiValues );
extern Abc_Ntk_t * Abc_NtkMiterForCofactors( Abc_Ntk_t * pNtk, int Out, int In1, int In2 );
extern Abc_Ntk_t * Abc_NtkMiterQuantify( Abc_Ntk_t * pNtk, int In, int fExist );
......@@ -831,6 +832,7 @@ extern int Abc_NtkGetChoiceNum( Abc_Ntk_t * pNtk );
extern int Abc_NtkGetFaninMax( Abc_Ntk_t * pNtk );
extern int Abc_NtkGetTotalFanins( Abc_Ntk_t * pNtk );
extern void Abc_NtkCleanCopy( Abc_Ntk_t * pNtk );
extern void Abc_NtkCleanData( Abc_Ntk_t * pNtk );
extern int Abc_NtkCountCopy( Abc_Ntk_t * pNtk );
extern Vec_Ptr_t * Abc_NtkSaveCopy( Abc_Ntk_t * pNtk );
extern void Abc_NtkLoadCopy( Abc_Ntk_t * pNtk, Vec_Ptr_t * vCopies );
......
......@@ -59,7 +59,8 @@ struct Abc_Aig_t_
Vec_Ptr_t * vStackReplaceNew; // the nodes to be used for replacement
Vec_Vec_t * vLevels; // the nodes to be updated
Vec_Vec_t * vLevelsR; // the nodes to be updated
Vec_Ptr_t * vUpdates; // the added and removed nodes
Vec_Ptr_t * vAddedCells; // the added nodes
Vec_Ptr_t * vUpdatedNets; // the nodes whose fanouts have changed
int nStrash0;
int nStrash1;
......@@ -163,8 +164,10 @@ void Abc_AigFree( Abc_Aig_t * pMan )
assert( Vec_PtrSize( pMan->vStackReplaceOld ) == 0 );
assert( Vec_PtrSize( pMan->vStackReplaceNew ) == 0 );
// free the table
if ( pMan->vUpdates )
Vec_PtrFree( pMan->vUpdates );
if ( pMan->vAddedCells )
Vec_PtrFree( pMan->vAddedCells );
if ( pMan->vUpdatedNets )
Vec_PtrFree( pMan->vUpdatedNets );
Vec_VecFree( pMan->vLevels );
Vec_VecFree( pMan->vLevelsR );
Vec_PtrFree( pMan->vStackReplaceOld );
......@@ -326,8 +329,8 @@ Abc_Obj_t * Abc_AigAndCreate( Abc_Aig_t * pMan, Abc_Obj_t * p0, Abc_Obj_t * p1 )
// Abc_NodeGetCuts( pAnd->pNtk->pManCut, pAnd );
pAnd->pCopy = NULL;
// add the node to the list of updated nodes
if ( pMan->vUpdates )
Vec_PtrPush( pMan->vUpdates, pAnd );
if ( pMan->vAddedCells )
Vec_PtrPush( pMan->vAddedCells, pAnd );
return pAnd;
}
......@@ -366,8 +369,8 @@ Abc_Obj_t * Abc_AigAndCreateFrom( Abc_Aig_t * pMan, Abc_Obj_t * p0, Abc_Obj_t *
// Abc_NodeGetCuts( pAnd->pNtk->pManCut, pAnd );
pAnd->pCopy = NULL;
// add the node to the list of updated nodes
if ( pMan->vUpdates )
Vec_PtrPush( pMan->vUpdates, pAnd );
// if ( pMan->vAddedCells )
// Vec_PtrPush( pMan->vAddedCells, pAnd );
return pAnd;
}
......@@ -548,9 +551,6 @@ void Abc_AigAndDelete( Abc_Aig_t * pMan, Abc_Obj_t * pThis )
// delete the cuts if defined
if ( pThis->pNtk->pManCut )
Abc_NodeFreeCuts( pThis->pNtk->pManCut, pThis );
// add the node to the list of updated nodes
if ( pMan->vUpdates )
Vec_PtrPush( pMan->vUpdates, pThis );
}
/**Function*************************************************************
......@@ -961,6 +961,13 @@ void Abc_AigDeleteNode( Abc_Aig_t * pMan, Abc_Obj_t * pNode )
pNode0 = Abc_ObjFanin0( pNode );
pNode1 = Abc_ObjFanin1( pNode );
// add the node to the list of updated nodes
if ( pMan->vUpdatedNets )
{
Vec_PtrPushUnique( pMan->vUpdatedNets, pNode0 );
Vec_PtrPushUnique( pMan->vUpdatedNets, pNode1 );
}
// remove the node from the table
Abc_AigAndDelete( pMan, pNode );
// if the node is in the level structure, remove it
......@@ -1368,10 +1375,13 @@ void Abc_AigSetNodePhases( Abc_Ntk_t * pNtk )
SeeAlso []
***********************************************************************/
Vec_Ptr_t * Abc_AigUpdateStart( Abc_Aig_t * pMan )
Vec_Ptr_t * Abc_AigUpdateStart( Abc_Aig_t * pMan, Vec_Ptr_t ** pvUpdatedNets )
{
assert( pMan->vUpdates == NULL );
return pMan->vUpdates = Vec_PtrAlloc( 1000 );
assert( pMan->vAddedCells == NULL );
pMan->vAddedCells = Vec_PtrAlloc( 1000 );
pMan->vUpdatedNets = Vec_PtrAlloc( 1000 );
*pvUpdatedNets = pMan->vUpdatedNets;
return pMan->vAddedCells;
}
/**Function*************************************************************
......@@ -1387,8 +1397,11 @@ Vec_Ptr_t * Abc_AigUpdateStart( Abc_Aig_t * pMan )
***********************************************************************/
void Abc_AigUpdateStop( Abc_Aig_t * pMan )
{
assert( pMan->vUpdates != NULL );
Vec_PtrFree( pMan->vUpdates );
assert( pMan->vAddedCells != NULL );
Vec_PtrFree( pMan->vAddedCells );
Vec_PtrFree( pMan->vUpdatedNets );
pMan->vAddedCells = NULL;
pMan->vUpdatedNets = NULL;
}
/**Function*************************************************************
......@@ -1404,41 +1417,9 @@ void Abc_AigUpdateStop( Abc_Aig_t * pMan )
***********************************************************************/
void Abc_AigUpdateReset( Abc_Aig_t * pMan )
{
assert( pMan->vUpdates != NULL );
Vec_PtrClear( pMan->vUpdates );
}
/**Function*************************************************************
Synopsis [Add a new update.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_AigUpdateAdd( Abc_Aig_t * pMan, Abc_Obj_t * pObj )
{
if ( pMan->vUpdates )
Vec_PtrPush( pMan->vUpdates, pObj );
}
/**Function*************************************************************
Synopsis [Read the updates array.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Ptr_t * Abc_AigUpdateRead( Abc_Aig_t * pMan )
{
return pMan->vUpdates;
assert( pMan->vAddedCells != NULL );
Vec_PtrClear( pMan->vAddedCells );
Vec_PtrClear( pMan->vUpdatedNets );
}
////////////////////////////////////////////////////////////////////////
......
......@@ -199,6 +199,76 @@ Vec_Ptr_t * Abc_NtkDfsReverse( Abc_Ntk_t * pNtk )
return vNodes;
}
/**Function*************************************************************
Synopsis [Performs DFS for one node.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_NtkDfsReverseNodes_rec( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes )
{
Abc_Obj_t * pFanout;
int i;
assert( !Abc_ObjIsNet(pNode) );
// if this node is already visited, skip
if ( Abc_NodeIsTravIdCurrent( pNode ) )
return;
// mark the node as visited
Abc_NodeSetTravIdCurrent( pNode );
// skip the CI
if ( Abc_ObjIsCo(pNode) )
return;
assert( Abc_ObjIsNode( pNode ) );
// visit the transitive fanin of the node
pNode = Abc_ObjFanout0Ntk(pNode);
Abc_ObjForEachFanout( pNode, pFanout, i )
Abc_NtkDfsReverseNodes_rec( pFanout, vNodes );
// add the node after the fanins have been added
// Vec_PtrPush( vNodes, pNode );
Vec_PtrFillExtra( vNodes, pNode->Level + 1, NULL );
pNode->pCopy = Vec_PtrEntry( vNodes, pNode->Level );
Vec_PtrWriteEntry( vNodes, pNode->Level, pNode );
}
/**Function*************************************************************
Synopsis [Returns the levelized array of TFO nodes.]
Description [Collects the levelized array of internal nodes, leaving out CIs/COs.
However it marks both CIs and COs with the current TravId.]
SideEffects []
SeeAlso []
***********************************************************************/
Vec_Ptr_t * Abc_NtkDfsReverseNodes( Abc_Ntk_t * pNtk, Abc_Obj_t ** ppNodes, int nNodes )
{
Vec_Ptr_t * vNodes;
Abc_Obj_t * pObj, * pFanout;
int i, k;
assert( Abc_NtkIsStrash(pNtk) );
// set the traversal ID
Abc_NtkIncrementTravId( pNtk );
// start the array of nodes
vNodes = Vec_PtrStart( Abc_AigLevel(pNtk) + 1 );
for ( i = 0; i < nNodes; i++ )
{
pObj = ppNodes[i];
assert( Abc_ObjIsCi(pObj) );
Abc_NodeSetTravIdCurrent( pObj );
pObj = Abc_ObjFanout0Ntk(pObj);
Abc_ObjForEachFanout( pObj, pFanout, k )
Abc_NtkDfsReverseNodes_rec( pFanout, vNodes );
}
return vNodes;
}
/**Function*************************************************************
......
......@@ -486,6 +486,25 @@ void Abc_NtkCleanCopy( Abc_Ntk_t * pNtk )
/**Function*************************************************************
Synopsis [Cleans the copy field of all objects.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void Abc_NtkCleanData( Abc_Ntk_t * pNtk )
{
Abc_Obj_t * pObj;
int i;
Abc_NtkForEachObj( pNtk, pObj, i )
pObj->pData = NULL;
}
/**Function*************************************************************
Synopsis [Counts the number of nodes having non-trivial copies.]
Description []
......
......@@ -74,7 +74,7 @@ void Abc_NtkAutoPrint( Abc_Ntk_t * pNtk, int Output, int fNaive, int fVerbose )
// print the size of the BDDs
if ( fVerbose )
printf( "The shared BDD size is %d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
printf( "Shared BDD size = %6d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
// allocate additional variables
for ( i = 0; i < nInputs; i++ )
......
/**CFile****************************************************************
FileName [abcCas.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Network and node package.]
Synopsis [Decomposition of shared BDDs into LUT cascade.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: abcCas.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#include "abc.h"
/*
This LUT cascade synthesis algorithm is described in the paper:
A. Mishchenko and T. Sasao, "Encoding of Boolean functions and its
application to LUT cascade synthesis", Proc. IWLS '02, pp. 115-120.
http://www.eecs.berkeley.edu/~alanmi/publications/2002/iwls02_enc.pdf
*/
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
extern int Abc_CascadeExperiment( char * pFileGeneric, DdManager * dd, DdNode ** pOutputs, int nInputs, int nOutputs, int nLutSize, int fCheck, int fVerbose );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Abc_Ntk_t * Abc_NtkCascade( Abc_Ntk_t * pNtk, int nLutSize, int fCheck, int fVerbose )
{
DdManager * dd;
DdNode ** ppOutputs;
Abc_Ntk_t * pNtkNew;
Abc_Obj_t * pNode;
char * pFileGeneric;
int fBddSizeMax = 500000;
int fReorder = 1;
int i, clk = clock();
assert( Abc_NtkIsStrash(pNtk) );
// compute the global BDDs
if ( Abc_NtkBuildGlobalBdds(pNtk, fBddSizeMax, 1, fReorder, fVerbose) == NULL )
return NULL;
if ( fVerbose )
{
DdManager * dd = Abc_NtkGlobalBddMan( pNtk );
printf( "Shared BDD size = %6d nodes. ", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
PRT( "BDD construction time", clock() - clk );
}
// collect global BDDs
dd = Abc_NtkGlobalBddMan( pNtk );
ppOutputs = ALLOC( DdNode *, Abc_NtkCoNum(pNtk) );
Abc_NtkForEachCo( pNtk, pNode, i )
ppOutputs[i] = Abc_ObjGlobalBdd(pNode);
// call the decomposition
pFileGeneric = Extra_FileNameGeneric( pNtk->pSpec );
if ( !Abc_CascadeExperiment( pFileGeneric, dd, ppOutputs, Abc_NtkCiNum(pNtk), Abc_NtkCoNum(pNtk), nLutSize, fCheck, fVerbose ) )
{
// the LUT size is too small
}
// for now, duplicate the network
pNtkNew = Abc_NtkDup( pNtk );
// cleanup
Abc_NtkFreeGlobalBdds( pNtk, 1 );
free( ppOutputs );
free( pFileGeneric );
// if ( pNtk->pExdc )
// pNtkNew->pExdc = Abc_NtkDup( pNtk->pExdc );
// make sure that everything is okay
if ( !Abc_NtkCheck( pNtkNew ) )
{
printf( "Abc_NtkCollapse: The network check has failed.\n" );
Abc_NtkDelete( pNtkNew );
return NULL;
}
return pNtkNew;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
......@@ -54,7 +54,7 @@ Abc_Ntk_t * Abc_NtkCollapse( Abc_Ntk_t * pNtk, int fBddSizeMax, int fDualRail, i
if ( fVerbose )
{
DdManager * dd = Abc_NtkGlobalBddMan( pNtk );
printf( "The shared BDD size is %d nodes. ", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
printf( "Shared BDD size = %6d nodes. ", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
PRT( "BDD construction time", clock() - clk );
}
......
......@@ -62,7 +62,7 @@ Abc_Ntk_t * Abc_NtkDsdGlobal( Abc_Ntk_t * pNtk, bool fVerbose, bool fPrint, bool
if ( dd == NULL )
return NULL;
if ( fVerbose )
printf( "The shared BDD size is %d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
printf( "Shared BDD size = %6d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
// transform the result of mapping into a BDD network
pNtkNew = Abc_NtkDsdInternal( pNtk, fVerbose, fPrint, fShort );
Extra_StopManager( dd );
......
......@@ -294,7 +294,7 @@ void Abc_NtkMiterFinalize( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, Abc_Ntk_t * pNt
SeeAlso []
***********************************************************************/
Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 )
Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2, int fOr, int fCompl2 )
{
char Buffer[1000];
Abc_Ntk_t * pNtkMiter;
......@@ -313,7 +313,8 @@ Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 )
// start the new network
pNtkMiter = Abc_NtkAlloc( ABC_NTK_STRASH, ABC_FUNC_AIG, 1 );
sprintf( Buffer, "%s_%s_miter", pNtk1->pName, pNtk2->pName );
// sprintf( Buffer, "%s_%s_miter", pNtk1->pName, pNtk2->pName );
sprintf( Buffer, "product" );
pNtkMiter->pName = Extra_UtilStrsav(Buffer);
// perform strashing
......@@ -324,10 +325,13 @@ Abc_Ntk_t * Abc_NtkMiterAnd( Abc_Ntk_t * pNtk1, Abc_Ntk_t * pNtk2 )
pRoot1 = Abc_NtkPo(pNtk1,0);
pRoot2 = Abc_NtkPo(pNtk2,0);
pOutput1 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot1)->pCopy, Abc_ObjFaninC0(pRoot1) );
pOutput2 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot2)->pCopy, Abc_ObjFaninC0(pRoot2) );
pOutput2 = Abc_ObjNotCond( Abc_ObjFanin0(pRoot2)->pCopy, Abc_ObjFaninC0(pRoot2) ^ fCompl2 );
// create the miter of the two outputs
pMiter = Abc_AigAnd( pNtkMiter->pManFunc, pOutput1, pOutput2 );
if ( fOr )
pMiter = Abc_AigOr( pNtkMiter->pManFunc, pOutput1, pOutput2 );
else
pMiter = Abc_AigAnd( pNtkMiter->pManFunc, pOutput1, pOutput2 );
Abc_ObjAddFanin( Abc_NtkPo(pNtkMiter,0), pMiter );
// make sure that everything is okay
......
......@@ -120,7 +120,7 @@ float Abc_PlaceEvaluateCut( Abc_Obj_t * pRoot, Vec_Ptr_t * vFanins )
SeeAlso []
***********************************************************************/
void Abc_PlaceUpdate( Vec_Ptr_t * vUpdates, int nNodesOld )
void Abc_PlaceUpdate( Vec_Ptr_t * vAddedCells, Vec_Ptr_t * vUpdatedNets )
{
Abc_Obj_t * pObj, * pFanin;
int i, k;
......@@ -130,24 +130,26 @@ void Abc_PlaceUpdate( Vec_Ptr_t * vUpdates, int nNodesOld )
vCells = Vec_PtrAlloc( 16 );
vNets = Vec_PtrAlloc( 32 );
// go through the modified nodes
Vec_PtrForEachEntry( vUpdates, pObj, i )
// go through the new nodes
Vec_PtrForEachEntry( vAddedCells, pObj, i )
{
if ( pObj->Id > nNodesOld ) // pObj is a new node
{
Abc_PlaceCreateCell( pObj, 1 );
Abc_PlaceUpdateNet( pObj );
// add the new cell and its fanin nets to temporary storage
Vec_PtrPush( vCells, &(cells[pObj->Id]) );
Abc_ObjForEachFanin( pObj, pFanin, k )
Vec_PtrPushUnique( vNets, &(nets[pFanin->Id]) );
}
else // pObj is an old node
{
Abc_PlaceUpdateNet( Abc_ObjFanin0(pObj) );
Abc_PlaceUpdateNet( Abc_ObjFanin1(pObj) );
}
assert( !Abc_ObjIsComplement(pObj) );
Abc_PlaceCreateCell( pObj, 1 );
Abc_PlaceUpdateNet( pObj );
// add the new cell and its fanin nets to temporary storage
Vec_PtrPush( vCells, &(cells[pObj->Id]) );
Abc_ObjForEachFanin( pObj, pFanin, k )
Vec_PtrPushUnique( vNets, &(nets[pFanin->Id]) );
}
// go through the modified nets
Vec_PtrForEachEntry( vUpdatedNets, pObj, i )
{
assert( !Abc_ObjIsComplement(pObj) );
if ( Abc_ObjType(pObj) == ABC_OBJ_NONE ) // dead node
continue;
Abc_PlaceUpdateNet( pObj );
}
// update the placement
......
......@@ -38,7 +38,7 @@ static void Abc_ManShowCutCone( Abc_Obj_t * pNode, Vec_Ptr_t * vLeaves );
extern void Abc_PlaceBegin( Abc_Ntk_t * pNtk );
extern void Abc_PlaceEnd( Abc_Ntk_t * pNtk );
extern void Abc_PlaceUpdate( Vec_Ptr_t * vUpdates, int nNodesOld );
extern void Abc_PlaceUpdate( Vec_Ptr_t * vAddedCells, Vec_Ptr_t * vUpdatedNets );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
......@@ -61,7 +61,7 @@ int Abc_NtkRewrite( Abc_Ntk_t * pNtk, int fUpdateLevel, int fUseZeros, int fVerb
Cut_Man_t * pManCut;
Rwr_Man_t * pManRwr;
Abc_Obj_t * pNode;
Vec_Ptr_t * vUpdates = NULL;
Vec_Ptr_t * vAddedCells = NULL, * vUpdatedNets = NULL;
Dec_Graph_t * pGraph;
int i, nNodes, nGain, fCompl;
int clk, clkStart = clock();
......@@ -74,7 +74,7 @@ int Abc_NtkRewrite( Abc_Ntk_t * pNtk, int fUpdateLevel, int fUseZeros, int fVerb
if ( fPlaceEnable )
{
Abc_PlaceBegin( pNtk );
vUpdates = Abc_AigUpdateStart( pNtk->pManFunc );
vAddedCells = Abc_AigUpdateStart( pNtk->pManFunc, &vUpdatedNets );
}
// start the rewriting manager
......@@ -132,7 +132,7 @@ Rwr_ManAddTimeUpdate( pManRwr, clock() - clk );
// use the array of changed nodes to update placement
if ( fPlaceEnable )
Abc_PlaceUpdate( vUpdates, nNodes );
Abc_PlaceUpdate( vAddedCells, vUpdatedNets );
}
Extra_ProgressBarStop( pProgress );
Rwr_ManAddTimeTotal( pManRwr, clock() - clkStart );
......
......@@ -55,7 +55,7 @@ Abc_Ntk_t * Abc_NtkRestrash( Abc_Ntk_t * pNtk, bool fCleanup )
// print warning about choice nodes
if ( Abc_NtkGetChoiceNum( pNtk ) )
printf( "Warning: The choice nodes in the original AIG are removed by strashing.\n" );
// start the new network (constants and CIs are already mappined after this step
// start the new network (constants and CIs of the old network will point to the their counterparts in the new network)
pNtkAig = Abc_NtkStartFrom( pNtk, ABC_NTK_STRASH, ABC_FUNC_AIG );
// restrash the nodes (assuming a topological order of the old network)
Abc_NtkForEachNode( pNtk, pObj, i )
......
......@@ -84,7 +84,7 @@ clkBdd = clock() - clk;
// pbGlobal = (DdNode **)Vec_PtrArray( pNtk->vFuncsGlob );
// print the size of the BDDs
printf( "The shared BDD size is %d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
printf( "Shared BDD size = %6d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
// perform naive BDD-based computation
if ( fUseNaive )
......
......@@ -62,7 +62,7 @@ int Abc_NtkExtractSequentialDcs( Abc_Ntk_t * pNtk, bool fVerbose )
if ( dd == NULL )
return 0;
if ( fVerbose )
printf( "The shared BDD size is %d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
printf( "Shared BDD size = %6d nodes.\n", Cudd_ReadKeys(dd) - Cudd_ReadDead(dd) );
// create the transition relation (dereferenced global BDDs)
bRelation = Abc_NtkTransitionRelation( dd, pNtk, fVerbose ); Cudd_Ref( bRelation );
......@@ -221,7 +221,7 @@ DdNode * Abc_NtkComputeUnreachable( DdManager * dd, Abc_Ntk_t * pNtk, DdNode * b
{
DdNode * bRelation, * bReached, * bCubeCs;
DdNode * bCurrent, * bNext, * bTemp;
int nIters;
int nIters, nMints;
// perform reachability analisys
bCurrent = bInitial; Cudd_Ref( bCurrent );
......@@ -258,9 +258,9 @@ DdNode * Abc_NtkComputeUnreachable( DdManager * dd, Abc_Ntk_t * pNtk, DdNode * b
// report the stats
if ( fVerbose )
{
fprintf( stdout, "Reachability analysis completed in %d iterations.\n", nIters );
fprintf( stdout, "The number of minterms in the reachable state set = %d.\n",
(int)Cudd_CountMinterm(dd, bReached, Abc_NtkLatchNum(pNtk) ) );
nMints = (int)Cudd_CountMinterm(dd, bReached, Abc_NtkLatchNum(pNtk) );
fprintf( stdout, "Reachability analysis completed in %d iterations.\n", nIters );
fprintf( stdout, "The number of minterms in the reachable state set = %d. (%6.2f %%)\n", nMints, 100.0*nMints/(1<<Abc_NtkLatchNum(pNtk)) );
}
//PRB( dd, bReached );
Cudd_Deref( bReached );
......
......@@ -3,6 +3,7 @@ SRC += src/base/abci/abc.c \
src/base/abci/abcAuto.c \
src/base/abci/abcBalance.c \
src/base/abci/abcBmc.c \
src/base/abci/abcCas.c \
src/base/abci/abcClpBdd.c \
src/base/abci/abcClpSop.c \
src/base/abci/abcCut.c \
......@@ -29,6 +30,7 @@ SRC += src/base/abci/abc.c \
src/base/abci/abcPlace.c \
src/base/abci/abcPrint.c \
src/base/abci/abcProve.c \
src/base/abci/abcQuant.c \
src/base/abci/abcReconv.c \
src/base/abci/abcRefactor.c \
src/base/abci/abcRenode.c \
......
/**CFile****************************************************************
FileName [cas.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [CASCADE: Decomposition of shared BDDs into a LUT cascade.]
Synopsis [External declarations.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - June 20, 2005.]
Revision [$Id: cas.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
***********************************************************************/
#ifndef __CAS_H__
#define __CAS_H__
#ifdef __cplusplus
extern "C" {
#endif
////////////////////////////////////////////////////////////////////////
/// INCLUDES ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// PARAMETERS ///
////////////////////////////////////////////////////////////////////////
#define MAXINPUTS 1024
#define MAXOUTPUTS 1024
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
/*=== zzz.c ==========================================================*/
#ifdef __cplusplus
}
#endif
#endif
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
SRC += src/bdd/cas/casCore.c \
src/bdd/cas/casDec
......@@ -147,6 +147,19 @@ extern DdNode * extraBddSpaceFromMatrixNeg( DdManager * dd, DdNode * zA );
extern DdNode * Extra_bddSpaceReduce( DdManager * dd, DdNode * bFunc, DdNode * bCanonVars );
extern DdNode ** Extra_bddSpaceExorGates( DdManager * dd, DdNode * bFuncRed, DdNode * zEquations );
/*=== extraBddCas.c =============================================================*/
/* performs the binary encoding of the set of function using the given vars */
extern DdNode * Extra_bddEncodingBinary( DdManager * dd, DdNode ** pbFuncs, int nFuncs, DdNode ** pbVars, int nVars );
/* solves the column encoding problem using a sophisticated method */
extern DdNode * Extra_bddEncodingNonStrict( DdManager * dd, DdNode ** pbColumns, int nColumns, DdNode * bVarsCol, DdNode ** pCVars, int nMulti, int * pSimple );
/* collects the nodes under the cut and, for each node, computes the sum of paths leading to it from the root */
extern st_table * Extra_bddNodePathsUnderCut( DdManager * dd, DdNode * bFunc, int CutLevel );
/* collects the nodes under the cut starting from the given set of ADD nodes */
extern int Extra_bddNodePathsUnderCutArray( DdManager * dd, DdNode ** paNodes, DdNode ** pbCubes, int nNodes, DdNode ** paNodesRes, DdNode ** pbCubesRes, int CutLevel );
/* find the profile of a DD (the number of edges crossing each level) */
extern int Extra_ProfileWidth( DdManager * dd, DdNode * F, int * Profile, int CutLevel );
/*=== extraBddMisc.c ========================================================*/
extern DdNode * Extra_TransferPermute( DdManager * ddSource, DdManager * ddDestination, DdNode * f, int * Permute );
......@@ -174,6 +187,7 @@ extern DdNode * Extra_bddCreateAnd( DdManager * dd, int nVars );
extern DdNode * Extra_bddCreateOr( DdManager * dd, int nVars );
extern DdNode * Extra_bddCreateExor( DdManager * dd, int nVars );
extern DdNode * Extra_zddPrimes( DdManager * dd, DdNode * F );
extern void Extra_bddPermuteArray( DdManager * dd, DdNode ** bNodesIn, DdNode ** bNodesOut, int nNodes, int *permut );
/*=== extraBddKmap.c ================================================================*/
......
......@@ -50,6 +50,7 @@
// file "extraDdTransfer.c"
static DdNode * extraTransferPermuteRecur( DdManager * ddS, DdManager * ddD, DdNode * f, st_table * table, int * Permute );
static DdNode * extraTransferPermute( DdManager * ddS, DdManager * ddD, DdNode * f, int * Permute );
static DdNode * cuddBddPermuteRecur ARGS( ( DdManager * manager, DdHashTable * table, DdNode * node, int *permut ) );
// file "cuddUtils.c"
static void ddSupportStep(DdNode *f, int *support);
......@@ -916,6 +917,49 @@ DdNode * Extra_zddPrimes( DdManager * dd, DdNode * F )
} /* end of Extra_zddPrimes */
/**Function********************************************************************
Synopsis [Permutes the variables of the array of BDDs.]
Description [Given a permutation in array permut, creates a new BDD
with permuted variables. There should be an entry in array permut
for each variable in the manager. The i-th entry of permut holds the
index of the variable that is to substitute the i-th variable.
The DDs in the resulting array are already referenced.]
SideEffects [None]
SeeAlso [Cudd_addPermute Cudd_bddSwapVariables]
******************************************************************************/
void Extra_bddPermuteArray( DdManager * manager, DdNode ** bNodesIn, DdNode ** bNodesOut, int nNodes, int *permut )
{
DdHashTable *table;
int i, k;
do
{
manager->reordered = 0;
table = cuddHashTableInit( manager, 1, 2 );
/* permute the output functions one-by-one */
for ( i = 0; i < nNodes; i++ )
{
bNodesOut[i] = cuddBddPermuteRecur( manager, table, bNodesIn[i], permut );
if ( bNodesOut[i] == NULL )
{
/* deref the array of the already computed outputs */
for ( k = 0; k < i; k++ )
Cudd_RecursiveDeref( manager, bNodesOut[k] );
break;
}
cuddRef( bNodesOut[i] );
}
/* Dispose of local cache. */
cuddHashTableQuit( table );
}
while ( manager->reordered == 1 );
} /* end of Extra_bddPermuteArray */
/*---------------------------------------------------------------------------*/
/* Definition of internal functions */
......@@ -1467,6 +1511,102 @@ DdNode* extraZddPrimes( DdManager *dd, DdNode* F )
}
} /* end of extraZddPrimes */
/**Function********************************************************************
Synopsis [Implements the recursive step of Cudd_bddPermute.]
Description [ Recursively puts the BDD in the order given in the array permut.
Checks for trivial cases to terminate recursion, then splits on the
children of this node. Once the solutions for the children are
obtained, it puts into the current position the node from the rest of
the BDD that should be here. Then returns this BDD.
The key here is that the node being visited is NOT put in its proper
place by this instance, but rather is switched when its proper position
is reached in the recursion tree.<p>
The DdNode * that is returned is the same BDD as passed in as node,
but in the new order.]
SideEffects [None]
SeeAlso [Cudd_bddPermute cuddAddPermuteRecur]
******************************************************************************/
static DdNode *
cuddBddPermuteRecur( DdManager * manager /* DD manager */ ,
DdHashTable * table /* computed table */ ,
DdNode * node /* BDD to be reordered */ ,
int *permut /* permutation array */ )
{
DdNode *N, *T, *E;
DdNode *res;
int index;
statLine( manager );
N = Cudd_Regular( node );
/* Check for terminal case of constant node. */
if ( cuddIsConstant( N ) )
{
return ( node );
}
/* If problem already solved, look up answer and return. */
if ( N->ref != 1 && ( res = cuddHashTableLookup1( table, N ) ) != NULL )
{
#ifdef DD_DEBUG
bddPermuteRecurHits++;
#endif
return ( Cudd_NotCond( res, N != node ) );
}
/* Split and recur on children of this node. */
T = cuddBddPermuteRecur( manager, table, cuddT( N ), permut );
if ( T == NULL )
return ( NULL );
cuddRef( T );
E = cuddBddPermuteRecur( manager, table, cuddE( N ), permut );
if ( E == NULL )
{
Cudd_IterDerefBdd( manager, T );
return ( NULL );
}
cuddRef( E );
/* Move variable that should be in this position to this position
** by retrieving the single var BDD for that variable, and calling
** cuddBddIteRecur with the T and E we just created.
*/
index = permut[N->index];
res = cuddBddIteRecur( manager, manager->vars[index], T, E );
if ( res == NULL )
{
Cudd_IterDerefBdd( manager, T );
Cudd_IterDerefBdd( manager, E );
return ( NULL );
}
cuddRef( res );
Cudd_IterDerefBdd( manager, T );
Cudd_IterDerefBdd( manager, E );
/* Do not keep the result if the reference count is only 1, since
** it will not be visited again.
*/
if ( N->ref != 1 )
{
ptrint fanout = ( ptrint ) N->ref;
cuddSatDec( fanout );
if ( !cuddHashTableInsert1( table, N, res, fanout ) )
{
Cudd_IterDerefBdd( manager, res );
return ( NULL );
}
}
cuddDeref( res );
return ( Cudd_NotCond( res, N != node ) );
} /* end of cuddBddPermuteRecur */
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
......
SRC += src/misc/extra/extraBddAuto.c \
src/misc/extra/extraBddCas.c \
src/misc/extra/extraBddKmap.c \
src/misc/extra/extraBddMisc.c \
src/misc/extra/extraBddSymm.c \
......
Volume in drive C is IBM_PRELOAD
Volume Serial Number is 20EA-F780
Directory of C:\_projects\abc\src\phys\place
02/16/2007 11:01 AM <DIR> .
02/16/2007 11:01 AM <DIR> ..
01/23/2007 10:02 PM 165 1.c
02/16/2007 11:01 AM 0 1.txt
02/10/2007 05:52 PM 1,103,488 ac97_emap.fastplace.pl
02/09/2007 04:37 PM 362,675 ac97_emap.initial.pl
02/09/2007 03:34 PM 1,247,692 ac97_emap.nets
02/09/2007 03:34 PM 294,862 ac97_emap.nodes
02/13/2007 12:19 AM 670,459 ac97_emap.pl
02/10/2007 05:52 PM 1,184 hpwl
02/10/2007 01:52 AM 551 libhmetis.h
02/13/2007 12:25 AM 625 Makefile
02/13/2007 12:16 AM 9,552 place_base.c
02/16/2007 10:29 AM 3,801 place_base.h
02/13/2007 12:08 AM 8,175 place_bin.c
02/13/2007 12:16 AM 9,263 place_genqp.c
02/13/2007 12:08 AM 4,950 place_gordian.c
02/13/2007 12:18 AM 1,886 place_gordian.h
02/13/2007 12:08 AM 514 place_legalize.c
02/13/2007 12:08 AM 4,900 place_pads.c
02/13/2007 12:17 AM 36,942 place_partition.c
02/13/2007 12:08 AM 29,189 place_qpsolver.c
02/13/2007 12:08 AM 4,882 place_qpsolver.h
02/13/2007 12:08 AM 9,454 place_test.c
02/12/2007 05:01 PM 1,577 README
02/10/2007 04:26 PM 114 test.nets
02/10/2007 04:25 PM 112 test.nodes
02/11/2007 03:31 PM 130 test.pl
26 File(s) 3,807,142 bytes
2 Dir(s) 1,486,884,864 bytes free
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -5,4 +5,6 @@ SRC += src/phys/place/place_base.c \
src/phys/place/place_legalize.c \
src/phys/place/place_pads.c \
src/phys/place/place_partition.c \
src/phys/place/place_qpsolver.c
src/phys/place/place_qpsolver.c \
src/phys/place/place_io.c \
src/phys/place/place_inc.c
......@@ -112,6 +112,8 @@ void addConcreteNet(ConcreteNet *net) {
assert(net);
assert(net->m_id >= 0);
if (net->m_id >= g_place_concreteNetsSize) {
g_place_concreteNetsSize = (net->m_id > g_place_concreteNetsSize ?
net->m_id : g_place_concreteNetsSize);
g_place_concreteNetsSize *= 1.5;
g_place_concreteNetsSize += 20;
g_place_concreteNets = (ConcreteNet**)realloc(g_place_concreteNets,
......@@ -122,6 +124,7 @@ void addConcreteNet(ConcreteNet *net) {
memset(&(g_place_concreteNets[g_place_numNets]), 0,
sizeof(ConcreteNet*)*(net->m_id+1-g_place_numNets));
g_place_numNets = net->m_id+1;
assert(g_place_numNets <= g_place_concreteNetsSize);
}
g_place_concreteNets[net->m_id] = net;
}
......@@ -150,6 +153,8 @@ void addConcreteCell(ConcreteCell *cell) {
assert(cell);
assert(cell->m_id >= 0);
if (cell->m_id >= g_place_concreteCellsSize) {
g_place_concreteCellsSize = (cell->m_id > g_place_concreteCellsSize ?
cell->m_id : g_place_concreteCellsSize);
g_place_concreteCellsSize *= 1.5;
g_place_concreteCellsSize += 20;
g_place_concreteCells = (ConcreteCell**)realloc(g_place_concreteCells,
......
......@@ -6,7 +6,7 @@
// ahurst@eecs.berkeley.edu
//
/*===================================================================*/
#if !defined(PLACE_BASE_H_)
#define PLACE_BASE_H_
......@@ -37,7 +37,9 @@ typedef struct Rect {
typedef struct AbstractCell {
char *m_label; // string description
float m_width, m_height; // dimensions
bool m_pad; // a pad (external I/O) cell?
} AbstractCell;
......@@ -45,11 +47,15 @@ typedef struct AbstractCell {
// --- ConcreteCell - a design object
typedef struct ConcreteCell {
AbstractCell *m_parent; // cell type
char *m_label; // string description
int m_id; // a unique ID (see below)
char *m_label; // string description
AbstractCell *m_parent; // cell type
bool m_fixed; // position is fixed?
float m_x, m_y; // center of cell
int m_data;
} ConcreteCell;
......@@ -57,9 +63,13 @@ typedef struct ConcreteCell {
typedef struct ConcreteNet {
int m_id; // a unique ID (see below)
int m_numTerms; // num. of connected cells
ConcreteCell **m_terms; // connected cells
float m_weight; // relative weight
int m_data;
} ConcreteNet;
......@@ -102,15 +112,17 @@ void globalPlace();
void globalIncremental();
void globalFixDensity(int numBins, float maxMovement);
float fastUnplace(ConcreteCell *cell); // UNIMPLEMENTED
float fastPlace(int numCells, ConcreteCell *cells []); // UNIMPLEMENTED
float fastEstimate(int numCells, ConcreteCell *cells []); // UNIMPLEMENTED
float fastEstimate(ConcreteCell *cell,
int numNets, ConcreteNet *nets[]);
float fastTopoPlace(int numCells, ConcreteCell *cells[],
int numNets, ConcreteNet *nets[]);
Rect getNetBBox(const ConcreteNet *net);
float getNetWirelength(const ConcreteNet *net);
float getTotalWirelength();
float getCellArea(const ConcreteCell *cell);
void writeBookshelf(const char *filename);
// comparative qsort-style functions
int netSortByL(const void *a, const void *b);
......
......@@ -13,6 +13,8 @@
#include <limits.h>
#include <assert.h>
//#define DEBUG
#include "place_base.h"
// --------------------------------------------------------------------
......@@ -93,7 +95,9 @@ void spreadDensityX(int numBins, float maxMovement) {
memcpy(binCells, &(allCells[yBinStart]), sizeof(ConcreteCell*)*yBinCount);
qsort(binCells, yBinCount, sizeof(ConcreteCell*), cellSortByX);
// printf("y-bin %d count=%d area=%f\n",y,yBinCount, yBinArea);
#if defined(DEBUG)
printf("y-bin %d count=%d area=%f\n",y,yBinCount, yBinArea);
#endif
x = 0;
xBinCount = 0, xBinStart = 0;
......@@ -109,6 +113,8 @@ void spreadDensityX(int numBins, float maxMovement) {
xBinCount++;
curOldEdge = xCell->m_x;
printf("%.3f ", xCell->m_x);
// have we filled up an x-bin?
if (xCumArea >= yBinArea*(x+1)/numBins && xBinArea > 0) {
curNewEdge = lastNewEdge + g_place_coreBounds.w*xBinArea/yBinArea;
......@@ -118,21 +124,28 @@ void spreadDensityX(int numBins, float maxMovement) {
if ((curNewEdge-curOldEdge)>maxMovement) curNewEdge = curOldEdge + maxMovement;
if ((curOldEdge-curNewEdge)>maxMovement) curNewEdge = curOldEdge - maxMovement;
#if defined(DEBUG)
printf("->\tx-bin %d count=%d area=%f (%f,%f)->(%f,%f)\n",x, xBinCount, xBinArea,
curOldEdge, lastOldEdge, curNewEdge, lastNewEdge);
#endif
stretch = (curNewEdge-lastNewEdge)/(curOldEdge-lastOldEdge);
// stretch!
for(c3=xBinStart; c3<xBinStart+xBinCount; c3++) {
binCells[c3]->m_x = lastNewEdge+(binCells[c3]->m_x-lastOldEdge)*stretch;
// force within core
if (curOldEdge == lastOldEdge)
binCells[c3]->m_x = lastNewEdge+(c3-xBinStart)*(curNewEdge-lastNewEdge);
else
binCells[c3]->m_x = lastNewEdge+(binCells[c3]->m_x-lastOldEdge)*stretch;
// force within core
w = binCells[c3]->m_parent->m_width*0.5;
if (binCells[c3]->m_x-w < g_place_coreBounds.x)
binCells[c3]->m_x = g_place_coreBounds.x+w;
if (binCells[c3]->m_x+w > g_place_coreBounds.x+g_place_coreBounds.w)
binCells[c3]->m_x = g_place_coreBounds.x+g_place_coreBounds.w-w;
}
lastOldEdge = curOldEdge;
lastNewEdge = curNewEdge;
x++;
......@@ -141,7 +154,7 @@ void spreadDensityX(int numBins, float maxMovement) {
xBinStart = c2+1;
}
}
y++;
yBinCount = 0;
yBinArea = 0;
......@@ -228,6 +241,7 @@ void spreadDensityY(int numBins, float maxMovement) {
if ((curNewEdge-curOldEdge)>maxMovement) curNewEdge = curOldEdge + maxMovement;
if ((curOldEdge-curNewEdge)>maxMovement) curNewEdge = curOldEdge - maxMovement;
if (curOldEdge == lastOldEdge) continue; // hmmm
stretch = (curNewEdge-lastNewEdge)/(curOldEdge-lastOldEdge);
// stretch!
......
/*===================================================================*/
//
// place_inc.c
//
// Aaron P. Hurst, 2003-2007
// ahurst@eecs.berkeley.edu
//
/*===================================================================*/
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
#include <string.h>
#include "place_base.h"
#include "place_gordian.h"
inline int sqHashId(int id, int max) {
return ((id * (id+17)) % max);
}
#if 0
// --------------------------------------------------------------------
// fastPlace()
//
/// The first cell is assumed to be the "output".
// --------------------------------------------------------------------
float fastPlace(int numCells, ConcreteCell *cells[],
int numNets, ConcreteNet *nets[]) {
int n, t, c, i, local_id = 0, pass;
const int NUM_PASSES = 4;
int *cell_numTerms = calloc(numCells, sizeof(int));
ConcreteNet **cell_terms;
ConcreteNet *net;
Rect outputBox;
outputBox = getNetBBox(nets[0]);
// assign local ids
// put cells in reasonable initial location
for(n=0; n<numNets; n++)
for(t=0; nets[n]->m_numTerms; t++)
nets[n]->m_terms[t]->m_data = -1;
for(c=0; c<numCells; c++) {
cells[c]->m_data = local_id;
cells[c]->m_x = outputBox.x + 0.5*outputBox.w;
cells[c]->m_y = outputBox.y + 0.5*outputBox.h;
}
// build reverse map of cells to nets
for(n=0; n<numNets; n++)
for(t=0; nets[n]->m_numTerms; t++) {
local_id = nets[n]->m_terms[t]->m_data;
if (local_id >= 0)
cell_numTerms[local_id]++;
}
for(c=0; c<numCells; c++) {
cell_terms[c] = malloc(sizeof(ConcreteNet*)*cell_numTerms[c]);
cell_numTerms[c] = 0;
}
for(n=0; n<numNets; n++)
for(t=0; nets[n]->m_numTerms; t++) {
local_id = nets[n]->m_terms[t]->m_data;
if (local_id >= 0)
cell_terms[cell_numTerms[local_id]++] = nets[n];
}
// topological order?
// iterative linear
for(pass=0; pass<NUM_PASSES; pass++)
for(c=0; c<numCells; c++) {
for(n=0; n<cell_numTerms[c]; n++) {
net = cell_terms[c];
for(t=0; t<net->m_numTerms; t++);
}
}
}
#endif
// --------------------------------------------------------------------
// fastEstimate()
//
// --------------------------------------------------------------------
float fastEstimate(ConcreteCell *cell,
int numNets, ConcreteNet *nets[]) {
float len = 0;
int n;
Rect box;
assert(cell);
for(n=0; n<numNets; n++) {
box = getNetBBox(nets[n]);
if (cell->m_x < box.x) len += (box.x - cell->m_x);
if (cell->m_x > box.x+box.w) len += (cell->m_x-box.x-box.w);
if (cell->m_y < box.y) len += (box.x - cell->m_y);
if (cell->m_y > box.y+box.h) len += (cell->m_y-box.y-box.h);
}
return len;
}
/*===================================================================*/
//
// place_io.c
//
// Aaron P. Hurst, 2003-2007
// ahurst@eecs.berkeley.edu
//
/*===================================================================*/
#include <stdlib.h>
#include <limits.h>
#include <assert.h>
#include <string.h>
#include <stdio.h>
#include "place_base.h"
// --------------------------------------------------------------------
// writeBookshelfNodes()
//
// --------------------------------------------------------------------
void writeBookshelfNodes(const char *filename) {
int c = 0;
int numNodes, numTerms;
FILE *nodesFile = fopen(filename, "w");
if (!nodesFile) {
printf("ERROR: Could not open .nodes file\n");
exit(1);
}
numNodes = numTerms = 0;
for(c=0; c<g_place_numCells; c++) if (g_place_concreteCells[c]) {
numNodes++;
if (g_place_concreteCells[c]->m_parent->m_pad)
numTerms++;
}
fprintf(nodesFile, "UCLA nodes 1.0\n");
fprintf(nodesFile, "NumNodes : %d\n", numNodes);
fprintf(nodesFile, "NumTerminals : %d\n", numTerms);
for(c=0; c<g_place_numCells; c++) if (g_place_concreteCells[c]) {
fprintf(nodesFile, "CELL%d %f %f %s\n",
g_place_concreteCells[c]->m_id,
g_place_concreteCells[c]->m_parent->m_width,
g_place_concreteCells[c]->m_parent->m_height,
(g_place_concreteCells[c]->m_parent->m_pad ? " terminal" : ""));
}
fclose(nodesFile);
}
// --------------------------------------------------------------------
// writeBookshelfPl()
//
// --------------------------------------------------------------------
void writeBookshelfPl(const char *filename) {
int c = 0;
FILE *plFile = fopen(filename, "w");
if (!plFile) {
printf("ERROR: Could not open .pl file\n");
exit(1);
}
fprintf(plFile, "UCLA pl 1.0\n");
for(c=0; c<g_place_numCells; c++) if (g_place_concreteCells[c]) {
fprintf(plFile, "CELL%d %f %f : N %s\n",
g_place_concreteCells[c]->m_id,
g_place_concreteCells[c]->m_x,
g_place_concreteCells[c]->m_y,
(g_place_concreteCells[c]->m_fixed ? "\\FIXED" : ""));
}
fclose(plFile);
}
// --------------------------------------------------------------------
// writeBookshelf()
//
// --------------------------------------------------------------------
void writeBookshelf(const char *filename) {
writeBookshelfNodes("out.nodes");
writeBookshelfPl("out.pl");
}
UCLA nets 1.0
NumNets : 2
NumPins : 4
NetDegree 2 :
0 pin : 0 0
3 pin : 0 0
NetDegree 2 :
2 pin : 0 0
3 pin : 0 0
UCLA nodes 1.0
NumNodes : 4
NumTerminals : 3
0 1.0 1.0 terminal
1 1.0 1.0 terminal
2 1.0 1.0 terminal
3 1.0 1.0
UCLA pl 1.0
0 0.000000 0.000000 : N \FIXED
1 5.000000 5.000000 : N \FIXED
2 0.000000 5.000000 : N \FIXED
3 4.500000 2.500000 : N
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