summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2017-03-26 21:46:09 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2017-03-26 21:46:09 -0700
commit2ccd0f9b85cb42d3e6e894a71cd8e962b2d3bd12 (patch)
tree82c6fdc7c57af683b9d9e89ab248ba8d07d620b0 /src/base
parent23151498faa67c0dd7de23d8fedb1a2976f12a88 (diff)
downloadabc-2ccd0f9b85cb42d3e6e894a71cd8e962b2d3bd12.tar.gz
abc-2ccd0f9b85cb42d3e6e894a71cd8e962b2d3bd12.tar.bz2
abc-2ccd0f9b85cb42d3e6e894a71cd8e962b2d3bd12.zip
Experiments with don't-cares.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abc/abc.h1
-rw-r--r--src/base/abc/abcSop.c32
-rw-r--r--src/base/abci/abc.c15
-rw-r--r--src/base/abci/abcMfs.c15
-rw-r--r--src/base/acb/acbAbc.c12
-rw-r--r--src/base/acb/acbMfs.c2
-rw-r--r--src/base/acb/acbUtil.c1
7 files changed, 60 insertions, 18 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h
index 3357b7bd..8defc9d4 100644
--- a/src/base/abc/abc.h
+++ b/src/base/abc/abc.h
@@ -897,6 +897,7 @@ extern ABC_DLL char * Abc_SopCreateInv( Mem_Flex_t * pMan );
extern ABC_DLL char * Abc_SopCreateBuf( Mem_Flex_t * pMan );
extern ABC_DLL char * Abc_SopCreateFromTruth( Mem_Flex_t * pMan, int nVars, unsigned * pTruth );
extern ABC_DLL char * Abc_SopCreateFromIsop( Mem_Flex_t * pMan, int nVars, Vec_Int_t * vCover );
+extern ABC_DLL char * Abc_SopCreateFromTruthIsop( Mem_Flex_t * pMan, int nVars, word * pTruth, Vec_Int_t * vCover );
extern ABC_DLL int Abc_SopGetCubeNum( char * pSop );
extern ABC_DLL int Abc_SopGetLitNum( char * pSop );
extern ABC_DLL int Abc_SopGetVarNum( char * pSop );
diff --git a/src/base/abc/abcSop.c b/src/base/abc/abcSop.c
index ea94c961..af758970 100644
--- a/src/base/abc/abcSop.c
+++ b/src/base/abc/abcSop.c
@@ -19,6 +19,7 @@
***********************************************************************/
#include "abc.h"
+#include "bool/kit/kit.h"
ABC_NAMESPACE_IMPL_START
@@ -453,6 +454,37 @@ char * Abc_SopCreateFromIsop( Mem_Flex_t * pMan, int nVars, Vec_Int_t * vCover )
SeeAlso []
***********************************************************************/
+char * Abc_SopCreateFromTruthIsop( Mem_Flex_t * pMan, int nVars, word * pTruth, Vec_Int_t * vCover )
+{
+ char * pSop = NULL;
+ assert( nVars <= 6 );
+ if ( pTruth[0] == 0 )
+ pSop = Abc_SopRegister( pMan, " 0\n" );
+ else if ( ~pTruth[0] == 0 )
+ pSop = Abc_SopRegister( pMan, " 1\n" );
+ else
+ {
+ int RetValue = Kit_TruthIsop( (unsigned *)pTruth, nVars, vCover, 1 );
+ assert( nVars > 0 );
+ assert( RetValue == 0 || RetValue == 1 );
+ pSop = Abc_SopCreateFromIsop( pMan, nVars, vCover );
+ if ( RetValue )
+ Abc_SopComplement( pSop );
+ }
+ return pSop;
+}
+
+/**Function*************************************************************
+
+ Synopsis [Creates the cover from the ISOP computed from TT.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
void Abc_SopToIsop( char * pSop, Vec_Int_t * vCover )
{
char * pCube;
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 537cdf5b..01bffece 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -5672,7 +5672,7 @@ usage:
int Abc_CommandMfse( Abc_Frame_t * pAbc, int argc, char ** argv )
{
extern Abc_Ntk_t * Abc_NtkOptMfse( Abc_Ntk_t * pNtk, Acb_Par_t * pPars );
- Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
+ Abc_Ntk_t * pNtkNew, * pNtk = Abc_FrameReadNtk(pAbc);
Acb_Par_t Pars, * pPars = &Pars; int c;
Acb_ParSetDefault( pPars );
Extra_UtilGetoptReset();
@@ -5771,6 +5771,19 @@ int Abc_CommandMfse( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "This command can only be applied to a logic network.\n" );
return 1;
}
+ pPars->nLutSize = Abc_NtkGetFaninMax( pNtk );
+ if ( pPars->nLutSize > 6 )
+ {
+ Abc_Print( -1, "Command is only applicable to LUT size no more than 6.\n" );
+ return 1;
+ }
+ pNtkNew = Abc_NtkOptMfse( pNtk, pPars );
+ if ( pNtkNew == NULL )
+ {
+ Abc_Print( -1, "Command \"mfse\" has failed.\n" );
+ return 1;
+ }
+ Abc_FrameReplaceCurrentNetwork( pAbc, pNtkNew );
return 0;
usage:
diff --git a/src/base/abci/abcMfs.c b/src/base/abci/abcMfs.c
index d44ca1a0..5c566074 100644
--- a/src/base/abci/abcMfs.c
+++ b/src/base/abci/abcMfs.c
@@ -216,21 +216,8 @@ void Abc_NtkInsertMfs( Abc_Ntk_t * pNtk, Sfm_Ntk_t * p )
vArray = Sfm_NodeReadFanins( p, pNode->iTemp );
Vec_IntForEachEntry( vArray, Fanin, k )
Abc_ObjAddFanin( pNode, Abc_NtkObj(pNtk, Vec_IntEntry(vMap, Fanin)) );
- // update function
pTruth = Sfm_NodeReadTruth( p, pNode->iTemp );
- if ( pTruth[0] == 0 )
- pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, " 0\n" );
- else if ( ~pTruth[0] == 0 )
- pNode->pData = Abc_SopRegister( (Mem_Flex_t *)pNtk->pManFunc, " 1\n" );
- else
- {
- int RetValue = Kit_TruthIsop( (unsigned *)pTruth, Vec_IntSize(vArray), vCover, 1 );
- assert( Vec_IntSize(vArray) > 0 );
- assert( RetValue == 0 || RetValue == 1 );
- pNode->pData = Abc_SopCreateFromIsop( (Mem_Flex_t *)pNtk->pManFunc, Vec_IntSize(vArray), vCover );
- if ( RetValue )
- Abc_SopComplement( (char *)pNode->pData );
- }
+ pNode->pData = Abc_SopCreateFromTruthIsop( (Mem_Flex_t *)pNtk->pManFunc, Vec_IntSize(vArray), pTruth, vCover );
assert( Abc_SopGetVarNum((char *)pNode->pData) == Vec_IntSize(vArray) );
}
Vec_IntFree( vCover );
diff --git a/src/base/acb/acbAbc.c b/src/base/acb/acbAbc.c
index b6604a54..169532e5 100644
--- a/src/base/acb/acbAbc.c
+++ b/src/base/acb/acbAbc.c
@@ -86,15 +86,23 @@ Abc_Ntk_t * Acb_NtkToAbc( Abc_Ntk_t * pNtk, Acb_Ntk_t * p )
int i, k, iObj, iFanin;
Abc_Ntk_t * pNtkNew = Abc_NtkStartFrom( pNtk, ABC_NTK_LOGIC, ABC_FUNC_SOP );
Mem_Flex_t * pMan = (Mem_Flex_t *)pNtkNew->pManFunc;
+ Vec_Int_t * vCover = Vec_IntAlloc( 1000 );
Acb_NtkCleanObjCopies( p );
Acb_NtkForEachCi( p, iObj, i )
Acb_ObjSetCopy( p, iObj, Abc_ObjId(Abc_NtkCi(pNtkNew, i)) );
Acb_NtkForEachNode( p, iObj )
{
Abc_Obj_t * pObjNew = Abc_NtkCreateNode( pNtkNew );
+ pObjNew->pData = Abc_SopCreateFromTruthIsop( pMan, Acb_ObjFaninNum(p, iObj), Acb_ObjTruthP(p, iObj), vCover );
+ Acb_ObjSetCopy( p, iObj, Abc_ObjId(pObjNew) );
+ }
+ Vec_IntFree( vCover );
+ Acb_NtkForEachNode( p, iObj )
+ {
+ Abc_Obj_t * pObjNew = Abc_NtkObj(pNtkNew, Acb_ObjCopy(p, iObj));
Acb_ObjForEachFanin( p, iObj, iFanin, k )
Abc_ObjAddFanin( pObjNew, Abc_NtkObj(pNtkNew, Acb_ObjCopy(p, iFanin)) );
- pObjNew->pData = Abc_SopCreateFromTruth( pMan, Acb_ObjFaninNum(p, iObj), (unsigned *)Acb_ObjTruthP(p, iObj) );
+ assert( Abc_SopGetVarNum((char *)pObjNew->pData) == Abc_ObjFaninNum(pObjNew) );
}
Acb_NtkForEachCoDriver( p, iFanin, i )
Abc_ObjAddFanin( Abc_NtkCo(pNtkNew, i), Abc_NtkObj(pNtkNew, Acb_ObjCopy(p, iFanin)) );
@@ -222,7 +230,7 @@ Abc_Ntk_t * Abc_NtkOptMfse( Abc_Ntk_t * pNtk, Acb_Par_t * pPars )
extern void Acb_NtkOpt( Acb_Ntk_t * p, Acb_Par_t * pPars );
Abc_Ntk_t * pNtkNew;
Acb_Ntk_t * p = Acb_NtkFromAbc( pNtk );
- Acb_NtkOpt( p, pPars );
+ //Acb_NtkOpt( p, pPars );
pNtkNew = Acb_NtkToAbc( pNtk, p );
Acb_ManFree( p->pDesign );
return pNtkNew;
diff --git a/src/base/acb/acbMfs.c b/src/base/acb/acbMfs.c
index 9a1ff847..7b86a686 100644
--- a/src/base/acb/acbMfs.c
+++ b/src/base/acb/acbMfs.c
@@ -95,7 +95,7 @@ Vec_Wec_t * Acb_DeriveCnfForWindow( Acb_Ntk_t * p, Vec_Int_t * vWin, int PivotVa
if ( Abc_LitIsCompl(iObj) && i < PivotVar )
continue;
vCnfBase = (Vec_Str_t *)Vec_WecEntry( vCnfs, iObj );
- if ( vCnfBase != NULL )
+ if ( Vec_StrSize(vCnfBase) > 0 )
continue;
if ( vCnf == NULL )
vCnf = Vec_StrAlloc( 1000 );
diff --git a/src/base/acb/acbUtil.c b/src/base/acb/acbUtil.c
index fab63124..ab9bf44c 100644
--- a/src/base/acb/acbUtil.c
+++ b/src/base/acb/acbUtil.c
@@ -362,6 +362,7 @@ void Acb_NtkUpdateNode( Acb_Ntk_t * p, int Pivot, word uTruth, Vec_Int_t * vSupp
Acb_ObjAddFanin( p, Pivot, iFanin );
Acb_ObjAddFanout( p, Pivot );
Acb_NtkUpdateTiming( p, Pivot );
+ Vec_IntErase( Vec_WecEntry(&p->vCnfs, Pivot) );
}