summaryrefslogtreecommitdiffstats
path: root/src/misc/tim
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-10-04 17:45:24 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-10-04 17:45:24 -0700
commita1e9f668a88f01dccda8da1bc5ca8e22211b1751 (patch)
tree277a1c1e6b11945a906ae5e8c0c4e6fa8feb0bd8 /src/misc/tim
parent26dc25b7f5e23689636b4d89b98281e821cf7fe8 (diff)
downloadabc-a1e9f668a88f01dccda8da1bc5ca8e22211b1751.tar.gz
abc-a1e9f668a88f01dccda8da1bc5ca8e22211b1751.tar.bz2
abc-a1e9f668a88f01dccda8da1bc5ca8e22211b1751.zip
Adding support for black boxes in extended AIG.
Diffstat (limited to 'src/misc/tim')
-rw-r--r--src/misc/tim/tim.h3
-rw-r--r--src/misc/tim/timBox.c3
-rw-r--r--src/misc/tim/timDump.c6
-rw-r--r--src/misc/tim/timMan.c20
4 files changed, 25 insertions, 7 deletions
diff --git a/src/misc/tim/tim.h b/src/misc/tim/tim.h
index 04ef6706..266688dd 100644
--- a/src/misc/tim/tim.h
+++ b/src/misc/tim/tim.h
@@ -110,7 +110,7 @@ typedef struct Tim_Man_t_ Tim_Man_t;
////////////////////////////////////////////////////////////////////////
/*=== timBox.c ===========================================================*/
-extern void Tim_ManCreateBox( Tim_Man_t * p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable );
+extern void Tim_ManCreateBox( Tim_Man_t * p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable, int fBlack );
extern int Tim_ManBoxForCi( Tim_Man_t * p, int iCo );
extern int Tim_ManBoxForCo( Tim_Man_t * p, int iCi );
extern int Tim_ManBoxInputFirst( Tim_Man_t * p, int iBox );
@@ -147,6 +147,7 @@ extern int Tim_ManPiNum( Tim_Man_t * p );
extern int Tim_ManPoNum( Tim_Man_t * p );
extern int Tim_ManBoxNum( Tim_Man_t * p );
extern int Tim_ManBlackBoxNum( Tim_Man_t * p );
+extern void Tim_ManBlackBoxIoNum( Tim_Man_t * p, int * pnBbIns, int * pnBbOuts );
extern int Tim_ManDelayTableNum( Tim_Man_t * p );
extern void Tim_ManSetDelayTables( Tim_Man_t * p, Vec_Ptr_t * vDelayTables );
extern void Tim_ManTravIdDisable( Tim_Man_t * p );
diff --git a/src/misc/tim/timBox.c b/src/misc/tim/timBox.c
index a1526673..9e311428 100644
--- a/src/misc/tim/timBox.c
+++ b/src/misc/tim/timBox.c
@@ -41,7 +41,7 @@ ABC_NAMESPACE_IMPL_START
SeeAlso []
***********************************************************************/
-void Tim_ManCreateBox( Tim_Man_t * p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable )
+void Tim_ManCreateBox( Tim_Man_t * p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable, int fBlack )
{
Tim_Box_t * pBox;
int i;
@@ -54,6 +54,7 @@ void Tim_ManCreateBox( Tim_Man_t * p, int firstIn, int nIns, int firstOut, int n
pBox->iDelayTable = iDelayTable;
pBox->nInputs = nIns;
pBox->nOutputs = nOuts;
+ pBox->fBlack = fBlack;
for ( i = 0; i < nIns; i++ )
{
assert( firstIn+i < p->nCos );
diff --git a/src/misc/tim/timDump.c b/src/misc/tim/timDump.c
index 1cda07b9..73519fd3 100644
--- a/src/misc/tim/timDump.c
+++ b/src/misc/tim/timDump.c
@@ -70,6 +70,7 @@ Vec_Str_t * Tim_ManSave( Tim_Man_t * p, int fHieOnly )
Vec_StrPutI_ne( vStr, Tim_ManBoxOutputNum(p, pBox->iBox) );
Vec_StrPutI_ne( vStr, Tim_ManBoxDelayTableId(p, pBox->iBox) ); // can be -1 if delay table is not given
Vec_StrPutI_ne( vStr, Tim_ManBoxCopy(p, pBox->iBox) ); // can be -1 if the copy is node defined
+ //Vec_StrPutI_ne( vStr, Tim_ManBoxIsBlack(p, pBox->iBox) );
}
if ( fHieOnly )
return vStr;
@@ -114,7 +115,7 @@ Tim_Man_t * Tim_ManLoad( Vec_Str_t * p, int fHieOnly )
Tim_Man_t * pMan;
Tim_Obj_t * pObj;
int VerNum, nCis, nCos, nPis, nPos;
- int nBoxes, nBoxIns, nBoxOuts, CopyBox;
+ int nBoxes, nBoxIns, nBoxOuts, CopyBox, fBlack;
int TableId, nTables, TableSize, TableX, TableY;
int i, k, curPi, curPo, iStr = 0;
float * pDelayTable;
@@ -143,7 +144,8 @@ Tim_Man_t * Tim_ManLoad( Vec_Str_t * p, int fHieOnly )
nBoxOuts = Vec_StrGetI_ne( p, &iStr );
TableId = Vec_StrGetI_ne( p, &iStr );
CopyBox = Vec_StrGetI_ne( p, &iStr );
- Tim_ManCreateBox( pMan, curPo, nBoxIns, curPi, nBoxOuts, TableId );
+ fBlack = 0;//Vec_StrGetI_ne( p, &iStr );
+ Tim_ManCreateBox( pMan, curPo, nBoxIns, curPi, nBoxOuts, TableId, fBlack );
Tim_ManBoxSetCopy( pMan, i, CopyBox );
curPi += nBoxOuts;
curPo += nBoxIns;
diff --git a/src/misc/tim/timMan.c b/src/misc/tim/timMan.c
index 87e7e0f3..8cec9788 100644
--- a/src/misc/tim/timMan.c
+++ b/src/misc/tim/timMan.c
@@ -145,7 +145,7 @@ Tim_Man_t * Tim_ManDup( Tim_Man_t * p, int fUnitDelay )
Tim_ManForEachBox( p, pBox, i )
{
Tim_ManCreateBox( pNew, pBox->Inouts[0], pBox->nInputs,
- pBox->Inouts[pBox->nInputs], pBox->nOutputs, pBox->iDelayTable );
+ pBox->Inouts[pBox->nInputs], pBox->nOutputs, pBox->iDelayTable, pBox->fBlack );
Tim_ManBoxSetCopy( pNew, i, pBox->iCopy );
}
}
@@ -228,7 +228,7 @@ Tim_Man_t * Tim_ManTrim( Tim_Man_t * p, Vec_Int_t * vBoxPres )
Tim_ManForEachBox( p, pBox, i )
if ( Vec_IntEntry(vBoxPres, i) )
{
- Tim_ManCreateBox( pNew, curPo, pBox->nInputs, curPi, pBox->nOutputs, pBox->iDelayTable );
+ Tim_ManCreateBox( pNew, curPo, pBox->nInputs, curPi, pBox->nOutputs, pBox->iDelayTable, pBox->fBlack );
Tim_ManBoxSetCopy( pNew, Tim_ManBoxNum(pNew) - 1, Tim_ManBoxCopy(p, i) == -1 ? i : Tim_ManBoxCopy(p, i) );
curPi += pBox->nOutputs;
curPo += pBox->nInputs;
@@ -321,7 +321,7 @@ Tim_Man_t * Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft, int nTermsDiff
Vec_IntForEachEntry( vBoxesLeft, iBox, i )
{
pBox = Tim_ManBox( p, iBox );
- Tim_ManCreateBox( pNew, curPo, pBox->nInputs, curPi, pBox->nOutputs, pBox->iDelayTable );
+ Tim_ManCreateBox( pNew, curPo, pBox->nInputs, curPi, pBox->nOutputs, pBox->iDelayTable, pBox->fBlack );
Tim_ManBoxSetCopy( pNew, Tim_ManBoxNum(pNew) - 1, Tim_ManBoxCopy(p, iBox) == -1 ? iBox : Tim_ManBoxCopy(p, iBox) );
curPi += pBox->nOutputs;
curPo += pBox->nInputs;
@@ -730,6 +730,20 @@ int Tim_ManBlackBoxNum( Tim_Man_t * p )
Counter += pBox->fBlack;
return Counter;
}
+void Tim_ManBlackBoxIoNum( Tim_Man_t * p, int * pnBbIns, int * pnBbOuts )
+{
+ Tim_Box_t * pBox;
+ int i;
+ *pnBbIns = *pnBbOuts = 0;
+ if ( Tim_ManBoxNum(p) )
+ Tim_ManForEachBox( p, pBox, i )
+ {
+ if ( !pBox->fBlack )
+ continue;
+ *pnBbIns += Tim_ManBoxInputNum( p, i );
+ *pnBbOuts += Tim_ManBoxOutputNum( p, i );
+ }
+}
int Tim_ManDelayTableNum( Tim_Man_t * p )
{
return p->vDelayTables ? Vec_PtrSize(p->vDelayTables) : 0;