abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
giaMfs.c File Reference
#include "gia.h"
#include "opt/sfm/sfm.h"
#include "misc/tim/tim.h"

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START
Sfm_Ntk_t
Gia_ManExtractMfs (Gia_Man_t *p)
 DECLARATIONS ///. More...
 
Gia_Man_tGia_ManInsertMfs (Gia_Man_t *p, Sfm_Ntk_t *pNtk)
 
Gia_Man_tGia_ManPerformMfs (Gia_Man_t *p, Sfm_Par_t *pPars)
 

Function Documentation

ABC_NAMESPACE_IMPL_START Sfm_Ntk_t* Gia_ManExtractMfs ( Gia_Man_t p)

DECLARATIONS ///.

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

FileName [giaMfs.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Scalable AIG package.]

Synopsis [Interface with the MFS package.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
giaMfs.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file giaMfs.c.

47 {
48  word uTruth, uTruths6[6] = {
49  ABC_CONST(0xAAAAAAAAAAAAAAAA),
50  ABC_CONST(0xCCCCCCCCCCCCCCCC),
51  ABC_CONST(0xF0F0F0F0F0F0F0F0),
52  ABC_CONST(0xFF00FF00FF00FF00),
53  ABC_CONST(0xFFFF0000FFFF0000),
54  ABC_CONST(0xFFFFFFFF00000000)
55  };
56  Gia_Obj_t * pObj, * pObjExtra;
57  Vec_Wec_t * vFanins; // mfs data
58  Vec_Str_t * vFixed; // mfs data
59  Vec_Str_t * vEmpty; // mfs data
60  Vec_Wrd_t * vTruths; // mfs data
61  Vec_Int_t * vArray;
62  Vec_Int_t * vLeaves;
63  Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
64  int nBoxes = Gia_ManBoxNum(p);
65  int nRealPis = nBoxes ? Tim_ManPiNum(pManTime) : Gia_ManPiNum(p);
66  int nRealPos = nBoxes ? Tim_ManPoNum(pManTime) : Gia_ManPoNum(p);
67  int i, j, k, curCi, curCo, nBoxIns, nBoxOuts;
68  int Id, iFan, nMfsVars, Counter = 0;
69  assert( !p->pAigExtra || Gia_ManPiNum(p->pAigExtra) <= 6 );
70  // prepare storage
71  nMfsVars = Gia_ManCiNum(p) + 1 + Gia_ManLutNum(p) + Gia_ManCoNum(p);
72  vFanins = Vec_WecStart( nMfsVars );
73  vFixed = Vec_StrStart( nMfsVars );
74  vEmpty = Vec_StrStart( nMfsVars );
75  vTruths = Vec_WrdStart( nMfsVars );
76  // set internal PIs
78  Gia_ManForEachCiId( p, Id, i )
79  Gia_ObjSetCopyArray( p, Id, Counter++ );
80  // set constant node
81  Vec_StrWriteEntry( vFixed, Counter, (char)1 );
82  Vec_WrdWriteEntry( vTruths, Counter, (word)0 );
83  Gia_ObjSetCopyArray( p, 0, Counter++ );
84  // set internal LUTs
85  vLeaves = Vec_IntAlloc( 6 );
87  Gia_ManForEachLut( p, Id )
88  {
89  Vec_IntClear( vLeaves );
90  vArray = Vec_WecEntry( vFanins, Counter );
91  Vec_IntGrow( vArray, Gia_ObjLutSize(p, Id) );
92  Gia_LutForEachFanin( p, Id, iFan, k )
93  {
94  assert( Gia_ObjCopyArray(p, iFan) >= 0 );
95  Vec_IntPush( vArray, Gia_ObjCopyArray(p, iFan) );
96  Vec_IntPush( vLeaves, iFan );
97  }
98  assert( Vec_IntSize(vLeaves) <= 6 );
99  assert( Vec_IntSize(vLeaves) == Gia_ObjLutSize(p, Id) );
100  uTruth = *Gia_ObjComputeTruthTableCut( p, Gia_ManObj(p, Id), vLeaves );
101  Vec_WrdWriteEntry( vTruths, Counter, uTruth );
102  Gia_ObjSetCopyArray( p, Id, Counter++ );
103  }
105  // set all POs
106  Gia_ManForEachCo( p, pObj, i )
107  {
108  iFan = Gia_ObjFaninId0p( p, pObj );
109  assert( Gia_ObjCopyArray(p, iFan) >= 0 );
110  vArray = Vec_WecEntry( vFanins, Counter );
111  Vec_IntFill( vArray, 1, Gia_ObjCopyArray(p, iFan) );
112  if ( i < Gia_ManCoNum(p) - nRealPos ) // internal PO
113  {
114  Vec_StrWriteEntry( vFixed, Counter, (char)1 );
115  Vec_StrWriteEntry( vEmpty, Counter, (char)1 );
116  uTruth = Gia_ObjFaninC0(pObj) ? ~uTruths6[0]: uTruths6[0];
117  Vec_WrdWriteEntry( vTruths, Counter, uTruth );
118  }
119  Gia_ObjSetCopyArray( p, Gia_ObjId(p, pObj), Counter++ );
120  }
121  assert( Counter == nMfsVars );
122  // add functions of the boxes
123  if ( p->pAigExtra )
124  {
125  Gia_ObjComputeTruthTableStart( p->pAigExtra, 6 );
126  curCi = nRealPis;
127  curCo = 0;
128  for ( k = 0; k < nBoxes; k++ )
129  {
130  assert( !Tim_ManBoxIsBlack(pManTime, k) );
131  nBoxIns = Tim_ManBoxInputNum( pManTime, k );
132  nBoxOuts = Tim_ManBoxOutputNum( pManTime, k );
133  // collect truth table leaves
134  Vec_IntClear( vLeaves );
135  for ( i = 0; i < nBoxIns; i++ )
136  Vec_IntPush( vLeaves, Gia_ObjId(p->pAigExtra, Gia_ManCi(p->pAigExtra, i)) );
137  // iterate through box outputs
138  //printf( "Box %d:\n", k );
139  for ( j = 0; j < nBoxOuts; j++ )
140  {
141  // CI corresponding to the box outputs
142  pObj = Gia_ManCi( p, curCi + j );
143  Counter = Gia_ObjCopyArray( p, Gia_ObjId(p, pObj) );
144  // box output in the extra manager
145  pObjExtra = Gia_ManCo( p->pAigExtra, curCi - nRealPis + j );
146  // compute truth table
147  if ( Gia_ObjFaninId0p(p->pAigExtra, pObjExtra) == 0 )
148  uTruth = 0;
149  else if ( Gia_ObjIsCi(Gia_ObjFanin0(pObjExtra)) )
150  uTruth = uTruths6[Gia_ObjCioId(Gia_ObjFanin0(pObjExtra))];
151  else
152  uTruth = *Gia_ObjComputeTruthTableCut( p->pAigExtra, Gia_ObjFanin0(pObjExtra), vLeaves );
153  uTruth = Gia_ObjFaninC0(pObjExtra) ? ~uTruth : uTruth;
154  Vec_WrdWriteEntry( vTruths, Counter, uTruth );
155  //Dau_DsdPrintFromTruth( &uTruth, Vec_IntSize(vLeaves) );
156  // add box inputs (POs of the AIG) as fanins
157  vArray = Vec_WecEntry( vFanins, Counter );
158  Vec_IntGrow( vArray, nBoxIns );
159  for ( i = 0; i < nBoxIns; i++ )
160  {
161  iFan = Gia_ObjId( p, Gia_ManCo(p, curCo + i) );
162  assert( Gia_ObjCopyArray(p, iFan) >= 0 );
163  Vec_IntPush( vArray, Gia_ObjCopyArray(p, iFan) );
164  }
165  Vec_StrWriteEntry( vFixed, Counter, (char)1 );
166  }
167  // set internal POs pointing directly to internal PIs as no-delay
168  for ( i = 0; i < nBoxIns; i++ )
169  {
170  pObj = Gia_ManCo( p, curCo + i );
171  if ( !Gia_ObjIsCi( Gia_ObjFanin0(pObj) ) )
172  continue;
173  Counter = Gia_ObjCopyArray( p, Gia_ObjFaninId0p(p, pObj) );
174  Vec_StrWriteEntry( vEmpty, Counter, (char)1 );
175  }
176  curCo += nBoxIns;
177  curCi += nBoxOuts;
178  }
179  curCo += nRealPos;
180  Gia_ObjComputeTruthTableStop( p->pAigExtra );
181  // verify counts
182  assert( curCi == Gia_ManCiNum(p) );
183  assert( curCo == Gia_ManCoNum(p) );
184  assert( curCi - nRealPis == Gia_ManCoNum(p->pAigExtra) );
185  }
186  // finalize
187  Vec_IntFree( vLeaves );
188  return Sfm_NtkConstruct( vFanins, nRealPis, nRealPos, vFixed, vEmpty, vTruths );
189 }
static void Gia_ManCleanCopyArray(Gia_Man_t *p)
Definition: gia.h:489
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
void Gia_ObjComputeTruthTableStart(Gia_Man_t *p, int nVarsMax)
Definition: giaTruth.c:282
Gia_Man_t * pAigExtra
Definition: gia.h:149
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
word * Gia_ObjComputeTruthTableCut(Gia_Man_t *p, Gia_Obj_t *pObj, Vec_Int_t *vLeaves)
Definition: giaTruth.c:351
static Vec_Wec_t * Vec_WecStart(int nSize)
Definition: vecWec.h:98
void Gia_ObjComputeTruthTableStop(Gia_Man_t *p)
Definition: giaTruth.c:293
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
int Gia_ManLutNum(Gia_Man_t *p)
Definition: giaIf.c:144
static Gia_Obj_t * Gia_ManObj(Gia_Man_t *p, int v)
Definition: gia.h:402
Definition: gia.h:75
#define Gia_ManForEachLut(p, i)
Definition: gia.h:968
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
#define Gia_ManForEachCiId(p, Id, i)
Definition: gia.h:1018
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: bblif.c:336
static void Vec_StrWriteEntry(Vec_Str_t *p, int i, char Entry)
Definition: vecStr.h:370
static Gia_Obj_t * Gia_ObjFanin0(Gia_Obj_t *pObj)
Definition: gia.h:454
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static int Gia_ObjLutSize(Gia_Man_t *p, int Id)
Definition: gia.h:953
int Gia_ManBoxNum(Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaTim.c:49
static void Vec_WrdWriteEntry(Vec_Wrd_t *p, int i, word Entry)
Definition: vecWrd.h:418
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static int Gia_ObjCopyArray(Gia_Man_t *p, int iObj)
Definition: gia.h:487
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:356
static Vec_Str_t * Vec_StrStart(int nSize)
Definition: vecStr.h:95
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
void * pManTime
Definition: gia.h:165
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
static int Counter
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
Definition: vecWec.h:142
static Vec_Wrd_t * Vec_WrdStart(int nSize)
Definition: vecWrd.h:103
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
int Tim_ManBoxIsBlack(Tim_Man_t *p, int iBox)
Definition: timBox.c:257
static void Gia_ObjSetCopyArray(Gia_Man_t *p, int iObj, int iLit)
Definition: gia.h:488
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
Sfm_Ntk_t * Sfm_NtkConstruct(Vec_Wec_t *vFanins, int nPis, int nPos, Vec_Str_t *vFixed, Vec_Str_t *vEmpty, Vec_Wrd_t *vTruths)
Definition: sfmNtk.c:167
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
static int Gia_ObjIsCi(Gia_Obj_t *pObj)
Definition: gia.h:420
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
#define Gia_LutForEachFanin(p, i, iFan, k)
Definition: gia.h:970
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
static int Gia_ObjCioId(Gia_Obj_t *pObj)
Definition: gia.h:411
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Gia_Man_t* Gia_ManInsertMfs ( Gia_Man_t p,
Sfm_Ntk_t pNtk 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 202 of file giaMfs.c.

203 {
204  extern int Gia_ManFromIfLogicCreateLut( Gia_Man_t * pNew, word * pRes, Vec_Int_t * vLeaves, Vec_Int_t * vCover, Vec_Int_t * vMapping, Vec_Int_t * vMapping2 );
205  Gia_Man_t * pNew; Gia_Obj_t * pObj;
206  Tim_Man_t * pManTime = (Tim_Man_t *)p->pManTime;
207  int nBoxes = Gia_ManBoxNum(p);
208  int nRealPis = nBoxes ? Tim_ManPiNum(pManTime) : Gia_ManPiNum(p);
209  int nRealPos = nBoxes ? Tim_ManPoNum(pManTime) : Gia_ManPoNum(p);
210  int i, k, Id, curCi, curCo, nBoxIns, nBoxOuts, iLitNew, iMfsId, iGroup, Fanin;
211  int nMfsNodes = 1 + Gia_ManCiNum(p) + Gia_ManLutNum(p) + Gia_ManCoNum(p);
212  word * pTruth, uTruthVar = ABC_CONST(0xAAAAAAAAAAAAAAAA);
213  Vec_Wec_t * vGroups = Vec_WecStart( nBoxes );
214  Vec_Int_t * vMfs2Gia = Vec_IntStartFull( nMfsNodes );
215  Vec_Int_t * vGroupMap = Vec_IntStartFull( nMfsNodes );
216  Vec_Int_t * vMfsTopo, * vCover, * vBoxesLeft;
217  Vec_Int_t * vArray, * vLeaves;
218  Vec_Int_t * vMapping, * vMapping2;
219  // collect nodes
220  curCi = nRealPis;
221  curCo = 0;
222  for ( i = 0; i < nBoxes; i++ )
223  {
224  nBoxIns = Tim_ManBoxInputNum( pManTime, i );
225  nBoxOuts = Tim_ManBoxOutputNum( pManTime, i );
226  vArray = Vec_WecEntry( vGroups, i );
227  for ( k = 0; k < nBoxIns; k++ )
228  {
229  pObj = Gia_ManCo( p, curCo + k );
230  iMfsId = Gia_ObjCopyArray( p, Gia_ObjId(p, pObj) );
231  assert( iMfsId > 0 );
232  Vec_IntPush( vArray, iMfsId );
233  Vec_IntWriteEntry( vGroupMap, iMfsId, Abc_Var2Lit(i,0) );
234  }
235  for ( k = 0; k < nBoxOuts; k++ )
236  {
237  pObj = Gia_ManCi( p, curCi + k );
238  iMfsId = Gia_ObjCopyArray( p, Gia_ObjId(p, pObj) );
239  assert( iMfsId > 0 );
240  Vec_IntPush( vArray, iMfsId );
241  Vec_IntWriteEntry( vGroupMap, iMfsId, Abc_Var2Lit(i,1) );
242  }
243  curCo += nBoxIns;
244  curCi += nBoxOuts;
245  }
246  curCo += nRealPos;
247  assert( curCi == Gia_ManCiNum(p) );
248  assert( curCo == Gia_ManCoNum(p) );
249 
250  // collect nodes in the given order
251  vBoxesLeft = Vec_IntAlloc( nBoxes );
252  vMfsTopo = Sfm_NtkDfs( pNtk, vGroups, vGroupMap, vBoxesLeft );
253  assert( Vec_IntSize(vBoxesLeft) <= nBoxes );
254  assert( Vec_IntSize(vMfsTopo) > 0 );
255 
256  // start new GIA
257  pNew = Gia_ManStart( Gia_ManObjNum(p) );
258  pNew->pName = Abc_UtilStrsav( p->pName );
259  pNew->pSpec = Abc_UtilStrsav( p->pSpec );
260 
261  // start mapping
262  vMapping = Vec_IntStart( Gia_ManObjNum(p) );
263  vMapping2 = Vec_IntStart( 1 );
264  // create const LUT
265  Vec_IntWriteEntry( vMapping, 0, Vec_IntSize(vMapping2) );
266  Vec_IntPush( vMapping2, 0 );
267  Vec_IntPush( vMapping2, 0 );
268 
269  // map constant
270  Vec_IntWriteEntry( vMfs2Gia, Gia_ObjCopyArray(p, 0), 0 );
271  // map primary inputs
272  Gia_ManForEachCiId( p, Id, i )
273  if ( i < nRealPis )
274  Vec_IntWriteEntry( vMfs2Gia, Gia_ObjCopyArray(p, Id), Gia_ManAppendCi(pNew) );
275  // map internal nodes
276  vLeaves = Vec_IntAlloc( 6 );
277  vCover = Vec_IntAlloc( 1 << 16 );
278  Vec_IntForEachEntry( vMfsTopo, iMfsId, i )
279  {
280  pTruth = Sfm_NodeReadTruth( pNtk, iMfsId );
281  iGroup = Vec_IntEntry( vGroupMap, iMfsId );
282  vArray = Sfm_NodeReadFanins( pNtk, iMfsId ); // belongs to pNtk
283  Vec_IntClear( vLeaves );
284  Vec_IntForEachEntry( vArray, Fanin, k )
285  {
286  iLitNew = Vec_IntEntry( vMfs2Gia, Fanin ); assert( iLitNew >= 0 );
287  Vec_IntPush( vLeaves, iLitNew );
288  }
289  if ( iGroup == -1 ) // internal node
290  {
291  assert( Sfm_NodeReadUsed(pNtk, iMfsId) );
292  iLitNew = Gia_ManFromIfLogicCreateLut( pNew, pTruth, vLeaves, vCover, vMapping, vMapping2 );
293  }
294  else if ( Abc_LitIsCompl(iGroup) ) // internal CI
295  {
296  //Dau_DsdPrintFromTruth( pTruth, Vec_IntSize(vLeaves) );
297  iLitNew = Gia_ManAppendCi( pNew );
298  }
299  else // internal CO
300  {
301  iLitNew = Gia_ManAppendCo( pNew, Abc_LitNotCond(Vec_IntEntry(vLeaves, 0), pTruth[0] == ~uTruthVar) );
302  //printf("Group = %d. po = %d\n", iGroup>>1, iMfsId );
303  }
304  Vec_IntWriteEntry( vMfs2Gia, iMfsId, iLitNew );
305  }
306  Vec_IntFree( vCover );
307  Vec_IntFree( vLeaves );
308 
309  // map primary outputs
310  Gia_ManForEachCo( p, pObj, i )
311  {
312  if ( i < Gia_ManCoNum(p) - nRealPos ) // internal COs
313  {
314  iMfsId = Gia_ObjCopyArray( p, Gia_ObjId(p, pObj) );
315  iGroup = Vec_IntEntry( vGroupMap, iMfsId );
316  if ( Vec_IntFind(vMfsTopo, iGroup) >= 0 )
317  {
318  iLitNew = Vec_IntEntry( vMfs2Gia, iMfsId );
319  assert( iLitNew >= 0 );
320  }
321  continue;
322  }
323  iLitNew = Vec_IntEntry( vMfs2Gia, Gia_ObjCopyArray(p, Gia_ObjFaninId0p(p, pObj)) );
324  assert( iLitNew >= 0 );
325  Gia_ManAppendCo( pNew, Abc_LitNotCond(iLitNew, Gia_ObjFaninC0(pObj)) );
326  }
327 
328  // finish mapping
329  if ( Vec_IntSize(vMapping) > Gia_ManObjNum(pNew) )
330  Vec_IntShrink( vMapping, Gia_ManObjNum(pNew) );
331  else
332  Vec_IntFillExtra( vMapping, Gia_ManObjNum(pNew), 0 );
333  assert( Vec_IntSize(vMapping) == Gia_ManObjNum(pNew) );
334  Vec_IntForEachEntry( vMapping, iLitNew, i )
335  if ( iLitNew > 0 )
336  Vec_IntAddToEntry( vMapping, i, Gia_ManObjNum(pNew) );
337  Vec_IntAppend( vMapping, vMapping2 );
338  Vec_IntFree( vMapping2 );
339  assert( pNew->vMapping == NULL );
340  pNew->vMapping = vMapping;
341 
342  // create new timing manager and extra AIG
343  if ( pManTime )
344  pNew->pManTime = Gia_ManUpdateTimMan2( p, vBoxesLeft, 0 );
345  // update extra STG
346  if ( p->pAigExtra )
347  pNew->pAigExtra = Gia_ManUpdateExtraAig2( p->pManTime, p->pAigExtra, vBoxesLeft );
348  // duplicated flops
349  if ( p->vRegClasses )
350  pNew->vRegClasses = Vec_IntDup( p->vRegClasses );
351 
352  // cleanup
353  Vec_WecFree( vGroups );
354  Vec_IntFree( vMfsTopo );
355  Vec_IntFree( vGroupMap );
356  Vec_IntFree( vMfs2Gia );
357  Vec_IntFree( vBoxesLeft );
358  return pNew;
359 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Wec_t_ Vec_Wec_t
INCLUDES ///.
Definition: vecWec.h:42
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
#define Gia_ManForEachCo(p, pObj, i)
Definition: gia.h:1022
static int Gia_ManPoNum(Gia_Man_t *p)
Definition: gia.h:386
static Gia_Obj_t * Gia_ManCi(Gia_Man_t *p, int v)
Definition: gia.h:403
static int Gia_ManAppendCo(Gia_Man_t *p, int iLit0)
Definition: gia.h:703
static void Vec_IntFillExtra(Vec_Int_t *p, int nSize, int Fill)
Definition: bblif.c:376
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Vec_Int_t * Sfm_NtkDfs(Sfm_Ntk_t *p, Vec_Wec_t *vGroups, Vec_Int_t *vGroupMap, Vec_Int_t *vBoxesLeft)
Definition: sfmWin.c:166
static void Vec_WecFree(Vec_Wec_t *p)
Definition: vecWec.h:345
Vec_Int_t * Sfm_NodeReadFanins(Sfm_Ntk_t *p, int i)
Definition: sfmNtk.c:358
static int Gia_ManAppendCi(Gia_Man_t *p)
Definition: gia.h:583
static Vec_Wec_t * Vec_WecStart(int nSize)
Definition: vecWec.h:98
static int Abc_Var2Lit(int Var, int fCompl)
Definition: abc_global.h:263
static int Vec_IntFind(Vec_Int_t *p, int Entry)
Definition: vecInt.h:895
int Tim_ManBoxOutputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:202
int Gia_ManLutNum(Gia_Man_t *p)
Definition: giaIf.c:144
int Gia_ManFromIfLogicCreateLut(Gia_Man_t *pNew, word *pRes, Vec_Int_t *vLeaves, Vec_Int_t *vCover, Vec_Int_t *vMapping, Vec_Int_t *vMapping2)
Definition: giaIf.c:952
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static int Abc_LitNotCond(int Lit, int c)
Definition: abc_global.h:267
Definition: gia.h:75
int Tim_ManPiNum(Tim_Man_t *p)
Definition: timMan.c:688
int Sfm_NodeReadUsed(Sfm_Ntk_t *p, int i)
Definition: sfmNtk.c:370
#define Gia_ManForEachCiId(p, Id, i)
Definition: gia.h:1018
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
Gia_Man_t * Gia_ManUpdateExtraAig2(void *pTime, Gia_Man_t *pAig, Vec_Int_t *vBoxesLeft)
Definition: giaTim.c:702
static Vec_Int_t * Vec_IntStart(int nSize)
Definition: bblif.c:172
static int Abc_LitIsCompl(int Lit)
Definition: abc_global.h:265
char * pName
Definition: gia.h:97
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
int Gia_ManBoxNum(Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaTim.c:49
static void Vec_IntAddToEntry(Vec_Int_t *p, int i, int Addition)
Definition: bblif.c:302
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
static int Gia_ObjCopyArray(Gia_Man_t *p, int iObj)
Definition: gia.h:487
if(last==0)
Definition: sparse_int.h:34
char * pSpec
Definition: gia.h:98
Gia_Man_t * Gia_ManStart(int nObjsMax)
DECLARATIONS ///.
Definition: giaMan.c:52
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
static void Vec_IntAppend(Vec_Int_t *vVec1, Vec_Int_t *vVec2)
void * pManTime
Definition: gia.h:165
static int Gia_ObjId(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:410
int Tim_ManBoxInputNum(Tim_Man_t *p, int iBox)
Definition: timBox.c:186
static Vec_Int_t * Vec_WecEntry(Vec_Wec_t *p, int i)
Definition: vecWec.h:142
static int Gia_ManCiNum(Gia_Man_t *p)
Definition: gia.h:383
static Gia_Obj_t * Gia_ManCo(Gia_Man_t *p, int v)
Definition: gia.h:404
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static void Vec_IntShrink(Vec_Int_t *p, int nSizeNew)
Definition: bblif.c:435
#define ABC_CONST(number)
PARAMETERS ///.
Definition: abc_global.h:206
void * Gia_ManUpdateTimMan2(Gia_Man_t *p, Vec_Int_t *vBoxesLeft, int nTermsDiff)
Definition: giaTim.c:664
Definition: gia.h:95
static int Gia_ObjFaninId0p(Gia_Man_t *p, Gia_Obj_t *pObj)
Definition: gia.h:463
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static int Gia_ObjFaninC0(Gia_Obj_t *pObj)
Definition: gia.h:451
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static int Gia_ManPiNum(Gia_Man_t *p)
Definition: gia.h:385
static void Vec_IntClear(Vec_Int_t *p)
Definition: bblif.c:452
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
word * Sfm_NodeReadTruth(Sfm_Ntk_t *p, int i)
Definition: sfmNtk.c:362
int Tim_ManPoNum(Tim_Man_t *p)
Definition: timMan.c:694
static int Gia_ManObjNum(Gia_Man_t *p)
Definition: gia.h:388
static int Gia_ManCoNum(Gia_Man_t *p)
Definition: gia.h:384
Gia_Man_t* Gia_ManPerformMfs ( Gia_Man_t p,
Sfm_Par_t pPars 
)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 372 of file giaMfs.c.

373 {
374  Sfm_Ntk_t * pNtk;
375  Gia_Man_t * pNew;
376  int nFaninMax, nNodes;
377  assert( Gia_ManRegNum(p) == 0 );
378  assert( p->vMapping != NULL );
379  if ( p->pManTime != NULL && p->pAigExtra == NULL )
380  {
381  Abc_Print( 1, "Timing manager is given but there is no GIA of boxes.\n" );
382  return NULL;
383  }
384  // count fanouts
385  nFaninMax = Gia_ManLutSizeMax( p );
386  if ( nFaninMax > 6 )
387  {
388  Abc_Print( 1, "Currently \"&mfs\" cannot process the network containing nodes with more than 6 fanins.\n" );
389  return NULL;
390  }
391  // collect information
392  pNtk = Gia_ManExtractMfs( p );
393  // perform optimization
394  nNodes = Sfm_NtkPerform( pNtk, pPars );
395  if ( nNodes == 0 )
396  {
397  Abc_Print( 1, "The network is not changed by \"&mfs\".\n" );
398  pNew = Gia_ManDup( p );
399  pNew->vMapping = Vec_IntDup( p->vMapping );
400  Gia_ManTransferTiming( pNew, p );
401  }
402  else
403  {
404  pNew = Gia_ManInsertMfs( p, pNtk );
405  if( pPars->fVerbose )
406  Abc_Print( 1, "The network has %d nodes changed by \"&mfs\".\n", nNodes );
407  // check integrity
408  //Gia_ManCheckIntegrityWithBoxes( pNew );
409  }
410  Sfm_NtkFree( pNtk );
411  return pNew;
412 }
Gia_Man_t * Gia_ManDup(Gia_Man_t *p)
Definition: giaDup.c:552
static Vec_Int_t * Vec_IntDup(Vec_Int_t *pVec)
Definition: vecInt.h:214
Gia_Man_t * pAigExtra
Definition: gia.h:149
typedefABC_NAMESPACE_HEADER_START struct Sfm_Ntk_t_ Sfm_Ntk_t
INCLUDES ///.
Definition: sfm.h:41
Gia_Man_t * Gia_ManInsertMfs(Gia_Man_t *p, Sfm_Ntk_t *pNtk)
Definition: giaMfs.c:202
int Sfm_NtkPerform(Sfm_Ntk_t *p, Sfm_Par_t *pPars)
Definition: sfmCore.c:257
void * pManTime
Definition: gia.h:165
void Gia_ManTransferTiming(Gia_Man_t *p, Gia_Man_t *pGia)
Definition: giaIf.c:1912
int Gia_ManLutSizeMax(Gia_Man_t *p)
Definition: giaIf.c:125
static void Abc_Print(int level, const char *format,...)
Definition: abc_global.h:313
int fVerbose
Definition: sfm.h:56
void Sfm_NtkFree(Sfm_Ntk_t *p)
Definition: sfmNtk.c:213
Definition: gia.h:95
#define assert(ex)
Definition: util_old.h:213
Vec_Int_t * vMapping
Definition: gia.h:131
ABC_NAMESPACE_IMPL_START Sfm_Ntk_t * Gia_ManExtractMfs(Gia_Man_t *p)
DECLARATIONS ///.
Definition: giaMfs.c:46
static int Gia_ManRegNum(Gia_Man_t *p)
Definition: gia.h:387