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

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Abc_Obj_t
Abc_ConvertAigToAig (Abc_Ntk_t *pAig, Abc_Obj_t *pObjOld)
 DECLARATIONS ///. More...
 
Abc_Ntk_tRes_WndStrash (Res_Win_t *p)
 FUNCTION DEFINITIONS ///. More...
 

Function Documentation

ABC_NAMESPACE_IMPL_START Abc_Obj_t* Abc_ConvertAigToAig ( Abc_Ntk_t pNtkAig,
Abc_Obj_t pObjOld 
)

DECLARATIONS ///.

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

FileName [resStrash.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Resynthesis package.]

Synopsis [Structural hashing of the nodes in the window.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - January 15, 2007.]

Revision [

Id:
resStrash.c,v 1.00 2007/01/15 00:00:00 alanmi Exp

]

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

Synopsis [Converts the network from AIG to BDD representation.]

Description []

SideEffects []

SeeAlso []

Definition at line 1036 of file abcFunc.c.

1037 {
1038  Hop_Man_t * pHopMan;
1039  Hop_Obj_t * pRoot;
1040  Abc_Obj_t * pFanin;
1041  int i;
1042  // get the local AIG
1043  pHopMan = (Hop_Man_t *)pObjOld->pNtk->pManFunc;
1044  pRoot = (Hop_Obj_t *)pObjOld->pData;
1045  // check the case of a constant
1046  if ( Hop_ObjIsConst1( Hop_Regular(pRoot) ) )
1047  return Abc_ObjNotCond( Abc_AigConst1(pNtkAig), Hop_IsComplement(pRoot) );
1048  // assign the fanin nodes
1049  Abc_ObjForEachFanin( pObjOld, pFanin, i )
1050  {
1051  assert( pFanin->pCopy != NULL );
1052  Hop_ManPi(pHopMan, i)->pData = pFanin->pCopy;
1053  }
1054  // construct the AIG
1055  Abc_ConvertAigToAig_rec( pNtkAig, Hop_Regular(pRoot) );
1056  Hop_ConeUnmark_rec( Hop_Regular(pRoot) );
1057  // return the result
1058  return Abc_ObjNotCond( (Abc_Obj_t *)Hop_Regular(pRoot)->pData, Hop_IsComplement(pRoot) );
1059 }
ABC_DLL Abc_Obj_t * Abc_AigConst1(Abc_Ntk_t *pNtk)
Definition: abcAig.c:683
Definition: hop.h:65
void Hop_ConeUnmark_rec(Hop_Obj_t *pObj)
Definition: hopDfs.c:257
static Hop_Obj_t * Hop_ManPi(Hop_Man_t *p, int i)
Definition: hop.h:134
void * pManFunc
Definition: abc.h:191
Abc_Obj_t * pCopy
Definition: abc.h:148
void Abc_ConvertAigToAig_rec(Abc_Ntk_t *pNtkAig, Hop_Obj_t *pObj)
Definition: abcFunc.c:1013
static int Hop_IsComplement(Hop_Obj_t *p)
Definition: hop.h:129
void * pData
Definition: hop.h:68
static int Hop_ObjIsConst1(Hop_Obj_t *pObj)
Definition: hop.h:155
Abc_Ntk_t * pNtk
Definition: abc.h:130
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static Abc_Obj_t * Abc_ObjNotCond(Abc_Obj_t *p, int c)
Definition: abc.h:325
#define assert(ex)
Definition: util_old.h:213
void * pData
Definition: abc.h:145
static Hop_Obj_t * Hop_Regular(Hop_Obj_t *p)
Definition: hop.h:126
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition: hop.h:49
Abc_Ntk_t* Res_WndStrash ( Res_Win_t p)

FUNCTION DEFINITIONS ///.

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

Synopsis [Structurally hashes the given window.]

