52 pGraph->
nSize = nLeaves;
53 pGraph->
nCap = 2 * nLeaves + 50;
114 assert( 0 <= iLeaf && iLeaf < nLeaves );
183 return Kit_EdgeCreate( pGraph->
nSize - 1, 0 );
211 return Kit_EdgeCreate( pGraph->
nSize - 1, 1 );
309 unsigned uTruths[5] = { 0xAAAAAAAA, 0xCCCCCCCC, 0xF0F0F0F0, 0xFF00FF00, 0xFFFF0000 };
310 unsigned uTruth = 0, uTruth0, uTruth1;
315 assert( Kit_GraphLeaveNum(pGraph) >= 0 );
316 assert( Kit_GraphLeaveNum(pGraph) <= pGraph->
nSize );
317 assert( Kit_GraphLeaveNum(pGraph) <= 5 );
320 if ( Kit_GraphIsConst(pGraph) )
321 return Kit_GraphIsComplement(pGraph)? 0 : ~((unsigned)0);
323 if ( Kit_GraphIsVar(pGraph) )
324 return Kit_GraphIsComplement(pGraph)? ~uTruths[Kit_GraphVarInt(pGraph)] : uTruths[Kit_GraphVarInt(pGraph)];
328 pNode->
pFunc = (
void *)(
long)uTruths[i];
333 uTruth0 = (unsigned)(
long)Kit_GraphNode(pGraph, pNode->
eEdge0.
Node)->pFunc;
334 uTruth1 = (unsigned)(
long)Kit_GraphNode(pGraph, pNode->
eEdge1.
Node)->pFunc;
337 uTruth = uTruth0 & uTruth1;
338 pNode->
pFunc = (
void *)(
long)uTruth;
342 return Kit_GraphIsComplement(pGraph)? ~uTruth : uTruth;
362 if ( RetValue == -1 )
364 if ( Vec_IntSize(vMemory) > (1<<16) )
367 assert( RetValue == 0 || RetValue == 1 );
389 RetValue =
Kit_TruthIsop2( pTruth0, pTruth1, nVars, vMemory, 0, 0 );
390 if ( RetValue == -1 )
392 if ( Vec_IntSize(vMemory) > (1<<16) )
395 assert( RetValue == 0 || RetValue == 1 );
414 int Depth0, Depth1, Depth;
415 if ( pNode == pLeaf )
417 if ( Kit_GraphNodeIsVar(pGraph, pNode) )
421 Depth =
KIT_MAX( Depth0, Depth1 );
422 Depth = (Depth == -100) ? -100 : Depth + 1;
440 if ( Kit_GraphNodeIsVar(pGraph, pNode) )
444 return 1 +
KIT_MAX( Depth0, Depth1 );
461 int nNodes = Kit_GraphNodeNum( pGraph );
464 return (nLevels << 16) | nNodes;
469 int nInts = Abc_TruthWordNum( nVars );
470 Vec_Int_t * vMemory = Vec_IntAlloc( 1 << 16 );
471 for ( f = 0; f < nFuncs; f++ )
473 Vec_IntFree( vMemory );
479 for ( i = 0; i < (int)
strlen(pFileName); i++ )
480 if ( pFileName[i] >=
'0' && pFileName[i] <=
'9' )
481 return atoi(pFileName+i);
486 abctime clk = Abc_Clock();
int i;
489 int nFuncs = nFileSize / 4 / Abc_TruthWordNum(nVars);
492 printf(
"Finished proceessing %d functions with %d variables. ", nFuncs, nVars );
493 Abc_PrintTime( 1,
"Time", Abc_Clock() - clk );
495 for ( i = 0; i < 5; i++ )
496 printf(
"Function %3d : AND2 = %3d Lev = %3d\n", i, pResult[i] & 0xFFFF, pResult[i] >> 16 );
516 if ( RetValue == -1 || Vec_IntSize(vMemory) > (1<<16) )
518 assert( RetValue == 0 || RetValue == 1 );
520 nLits = 1 + Kit_GraphNodeNum( pGraph );
#define ABC_ALLOC(type, num)
#define ABC_REALLOC(type, obj, num)
#define ABC_CALLOC(type, num)
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
int * Kit_TruthStatsArray(unsigned *pArray, int nVars, int nFuncs)
Kit_Edge_t Kit_GraphAddNodeMux(Kit_Graph_t *pGraph, Kit_Edge_t eEdgeC, Kit_Edge_t eEdgeT, Kit_Edge_t eEdgeE, int Type)
unsigned Kit_GraphToTruth(Kit_Graph_t *pGraph)
int * Kit_TruthTest(char *pFileName)
Kit_Edge_t Kit_GraphAddNodeAnd(Kit_Graph_t *pGraph, Kit_Edge_t eEdge0, Kit_Edge_t eEdge1)
int Kit_TruthLitNum(unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
Kit_Graph_t * Kit_GraphCreateConst1()
Kit_Graph_t * Kit_TruthToGraph2(unsigned *pTruth0, unsigned *pTruth1, int nVars, Vec_Int_t *vMemory)
int Kit_GraphLevelNum_rec(Kit_Graph_t *pGraph, Kit_Node_t *pNode)
Kit_Node_t * Kit_GraphAppendNode(Kit_Graph_t *pGraph)
int Kit_GraphLeafDepth_rec(Kit_Graph_t *pGraph, Kit_Node_t *pNode, Kit_Node_t *pLeaf)
void Kit_GraphFree(Kit_Graph_t *pGraph)
int Kit_TruthStats(unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
Kit_Graph_t * Kit_GraphCreateLeaf(int iLeaf, int nLeaves, int fCompl)
Kit_Edge_t Kit_GraphAddNodeOr(Kit_Graph_t *pGraph, Kit_Edge_t eEdge0, Kit_Edge_t eEdge1)
Kit_Edge_t Kit_GraphAddNodeXor(Kit_Graph_t *pGraph, Kit_Edge_t eEdge0, Kit_Edge_t eEdge1, int Type)
Kit_Graph_t * Kit_GraphCreateConst0()
ABC_NAMESPACE_IMPL_START Kit_Graph_t * Kit_GraphCreate(int nLeaves)
DECLARATIONS ///.
Kit_Graph_t * Kit_TruthToGraph(unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
int Kit_TruthFindVarNum(char *pFileName)
#define Kit_GraphForEachNode(pGraph, pAnd, i)
struct Kit_Graph_t_ Kit_Graph_t
int Kit_TruthIsop(unsigned *puTruth, int nVars, Vec_Int_t *vMemory, int fTryBoth)
Kit_Graph_t * Kit_SopFactor(Vec_Int_t *vCover, int fCompl, int nVars, Vec_Int_t *vMemory)
FUNCTION DEFINITIONS ///.
struct Kit_Node_t_ Kit_Node_t
int Kit_TruthIsop2(unsigned *puTruth0, unsigned *puTruth1, int nVars, Vec_Int_t *vMemory, int fTryBoth, int fReturnTt)
FUNCTION DEFINITIONS ///.
#define Kit_GraphForEachLeaf(pGraph, pLeaf, i)
struct Kit_Edge_t_ Kit_Edge_t