summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abc/abc.h5
-rw-r--r--src/base/abc/abcNtk.c2
-rw-r--r--src/base/abci/abcIf.c91
-rw-r--r--src/base/abci/abcPrint.c2
-rw-r--r--src/base/io/ioReadBlifMv.c1
5 files changed, 98 insertions, 3 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h
index a7d7bd73..a7fa7d2d 100644
--- a/src/base/abc/abc.h
+++ b/src/base/abc/abc.h
@@ -179,9 +179,10 @@ struct Abc_Ntk_t_
Vec_Ptr_t * vBoxes; // the array of boxes
Vec_Ptr_t * vLtlProperties;
// the number of living objects
- int nConstrs; // the number of constraints (model checking only)
- int nObjs; // the number of live objs
int nObjCounts[ABC_OBJ_NUMBER]; // the number of objects by type
+ int nObjs; // the number of live objs
+ int nConstrs; // the number of constraints
+ int nRealPos; // the number of real POs
// the backup network and the step number
Abc_Ntk_t * pNetBackup; // the pointer to the previous backup network
int iStep; // the generation number for the given network
diff --git a/src/base/abc/abcNtk.c b/src/base/abc/abcNtk.c
index ef4c96e3..3ec71680 100644
--- a/src/base/abc/abcNtk.c
+++ b/src/base/abc/abcNtk.c
@@ -110,6 +110,7 @@ Abc_Ntk_t * Abc_NtkStartFrom( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc_NtkFunc_
// start the network
pNtkNew = Abc_NtkAlloc( Type, Func, 1 );
pNtkNew->nConstrs = pNtk->nConstrs;
+ pNtkNew->nRealPos = pNtk->nRealPos;
// duplicate the name and the spec
pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
@@ -163,6 +164,7 @@ Abc_Ntk_t * Abc_NtkStartFromNoLatches( Abc_Ntk_t * pNtk, Abc_NtkType_t Type, Abc
// start the network
pNtkNew = Abc_NtkAlloc( Type, Func, 1 );
pNtkNew->nConstrs = pNtk->nConstrs;
+ pNtkNew->nRealPos = pNtk->nRealPos;
// duplicate the name and the spec
pNtkNew->pName = Extra_UtilStrsav(pNtk->pName);
pNtkNew->pSpec = Extra_UtilStrsav(pNtk->pSpec);
diff --git a/src/base/abci/abcIf.c b/src/base/abci/abcIf.c
index 77f7805c..400e1193 100644
--- a/src/base/abci/abcIf.c
+++ b/src/base/abci/abcIf.c
@@ -38,6 +38,9 @@ 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, int fVerbose );
+
+extern void Abc_NtkCollectPoDrivers( If_Man_t * p, Abc_Ntk_t * pNtk );
+extern void Abc_NtkFreePoDrivers( If_Man_t * p );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
@@ -126,17 +129,22 @@ Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars )
pPars->pTimesArr[c] = -ABC_INFINITY;
}
- // perform FPGA mapping
+ // create FPGA mapper
pIfMan = Abc_NtkToIf( pNtk, pPars );
if ( pIfMan == NULL )
return NULL;
if ( pPars->fPower )
Abc_NtkIfComputeSwitching( pNtk, pIfMan );
+
+ // perform FPGA mapping
+// Abc_NtkCollectPoDrivers( pIfMan, pNtk );
if ( !If_ManPerformMapping( pIfMan ) )
{
+ Abc_NtkFreePoDrivers( pIfMan );
If_ManStop( pIfMan );
return NULL;
}
+ Abc_NtkFreePoDrivers( pIfMan );
// transform the result of mapping into the new network
pNtkNew = Abc_NtkFromIf( pIfMan, pNtk );
@@ -691,6 +699,87 @@ Vec_Ptr_t * Abc_NtkFindGoodOrder( Abc_Ntk_t * pNtk )
}
+/**Function*************************************************************
+
+ Synopsis [Sets PO drivers.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_NtkCollectPoDrivers( If_Man_t * p, Abc_Ntk_t * pNtk )
+{
+ // 1 a 2 b 3 c 4 a+b+c 5 ab+ac+bc
+ Vec_Int_t * vTemp;
+ Abc_Obj_t * pObj;
+ If_Obj_t * pIfObj;
+ int i, g, nGroups;
+ if ( pNtk->nRealPos == 0 )
+ {
+ printf( "PO drivers are not defined.\n" );
+ return;
+ }
+ if ( (Abc_NtkPoNum(pNtk) - pNtk->nRealPos) % 5 != 0 )
+ {
+ printf( "PO drivers are not divisible by 5.\n" );
+ return;
+ }
+ nGroups = (Abc_NtkPoNum(pNtk) - pNtk->nRealPos) / 5;
+ printf( "Processing %d groups of PO drivers.\n", nGroups );
+ // mark the drivers
+ assert( p->pDriverCuts == NULL );
+ p->pDriverCuts = ABC_CALLOC( Vec_Int_t *, If_ManObjNum(p) );
+ for ( g = 0; g < nGroups; g++ )
+ {
+ // collect inputs
+ vTemp = Vec_IntAlloc( 3 );
+ for ( i = 0; i < 3; i++ )
+ {
+ pObj = Abc_NtkPo( pNtk, pNtk->nRealPos + g * 5 + i );
+ pIfObj = If_Regular( ((If_Obj_t *)pObj->pCopy)->pFanin0 );
+ Vec_IntPush( vTemp, pIfObj->Id );
+ }
+ Vec_IntSort( vTemp, 0 );
+ // find output node
+ pObj = Abc_NtkPo( pNtk, pNtk->nRealPos + g * 5 + 3 );
+ pIfObj = If_Regular( ((If_Obj_t *)pObj->pCopy)->pFanin0 );
+ if ( !If_ObjIsConst1(pIfObj) && p->pDriverCuts[pIfObj->Id] == NULL )
+ p->pDriverCuts[pIfObj->Id] = Vec_IntDup( vTemp );
+ // find output node
+ pObj = Abc_NtkPo( pNtk, pNtk->nRealPos + g * 5 + 4 );
+ pIfObj = If_Regular( ((If_Obj_t *)pObj->pCopy)->pFanin0 );
+ if ( !If_ObjIsConst1(pIfObj) && p->pDriverCuts[pIfObj->Id] == NULL )
+ {
+ p->pDriverCuts[pIfObj->Id] = Vec_IntDup( vTemp );
+ pIfObj->fDriver = 1;
+ }
+ Vec_IntFree( vTemp );
+ }
+}
+
+/**Function*************************************************************
+
+ Synopsis [Frees PO drivers.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void Abc_NtkFreePoDrivers( If_Man_t * p )
+{
+ int i;
+ if ( p->pDriverCuts == NULL )
+ return;
+ for ( i = 0; i < If_ManObjNum(p); i++ )
+ Vec_IntFreeP( &p->pDriverCuts[i] );
+ ABC_FREE( p->pDriverCuts );
+}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c
index bdcd926e..352ddf52 100644
--- a/src/base/abci/abcPrint.c
+++ b/src/base/abci/abcPrint.c
@@ -212,6 +212,8 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum
fprintf( pFile, " i/o =%5d/%5d", Abc_NtkPiNum(pNtk), Abc_NtkPoNum(pNtk) );
if ( Abc_NtkConstrNum(pNtk) )
fprintf( pFile, "(c=%d)", Abc_NtkConstrNum(pNtk) );
+ if ( pNtk->nRealPos )
+ fprintf( pFile, "(p=%d)", Abc_NtkPoNum(pNtk) - pNtk->nRealPos );
fprintf( pFile, " lat =%5d", Abc_NtkLatchNum(pNtk) );
if ( Abc_NtkIsNetlist(pNtk) )
{
diff --git a/src/base/io/ioReadBlifMv.c b/src/base/io/ioReadBlifMv.c
index 1c28ac3d..e41b78b8 100644
--- a/src/base/io/ioReadBlifMv.c
+++ b/src/base/io/ioReadBlifMv.c
@@ -952,6 +952,7 @@ static int Io_MvParseLineOutputs( Io_MvMod_t * p, char * pLine )
Vec_Ptr_t * vTokens = p->pMan->vTokens;
char * pToken;
int i;
+ p->pNtk->nRealPos = Abc_NtkPoNum(p->pNtk);
Io_MvSplitIntoTokens( vTokens, pLine, '\0' );
pToken = (char *)Vec_PtrEntry(vTokens, 0);
assert( !strcmp(pToken, "outputs") );