ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
kitAig.c
Go to the documentation of this file.
1
20
21#include "kit.h"
22#include "aig/aig/aig.h"
23
25
26
30
34
47{
48 Kit_Node_t * pNode = NULL;
49 Aig_Obj_t * pAnd0, * pAnd1;
50 int i;
51 // check for constant function
52 if ( Kit_GraphIsConst(pGraph) )
53 return Aig_NotCond( Aig_ManConst1(pMan), Kit_GraphIsComplement(pGraph) );
54 // check for a literal
55 if ( Kit_GraphIsVar(pGraph) )
56 return Aig_NotCond( (Aig_Obj_t *)Kit_GraphVar(pGraph)->pFunc, Kit_GraphIsComplement(pGraph) );
57 // build the AIG nodes corresponding to the AND gates of the graph
58 Kit_GraphForEachNode( pGraph, pNode, i )
59 {
60 pAnd0 = Aig_NotCond( (Aig_Obj_t *)Kit_GraphNode(pGraph, pNode->eEdge0.Node)->pFunc, pNode->eEdge0.fCompl );
61 pAnd1 = Aig_NotCond( (Aig_Obj_t *)Kit_GraphNode(pGraph, pNode->eEdge1.Node)->pFunc, pNode->eEdge1.fCompl );
62 pNode->pFunc = Aig_And( pMan, pAnd0, pAnd1 );
63 }
64 // complement the result if necessary
65 return Aig_NotCond( (Aig_Obj_t *)pNode->pFunc, Kit_GraphIsComplement(pGraph) );
66}
67
79Aig_Obj_t * Kit_GraphToAig( Aig_Man_t * pMan, Aig_Obj_t ** pFanins, Kit_Graph_t * pGraph )
80{
81 Kit_Node_t * pNode = NULL;
82 int i;
83 // collect the fanins
84 Kit_GraphForEachLeaf( pGraph, pNode, i )
85 pNode->pFunc = pFanins[i];
86 // perform strashing
87 return Kit_GraphToAigInternal( pMan, pGraph );
88}
89
101Aig_Obj_t * Kit_TruthToAig( Aig_Man_t * pMan, Aig_Obj_t ** pFanins, unsigned * pTruth, int nVars, Vec_Int_t * vMemory )
102{
103 Aig_Obj_t * pObj;
104 Kit_Graph_t * pGraph;
105 // transform truth table into the decomposition tree
106 if ( vMemory == NULL )
107 {
108 vMemory = Vec_IntAlloc( 0 );
109 pGraph = Kit_TruthToGraph( pTruth, nVars, vMemory );
110 Vec_IntFree( vMemory );
111 }
112 else
113 pGraph = Kit_TruthToGraph( pTruth, nVars, vMemory );
114 // derive the AIG for the decomposition tree
115 pObj = Kit_GraphToAig( pMan, pFanins, pGraph );
116 Kit_GraphFree( pGraph );
117 return pObj;
118}
119
123
124
126
#define ABC_NAMESPACE_IMPL_START
#define ABC_NAMESPACE_IMPL_END
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition aigOper.c:104
struct Aig_Obj_t_ Aig_Obj_t
Definition aig.h:51
typedefABC_NAMESPACE_HEADER_START struct Aig_Man_t_ Aig_Man_t
INCLUDES ///.
Definition aig.h:50
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Aig_Obj_t * Kit_GraphToAig(Aig_Man_t *pMan, Aig_Obj_t **pFanins, Kit_Graph_t *pGraph)
Definition kitAig.c:79
ABC_NAMESPACE_IMPL_START Aig_Obj_t * Kit_GraphToAigInternal(Aig_Man_t *pMan, Kit_Graph_t *pGraph)
DECLARATIONS ///.
Definition kitAig.c:46
Aig_Obj_t * Kit_TruthToAig(Aig_Man_t *pMan, Aig_Obj_t **pFanins, unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
Definition kitAig.c:101
#define Kit_GraphForEachNode(pGraph, pAnd, i)
Definition kit.h:507
struct Kit_Graph_t_ Kit_Graph_t
Definition kit.h:88
struct Kit_Node_t_ Kit_Node_t
Definition kit.h:69
void Kit_GraphFree(Kit_Graph_t *pGraph)
Definition kitGraph.c:132
#define Kit_GraphForEachLeaf(pGraph, pLeaf, i)
Definition kit.h:505
Kit_Graph_t * Kit_TruthToGraph(unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
Definition kitGraph.c:356
unsigned fCompl
Definition kit.h:65
unsigned Node
Definition kit.h:66
Kit_Edge_t eEdge0
Definition kit.h:72
Kit_Edge_t eEdge1
Definition kit.h:73
void * pFunc
Definition kit.h:76