summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2020-04-02 18:29:39 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2020-04-02 18:29:39 -0700
commit5a20a27c620563e90694462df299dc3933844670 (patch)
tree20998cfcd443f35916bcf172566f68eff5cc15dc /src
parent65dce2fa8084617ec3e5df3ed04bf3031234ae14 (diff)
downloadabc-5a20a27c620563e90694462df299dc3933844670.tar.gz
abc-5a20a27c620563e90694462df299dc3933844670.tar.bz2
abc-5a20a27c620563e90694462df299dc3933844670.zip
Extend ISOP to return the truth table.
Diffstat (limited to 'src')
-rw-r--r--src/bool/kit/kit.h2
-rw-r--r--src/bool/kit/kitGraph.c2
-rw-r--r--src/bool/kit/kitIsop.c15
3 files changed, 14 insertions, 5 deletions
diff --git a/src/bool/kit/kit.h b/src/bool/kit/kit.h
index 6889aa32..9153a280 100644
--- a/src/bool/kit/kit.h
+++ b/src/bool/kit/kit.h
@@ -575,7 +575,7 @@ extern int Kit_GraphLeafDepth_rec( Kit_Graph_t * pGraph, Kit_Node_t
//extern Hop_Obj_t * Kit_CoverToHop( Hop_Man_t * pMan, Vec_Int_t * vCover, int nVars, Vec_Int_t * vMemory );
/*=== kitIsop.c ==========================================================*/
extern int Kit_TruthIsop( unsigned * puTruth, int nVars, Vec_Int_t * vMemory, int fTryBoth );
-extern int Kit_TruthIsop2( unsigned * puTruth0, unsigned * puTruth1, int nVars, Vec_Int_t * vMemory, int fTryBoth );
+extern int Kit_TruthIsop2( unsigned * puTruth0, unsigned * puTruth1, int nVars, Vec_Int_t * vMemory, int fTryBoth, int fReturnTt );
extern void Kit_TruthIsopPrint( unsigned * puTruth, int nVars, Vec_Int_t * vMemory, int fTryBoth );
extern void Kit_TruthIsopPrintCover( Vec_Int_t * vCover, int nVars, int fCompl );
/*=== kitPla.c ==========================================================*/
diff --git a/src/bool/kit/kitGraph.c b/src/bool/kit/kitGraph.c
index 2ee135e2..0e548575 100644
--- a/src/bool/kit/kitGraph.c
+++ b/src/bool/kit/kitGraph.c
@@ -385,7 +385,7 @@ Kit_Graph_t * Kit_TruthToGraph2( unsigned * pTruth0, unsigned * pTruth1, int nVa
Kit_Graph_t * pGraph;
int RetValue;
// derive SOP
- RetValue = Kit_TruthIsop2( pTruth0, pTruth1, nVars, vMemory, 1 ); // tried 1 and found not useful in "renode"
+ RetValue = Kit_TruthIsop2( pTruth0, pTruth1, nVars, vMemory, 1, 0 ); // tried 1 and found not useful in "renode"
if ( RetValue == -1 )
return NULL;
if ( Vec_IntSize(vMemory) > (1<<16) )
diff --git a/src/bool/kit/kitIsop.c b/src/bool/kit/kitIsop.c
index 828ef1de..bc789945 100644
--- a/src/bool/kit/kitIsop.c
+++ b/src/bool/kit/kitIsop.c
@@ -52,7 +52,7 @@ static unsigned Kit_TruthIsop5_rec( unsigned uOn, unsigned uOnDc, int nVars, K
SeeAlso []
***********************************************************************/
-int Kit_TruthIsop2( unsigned * puTruth0, unsigned * puTruth1, int nVars, Vec_Int_t * vMemory, int fTryBoth )
+int Kit_TruthIsop2( unsigned * puTruth0, unsigned * puTruth1, int nVars, Vec_Int_t * vMemory, int fTryBoth, int fReturnTt )
{
Kit_Sop_t cRes, * pcRes = &cRes;
Kit_Sop_t cRes2, * pcRes2 = &cRes2;
@@ -102,8 +102,17 @@ int Kit_TruthIsop2( unsigned * puTruth0, unsigned * puTruth1, int nVars, Vec_Int
}
// printf( "%d ", vMemory->nSize );
// move the cover representation to the beginning of the memory buffer
- memmove( vMemory->pArray, pcRes->pCubes, pcRes->nCubes * sizeof(unsigned) );
- Vec_IntShrink( vMemory, pcRes->nCubes );
+ if ( fReturnTt )
+ {
+ int nWords = Kit_TruthWordNum( nVars );
+ memmove( vMemory->pArray, pResult, nWords * sizeof(unsigned) );
+ Vec_IntShrink( vMemory, nWords );
+ }
+ else
+ {
+ memmove( vMemory->pArray, pcRes->pCubes, pcRes->nCubes * sizeof(unsigned) );
+ Vec_IntShrink( vMemory, pcRes->nCubes );
+ }
return RetValue;
}