summaryrefslogtreecommitdiffstats
path: root/src/aig/gia
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2020-01-07 01:36:06 +0200
committerAlan Mishchenko <alanmi@berkeley.edu>2020-01-07 01:36:06 +0200
commit1485e63ae3cc36d2840b5c2d1d7da38a88ee8928 (patch)
tree9ba48d1d144f77a486fd9929ade266af8f650e1b /src/aig/gia
parente1997b038a2d22abffa1215fbfb2209d6bf70c5c (diff)
downloadabc-1485e63ae3cc36d2840b5c2d1d7da38a88ee8928.tar.gz
abc-1485e63ae3cc36d2840b5c2d1d7da38a88ee8928.tar.bz2
abc-1485e63ae3cc36d2840b5c2d1d7da38a88ee8928.zip
Allowing nodes and boxes to have more than 6 inputs in mfs2 and &mfs.
Diffstat (limited to 'src/aig/gia')
-rw-r--r--src/aig/gia/giaMfs.c77
1 files changed, 61 insertions, 16 deletions
diff --git a/src/aig/gia/giaMfs.c b/src/aig/gia/giaMfs.c
index 2d9d09e8..69f6ee7a 100644
--- a/src/aig/gia/giaMfs.c
+++ b/src/aig/gia/giaMfs.c
@@ -46,7 +46,7 @@ ABC_NAMESPACE_IMPL_START
***********************************************************************/
Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
{
- word uTruth, uTruths6[6] = {
+ word uTruth, * pTruth, uTruths6[6] = {
ABC_CONST(0xAAAAAAAAAAAAAAAA),
ABC_CONST(0xCCCCCCCCCCCCCCCC),
ABC_CONST(0xF0F0F0F0F0F0F0F0),
@@ -60,6 +60,8 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
Vec_Str_t * vEmpty; // mfs data
Vec_Wrd_t * vTruths; // mfs data
Vec_Int_t * vArray;
+ Vec_Int_t * vStarts;
+ Vec_Wrd_t * vTruths2;
Vec_Int_t * vLeaves;
Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
int nBoxes = Gia_ManBoxNum(p), nVars;
@@ -67,6 +69,9 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
int nRealPos = nBoxes ? Tim_ManPoNum(pManTime) : Gia_ManPoNum(p);
int i, j, k, curCi, curCo, nBoxIns, nBoxOuts;
int Id, iFan, nMfsVars, nBbIns = 0, nBbOuts = 0, Counter = 0;
+ int nLutSizeMax = Gia_ManLutSizeMax( p );
+ nLutSizeMax = Abc_MaxInt( nLutSizeMax, 6 );
+ assert( nLutSizeMax < 16 );
//assert( !p->pAigExtra || Gia_ManPiNum(p->pAigExtra) <= 6 );
if ( pManTime ) Tim_ManBlackBoxIoNum( pManTime, &nBbIns, &nBbOuts );
// skip PIs due to box outputs
@@ -77,6 +82,8 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
vFixed = Vec_StrStart( nMfsVars );
vEmpty = Vec_StrStart( nMfsVars );
vTruths = Vec_WrdStart( nMfsVars );
+ vStarts = Vec_IntStart( nMfsVars );
+ vTruths2 = Vec_WrdAlloc( 10000 );
// set internal PIs
Gia_ManCleanCopyArray( p );
Gia_ManForEachCiId( p, Id, i )
@@ -86,8 +93,8 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
Vec_WrdWriteEntry( vTruths, Counter, (word)0 );
Gia_ObjSetCopyArray( p, 0, Counter++ );
// set internal LUTs
- vLeaves = Vec_IntAlloc( 6 );
- Gia_ObjComputeTruthTableStart( p, 6 );
+ vLeaves = Vec_IntAlloc( nLutSizeMax );
+ Gia_ObjComputeTruthTableStart( p, nLutSizeMax );
Gia_ManForEachLut( p, Id )
{
Vec_IntClear( vLeaves );
@@ -99,12 +106,22 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
Vec_IntPush( vArray, Gia_ObjCopyArray(p, iFan) );
Vec_IntPush( vLeaves, iFan );
}
- assert( Vec_IntSize(vLeaves) <= 6 );
+ assert( Vec_IntSize(vLeaves) < 16 );
assert( Vec_IntSize(vLeaves) == Gia_ObjLutSize(p, Id) );
- uTruth = *Gia_ObjComputeTruthTableCut( p, Gia_ManObj(p, Id), vLeaves );
- nVars = Abc_Tt6MinBase( &uTruth, Vec_IntArray(vArray), Vec_IntSize(vArray) );
+// uTruth = *Gia_ObjComputeTruthTableCut( p, Gia_ManObj(p, Id), vLeaves );
+// nVars = Abc_Tt6MinBase( &uTruth, Vec_IntArray(vArray), Vec_IntSize(vArray) );
+ pTruth = Gia_ObjComputeTruthTableCut( p, Gia_ManObj(p, Id), vLeaves );
+ nVars = Abc_TtMinBase( pTruth, Vec_IntArray(vArray), Vec_IntSize(vArray), Vec_IntSize(vLeaves) );
Vec_IntShrink( vArray, nVars );
- Vec_WrdWriteEntry( vTruths, Counter, uTruth );
+ if ( nVars <= 6 )
+ Vec_WrdWriteEntry( vTruths, Counter, pTruth[0] );
+ else
+ {
+ int w, nWords = Abc_Truth6WordNum( nVars );
+ Vec_IntWriteEntry( vStarts, Counter, Vec_WrdSize(vTruths2) );
+ for ( w = 0; w < nWords; w++ )
+ Vec_WrdPush( vTruths2, pTruth[w] );
+ }
if ( Gia_ObjLutIsMux(p, Id) )
{
Vec_StrWriteEntry( vFixed, Counter, (char)1 );
@@ -136,7 +153,8 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
if ( p->pAigExtra )
{
int iBbIn = 0, iBbOut = 0;
- Gia_ObjComputeTruthTableStart( p->pAigExtra, 6 );
+ assert( Gia_ManCiNum(p->pAigExtra) < 16 );
+ Gia_ObjComputeTruthTableStart( p->pAigExtra, Gia_ManCiNum(p->pAigExtra) );
curCi = nRealPis;
curCo = 0;
for ( k = 0; k < nBoxes; k++ )
@@ -148,7 +166,7 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
for ( i = 0; i < nBoxIns; i++ )
Vec_IntPush( vLeaves, Gia_ObjId(p->pAigExtra, Gia_ManCi(p->pAigExtra, i)) );
// iterate through box outputs
- if ( !Tim_ManBoxIsBlack(pManTime, k) && Tim_ManBoxInputNum(pManTime, k) <= 6 )
+ if ( !Tim_ManBoxIsBlack(pManTime, k) ) //&& Tim_ManBoxInputNum(pManTime, k) <= 6 )
{
for ( j = 0; j < nBoxOuts; j++ )
{
@@ -168,17 +186,39 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
// box output in the extra manager
pObjExtra = Gia_ManCo( p->pAigExtra, curCi - nRealPis + j );
// compute truth table
+ pTruth = NULL;
if ( Gia_ObjFaninId0p(p->pAigExtra, pObjExtra) == 0 )
+ {
uTruth = 0;
+ uTruth = Gia_ObjFaninC0(pObjExtra) ? ~uTruth : uTruth;
+ pTruth = &uTruth;
+ }
else if ( Gia_ObjIsCi(Gia_ObjFanin0(pObjExtra)) )
+ {
uTruth = uTruths6[Gia_ObjCioId(Gia_ObjFanin0(pObjExtra))];
+ uTruth = Gia_ObjFaninC0(pObjExtra) ? ~uTruth : uTruth;
+ pTruth = &uTruth;
+ }
else
- uTruth = *Gia_ObjComputeTruthTableCut( p->pAigExtra, Gia_ObjFanin0(pObjExtra), vLeaves );
- uTruth = Gia_ObjFaninC0(pObjExtra) ? ~uTruth : uTruth;
+ {
+ pTruth = Gia_ObjComputeTruthTableCut( p->pAigExtra, Gia_ObjFanin0(pObjExtra), vLeaves );
+ if ( Gia_ObjFaninC0(pObjExtra) )
+ Abc_TtNot( pTruth, Abc_Truth6WordNum(Vec_IntSize(vLeaves)) );
+ }
+ //uTruth = Gia_ObjFaninC0(pObjExtra) ? ~uTruth : uTruth;
//Dau_DsdPrintFromTruth( &uTruth, Vec_IntSize(vArray) );
- nVars = Abc_Tt6MinBase( &uTruth, Vec_IntArray(vArray), Vec_IntSize(vArray) );
+ //nVars = Abc_Tt6MinBase( &uTruth, Vec_IntArray(vArray), Vec_IntSize(vArray) );
+ nVars = Abc_TtMinBase( pTruth, Vec_IntArray(vArray), Vec_IntSize(vArray), Vec_IntSize(vLeaves) );
Vec_IntShrink( vArray, nVars );
- Vec_WrdWriteEntry( vTruths, Counter, uTruth );
+ if ( nVars <= 6 )
+ Vec_WrdWriteEntry( vTruths, Counter, pTruth[0] );
+ else
+ {
+ int w, nWords = Abc_Truth6WordNum( nVars );
+ Vec_IntWriteEntry( vStarts, Counter, Vec_WrdSize(vTruths2) );
+ for ( w = 0; w < nWords; w++ )
+ Vec_WrdPush( vTruths2, pTruth[w] );
+ }
}
}
else // create buffers for black box inputs and outputs
@@ -230,7 +270,7 @@ Sfm_Ntk_t * Gia_ManExtractMfs( Gia_Man_t * p )
}
// finalize
Vec_IntFree( vLeaves );
- return Sfm_NtkConstruct( vFanins, nBbOuts + nRealPis, nRealPos + nBbIns, vFixed, vEmpty, vTruths );
+ return Sfm_NtkConstruct( vFanins, nBbOuts + nRealPis, nRealPos + nBbIns, vFixed, vEmpty, vTruths, vStarts, vTruths2 );
}
/**Function*************************************************************
@@ -464,11 +504,16 @@ Gia_Man_t * Gia_ManPerformMfs( Gia_Man_t * p, Sfm_Par_t * pPars )
Abc_Print( 1, "Timing manager is given but there is no GIA of boxes.\n" );
return NULL;
}
+ if ( p->pManTime != NULL && p->pAigExtra != NULL && Gia_ManCiNum(p->pAigExtra) > 15 )
+ {
+ Abc_Print( 1, "Currently \"&mfs\" cannot process the network containing white-boxes with more than 15 inputs.\n" );
+ return NULL;
+ }
// count fanouts
nFaninMax = Gia_ManLutSizeMax( p );
- if ( nFaninMax > 6 )
+ if ( nFaninMax > 15 )
{
- Abc_Print( 1, "Currently \"&mfs\" cannot process the network containing nodes with more than 6 fanins.\n" );
+ Abc_Print( 1, "Currently \"&mfs\" cannot process the network containing nodes with more than 15 fanins.\n" );
return NULL;
}
// collect information