#include "cnf.h"
Go to the source code of this file.
Functions | |
void | Cnf_CutAssignAreaFlow (Cnf_Man_t *p, Dar_Cut_t *pCut, int *pAreaFlows) |
int | Cnf_CutSuperAreaFlow (Vec_Ptr_t *vSuper, int *pAreaFlows) |
void | Cnf_DeriveMapping (Cnf_Man_t *p) |
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 [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Computes area flow of the cut.]
Description []
SideEffects []
SeeAlso []
Definition at line 42 of file cnfMap.c.
00043 { 00044 Aig_Obj_t * pLeaf; 00045 int i; 00046 pCut->Value = 0; 00047 pCut->uSign = 100 * Cnf_CutSopCost( p, pCut ); 00048 Dar_CutForEachLeaf( p->pManAig, pCut, pLeaf, i ) 00049 { 00050 pCut->Value += pLeaf->nRefs; 00051 if ( !Aig_ObjIsNode(pLeaf) ) 00052 continue; 00053 assert( pLeaf->nRefs > 0 ); 00054 pCut->uSign += pAreaFlows[pLeaf->Id] / (pLeaf->nRefs? pLeaf->nRefs : 1); 00055 } 00056 }
int Cnf_CutSuperAreaFlow | ( | Vec_Ptr_t * | vSuper, | |
int * | pAreaFlows | |||
) |
Function*************************************************************
Synopsis [Computes area flow of the supergate.]
Description []
SideEffects []
SeeAlso []
Definition at line 69 of file cnfMap.c.
00070 { 00071 Aig_Obj_t * pLeaf; 00072 int i, nAreaFlow; 00073 nAreaFlow = 100 * (Vec_PtrSize(vSuper) + 1); 00074 Vec_PtrForEachEntry( vSuper, pLeaf, i ) 00075 { 00076 pLeaf = Aig_Regular(pLeaf); 00077 if ( !Aig_ObjIsNode(pLeaf) ) 00078 continue; 00079 assert( pLeaf->nRefs > 0 ); 00080 nAreaFlow += pAreaFlows[pLeaf->Id] / (pLeaf->nRefs? pLeaf->nRefs : 1); 00081 } 00082 return nAreaFlow; 00083 }
void Cnf_DeriveMapping | ( | Cnf_Man_t * | p | ) |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 96 of file cnfMap.c.
00097 { 00098 Vec_Ptr_t * vSuper; 00099 Aig_Obj_t * pObj; 00100 Dar_Cut_t * pCut, * pCutBest; 00101 int i, k, AreaFlow, * pAreaFlows; 00102 // allocate area flows 00103 pAreaFlows = ALLOC( int, Aig_ManObjNumMax(p->pManAig) ); 00104 memset( pAreaFlows, 0, sizeof(int) * Aig_ManObjNumMax(p->pManAig) ); 00105 // visit the nodes in the topological order and update their best cuts 00106 vSuper = Vec_PtrAlloc( 100 ); 00107 Aig_ManForEachNode( p->pManAig, pObj, i ) 00108 { 00109 // go through the cuts 00110 pCutBest = NULL; 00111 Dar_ObjForEachCut( pObj, pCut, k ) 00112 { 00113 pCut->fBest = 0; 00114 if ( k == 0 ) 00115 continue; 00116 Cnf_CutAssignAreaFlow( p, pCut, pAreaFlows ); 00117 if ( pCutBest == NULL || pCutBest->uSign > pCut->uSign || 00118 (pCutBest->uSign == pCut->uSign && pCutBest->Value < pCut->Value) ) 00119 pCutBest = pCut; 00120 } 00121 // check the big cut 00122 // Aig_ObjCollectSuper( pObj, vSuper ); 00123 // get the area flow of this cut 00124 // AreaFlow = Cnf_CutSuperAreaFlow( vSuper, pAreaFlows ); 00125 AreaFlow = AIG_INFINITY; 00126 if ( AreaFlow >= (int)pCutBest->uSign ) 00127 { 00128 pAreaFlows[pObj->Id] = pCutBest->uSign; 00129 pCutBest->fBest = 1; 00130 } 00131 else 00132 { 00133 pAreaFlows[pObj->Id] = AreaFlow; 00134 pObj->fMarkB = 1; // mark the special node 00135 } 00136 } 00137 Vec_PtrFree( vSuper ); 00138 free( pAreaFlows ); 00139 00140 /* 00141 // compute the area of mapping 00142 AreaFlow = 0; 00143 Aig_ManForEachPo( p->pManAig, pObj, i ) 00144 AreaFlow += Dar_ObjBestCut(Aig_ObjFanin0(pObj))->uSign / 100 / Aig_ObjFanin0(pObj)->nRefs; 00145 printf( "Area of the network = %d.\n", AreaFlow ); 00146 */ 00147 }