Description [The first PO is the observability condition. The second is the node's function. The remaining POs are the candidate divisors.]

SideEffects []

SeeAlso []

Definition at line 49 of file resStrash.c.

50 {
51  Vec_Ptr_t * vPairs;
52  Abc_Ntk_t * pAig;
53  Abc_Obj_t * pObj, * pMiter;
54  int i;
55  assert( Abc_NtkHasAig(p->pNode->pNtk) );
56 // Abc_NtkCleanCopy( p->pNode->pNtk );
57  // create the network
59  pAig->pName = Extra_UtilStrsav( "window" );
60  // create the inputs
61  Vec_PtrForEachEntry( Abc_Obj_t *, p->vLeaves, pObj, i )
62  pObj->pCopy = Abc_NtkCreatePi( pAig );
63  Vec_PtrForEachEntry( Abc_Obj_t *, p->vBranches, pObj, i )
64  pObj->pCopy = Abc_NtkCreatePi( pAig );
65  // go through the nodes in the topological order
66  Vec_PtrForEachEntry( Abc_Obj_t *, p->vNodes, pObj, i )
67  {
68  pObj->pCopy = Abc_ConvertAigToAig( pAig, pObj );
69  if ( pObj == p->pNode )
70  pObj->pCopy = Abc_ObjNot( pObj->pCopy );
71  }
72  // collect the POs
73  vPairs = Vec_PtrAlloc( 2 * Vec_PtrSize(p->vRoots) );
74  Vec_PtrForEachEntry( Abc_Obj_t *, p->vRoots, pObj, i )
75  {
76  Vec_PtrPush( vPairs, pObj->pCopy );
77  Vec_PtrPush( vPairs, NULL );
78  }
79  // mark the TFO of the node
80  Abc_NtkIncrementTravId( p->pNode->pNtk );
81  Res_WinSweepLeafTfo_rec( p->pNode, (int)p->pNode->Level + p->nWinTfoMax );
82  // update strashing of the node
83  p->pNode->pCopy = Abc_ObjNot( p->pNode->pCopy );
84  Abc_NodeSetTravIdPrevious( p->pNode );
85  // redo strashing in the TFO
86  Vec_PtrForEachEntry( Abc_Obj_t *, p->vNodes, pObj, i )
87  {
88  if ( Abc_NodeIsTravIdCurrent(pObj) )
89  pObj->pCopy = Abc_ConvertAigToAig( pAig, pObj );
90  }
91  // collect the POs
92  Vec_PtrForEachEntry( Abc_Obj_t *, p->vRoots, pObj, i )
93  Vec_PtrWriteEntry( vPairs, 2 * i + 1, pObj->pCopy );
94  // add the miter
95  pMiter = Abc_AigMiter( (Abc_Aig_t *)pAig->pManFunc, vPairs, 0 );
96  Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), pMiter );
97  Vec_PtrFree( vPairs );
98  // add the node
99  Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), p->pNode->pCopy );
100  // add the fanins
101  Abc_ObjForEachFanin( p->pNode, pObj, i )
102  Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), pObj->pCopy );
103  // add the divisors
104  Vec_PtrForEachEntry( Abc_Obj_t *, p->vDivs, pObj, i )
105  Abc_ObjAddFanin( Abc_NtkCreatePo(pAig), pObj->pCopy );
106  // add the names
107  Abc_NtkAddDummyPiNames( pAig );
108  Abc_NtkAddDummyPoNames( pAig );
109  // check the resulting network
110  if ( !Abc_NtkCheck( pAig ) )
111  fprintf( stdout, "Res_WndStrash(): Network check has failed.\n" );
112  return pAig;
113 }
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
static void Abc_NodeSetTravIdPrevious(Abc_Obj_t *p)
Definition: abc.h:410
Vec_Ptr_t * vRoots
Definition: llb3Image.c:51
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
ABC_DLL int Abc_NtkCheck(Abc_Ntk_t *pNtk)
FUNCTION DEFINITIONS ///.
Definition: abcCheck.c:61
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
DECLARATIONS ///.
Definition: abcAig.c:52
char * Extra_UtilStrsav(const char *s)
ABC_DLL void Abc_ObjAddFanin(Abc_Obj_t *pObj, Abc_Obj_t *pFanin)
Definition: abcFanio.c:84
ABC_DLL Abc_Ntk_t * Abc_NtkAlloc(Abc_NtkType_t Type, Abc_NtkFunc_t Func, int fUseMemMan)
DECLARATIONS ///.
Definition: abcNtk.c:50
static void check(int expr)
Definition: satSolver.c:46
ABC_DLL void Abc_NtkAddDummyPoNames(Abc_Ntk_t *pNtk)
Definition: abcNames.c:398
ABC_DLL Abc_Obj_t * Abc_AigMiter(Abc_Aig_t *pMan, Vec_Ptr_t *vPairs, int fImplic)
Definition: abcAig.c:789
if(last==0)
Definition: sparse_int.h:34
static Abc_Obj_t * Abc_NtkCreatePi(Abc_Ntk_t *pNtk)
Definition: abc.h:303
static void Vec_PtrWriteEntry(Vec_Ptr_t *p, int i, void *Entry)
Definition: vecPtr.h:396
Vec_Ptr_t * vLeaves
Definition: llb3Image.c:50
Abc_Ntk_t * Res_WndStrash(Res_Win_t *p)
FUNCTION DEFINITIONS ///.
Definition: resStrash.c:49
static int Abc_NodeIsTravIdCurrent(Abc_Obj_t *p)
Definition: abc.h:411
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition: abc.h:524
static void Abc_NtkIncrementTravId(Abc_Ntk_t *p)
Definition: abc.h:406
void Res_WinSweepLeafTfo_rec(Abc_Obj_t *pObj, int nLevelLimit)
Definition: resDivs.c:196
#define assert(ex)
Definition: util_old.h:213
static int Abc_NtkHasAig(Abc_Ntk_t *pNtk)
Definition: abc.h:255
static Abc_Obj_t * Abc_ObjNot(Abc_Obj_t *p)
Definition: abc.h:324
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
ABC_DLL void Abc_NtkAddDummyPiNames(Abc_Ntk_t *pNtk)
Definition: abcNames.c:378
static Abc_Obj_t * Abc_NtkCreatePo(Abc_Ntk_t *pNtk)
Definition: abc.h:304
char * pName
Definition: abc.h:158
ABC_NAMESPACE_IMPL_START Abc_Obj_t * Abc_ConvertAigToAig(Abc_Ntk_t *pAig, Abc_Obj_t *pObjOld)
DECLARATIONS ///.
Definition: abcFunc.c:1036
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223