summaryrefslogtreecommitdiffstats
path: root/src/base/abci
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2008-03-14 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2008-03-14 08:01:00 -0700
commitff6f0943362c30176fd1f961bcbd19e188cee520 (patch)
treefc2b888c8403ee04fb7d473433c1eb3bcc5ef8c5 /src/base/abci
parent6205eaaee3a840dd076f9baaac67720d85d6a680 (diff)
downloadabc-ff6f0943362c30176fd1f961bcbd19e188cee520.tar.gz
abc-ff6f0943362c30176fd1f961bcbd19e188cee520.tar.bz2
abc-ff6f0943362c30176fd1f961bcbd19e188cee520.zip
Version abc80314
Diffstat (limited to 'src/base/abci')
-rw-r--r--src/base/abci/abc.c65
-rw-r--r--src/base/abci/abcBidec.c126
-rw-r--r--src/base/abci/abcIf.c86
-rw-r--r--src/base/abci/module.make1
4 files changed, 195 insertions, 83 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index f366a612..4262cd0d 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -93,6 +93,7 @@ static int Abc_CommandSop ( Abc_Frame_t * pAbc, int argc, char ** arg
static int Abc_CommandBdd ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandAig ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandReorder ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Abc_CommandBidec ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandOrder ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandMuxes ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandExtSeqDcs ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -275,6 +276,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "Various", "bdd", Abc_CommandBdd, 0 );
Cmd_CommandAdd( pAbc, "Various", "aig", Abc_CommandAig, 0 );
Cmd_CommandAdd( pAbc, "Various", "reorder", Abc_CommandReorder, 0 );
+ Cmd_CommandAdd( pAbc, "Various", "bidec", Abc_CommandBidec, 1 );
Cmd_CommandAdd( pAbc, "Various", "order", Abc_CommandOrder, 0 );
Cmd_CommandAdd( pAbc, "Various", "muxes", Abc_CommandMuxes, 1 );
Cmd_CommandAdd( pAbc, "Various", "ext_seq_dcs", Abc_CommandExtSeqDcs, 0 );
@@ -5202,6 +5204,69 @@ usage:
SeeAlso []
***********************************************************************/
+int Abc_CommandBidec( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ FILE * pOut, * pErr;
+ Abc_Ntk_t * pNtk;
+ int c;
+ int fVerbose;
+ extern void Abc_NtkBidecResyn( Abc_Ntk_t * pNtk, int fVerbose );
+
+ pNtk = Abc_FrameReadNtk(pAbc);
+ pOut = Abc_FrameReadOut(pAbc);
+ pErr = Abc_FrameReadErr(pAbc);
+
+ // set defaults
+ fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+
+ if ( pNtk == NULL )
+ {
+ fprintf( pErr, "Empty network.\n" );
+ return 1;
+ }
+
+ // get the new network
+ if ( !Abc_NtkIsAigLogic(pNtk) )
+ {
+ fprintf( pErr, "Bi-decomposition only works when node functions are AIGs (run \"aig\").\n" );
+ return 1;
+ }
+ Abc_NtkBidecResyn( pNtk, fVerbose );
+ return 0;
+
+usage:
+ fprintf( pErr, "usage: bidec [-vh]\n" );
+ fprintf( pErr, "\t applies bi-decomposition to local functions of the nodes\n" );
+ fprintf( pErr, "\t-v : prints verbose information [default = %s]\n", fVerbose? "yes": "no" );
+ fprintf( pErr, "\t-h : print the command usage\n");
+ return 1;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
int Abc_CommandOrder( Abc_Frame_t * pAbc, int argc, char ** argv )
{
FILE * pOut, * pErr, * pFile;
diff --git a/src/base/abci/abcBidec.c b/src/base/abci/abcBidec.c
new file mode 100644
index 00000000..ad332314
--- /dev/null
+++ b/src/base/abci/abcBidec.c
@@ -0,0 +1,126 @@
+/**CFile****************************************************************
+
+ FileName [abcBidec.c]
+
+ SystemName [ABC: Logic synthesis and verification system.]
+
+ PackageName [Network and node package.]
+
+ Synopsis [Interface to bi-decomposition.]
+
+ Author [Alan Mishchenko]
+
+ Affiliation [UC Berkeley]
+
+ Date [Ver. 1.0. Started - June 20, 2005.]
+
+ Revision [$Id: abcBidec.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]
+
+***********************************************************************/
+
+#include "abc.h"
+
+#include "bdc.h"
+#include "bdcInt.h"
+
+////////////////////////////////////////////////////////////////////////
+/// DECLARATIONS ///
+////////////////////////////////////////////////////////////////////////
+
+static inline Hop_Obj_t * Bdc_FunCopyHop( Bdc_Fun_t * pObj ) { return Hop_NotCond( Bdc_Regular(pObj)->pCopy, Bdc_IsComplement(pObj) ); }
+
+////////////////////////////////////////////////////////////////////////
+/// FUNCTION DEFINITIONS ///
+////////////////////////////////////////////////////////////////////////
+
+/**Function*************************************************************
+
+ Synopsis [Resynthesizes nodes using bi-decomposition.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Hop_Obj_t * Abc_NodeIfNodeResyn( Bdc_Man_t * p, Hop_Man_t * pHop, Hop_Obj_t * pRoot, int nVars, Vec_Int_t * vTruth, unsigned * puCare )
+{
+ unsigned * pTruth;
+ Bdc_Fun_t * pFunc;
+ int i;
+ assert( nVars <= 16 );
+ // derive truth table
+ pTruth = Abc_ConvertAigToTruth( pHop, Hop_Regular(pRoot), nVars, vTruth, 0 );
+ if ( Hop_IsComplement(pRoot) )
+ Extra_TruthNot( pTruth, pTruth, nVars );
+ // decompose truth table
+ Bdc_ManDecompose( p, pTruth, puCare, nVars, NULL, 1000 );
+ // convert back into HOP
+ Bdc_FunWithId( p, 0 )->pCopy = Hop_ManConst1( pHop );
+ for ( i = 0; i < nVars; i++ )
+ Bdc_FunWithId( p, i+1 )->pCopy = Hop_ManPi( pHop, i );
+ for ( i = nVars + 1; i < p->nNodes; i++ )
+ {
+ pFunc = Bdc_FunWithId( p, i );
+ pFunc->pCopy = Hop_And( pHop, Bdc_FunCopyHop(pFunc->pFan0), Bdc_FunCopyHop(pFunc->pFan1) );
+ }
+ return Bdc_FunCopyHop(p->pRoot);
+}
+
+/**Function*************************************************************
+
+ Synopsis [Resynthesizes nodes using bi-decomposition.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_NtkBidecResyn( Abc_Ntk_t * pNtk, int fVerbose )
+{
+ Bdc_Par_t Pars = {0}, * pPars = &Pars;
+ Bdc_Man_t * p;
+ Abc_Obj_t * pObj;
+ Vec_Int_t * vTruth;
+ int i, nGainTotal = 0, nNodes1, nNodes2;
+ int clk = clock();
+ assert( Abc_NtkIsLogic(pNtk) );
+ if ( !Abc_NtkToAig(pNtk) )
+ return;
+ pPars->nVarsMax = Abc_NtkGetFaninMax( pNtk );
+ pPars->fVerbose = fVerbose;
+ if ( pPars->nVarsMax > 15 )
+ {
+ if ( fVerbose )
+ printf( "Resynthesis is not performed for nodes with more than 15 inputs.\n" );
+ pPars->nVarsMax = 15;
+ }
+ vTruth = Vec_IntAlloc( 0 );
+ p = Bdc_ManAlloc( pPars );
+ Abc_NtkForEachNode( pNtk, pObj, i )
+ {
+ if ( Abc_ObjFaninNum(pObj) > 15 )
+ continue;
+ nNodes1 = Hop_DagSize(pObj->pData);
+ pObj->pData = Abc_NodeIfNodeResyn( p, pNtk->pManFunc, pObj->pData, Abc_ObjFaninNum(pObj), vTruth, NULL );
+ nNodes2 = Hop_DagSize(pObj->pData);
+ nGainTotal += nNodes1 - nNodes2;
+ }
+ Bdc_ManFree( p );
+ Vec_IntFree( vTruth );
+ if ( fVerbose )
+ {
+ printf( "Total gain in AIG nodes = %d. ", nGainTotal );
+ PRT( "Total runtime", clock() - clk );
+ }
+}
+
+
+////////////////////////////////////////////////////////////////////////
+/// END OF FILE ///
+////////////////////////////////////////////////////////////////////////
+
+
diff --git a/src/base/abci/abcIf.c b/src/base/abci/abcIf.c
index a20925b2..35ec473f 100644
--- a/src/base/abci/abcIf.c
+++ b/src/base/abci/abcIf.c
@@ -34,7 +34,7 @@ static Hop_Obj_t * Abc_NodeIfToHop( Hop_Man_t * pHopMan, If_Man_t * pIfMan, If_O
static Vec_Ptr_t * Abc_NtkFindGoodOrder( Abc_Ntk_t * pNtk );
extern void Abc_NtkBddReorder( Abc_Ntk_t * pNtk, int fVerbose );
-extern void Abc_NtkBidecResyn( Abc_Ntk_t * pNtk );
+extern void Abc_NtkBidecResyn( Abc_Ntk_t * pNtk, int fVerbose );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
@@ -86,7 +86,7 @@ Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars )
return NULL;
If_ManStop( pIfMan );
if ( pPars->fBidec && pPars->nLutSize <= 8 )
- Abc_NtkBidecResyn( pNtkNew );
+ Abc_NtkBidecResyn( pNtkNew, 0 );
// duplicate EXDC
if ( pNtk->pExdc )
@@ -256,7 +256,7 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
pNodeNew = Abc_NtkCreateNode( pNtkNew );
pCutBest = If_ObjCutBest( pIfObj );
// if ( pIfMan->pPars->pLutLib && pIfMan->pPars->pLutLib->fVarPinDelays )
-// If_CutRotatePins( pIfMan, pCutBest );
+ If_CutRotatePins( pIfMan, pCutBest );
if ( pIfMan->pPars->fUseCnfs || pIfMan->pPars->fUseMv )
{
If_CutForEachLeafReverse( pIfMan, pCutBest, pIfLeaf, i )
@@ -551,86 +551,6 @@ Vec_Ptr_t * Abc_NtkFindGoodOrder( Abc_Ntk_t * pNtk )
}
-#include "bdc.h"
-#include "bdcInt.h"
-
-static inline Hop_Obj_t * Bdc_FunCopyHop( Bdc_Fun_t * pObj ) { return Hop_NotCond( Bdc_Regular(pObj)->pCopy, Bdc_IsComplement(pObj) ); }
-
-/**Function*************************************************************
-
- Synopsis [Resynthesizes nodes using bi-decomposition.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-Hop_Obj_t * Abc_NodeIfNodeResyn( Bdc_Man_t * p, Hop_Man_t * pHop, Hop_Obj_t * pRoot, int nVars, Vec_Int_t * vTruth )
-{
- unsigned * pTruth;
- Bdc_Fun_t * pFunc;
- int i;
- // derive truth table
- pTruth = Abc_ConvertAigToTruth( pHop, Hop_Regular(pRoot), nVars, vTruth, 0 );
- if ( Hop_IsComplement(pRoot) )
- Extra_TruthNot( pTruth, pTruth, nVars );
- // decompose truth table
- Bdc_ManDecompose( p, pTruth, NULL, nVars, NULL, 1000 );
- // convert back into HOP
- Bdc_FunWithId( p, 0 )->pCopy = Hop_ManConst1( pHop );
- for ( i = 0; i < nVars; i++ )
- Bdc_FunWithId( p, i+1 )->pCopy = Hop_ManPi( pHop, i );
- for ( i = nVars + 1; i < p->nNodes; i++ )
- {
- pFunc = Bdc_FunWithId( p, i );
- pFunc->pCopy = Hop_And( pHop, Bdc_FunCopyHop(pFunc->pFan0), Bdc_FunCopyHop(pFunc->pFan1) );
- }
- return Bdc_FunCopyHop(p->pRoot);
-}
-
-/**Function*************************************************************
-
- Synopsis [Resynthesizes nodes using bi-decomposition.]
-
- Description []
-
- SideEffects []
-
- SeeAlso []
-
-***********************************************************************/
-void Abc_NtkBidecResyn( Abc_Ntk_t * pNtk )
-{
- Bdc_Par_t Pars = {0}, * pPars = &Pars;
- Bdc_Man_t * p;
- Abc_Obj_t * pObj;
- Vec_Int_t * vTruth;
- int i, nGainTotal = 0, nNodes1, nNodes2;
- int clk = clock();
- pPars->nVarsMax = Abc_NtkGetFaninMax( pNtk );
- if ( pPars->nVarsMax > 8 )
- {
- printf( "Resynthesis is not performed.\n" );
- return;
- }
- vTruth = Vec_IntAlloc( 0 );
- p = Bdc_ManAlloc( pPars );
- Abc_NtkForEachNode( pNtk, pObj, i )
- {
- nNodes1 = Hop_DagSize(pObj->pData);
- pObj->pData = Abc_NodeIfNodeResyn( p, pNtk->pManFunc, pObj->pData, Abc_ObjFaninNum(pObj), vTruth );
- nNodes2 = Hop_DagSize(pObj->pData);
- nGainTotal += nNodes1 - nNodes2;
- }
-// printf( "LUTs = %d. Total gain in AIG nodes = %d. ", Abc_NtkNodeNum(pNtk), nGainTotal );
-// PRT( "Time", clock() - clk );
- Bdc_ManFree( p );
- Vec_IntFree( vTruth );
-}
-
-
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
diff --git a/src/base/abci/module.make b/src/base/abci/module.make
index 55b724b8..a2f879e3 100644
--- a/src/base/abci/module.make
+++ b/src/base/abci/module.make
@@ -2,6 +2,7 @@ SRC += src/base/abci/abc.c \
src/base/abci/abcAttach.c \
src/base/abci/abcAuto.c \
src/base/abci/abcBalance.c \
+ src/base/abci/abcBidec.c \
src/base/abci/abcBmc.c \
src/base/abci/abcCas.c \
src/base/abci/abcClpBdd.c \