abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
cnfMap.c File Reference
#include "cnf.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START void Cnf_CutAssignAreaFlow (Cnf_Man_t *p, Dar_Cut_t *pCut, int *pAreaFlows)
 DECLARATIONS ///. More...
 
int Cnf_CutSuperAreaFlow (Vec_Ptr_t *vSuper, int *pAreaFlows)
 
void Cnf_DeriveMapping (Cnf_Man_t *p)
 

Function Documentation

ABC_NAMESPACE_IMPL_START void Cnf_CutAssignAreaFlow ( Cnf_Man_t p,
Dar_Cut_t pCut,
int *  pAreaFlows 
)

DECLARATIONS ///.

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

FileName [cnfMap.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [AIG-to-CNF conversion.]

Synopsis []

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - April 28, 2007.]

Revision [

Id:
cnfMap.c,v 1.00 2007/04/28 00:00:00 alanmi Exp

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

Synopsis [Computes area flow of the cut.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file cnfMap.c.

46 {
47  Aig_Obj_t * pLeaf;
48  int i;
49  pCut->Value = 0;
50 // pCut->uSign = 100 * Cnf_CutSopCost( p, pCut );
51  pCut->uSign = 10 * Cnf_CutSopCost( p, pCut );
52  Dar_CutForEachLeaf( p->pManAig, pCut, pLeaf, i )
53  {
54  pCut->Value += pLeaf->nRefs;
55  if ( !Aig_ObjIsNode(pLeaf) )
56  continue;
57  assert( pLeaf->nRefs > 0 );
58  pCut->uSign += pAreaFlows[pLeaf->Id] / (pLeaf->nRefs? pLeaf->nRefs : 1);
59  }
60 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Cnf_CutSopCost(Cnf_Man_t *p, Dar_Cut_t *pCut)
Definition: cnf.h:99
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Definition: aig.h:69
#define Dar_CutForEachLeaf(p, pCut, pLeaf, i)
Definition: darInt.h:124
unsigned uSign
Definition: darInt.h:57
#define assert(ex)
Definition: util_old.h:213
unsigned Value
Definition: darInt.h:59
int Id
Definition: aig.h:85
unsigned int nRefs
Definition: aig.h:81
int Cnf_CutSuperAreaFlow ( Vec_Ptr_t vSuper,
int *  pAreaFlows 
)

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

Synopsis [Computes area flow of the supergate.]

Description []

SideEffects []

SeeAlso []

Definition at line 73 of file cnfMap.c.

74 {
75  Aig_Obj_t * pLeaf;
76  int i, nAreaFlow;
77  nAreaFlow = 100 * (Vec_PtrSize(vSuper) + 1);
78  Vec_PtrForEachEntry( Aig_Obj_t *, vSuper, pLeaf, i )
79  {
80  pLeaf = Aig_Regular(pLeaf);
81  if ( !Aig_ObjIsNode(pLeaf) )
82  continue;
83  assert( pLeaf->nRefs > 0 );
84  nAreaFlow += pAreaFlows[pLeaf->Id] / (pLeaf->nRefs? pLeaf->nRefs : 1);
85  }
86  return nAreaFlow;
87 }
static Aig_Obj_t * Aig_Regular(Aig_Obj_t *p)
Definition: aig.h:246
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Aig_ObjIsNode(Aig_Obj_t *pObj)
Definition: aig.h:280
Definition: aig.h:69
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
int Id
Definition: aig.h:85
unsigned int nRefs
Definition: aig.h:81
void Cnf_DeriveMapping ( Cnf_Man_t p)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 100 of file cnfMap.c.

101 {
102  Vec_Ptr_t * vSuper;
103  Aig_Obj_t * pObj;
104  Dar_Cut_t * pCut, * pCutBest;
105  int i, k, AreaFlow, * pAreaFlows;
106  // allocate area flows
107  pAreaFlows = ABC_ALLOC( int, Aig_ManObjNumMax(p->pManAig) );
108  memset( pAreaFlows, 0, sizeof(int) * Aig_ManObjNumMax(p->pManAig) );
109  // visit the nodes in the topological order and update their best cuts
110  vSuper = Vec_PtrAlloc( 100 );
111  Aig_ManForEachNode( p->pManAig, pObj, i )
112  {
113  // go through the cuts
114  pCutBest = NULL;
115  Dar_ObjForEachCut( pObj, pCut, k )
116  {
117  pCut->fBest = 0;
118  if ( k == 0 )
119  continue;
120  Cnf_CutAssignAreaFlow( p, pCut, pAreaFlows );
121  if ( pCutBest == NULL || pCutBest->uSign > pCut->uSign ||
122  (pCutBest->uSign == pCut->uSign && pCutBest->Value < pCut->Value) )
123  pCutBest = pCut;
124  }
125  // check the big cut
126 // Aig_ObjCollectSuper( pObj, vSuper );
127  // get the area flow of this cut
128 // AreaFlow = Cnf_CutSuperAreaFlow( vSuper, pAreaFlows );
129  AreaFlow = ABC_INFINITY;
130  if ( AreaFlow >= (int)pCutBest->uSign )
131  {
132  pAreaFlows[pObj->Id] = pCutBest->uSign;
133  pCutBest->fBest = 1;
134  }
135  else
136  {
137  pAreaFlows[pObj->Id] = AreaFlow;
138  pObj->fMarkB = 1; // mark the special node
139  }
140  }
141  Vec_PtrFree( vSuper );
142  ABC_FREE( pAreaFlows );
143 
144 /*
145  // compute the area of mapping
146  AreaFlow = 0;
147  Aig_ManForEachCo( p->pManAig, pObj, i )
148  AreaFlow += Dar_ObjBestCut(Aig_ObjFanin0(pObj))->uSign / 100 / Aig_ObjFanin0(pObj)->nRefs;
149  printf( "Area of the network = %d.\n", AreaFlow );
150 */
151 }
char * memset()
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
unsigned int fMarkB
Definition: aig.h:80
unsigned fBest
Definition: darInt.h:60
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
#define Dar_ObjForEachCut(pObj, pCut, i)
Definition: darInt.h:121
#define Aig_ManForEachNode(p, pObj, i)
Definition: aig.h:413
ABC_NAMESPACE_IMPL_START void Cnf_CutAssignAreaFlow(Cnf_Man_t *p, Dar_Cut_t *pCut, int *pAreaFlows)
DECLARATIONS ///.
Definition: cnfMap.c:45
Definition: aig.h:69
static int Aig_ManObjNumMax(Aig_Man_t *p)
Definition: aig.h:259
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define ABC_INFINITY
MACRO DEFINITIONS ///.
Definition: abc_global.h:216
unsigned uSign
Definition: darInt.h:57
unsigned Value
Definition: darInt.h:59
int Id
Definition: aig.h:85
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223