summaryrefslogtreecommitdiffstats
path: root/src/bool/kit
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2020-11-01 09:56:01 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2020-11-01 09:56:01 -0800
commit3a7b3d27f19e1d8b43cfe974b6c8c3ab5c79d351 (patch)
treebc34c309f599b077ccaa2926913c17b92676f91d /src/bool/kit
parent2325cd77e3d6072b335dd551b3eda2ef20eaa92c (diff)
downloadabc-3a7b3d27f19e1d8b43cfe974b6c8c3ab5c79d351.tar.gz
abc-3a7b3d27f19e1d8b43cfe974b6c8c3ab5c79d351.tar.bz2
abc-3a7b3d27f19e1d8b43cfe974b6c8c3ab5c79d351.zip
Experimental cost function in technology mapping.
Diffstat (limited to 'src/bool/kit')
-rw-r--r--src/bool/kit/kit.h1
-rw-r--r--src/bool/kit/kitGraph.c25
2 files changed, 26 insertions, 0 deletions
diff --git a/src/bool/kit/kit.h b/src/bool/kit/kit.h
index 47f06403..5436956a 100644
--- a/src/bool/kit/kit.h
+++ b/src/bool/kit/kit.h
@@ -568,6 +568,7 @@ extern unsigned Kit_GraphToTruth( Kit_Graph_t * pGraph );
extern Kit_Graph_t * Kit_TruthToGraph( unsigned * pTruth, int nVars, Vec_Int_t * vMemory );
extern Kit_Graph_t * Kit_TruthToGraph2( unsigned * pTruth0, unsigned * pTruth1, int nVars, Vec_Int_t * vMemory );
extern int Kit_GraphLeafDepth_rec( Kit_Graph_t * pGraph, Kit_Node_t * pNode, Kit_Node_t * pLeaf );
+extern int Kit_TruthLitNum( unsigned * pTruth, int nVars, Vec_Int_t * vMemory );
/*=== kitHop.c ==========================================================*/
//extern int Kit_TruthToGia( Gia_Man_t * pMan, unsigned * pTruth, int nVars, Vec_Int_t * vMemory, Vec_Int_t * vLeaves, int fHash );
//extern Hop_Obj_t * Kit_GraphToHop( Hop_Man_t * pMan, Kit_Graph_t * pGraph );
diff --git a/src/bool/kit/kitGraph.c b/src/bool/kit/kitGraph.c
index 0e548575..9d7189a2 100644
--- a/src/bool/kit/kitGraph.c
+++ b/src/bool/kit/kitGraph.c
@@ -496,6 +496,31 @@ int * Kit_TruthTest( char * pFileName )
return pResult;
}
+/**Function*************************************************************
+
+ Synopsis [Derives the factored form from the truth table.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+int Kit_TruthLitNum( unsigned * pTruth, int nVars, Vec_Int_t * vMemory )
+{
+ Kit_Graph_t * pGraph;
+ int RetValue, nLits;
+ RetValue = Kit_TruthIsop( pTruth, nVars, vMemory, 1 );
+ if ( RetValue == -1 || Vec_IntSize(vMemory) > (1<<16) )
+ return -1;
+ assert( RetValue == 0 || RetValue == 1 );
+ pGraph = Kit_SopFactor( vMemory, RetValue, nVars, vMemory );
+ nLits = 1 + Kit_GraphNodeNum( pGraph );
+ Kit_GraphFree( pGraph );
+ return nLits;
+}
+
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////