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

Go to the source code of this file.

Data Structures

struct  Int_Des_t_
 
struct  Int_Obj_t_
 
struct  Int_Ntk_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_IMPL_START
struct Int_Des_t_ 
Int_Des_t
 DECLARATIONS ///. More...
 
typedef struct Int_Obj_t_ Int_Obj_t
 
typedef struct Int_Ntk_t_ Int_Ntk_t
 

Functions

static char * Int_DesName (Int_Des_t *p)
 
static int Int_DesNtkNum (Int_Des_t *p)
 
static Int_Ntk_tInt_DesNtk (Int_Des_t *p, int i)
 
static char * Int_NtkName (Int_Ntk_t *p)
 
static int Int_NtkPiNum (Int_Ntk_t *p)
 
static int Int_NtkPoNum (Int_Ntk_t *p)
 
static int Int_ObjInputNum (Int_Ntk_t *p, Int_Obj_t *pObj)
 
static int Int_ObjOutputNum (Int_Ntk_t *p, Int_Obj_t *pObj)
 
static int Ptr_ManCheckArray (Vec_Ptr_t *vArray)
 FUNCTION DEFINITIONS ///. More...
 
Vec_Int_tPtr_ManDumpArrayToInt (Abc_Nam_t *pNames, Vec_Ptr_t *vVec, int fNode)
 
Vec_Ptr_tPtr_ManDumpArrarArrayToInt (Abc_Nam_t *pNames, Vec_Ptr_t *vNodes, int fNode)
 
Vec_Ptr_tPtr_ManDumpNtkToInt (Abc_Nam_t *pNames, Vec_Ptr_t *vNtk, int i)
 
Vec_Ptr_tPtr_ManDumpToInt (Vec_Ptr_t *vDes)
 
Int_Obj_tInt_ObjAlloc (int nFanins)
 
void Int_ObjFree (Int_Obj_t *p)
 
Int_Ntk_tInt_NtkAlloc (Int_Des_t *pMan, int Id, int nPis, int nPos, int nInsts)
 
void Int_NtkFree (Int_Ntk_t *p)
 
Int_Des_tInt_DesAlloc (char *pName, Abc_Nam_t *pNames, int nModels)
 
void Int_DesFree (Int_Des_t *p)
 
void Ptr_ManFindInputOutputNumbers (Int_Ntk_t *pModel, Vec_Int_t *vBox, Vec_Int_t *vMap)
 
void Ptr_ManConvertNtk (Int_Ntk_t *pNtk, Vec_Ptr_t *vNtk, Vec_Wrd_t *vMap, Vec_Int_t *vMap2)
 
Int_Ntk_tPtr_ManConvertNtkInter (Int_Des_t *pDes, Vec_Ptr_t *vNtk, int Id)
 
Int_Des_tPtr_ManConvert (Vec_Ptr_t *vDesPtr)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_IMPL_START struct Int_Des_t_ Int_Des_t

DECLARATIONS ///.

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

FileName [cbaBuild.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Verilog parser.]

Synopsis [Parses several flavors of word-level Verilog.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - November 29, 2014.]

Revision [

Id:
cbaBuild.c,v 1.00 2014/11/29 00:00:00 alanmi Exp

]

Definition at line 29 of file cbaBuild.c.

typedef struct Int_Ntk_t_ Int_Ntk_t

Definition at line 43 of file cbaBuild.c.

typedef struct Int_Obj_t_ Int_Obj_t

Definition at line 36 of file cbaBuild.c.

Function Documentation

Int_Des_t* Int_DesAlloc ( char *  pName,
Abc_Nam_t pNames,
int  nModels 
)

Definition at line 185 of file cbaBuild.c.

