21#ifndef ABC__aig__deco__deco_h
22#define ABC__aig__deco__deco_h
98#define Dec_GraphForEachLeaf( pGraph, pLeaf, i ) \
99 for ( i = 0; (i < (pGraph)->nLeaves) && (((pLeaf) = Dec_GraphNode(pGraph, i)), 1); i++ )
101#define Dec_GraphForEachNode( pGraph, pAnd, i ) \
102 for ( i = (pGraph)->nLeaves; (i < (pGraph)->nSize) && (((pAnd) = Dec_GraphNode(pGraph, i)), 1); i++ )
123static inline Dec_Edge_t Dec_EdgeCreate(
int Node,
int fCompl )
125 Dec_Edge_t eEdge = { (unsigned)fCompl, (
unsigned)Node };
140static inline unsigned Dec_EdgeToInt(
Dec_Edge_t eEdge )
142 return (eEdge.Node << 1) | eEdge.fCompl;
156static inline Dec_Edge_t Dec_IntToEdge(
unsigned Edge )
158 return Dec_EdgeCreate( Edge >> 1, Edge & 1 );
172static inline unsigned Dec_EdgeToInt_(
Dec_Edge_t m ) {
union {
Dec_Edge_t x;
unsigned y; } v; v.x = m;
return v.y; }
191static inline Dec_Edge_t Dec_IntToEdge_(
unsigned m ) {
union {
Dec_Edge_t x;
unsigned y; } v; v.y = m;
return v.x; }
210static inline Dec_Graph_t * Dec_GraphCreate(
int nLeaves )
216 pGraph->
nSize = nLeaves;
217 pGraph->
nCap = 2 * nLeaves + 50;
240 pGraph->
eRoot.fCompl = 1;
275static inline Dec_Graph_t * Dec_GraphCreateLeaf(
int iLeaf,
int nLeaves,
int fCompl )
278 assert( 0 <= iLeaf && iLeaf < nLeaves );
279 pGraph = Dec_GraphCreate( nLeaves );
280 pGraph->
eRoot.Node = iLeaf;
281 pGraph->
eRoot.fCompl = fCompl;
296static inline void Dec_GraphFree(
Dec_Graph_t * pGraph )
313static inline int Dec_GraphIsConst(
Dec_Graph_t * pGraph )
329static inline int Dec_GraphIsConst0(
Dec_Graph_t * pGraph )
345static inline int Dec_GraphIsConst1(
Dec_Graph_t * pGraph )
361static inline int Dec_GraphIsComplement(
Dec_Graph_t * pGraph )
363 return pGraph->
eRoot.fCompl;
377static inline void Dec_GraphComplement(
Dec_Graph_t * pGraph )
379 pGraph->
eRoot.fCompl ^= 1;
394static inline int Dec_GraphLeaveNum(
Dec_Graph_t * pGraph )
410static inline int Dec_GraphNodeNum(
Dec_Graph_t * pGraph )
428 return pGraph->
pNodes + i;
460 return pNode - pGraph->
pNodes;
474static inline int Dec_GraphIsVar(
Dec_Graph_t * pGraph )
492 return Dec_GraphNodeInt(pGraph,pNode) < pGraph->
nLeaves;
508 assert( Dec_GraphIsVar( pGraph ) );
509 return Dec_GraphNode( pGraph, pGraph->
eRoot.Node );
523static inline int Dec_GraphVarInt(
Dec_Graph_t * pGraph )
525 assert( Dec_GraphIsVar( pGraph ) );
526 return Dec_GraphNodeInt( pGraph, Dec_GraphVar(pGraph) );
542 pGraph->
eRoot = eRoot;
584 pNode = Dec_GraphAppendNode( pGraph );
588 pNode->
fCompl0 = eEdge0.fCompl;
589 pNode->
fCompl1 = eEdge1.fCompl;
590 return Dec_EdgeCreate( pGraph->
nSize - 1, 0 );
608 pNode = Dec_GraphAppendNode( pGraph );
612 pNode->
fCompl0 = eEdge0.fCompl;
613 pNode->
fCompl1 = eEdge1.fCompl;
618 return Dec_EdgeCreate( pGraph->
nSize - 1, 1 );
639 eNode0 = Dec_GraphAddNodeAnd( pGraph, eEdge0, eEdge1 );
643 eNode1 = Dec_GraphAddNodeAnd( pGraph, eEdge0, eEdge1 );
645 eNode = Dec_GraphAddNodeOr( pGraph, eNode0, eNode1 );
650 eNode0 = Dec_GraphAddNodeAnd( pGraph, eEdge0, eEdge1 );
654 eNode1 = Dec_GraphAddNodeAnd( pGraph, eEdge0, eEdge1 );
656 eNode = Dec_GraphAddNodeOr( pGraph, eNode0, eNode1 );
679 eNode0 = Dec_GraphAddNodeAnd( pGraph, eEdgeC, eEdgeT );
682 eNode1 = Dec_GraphAddNodeAnd( pGraph, eEdgeC, eEdgeE );
684 eNode = Dec_GraphAddNodeOr( pGraph, eNode0, eNode1 );
692 eNode0 = Dec_GraphAddNodeAnd( pGraph, eEdgeC, eEdgeT );
695 eNode1 = Dec_GraphAddNodeAnd( pGraph, eEdgeC, eEdgeE );
697 eNode = Dec_GraphAddNodeOr( pGraph, eNode0, eNode1 );
#define ABC_ALLOC(type, num)
#define ABC_REALLOC(type, obj, num)
#define ABC_NAMESPACE_HEADER_END
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
struct Dec_Man_t_ Dec_Man_t
struct Dec_Node_t_ Dec_Node_t
typedefABC_NAMESPACE_HEADER_START struct Dec_Edge_t_ Dec_Edge_t
INCLUDES ///.
struct Dec_Graph_t_ Dec_Graph_t
unsigned short * puCanons