abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
kitAig.c File Reference
#include "kit.h"
#include "aig/aig/aig.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Aig_Obj_t
Kit_GraphToAigInternal (Aig_Man_t *pMan, Kit_Graph_t *pGraph)
 DECLARATIONS ///. More...
 
Aig_Obj_tKit_GraphToAig (Aig_Man_t *pMan, Aig_Obj_t **pFanins, Kit_Graph_t *pGraph)
 
Aig_Obj_tKit_TruthToAig (Aig_Man_t *pMan, Aig_Obj_t **pFanins, unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
 

Function Documentation

Aig_Obj_t* Kit_GraphToAig ( Aig_Man_t pMan,
Aig_Obj_t **  pFanins,
Kit_Graph_t pGraph 
)

Function*************************************************************

Synopsis [Strashes one logic node using its SOP.]

Description []

SideEffects []

SeeAlso []

Definition at line 79 of file kitAig.c.

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 }
#define Kit_GraphForEachLeaf(pGraph, pLeaf, i)
Definition: kit.h:502
ABC_NAMESPACE_IMPL_START Aig_Obj_t * Kit_GraphToAigInternal(Aig_Man_t *pMan, Kit_Graph_t *pGraph)
DECLARATIONS ///.
Definition: kitAig.c:46
ABC_NAMESPACE_IMPL_START Aig_Obj_t* Kit_GraphToAigInternal ( Aig_Man_t pMan,
Kit_Graph_t pGraph 
)

DECLARATIONS ///.

CFile****************************************************************

FileName [kitAig.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Computation kit.]

Synopsis [Procedures involving AIGs.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - Dec 6, 2006.]

Revision [

Id:
kitAig.c,v 1.00 2006/12/06 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [Transforms the decomposition graph into the AIG.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file kitAig.c.

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 }
Kit_Edge_t eEdge0
Definition: kit.h:69
static Kit_Node_t * Kit_GraphNode(Kit_Graph_t *pGraph, int i)
Definition: kit.h:211
Kit_Edge_t eEdge1
Definition: kit.h:70
static int Kit_GraphIsComplement(Kit_Graph_t *pGraph)
Definition: kit.h:205
static int Kit_GraphIsVar(Kit_Graph_t *pGraph)
Definition: kit.h:206
void * pFunc
Definition: kit.h:73
Aig_Obj_t * Aig_And(Aig_Man_t *p, Aig_Obj_t *p0, Aig_Obj_t *p1)
Definition: aigOper.c:104
static int Kit_GraphIsConst(Kit_Graph_t *pGraph)
Definition: kit.h:202
unsigned fCompl
Definition: kit.h:62
#define Kit_GraphForEachNode(pGraph, pAnd, i)
Definition: kit.h:504
unsigned Node
Definition: kit.h:63
Definition: aig.h:69
static Aig_Obj_t * Aig_ManConst1(Aig_Man_t *p)
Definition: aig.h:264
static Kit_Node_t * Kit_GraphVar(Kit_Graph_t *pGraph)
Definition: kit.h:215
static Aig_Obj_t * Aig_NotCond(Aig_Obj_t *p, int c)
Definition: aig.h:248
Aig_Obj_t* Kit_TruthToAig ( Aig_Man_t pMan,
Aig_Obj_t **  pFanins,
unsigned *  pTruth,
int  nVars,
Vec_Int_t vMemory 
)

Function*************************************************************

Synopsis [Strashed onen logic nodes using its truth table.]

Description []

SideEffects []

SeeAlso []

Definition at line 101 of file kitAig.c.

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 }
Aig_Obj_t * Kit_GraphToAig(Aig_Man_t *pMan, Aig_Obj_t **pFanins, Kit_Graph_t *pGraph)
Definition: kitAig.c:79
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
void Kit_GraphFree(Kit_Graph_t *pGraph)
Definition: kitGraph.c:131
Definition: aig.h:69
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
Kit_Graph_t * Kit_TruthToGraph(unsigned *pTruth, int nVars, Vec_Int_t *vMemory)
Definition: kitGraph.c:355