186 {
187  Int_Des_t * p = ABC_CALLOC( Int_Des_t, 1 );
188  p->pName = pName;
189  p->pNames = pNames;
190  Vec_PtrGrow( &p->vModels, nModels );
191  return p;
192 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
typedefABC_NAMESPACE_IMPL_START struct Int_Des_t_ Int_Des_t
DECLARATIONS ///.
Definition: cbaBuild.c:29
void Int_DesFree ( Int_Des_t p)

Definition at line 193 of file cbaBuild.c.

194 {
195  Int_Ntk_t * pTemp; int i;
196  Vec_PtrForEachEntry( Int_Ntk_t *, &p->vModels, pTemp, i )
197  Int_NtkFree( pTemp );
198  ABC_FREE( p );
199 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
void Int_NtkFree(Int_Ntk_t *p)
Definition: cbaBuild.c:172
static char* Int_DesName ( Int_Des_t p)
inlinestatic

Definition at line 57 of file cbaBuild.c.

57 { return p->pName; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Int_Ntk_t* Int_DesNtk ( Int_Des_t p,
int  i 
)
inlinestatic

Definition at line 59 of file cbaBuild.c.

59 { return (Int_Ntk_t *)Vec_PtrEntry( &p->vModels, i ); }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Int_DesNtkNum ( Int_Des_t p)
inlinestatic

Definition at line 58 of file cbaBuild.c.

58 { return Vec_PtrSize( &p->vModels ) - 1; }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Int_Ntk_t* Int_NtkAlloc ( Int_Des_t pMan,
int  Id,
int  nPis,
int  nPos,
int  nInsts 
)

Definition at line 160 of file cbaBuild.c.

161 {
162  Int_Ntk_t * p = ABC_CALLOC( Int_Ntk_t, 1 );
163  p->iName = Id;
164  p->nObjs = nPis + nInsts;
165  p->pMan = pMan;
166  Vec_PtrGrow( &p->vInstances, nInsts );
167  Vec_WrdGrow( &p->vOutputs, nPos );
168  Vec_IntGrow( &p->vInputNames, nPis );
169  Vec_IntGrow( &p->vOutputNames, nPos );
170  return p;
171 }
static void Vec_WrdGrow(Vec_Wrd_t *p, int nCapMin)
Definition: vecWrd.h:469
Vec_Int_t vInputNames
Definition: cbaBuild.c:51
Int_Des_t * pMan
Definition: cbaBuild.c:48
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrGrow(Vec_Ptr_t *p, int nCapMin)
Definition: vecPtr.h:430
Vec_Wrd_t vOutputs
Definition: cbaBuild.c:50
static void Vec_IntGrow(Vec_Int_t *p, int nCapMin)
Definition: bblif.c:336
int iName
Definition: cbaBuild.c:46
Vec_Int_t vOutputNames
Definition: cbaBuild.c:52
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
int nObjs
Definition: cbaBuild.c:47
Vec_Ptr_t vInstances
Definition: cbaBuild.c:49
void Int_NtkFree ( Int_Ntk_t p)

Definition at line 172 of file cbaBuild.c.

173 {
174  Int_Obj_t * pObj; int i;
175  Vec_PtrForEachEntry( Int_Obj_t *, &p->vInstances, pObj, i )
176  Int_ObjFree( pObj );
177  ABC_FREE( p->vInstances.pArray );
178  ABC_FREE( p->vOutputs.pArray );
179  ABC_FREE( p->vInputNames.pArray );
180  ABC_FREE( p->vOutputNames.pArray );
181  Vec_IntFreeP( &p->vCopies );
182  Vec_IntFreeP( &p->vCopies2 );
183  ABC_FREE( p );
184 }
static void Vec_IntFreeP(Vec_Int_t **p)
Definition: vecInt.h:289
#define ABC_FREE(obj)
Definition: abc_global.h:232
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t vInstances
Definition: cbaBuild.c:49
void Int_ObjFree(Int_Obj_t *p)
Definition: cbaBuild.c:156
static char* Int_NtkName ( Int_Ntk_t p)
inlinestatic

Definition at line 61 of file cbaBuild.c.

61 { return Abc_NamStr( p->pMan->pNames, p->iName ); }
Int_Des_t * pMan
Definition: cbaBuild.c:48
int iName
Definition: cbaBuild.c:46
char * Abc_NamStr(Abc_Nam_t *p, int NameId)
Definition: utilNam.c:479
static int Int_NtkPiNum ( Int_Ntk_t p)
inlinestatic

Definition at line 62 of file cbaBuild.c.

62 { return Vec_IntSize( &p->vInputNames ); }
Vec_Int_t vInputNames
Definition: cbaBuild.c:51
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static int Int_NtkPoNum ( Int_Ntk_t p)
inlinestatic

Definition at line 63 of file cbaBuild.c.

63 { return Vec_IntSize( &p->vOutputNames ); }
Vec_Int_t vOutputNames
Definition: cbaBuild.c:52
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Int_Obj_t* Int_ObjAlloc ( int  nFanins)

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

Synopsis [Transform Ptr into Int.]

Description []

SideEffects []

SeeAlso []

Definition at line 149 of file cbaBuild.c.

150 {
151  Int_Obj_t * p = (Int_Obj_t *)ABC_CALLOC( char, sizeof(Int_Obj_t) + sizeof(word) * nFanins );
152  p->vFanins.pArray = (word *)((char *)p + sizeof(Int_Obj_t));
153  p->vFanins.nCap = nFanins;
154  return p;
155 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Vec_Wrd_t vFanins
Definition: cbaBuild.c:41
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
struct Int_Obj_t_ Int_Obj_t
Definition: cbaBuild.c:36
#define ABC_CALLOC(type, num)
Definition: abc_global.h:230
void Int_ObjFree ( Int_Obj_t p)

Definition at line 156 of file cbaBuild.c.

157 {
158  ABC_FREE( p );
159 }
#define ABC_FREE(obj)
Definition: abc_global.h:232
static int Int_ObjInputNum ( Int_Ntk_t p,
Int_Obj_t pObj 
)
inlinestatic

Definition at line 65 of file cbaBuild.c.

65 { return pObj->iModel ? Int_NtkPiNum(Int_DesNtk(p->pMan, pObj->iModel)) : Vec_WrdSize(&pObj->vFanins); }
Int_Des_t * pMan
Definition: cbaBuild.c:48
static int Vec_WrdSize(Vec_Wrd_t *p)
Definition: vecWrd.h:336
static int Int_NtkPiNum(Int_Ntk_t *p)
Definition: cbaBuild.c:62
static Int_Ntk_t * Int_DesNtk(Int_Des_t *p, int i)
Definition: cbaBuild.c:59
int iModel
Definition: cbaBuild.c:39
static int Int_ObjOutputNum ( Int_Ntk_t p,
Int_Obj_t pObj 
)
inlinestatic

Definition at line 66 of file cbaBuild.c.

66 { return pObj->iModel ? Int_NtkPoNum(Int_DesNtk(p->pMan, pObj->iModel)) : 1; }
Int_Des_t * pMan
Definition: cbaBuild.c:48
static int Int_NtkPoNum(Int_Ntk_t *p)
Definition: cbaBuild.c:63
static Int_Ntk_t * Int_DesNtk(Int_Des_t *p, int i)
Definition: cbaBuild.c:59
int iModel
Definition: cbaBuild.c:39
static int Ptr_ManCheckArray ( Vec_Ptr_t vArray)
static

FUNCTION DEFINITIONS ///.

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

Synopsis [Transform Ptr into Int.]

Description []

SideEffects []

SeeAlso []

Definition at line 83 of file cbaBuild.c.

84 {
85  if ( Vec_PtrSize(vArray) == 0 )
86  return 1;
87  if ( Abc_MaxInt(8, Vec_PtrSize(vArray)) == Vec_PtrCap(vArray) )
88  return 1;
89  assert( 0 );
90  return 0;
91 }
static int Abc_MaxInt(int a, int b)
Definition: abc_global.h:238
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static int Vec_PtrCap(Vec_Ptr_t *p)
Definition: vecPtr.h:311
#define assert(ex)
Definition: util_old.h:213
Int_Des_t* Ptr_ManConvert ( Vec_Ptr_t vDesPtr)

Definition at line 312 of file cbaBuild.c.

313 {
314  Vec_Ptr_t * vNtk; int i;
315  char * pName = (char *)Vec_PtrEntry(vDesPtr, 0);
316  Vec_Ptr_t * vDes = Ptr_ManDumpToInt( vDesPtr );
317  Abc_Nam_t * pNames = (Abc_Nam_t *)Vec_PtrEntry(vDes, 0);
318  Vec_Wrd_t * vMap = Vec_WrdStartFull( Abc_NamObjNumMax(pNames) + 1 );
319  Vec_Int_t * vMap2 = Vec_IntStartFull( Abc_NamObjNumMax(pNames) + 1 );
320  Int_Des_t * pDes = Int_DesAlloc( pName, pNames, Vec_PtrSize(vDes)-1 );
321  Vec_PtrForEachEntryStart( Vec_Ptr_t *, vDes, vNtk, i, 1 )
322  Vec_PtrPush( &pDes->vModels, Ptr_ManConvertNtkInter(pDes, vNtk, i) );
323  Vec_PtrForEachEntryStart( Vec_Ptr_t *, vDes, vNtk, i, 1 )
324  Ptr_ManConvertNtk( Int_DesNtk(pDes, i), vNtk, vMap, vMap2 );
325 // Ptr_ManFreeDes( vDes );
326  Vec_IntFree( vMap2 );
327  Vec_WrdFree( vMap );
328  return pDes;
329 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
Int_Des_t * Int_DesAlloc(char *pName, Abc_Nam_t *pNames, int nModels)
Definition: cbaBuild.c:185
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
int Abc_NamObjNumMax(Abc_Nam_t *p)
Definition: utilNam.c:186
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Vec_Int_t * Vec_IntStartFull(int nSize)
Definition: vecInt.h:119
static void Vec_WrdFree(Vec_Wrd_t *p)
Definition: vecWrd.h:260
static Vec_Wrd_t * Vec_WrdStartFull(int nSize)
Definition: vecWrd.h:123
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
Vec_Ptr_t * Ptr_ManDumpToInt(Vec_Ptr_t *vDes)
Definition: cbaBuild.c:121
Int_Ntk_t * Ptr_ManConvertNtkInter(Int_Des_t *pDes, Vec_Ptr_t *vNtk, int Id)
Definition: cbaBuild.c:304
typedefABC_NAMESPACE_HEADER_START struct Abc_Nam_t_ Abc_Nam_t
INCLUDES ///.
Definition: utilNam.h:39
void Ptr_ManConvertNtk(Int_Ntk_t *pNtk, Vec_Ptr_t *vNtk, Vec_Wrd_t *vMap, Vec_Int_t *vMap2)
Definition: cbaBuild.c:220
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
typedefABC_NAMESPACE_IMPL_START struct Int_Des_t_ Int_Des_t
DECLARATIONS ///.
Definition: cbaBuild.c:29
typedefABC_NAMESPACE_HEADER_START struct Vec_Wrd_t_ Vec_Wrd_t
INCLUDES ///.
Definition: vecWrd.h:42
static Int_Ntk_t * Int_DesNtk(Int_Des_t *p, int i)
Definition: cbaBuild.c:59
void Ptr_ManConvertNtk ( Int_Ntk_t pNtk,
Vec_Ptr_t vNtk,
Vec_Wrd_t vMap,
Vec_Int_t vMap2 
)

Definition at line 220 of file cbaBuild.c.

221 {
222  Vec_Int_t * vInputs = (Vec_Int_t *)Vec_PtrEntry(vNtk, 1);
223  Vec_Int_t * vOutputs = (Vec_Int_t *)Vec_PtrEntry(vNtk, 2);
224  Vec_Ptr_t * vNodes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 3);
225  Vec_Ptr_t * vBoxes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4);
226  Vec_Int_t * vNode, * vBox;
227  Int_Ntk_t * pModel;
228  Int_Obj_t * pObj;
229  int i, k, iFormal, iName, nPis, nOffset, nNonDriven = 0;
230 
231  // map primary inputs
232  Vec_IntForEachEntry( vInputs, iName, i )
233  {
234  assert( ~Vec_WrdEntry(vMap, iName) == 0 ); // driven twice
235  Vec_WrdWriteEntry( vMap, iName, i );
236  }
237  // map internal nodes
238  nOffset = Vec_IntSize(vInputs);
239  Vec_PtrForEachEntry( Vec_Int_t *, vNodes, vNode, i )
240  {
241  iName = Vec_IntEntry(vNode, 0);
242  assert( ~Vec_WrdEntry(vMap, iName) == 0 ); // driven twice
243  Vec_WrdWriteEntry( vMap, iName, nOffset + i );
244  }
245  // map internal boxes
246  nOffset += Vec_PtrSize(vNodes);
247  Vec_PtrForEachEntry( Vec_Int_t *, vBoxes, vBox, i )
248  {
249  // get model name
250  iName = Vec_IntEntry( vBox, 0 );
251  assert( iName >= 1 && iName <= Int_DesNtkNum(pNtk->pMan) ); // bad model name
252  pModel = Int_DesNtk( pNtk->pMan, iName );
253  nPis = Int_NtkPiNum( pModel );
254  // replace inputs/outputs by their IDs
255  Ptr_ManFindInputOutputNumbers( pModel, vBox, vMap2 );
256  // go through outputs of this box
257  Vec_IntForEachEntryDouble( vBox, iFormal, iName, k )
258  if ( k > 0 && i >= nPis ) // output
259  {
260  assert( ~Vec_WrdEntry(vMap, iName) == 0 ); // driven twice
261  Vec_WrdWriteEntry( vMap, iName, (nOffset + i) | ((word)iFormal << 32) );
262  }
263  }
264 
265  // save input names
266  Vec_IntForEachEntry( vInputs, iName, i )
267  Vec_IntPush( &pNtk->vInputNames, iName );
268  // create nodes with the given connectivity
269  Vec_PtrForEachEntry( Vec_Int_t *, vNodes, vNode, i )
270  {
271  pObj = Int_ObjAlloc( Vec_IntSize(vNode) - 2 );
272  pObj->iFunc = Vec_IntEntry(vNode, 1);
273  Vec_IntForEachEntryStart( vNode, iName, k, 2 )
274  {
275  Vec_WrdPush( &pObj->vFanins, Vec_WrdEntry(vMap, iName) );
276  nNonDriven += (~Vec_WrdEntry(vMap, iName) == 0);
277  }
278  Vec_PtrPush( &pNtk->vInstances, pObj );
279  }
280  // create boxes with the given connectivity
281  Vec_PtrForEachEntry( Vec_Int_t *, vBoxes, vBox, i )
282  {
283  pModel = Int_DesNtk( pNtk->pMan, Vec_IntEntry(vBox, 0) );
284  nPis = Int_NtkPiNum( pModel );
285  pObj = Int_ObjAlloc( nPis );
286  Vec_IntForEachEntryDouble( vBox, iFormal, iName, k )
287  if ( k > 0 && iFormal < nPis ) // input
288  {
289  Vec_WrdPush( &pObj->vFanins, Vec_WrdEntry(vMap, iName) );
290  nNonDriven += (~Vec_WrdEntry(vMap, iName) == 0);
291  }
292  Vec_PtrPush( &pNtk->vInstances, pObj );
293  }
294  // save output names
295  Vec_IntForEachEntry( vOutputs, iName, i )
296  {
297  Vec_IntPush( &pNtk->vOutputNames, iName );
298  Vec_WrdPush( &pNtk->vOutputs, Vec_WrdEntry(vMap, iName) );
299  nNonDriven += (~Vec_WrdEntry(vMap, iName) == 0);
300  }
301  if ( nNonDriven )
302  printf( "Model %s has %d non-driven nets.\n", Int_NtkName(pNtk), nNonDriven );
303 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static int Int_DesNtkNum(Int_Des_t *p)
Definition: cbaBuild.c:58
Int_Des_t * pMan
Definition: cbaBuild.c:48
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static void Vec_WrdPush(Vec_Wrd_t *p, word Entry)
Definition: vecWrd.h:618
void Ptr_ManFindInputOutputNumbers(Int_Ntk_t *pModel, Vec_Int_t *vBox, Vec_Int_t *vMap)
Definition: cbaBuild.c:202
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Wrd_t vOutputs
Definition: cbaBuild.c:50
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
int iFunc
Definition: cbaBuild.c:40
Vec_Wrd_t vFanins
Definition: cbaBuild.c:41
static void Vec_WrdWriteEntry(Vec_Wrd_t *p, int i, word Entry)
Definition: vecWrd.h:418
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
unsigned __int64 word
DECLARATIONS ///.
Definition: kitPerm.c:36
Vec_Int_t vOutputNames
Definition: cbaBuild.c:52
if(last==0)
Definition: sparse_int.h:34
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
#define Vec_IntForEachEntryStart(vVec, Entry, i, Start)
Definition: vecInt.h:56
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition: vecInt.h:66
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
static char * Int_NtkName(Int_Ntk_t *p)
Definition: cbaBuild.c:61
static word Vec_WrdEntry(Vec_Wrd_t *p, int i)
Definition: vecWrd.h:384
Int_Obj_t * Int_ObjAlloc(int nFanins)
Definition: cbaBuild.c:149
#define assert(ex)
Definition: util_old.h:213
static int Int_NtkPiNum(Int_Ntk_t *p)
Definition: cbaBuild.c:62
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t vInstances
Definition: cbaBuild.c:49
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54
static Int_Ntk_t * Int_DesNtk(Int_Des_t *p, int i)
Definition: cbaBuild.c:59
Int_Ntk_t* Ptr_ManConvertNtkInter ( Int_Des_t pDes,
Vec_Ptr_t vNtk,
int  Id 
)

Definition at line 304 of file cbaBuild.c.

305 {
306  Vec_Int_t * vInputs = (Vec_Int_t *)Vec_PtrEntry(vNtk, 1);
307  Vec_Int_t * vOutputs = (Vec_Int_t *)Vec_PtrEntry(vNtk, 2);
308  Vec_Ptr_t * vNodes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 3);
309  Vec_Ptr_t * vBoxes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4);
310  return Int_NtkAlloc( pDes, Id, Vec_IntSize(vInputs), Vec_IntSize(vOutputs), Vec_PtrSize(vNodes) + Vec_PtrSize(vBoxes) );
311 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
Int_Ntk_t * Int_NtkAlloc(Int_Des_t *pMan, int Id, int nPis, int nPos, int nInsts)
Definition: cbaBuild.c:160
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static int Vec_IntSize(Vec_Int_t *p)
Definition: bblif.c:252
Vec_Ptr_t* Ptr_ManDumpArrarArrayToInt ( Abc_Nam_t pNames,
Vec_Ptr_t vNodes,
int  fNode 
)

Definition at line 100 of file cbaBuild.c.

101 {
102  Vec_Ptr_t * vNode; int i;
103  Vec_Ptr_t * vNew = Vec_PtrAlloc( Vec_PtrSize(vNodes) );
104  Vec_PtrForEachEntry( Vec_Ptr_t *, vNodes, vNode, i )
105  Vec_PtrPush( vNew, Ptr_ManDumpArrayToInt(pNames, vNode, fNode) );
106  assert( Ptr_ManCheckArray(vNew) );
107  return vNew;
108 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Int_t * Ptr_ManDumpArrayToInt(Abc_Nam_t *pNames, Vec_Ptr_t *vVec, int fNode)
Definition: cbaBuild.c:92
static int Ptr_ManCheckArray(Vec_Ptr_t *vArray)
FUNCTION DEFINITIONS ///.
Definition: cbaBuild.c:83
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Int_t* Ptr_ManDumpArrayToInt ( Abc_Nam_t pNames,
Vec_Ptr_t vVec,
int  fNode 
)

Definition at line 92 of file cbaBuild.c.

93 {
94  char * pName; int i;
95  Vec_Int_t * vNew = Vec_IntAlloc( Vec_PtrSize(vVec) );
96  Vec_PtrForEachEntry( char *, vVec, pName, i )
97  Vec_IntPush( vNew, (fNode && i == 1) ? Abc_Ptr2Int(pName) : Abc_NamStrFind(pNames, pName) );
98  return vNew;
99 }
static int Abc_Ptr2Int(void *p)
Definition: abc_global.h:272
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition: bblif.c:37
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: bblif.c:149
static void Vec_IntPush(Vec_Int_t *p, int Entry)
Definition: bblif.c:468
int Abc_NamStrFind(Abc_Nam_t *p, char *pStr)
Definition: utilNam.c:372
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Vec_Ptr_t* Ptr_ManDumpNtkToInt ( Abc_Nam_t pNames,
Vec_Ptr_t vNtk,
int  i 
)

Definition at line 109 of file cbaBuild.c.

110 {
111  Vec_Ptr_t * vNew = Vec_PtrAlloc( 5 );
112  assert( Abc_NamStrFind(pNames, (char *)Vec_PtrEntry(vNtk, 0)) == i );
113  Vec_PtrPush( vNew, Abc_Int2Ptr(i) );
114  Vec_PtrPush( vNew, Ptr_ManDumpArrayToInt(pNames, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1), 0) );
115  Vec_PtrPush( vNew, Ptr_ManDumpArrayToInt(pNames, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2), 0) );
116  Vec_PtrPush( vNew, Ptr_ManDumpArrarArrayToInt(pNames, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 3), 1) );
117  Vec_PtrPush( vNew, Ptr_ManDumpArrarArrayToInt(pNames, (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4), 0) );
118  assert( Ptr_ManCheckArray(vNew) );
119  return vNew;
120 }
Vec_Ptr_t * Ptr_ManDumpArrarArrayToInt(Abc_Nam_t *pNames, Vec_Ptr_t *vNodes, int fNode)
Definition: cbaBuild.c:100
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
Vec_Int_t * Ptr_ManDumpArrayToInt(Abc_Nam_t *pNames, Vec_Ptr_t *vVec, int fNode)
Definition: cbaBuild.c:92
int Abc_NamStrFind(Abc_Nam_t *p, char *pStr)
Definition: utilNam.c:372
static int Ptr_ManCheckArray(Vec_Ptr_t *vArray)
FUNCTION DEFINITIONS ///.
Definition: cbaBuild.c:83
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
#define assert(ex)
Definition: util_old.h:213
static void * Abc_Int2Ptr(int i)
Definition: abc_global.h:273
Vec_Ptr_t* Ptr_ManDumpToInt ( Vec_Ptr_t vDes)

Definition at line 121 of file cbaBuild.c.

122 {
123  Vec_Ptr_t * vNew = Vec_PtrAlloc( Vec_PtrSize(vDes) );
124  Vec_Ptr_t * vNtk; int i;
125  // create module names
126  Abc_Nam_t * pNames = Abc_NamStart( 1000, 20 );
127  Vec_PtrForEachEntryStart( Vec_Ptr_t *, vDes, vNtk, i, 1 )
128  Abc_NamStrFind( pNames, (char *)Vec_PtrEntry(vNtk, 0) );
129  assert( i == Abc_NamObjNumMax(pNames) );
130  // create resulting array
131  Vec_PtrPush( vNew, pNames );
132  Vec_PtrForEachEntryStart( Vec_Ptr_t *, vDes, vNtk, i, 1 )
133  Vec_PtrPush( vNew, Ptr_ManDumpNtkToInt(pNames, vNtk, i) );
134  assert( Ptr_ManCheckArray(vNew) );
135  return vNew;
136 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
#define Vec_PtrForEachEntryStart(Type, vVec, pEntry, i, Start)
Definition: vecPtr.h:57
Vec_Ptr_t * Ptr_ManDumpNtkToInt(Abc_Nam_t *pNames, Vec_Ptr_t *vNtk, int i)
Definition: cbaBuild.c:109
int Abc_NamObjNumMax(Abc_Nam_t *p)
Definition: utilNam.c:186
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Abc_Nam_t * Abc_NamStart(int nObjs, int nAveSize)
FUNCTION DEFINITIONS ///.
Definition: utilNam.c:78
int Abc_NamStrFind(Abc_Nam_t *p, char *pStr)
Definition: utilNam.c:372
static int Ptr_ManCheckArray(Vec_Ptr_t *vArray)
FUNCTION DEFINITIONS ///.
Definition: cbaBuild.c:83
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
typedefABC_NAMESPACE_HEADER_START struct Abc_Nam_t_ Abc_Nam_t
INCLUDES ///.
Definition: utilNam.h:39
#define assert(ex)
Definition: util_old.h:213
void Ptr_ManFindInputOutputNumbers ( Int_Ntk_t pModel,
Vec_Int_t vBox,
Vec_Int_t vMap 
)

Definition at line 202 of file cbaBuild.c.

203 {
204  int i, iFormal, iName, nPis = Int_NtkPiNum(pModel);
205  Vec_IntForEachEntry( &pModel->vInputNames, iFormal, i )
206  Vec_IntWriteEntry( vMap, iFormal, i );
207  Vec_IntForEachEntry( &pModel->vOutputNames, iFormal, i )
208  Vec_IntWriteEntry( vMap, iFormal, nPis+i );
209  Vec_IntForEachEntryDouble( vBox, iFormal, iName, i )
210  {
211  if ( i == 0 ) continue;
212  assert( Vec_IntEntry(vMap, iFormal) >= 0 );
213  Vec_IntWriteEntry( vBox, i, Vec_IntEntry(vMap, iFormal) );
214  }
215  Vec_IntForEachEntry( &pModel->vInputNames, iFormal, i )
216  Vec_IntWriteEntry( vMap, iFormal, -1 );
217  Vec_IntForEachEntry( &pModel->vOutputNames, iFormal, i )
218  Vec_IntWriteEntry( vMap, iFormal, -1 );
219 }
Vec_Int_t vInputNames
Definition: cbaBuild.c:51
static void Vec_IntWriteEntry(Vec_Int_t *p, int i, int Entry)
Definition: bblif.c:285
static int Vec_IntEntry(Vec_Int_t *p, int i)
Definition: bblif.c:268
#define Vec_IntForEachEntryDouble(vVec, Entry1, Entry2, i)
Definition: vecInt.h:66
#define assert(ex)
Definition: util_old.h:213
static int Int_NtkPiNum(Int_Ntk_t *p)
Definition: cbaBuild.c:62
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition: vecInt.h:54