ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
bacPtrAbc.c File Reference
#include "bac.h"
#include "base/abc/abc.h"
#include "map/mio/mio.h"
#include "base/main/mainInt.h"
Include dependency graph for bacPtrAbc.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START char * Ptr_HopToType (Abc_Obj_t *pObj)
 DECLARATIONS ///.
 
char * Ptr_AbcObjName (Abc_Obj_t *pObj)
 
Vec_Ptr_tPtr_AbcDeriveNode (Abc_Obj_t *pObj)
 
Vec_Ptr_tPtr_AbcDeriveBox (Abc_Obj_t *pObj)
 
Vec_Ptr_tPtr_AbcDeriveBoxes (Abc_Ntk_t *pNtk)
 
Vec_Ptr_tPtr_AbcDeriveInputs (Abc_Ntk_t *pNtk)
 
Vec_Ptr_tPtr_AbcDeriveOutputs (Abc_Ntk_t *pNtk)
 
Vec_Ptr_tPtr_AbcDeriveNtk (Abc_Ntk_t *pNtk)
 
Vec_Ptr_tPtr_AbcDeriveDes (Abc_Ntk_t *pNtk)
 
void Ptr_ManExperiment (Abc_Ntk_t *pNtk)
 
int Ptr_ManCountNtk (Vec_Ptr_t *vNtk)
 
int Bac_BoxCountOutputs (Bac_Ntk_t *pNtk, char *pBoxNtk)
 
int Bac_NtkDeriveFromPtr (Bac_Ntk_t *pNtk, Vec_Ptr_t *vNtk, Vec_Int_t *vMap, Vec_Int_t *vBox2Id)
 
Bac_Man_tBac_PtrTransformToCba (Vec_Ptr_t *vDes)
 
Vec_Ptr_tBac_NtkTransformToPtrBox (Bac_Ntk_t *p, int iBox)
 
Vec_Ptr_tBac_NtkTransformToPtrBoxes (Bac_Ntk_t *p)
 
Vec_Ptr_tBac_NtkTransformToPtrInputs (Bac_Ntk_t *p)
 
Vec_Ptr_tBac_NtkTransformToPtrOutputs (Bac_Ntk_t *p)
 
Vec_Ptr_tBac_NtkTransformToPtr (Bac_Ntk_t *p)
 
Vec_Ptr_tBac_PtrDeriveFromCba (Bac_Man_t *p)
 

Function Documentation

◆ Bac_BoxCountOutputs()

int Bac_BoxCountOutputs ( Bac_Ntk_t * pNtk,
char * pBoxNtk )

Definition at line 269 of file bacPtrAbc.c.

270{
271 int ModuleId = Bac_ManNtkFindId( pNtk->pDesign, pBoxNtk );
272 if ( ModuleId == 0 )
273 return 1;
274 return Bac_NtkPoNumAlloc( Bac_ManNtk(pNtk->pDesign, ModuleId) );
275}
Bac_Man_t * pDesign
Definition bac.h:147
Here is the caller graph for this function:

◆ Bac_NtkDeriveFromPtr()

int Bac_NtkDeriveFromPtr ( Bac_Ntk_t * pNtk,
Vec_Ptr_t * vNtk,
Vec_Int_t * vMap,
Vec_Int_t * vBox2Id )

Definition at line 276 of file bacPtrAbc.c.

277{
278 char * pName, * pModuleName = (char *)Vec_PtrEntry(vNtk, 0);
279 Vec_Ptr_t * vInputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1);
280 Vec_Ptr_t * vOutputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2);
281 Vec_Ptr_t * vBoxes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4), * vBox;
282 int i, k, iObj, iTerm, NameId;
283 // start network with the given name
284 NameId = Abc_NamStrFindOrAdd( pNtk->pDesign->pStrs, pModuleName, NULL );
285 assert( Bac_NtkNameId(pNtk) == NameId );
286 // map driven NameIds into their ObjIds for PIs
287 Vec_PtrForEachEntry( char *, vInputs, pName, i )
288 {
289 NameId = Abc_NamStrFindOrAdd( pNtk->pDesign->pStrs, pName, NULL );
290 if ( Vec_IntGetEntryFull(vMap, NameId) != -1 )
291 { printf( "PI with name \"%s\" is not unique module \"%s\".\n", pName, pModuleName ); return 0; }
292 iObj = Bac_ObjAlloc( pNtk, BAC_OBJ_PI, -1 );
293 Bac_ObjSetName( pNtk, iObj, Abc_Var2Lit2(NameId, BAC_NAME_BIN) );
294 Vec_IntSetEntryFull( vMap, NameId, iObj );
295 Bac_NtkAddInfo( pNtk, Abc_Var2Lit2(NameId, 1), -1, -1 );
296 }
297 // map driven NameIds into their ObjIds for BOs
298 Vec_IntClear( vBox2Id );
299 Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i )
300 {
301 char * pBoxNtk = (char *)Vec_PtrEntry(vBox, 0);
302 char * pBoxName = (char *)Vec_PtrEntry(vBox, 1);
303 int nOutputs = Bac_BoxCountOutputs( pNtk, pBoxNtk );
304 int nInputs = Vec_PtrSize(vBox)/2 - nOutputs - 1;
305 int NtkId = Bac_ManNtkFindId( pNtk->pDesign, pBoxNtk );
306 assert( Vec_PtrSize(vBox) % 2 == 0 );
307 assert( nOutputs > 0 && 2*(nOutputs + 1) <= Vec_PtrSize(vBox) );
308 iObj = Bac_BoxAlloc( pNtk, (Bac_ObjType_t)Ptr_NameToType(pBoxNtk), nInputs, nOutputs, NtkId );
309 if ( NtkId > 0 )
310 Bac_NtkSetHost( Bac_ManNtk(pNtk->pDesign, NtkId), Bac_NtkId(pNtk), iObj );
311 Bac_ObjSetName( pNtk, iObj, Abc_Var2Lit2(Abc_NamStrFindOrAdd(pNtk->pDesign->pStrs, pBoxName, NULL), BAC_NAME_BIN) );
312 Bac_BoxForEachBo( pNtk, iObj, iTerm, k )
313 {
314 pName = (char *)Vec_PtrEntry( vBox, Vec_PtrSize(vBox) - 2*(nOutputs - k) + 1 );
315 NameId = Abc_NamStrFindOrAdd( pNtk->pDesign->pStrs, pName, NULL );
316 if ( Vec_IntGetEntryFull(vMap, NameId) != -1 )
317 { printf( "Signal \"%s\" has multiple drivers in module \"%s\".\n", pName, pModuleName ); return 0; }
318 Bac_ObjSetName( pNtk, iTerm, Abc_Var2Lit2(NameId, BAC_NAME_BIN) );
319 Vec_IntSetEntryFull( vMap, NameId, iTerm );
320 }
321 Vec_IntPush( vBox2Id, iObj );
322 }
323 assert( Vec_IntSize(vBox2Id) == Vec_PtrSize(vBoxes) );
324 // connect BIs
325 Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i )
326 {
327 iObj = Vec_IntEntry( vBox2Id, i );
328 Bac_BoxForEachBi( pNtk, iObj, iTerm, k )
329 {
330 pName = (char *)Vec_PtrEntry( vBox, 2*(k + 1) + 1 );
331 NameId = Abc_NamStrFindOrAdd( pNtk->pDesign->pStrs, pName, NULL );
332 if ( Vec_IntGetEntryFull(vMap, NameId) == -1 )
333 printf( "Signal \"%s\" in not driven in module \"%s\".\n", pName, pModuleName );
334 Bac_ObjSetFanin( pNtk, iTerm, Vec_IntGetEntryFull(vMap, NameId) );
335 }
336 }
337 // connect POs
338 Vec_PtrForEachEntry( char *, vOutputs, pName, i )
339 {
340 NameId = Abc_NamStrFindOrAdd( pNtk->pDesign->pStrs, pName, NULL );
341 if ( Vec_IntGetEntryFull(vMap, NameId) == -1 )
342 printf( "PO with name \"%s\" in not driven in module \"%s\".\n", pName, pModuleName );
343 iObj = Bac_ObjAlloc( pNtk, BAC_OBJ_PO, Vec_IntGetEntryFull(vMap, NameId) );
344 Bac_NtkAddInfo( pNtk, Abc_Var2Lit2(NameId, 2), -1, -1 );
345 }
346 // update map
347 Bac_NtkForEachCi( pNtk, iObj )
348 Vec_IntSetEntryFull( vMap, Bac_ObjNameId(pNtk, iObj), -1 );
349 // double check
350 Vec_IntForEachEntry( vMap, iObj, i )
351 assert( iObj == -1 );
352 assert( Bac_NtkObjNum(pNtk) == Vec_StrCap(&pNtk->vType) );
353 return 1;
354}
int Bac_BoxCountOutputs(Bac_Ntk_t *pNtk, char *pBoxNtk)
Definition bacPtrAbc.c:269
#define Bac_BoxForEachBo(p, iBox, iTerm, i)
Definition bac.h:377
#define Bac_NtkForEachCi(p, i)
Definition bac.h:361
#define Bac_BoxForEachBi(p, iBox, iTerm, i)
Definition bac.h:375
@ BAC_NAME_BIN
Definition bac.h:134
Bac_ObjType_t
INCLUDES ///.
Definition bac.h:43
@ BAC_OBJ_PO
Definition bac.h:46
@ BAC_OBJ_PI
Definition bac.h:45
Abc_Nam_t * pStrs
Definition bac.h:176
Vec_Str_t vType
Definition bac.h:159
int Abc_NamStrFindOrAdd(Abc_Nam_t *p, char *pStr, int *pfFound)
Definition utilNam.c:453
#define assert(ex)
Definition util_old.h:213
#define Vec_IntForEachEntry(vVec, Entry, i)
MACRO DEFINITIONS ///.
Definition vecInt.h:54
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition vecPtr.h:42
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkTransformToPtr()

Vec_Ptr_t * Bac_NtkTransformToPtr ( Bac_Ntk_t * p)

Definition at line 448 of file bacPtrAbc.c.

449{
450 Vec_Ptr_t * vNtk = Vec_PtrAllocExact(5);
451 Vec_PtrPush( vNtk, Bac_NtkName(p) );
452 Vec_PtrPush( vNtk, Bac_NtkTransformToPtrInputs(p) );
453 Vec_PtrPush( vNtk, Bac_NtkTransformToPtrOutputs(p) );
454 Vec_PtrPush( vNtk, Vec_PtrAllocExact(0) );
455 Vec_PtrPush( vNtk, Bac_NtkTransformToPtrBoxes(p) );
456 assert( Ptr_CheckArray(vNtk) );
457 return vNtk;
458}
Vec_Ptr_t * Bac_NtkTransformToPtrBoxes(Bac_Ntk_t *p)
Definition bacPtrAbc.c:420
Vec_Ptr_t * Bac_NtkTransformToPtrInputs(Bac_Ntk_t *p)
Definition bacPtrAbc.c:430
Vec_Ptr_t * Bac_NtkTransformToPtrOutputs(Bac_Ntk_t *p)
Definition bacPtrAbc.c:439
Cube * p
Definition exorList.c:222
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkTransformToPtrBox()

Vec_Ptr_t * Bac_NtkTransformToPtrBox ( Bac_Ntk_t * p,
int iBox )

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

Synopsis [Create Ptr from mapped Bac_Man_t.]

Description []

SideEffects []

SeeAlso []

Definition at line 398 of file bacPtrAbc.c.

399{
400 int i, iTerm, fUser = Bac_ObjIsBoxUser( p, iBox );
401 Bac_Ntk_t * pBoxNtk = Bac_BoxNtk( p, iBox );
402 Mio_Library_t * pLib = (Mio_Library_t *)p->pDesign->pMioLib;
403 Mio_Gate_t * pGate = pLib ? Mio_LibraryReadGateByName( pLib, Bac_BoxNtkName(p, iBox), NULL ) : NULL;
404 Vec_Ptr_t * vBox = Vec_PtrAllocExact( 2*Bac_BoxSize(p, iBox) );
405 Vec_PtrPush( vBox, Bac_BoxNtkName(p, iBox) );
406 Vec_PtrPush( vBox, Bac_ObjNameStr(p, iBox) );
407 Bac_BoxForEachBi( p, iBox, iTerm, i )
408 {
409 Vec_PtrPush( vBox, fUser ? Bac_ObjNameStr(pBoxNtk, Bac_NtkPi(pBoxNtk, i)) : Mio_GateReadPinName(pGate, i) );
410 Vec_PtrPush( vBox, Bac_ObjNameStr(p, iTerm) );
411 }
412 Bac_BoxForEachBo( p, iBox, iTerm, i )
413 {
414 Vec_PtrPush( vBox, fUser ? Bac_ObjNameStr(pBoxNtk, Bac_NtkPo(pBoxNtk, i)) : Mio_GateReadOutName(pGate) );
415 Vec_PtrPush( vBox, Bac_ObjNameStr(p, iTerm) );
416 }
417 assert( Ptr_CheckArray(vBox) );
418 return vBox;
419}
struct Bac_Ntk_t_ Bac_Ntk_t
Definition bac.h:141
struct Mio_LibraryStruct_t_ Mio_Library_t
Definition mio.h:42
Mio_Gate_t * Mio_LibraryReadGateByName(Mio_Library_t *pLib, char *pName, char *pOutName)
Definition mioApi.c:105
char * Mio_GateReadPinName(Mio_Gate_t *pGate, int iPin)
Definition mioApi.c:230
char * Mio_GateReadOutName(Mio_Gate_t *pGate)
Definition mioApi.c:170
struct Mio_GateStruct_t_ Mio_Gate_t
Definition mio.h:43
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkTransformToPtrBoxes()

Vec_Ptr_t * Bac_NtkTransformToPtrBoxes ( Bac_Ntk_t * p)

Definition at line 420 of file bacPtrAbc.c.

421{
422 int iBox;
423 Vec_Ptr_t * vBoxes = Vec_PtrAllocExact( Bac_NtkBoxNum(p) );
424 Bac_NtkForEachBox( p, iBox )
425 Vec_PtrPush( vBoxes, Bac_NtkTransformToPtrBox(p, iBox) );
426 assert( Ptr_CheckArray(vBoxes) );
427 return vBoxes;
428}
Vec_Ptr_t * Bac_NtkTransformToPtrBox(Bac_Ntk_t *p, int iBox)
Definition bacPtrAbc.c:398
#define Bac_NtkForEachBox(p, i)
Definition bac.h:354
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_NtkTransformToPtrInputs()

Vec_Ptr_t * Bac_NtkTransformToPtrInputs ( Bac_Ntk_t * p)

Definition at line 430 of file bacPtrAbc.c.

431{
432 int i, iTerm;
433 Vec_Ptr_t * vSigs = Vec_PtrAllocExact( Bac_NtkPiNum(p) );
434 Bac_NtkForEachPi( p, iTerm, i )
435 Vec_PtrPush( vSigs, Bac_ObjNameStr(p, iTerm) );
436 assert( Ptr_CheckArray(vSigs) );
437 return vSigs;
438}
#define Bac_NtkForEachPi(p, iObj, i)
Definition bac.h:337
Here is the caller graph for this function:

◆ Bac_NtkTransformToPtrOutputs()

Vec_Ptr_t * Bac_NtkTransformToPtrOutputs ( Bac_Ntk_t * p)

Definition at line 439 of file bacPtrAbc.c.

440{
441 int i, iTerm;
442 Vec_Ptr_t * vSigs = Vec_PtrAllocExact( Bac_NtkPoNum(p) );
443 Bac_NtkForEachPo( p, iTerm, i )
444 Vec_PtrPush( vSigs, Bac_ObjNameStr(p, iTerm) );
445 assert( Ptr_CheckArray(vSigs) );
446 return vSigs;
447}
#define Bac_NtkForEachPo(p, iObj, i)
Definition bac.h:339
Here is the caller graph for this function:

◆ Bac_PtrDeriveFromCba()

Vec_Ptr_t * Bac_PtrDeriveFromCba ( Bac_Man_t * p)

Definition at line 459 of file bacPtrAbc.c.

460{
461 Vec_Ptr_t * vDes;
462 Bac_Ntk_t * pTemp; int i;
463 if ( p == NULL )
464 return NULL;
465 if ( p->pMioLib == NULL )
466 {
467 printf( "Cannot transform CBA network into Ptr because it is not mapped.\n" );
468 return NULL;
469 }
471 vDes = Vec_PtrAllocExact( 1 + Bac_ManNtkNum(p) );
472 Vec_PtrPush( vDes, p->pName );
473 Bac_ManForEachNtk( p, pTemp, i )
474 Vec_PtrPush( vDes, Bac_NtkTransformToPtr(pTemp) );
475 assert( Ptr_CheckArray(vDes) );
476 return vDes;
477}
Vec_Ptr_t * Bac_NtkTransformToPtr(Bac_Ntk_t *p)
Definition bacPtrAbc.c:448
void Bac_ManAssignInternWordNames(Bac_Man_t *p)
Definition bacNtk.c:392
#define Bac_ManForEachNtk(p, pNtk, i)
MACRO DEFINITIONS ///.
Definition bac.h:334
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Bac_PtrTransformToCba()

Bac_Man_t * Bac_PtrTransformToCba ( Vec_Ptr_t * vDes)

Definition at line 355 of file bacPtrAbc.c.

356{
357 char * pName = (char *)Vec_PtrEntry(vDes, 0);
358 Bac_Man_t * pNew = Bac_ManAlloc( pName, Vec_PtrSize(vDes) - 1 );
359 Vec_Int_t * vMap = Vec_IntStartFull( 1000 );
360 Vec_Int_t * vBox2Id = Vec_IntAlloc( 1000 );
361 // create interfaces
362 Bac_Ntk_t * pNtk; int i;
363 Bac_ManForEachNtk( pNew, pNtk, i )
364 {
365 Vec_Ptr_t * vNtk = (Vec_Ptr_t *)Vec_PtrEntry(vDes, i);
366 Vec_Ptr_t * vInputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1);
367 Vec_Ptr_t * vOutputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2);
368 int NameId = Abc_NamStrFindOrAdd( pNew->pStrs, (char *)Vec_PtrEntry(vNtk, 0), NULL );
369 Bac_NtkAlloc( pNtk, NameId, Vec_PtrSize(vInputs), Vec_PtrSize(vOutputs), Ptr_ManCountNtk(vNtk) );
370 Bac_NtkStartNames( pNtk );
371 }
372 // parse the networks
373 Bac_ManForEachNtk( pNew, pNtk, i )
374 {
375 Vec_Ptr_t * vNtk = (Vec_Ptr_t *)Vec_PtrEntry(vDes, i);
376 if ( !Bac_NtkDeriveFromPtr( pNtk, vNtk, vMap, vBox2Id ) )
377 break;
378 }
379 if ( i <= Bac_ManNtkNum(pNew) )
380 Bac_ManFree(pNew), pNew = NULL;
381 Vec_IntFree( vBox2Id );
382 Vec_IntFree( vMap );
383 return pNew;
384}
int Bac_NtkDeriveFromPtr(Bac_Ntk_t *pNtk, Vec_Ptr_t *vNtk, Vec_Int_t *vMap, Vec_Int_t *vBox2Id)
Definition bacPtrAbc.c:276
int Ptr_ManCountNtk(Vec_Ptr_t *vNtk)
Definition bacPtrAbc.c:255
struct Bac_Man_t_ Bac_Man_t
Definition bac.h:142
typedefABC_NAMESPACE_IMPL_START struct Vec_Int_t_ Vec_Int_t
DECLARATIONS ///.
Definition bblif.c:37
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ptr_AbcDeriveBox()

Vec_Ptr_t * Ptr_AbcDeriveBox ( Abc_Obj_t * pObj)

Definition at line 132 of file bacPtrAbc.c.

133{
134 Abc_Obj_t * pNext; int i;
135 Abc_Ntk_t * pNtk = Abc_ObjModel(pObj);
136 Vec_Ptr_t * vBox = Vec_PtrAllocExact( 2 + 2 * Abc_ObjFaninNum(pObj) + 2 * Abc_ObjFanoutNum(pObj) );
137 assert( Abc_ObjIsBox(pObj) );
138 Vec_PtrPush( vBox, Abc_NtkName(pNtk) );
139 Vec_PtrPush( vBox, Ptr_AbcObjName(pObj) );
140 Abc_ObjForEachFanin( pObj, pNext, i )
141 {
142 Vec_PtrPush( vBox, Ptr_AbcObjName(Abc_NtkPi(pNtk, i)) );
143 Vec_PtrPush( vBox, Ptr_AbcObjName(pNext) );
144 }
145 Abc_ObjForEachFanout( pObj, pNext, i )
146 {
147 Vec_PtrPush( vBox, Ptr_AbcObjName(Abc_NtkPo(pNtk, i)) );
148 Vec_PtrPush( vBox, Ptr_AbcObjName(pNext) );
149 }
150 assert( Ptr_CheckArray(vBox) );
151 return vBox;
152}
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
#define Abc_ObjForEachFanout(pObj, pFanout, i)
Definition abc.h:529
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
char * Ptr_AbcObjName(Abc_Obj_t *pObj)
Definition bacPtrAbc.c:94
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ptr_AbcDeriveBoxes()

Vec_Ptr_t * Ptr_AbcDeriveBoxes ( Abc_Ntk_t * pNtk)

Definition at line 153 of file bacPtrAbc.c.

154{
155 Abc_Obj_t * pObj; int i;
156 Vec_Ptr_t * vBoxes = Vec_PtrAllocExact( Abc_NtkBoxNum(pNtk) + Abc_NtkNodeNum(pNtk) );
157 Abc_NtkForEachBox( pNtk, pObj, i )
158 Vec_PtrPush( vBoxes, Ptr_AbcDeriveBox(pObj) );
159 Abc_NtkForEachNode( pNtk, pObj, i )
160 Vec_PtrPush( vBoxes, Ptr_AbcDeriveNode(pObj) );
161 assert( Ptr_CheckArray(vBoxes) );
162 return vBoxes;
163}
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition abc.h:498
#define Abc_NtkForEachNode(pNtk, pNode, i)
Definition abc.h:464
Vec_Ptr_t * Ptr_AbcDeriveNode(Abc_Obj_t *pObj)
Definition bacPtrAbc.c:110
Vec_Ptr_t * Ptr_AbcDeriveBox(Abc_Obj_t *pObj)
Definition bacPtrAbc.c:132
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ptr_AbcDeriveDes()

Vec_Ptr_t * Ptr_AbcDeriveDes ( Abc_Ntk_t * pNtk)

Definition at line 194 of file bacPtrAbc.c.

195{
196 Vec_Ptr_t * vDes;
197 Abc_Ntk_t * pTemp; int i;
198 vDes = Vec_PtrAllocExact( 1 + Vec_PtrSize(pNtk->pDesign->vModules) );
199 Vec_PtrPush( vDes, pNtk->pDesign->pName );
200 Vec_PtrForEachEntry( Abc_Ntk_t *, pNtk->pDesign->vModules, pTemp, i )
201 Vec_PtrPush( vDes, Ptr_AbcDeriveNtk(pTemp) );
202 assert( Ptr_CheckArray(vDes) );
203 return vDes;
204}
Vec_Ptr_t * Ptr_AbcDeriveNtk(Abc_Ntk_t *pNtk)
Definition bacPtrAbc.c:183
Vec_Ptr_t * vModules
Definition abc.h:225
char * pName
Definition abc.h:222
Abc_Des_t * pDesign
Definition abc.h:180
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ptr_AbcDeriveInputs()

Vec_Ptr_t * Ptr_AbcDeriveInputs ( Abc_Ntk_t * pNtk)

Definition at line 165 of file bacPtrAbc.c.

166{
167 Abc_Obj_t * pObj; int i;
168 Vec_Ptr_t * vSigs = Vec_PtrAllocExact( Abc_NtkPiNum(pNtk) );
169 Abc_NtkForEachPi( pNtk, pObj, i )
170 Vec_PtrPush( vSigs, Ptr_AbcObjName(pObj) );
171 assert( Ptr_CheckArray(vSigs) );
172 return vSigs;
173}
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ptr_AbcDeriveNode()

Vec_Ptr_t * Ptr_AbcDeriveNode ( Abc_Obj_t * pObj)

Definition at line 110 of file bacPtrAbc.c.

111{
112 Abc_Obj_t * pFanin; int i;
113 Vec_Ptr_t * vNode = Vec_PtrAllocExact( 2 + 2 * (1 + Abc_ObjFaninNum(pObj)) );
114 assert( Abc_ObjIsNode(pObj) );
115 if ( Abc_NtkHasAig(pObj->pNtk) )
116 Vec_PtrPush( vNode, Ptr_HopToType(pObj) );
117 else if ( Abc_NtkHasSop(pObj->pNtk) )
118 Vec_PtrPush( vNode, Ptr_SopToTypeName((char *)pObj->pData) );
119 else assert( 0 );
120 Vec_PtrPush( vNode, Ptr_AbcObjName(pObj) );
121 assert( Abc_ObjFaninNum(pObj) <= 2 );
122 Abc_ObjForEachFanin( pObj, pFanin, i )
123 {
124 Vec_PtrPush( vNode, (void*)(i ? "r" : "l") );
125 Vec_PtrPush( vNode, Ptr_AbcObjName(pFanin) );
126 }
127 Vec_PtrPush( vNode, (void*)("o") );
128 Vec_PtrPush( vNode, Ptr_AbcObjName(pObj) );
129 assert( Ptr_CheckArray(vNode) );
130 return vNode;
131}
ABC_NAMESPACE_IMPL_START char * Ptr_HopToType(Abc_Obj_t *pObj)
DECLARATIONS ///.
Definition bacPtrAbc.c:47
void * pData
Definition abc.h:145
Abc_Ntk_t * pNtk
Definition abc.h:130
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ptr_AbcDeriveNtk()

Vec_Ptr_t * Ptr_AbcDeriveNtk ( Abc_Ntk_t * pNtk)

Definition at line 183 of file bacPtrAbc.c.

184{
185 Vec_Ptr_t * vNtk = Vec_PtrAllocExact( 5 );
186 Vec_PtrPush( vNtk, Abc_NtkName(pNtk) );
187 Vec_PtrPush( vNtk, Ptr_AbcDeriveInputs(pNtk) );
188 Vec_PtrPush( vNtk, Ptr_AbcDeriveOutputs(pNtk) );
189 Vec_PtrPush( vNtk, Vec_PtrAllocExact(0) );
190 Vec_PtrPush( vNtk, Ptr_AbcDeriveBoxes(pNtk) );
191 assert( Ptr_CheckArray(vNtk) );
192 return vNtk;
193}
Vec_Ptr_t * Ptr_AbcDeriveOutputs(Abc_Ntk_t *pNtk)
Definition bacPtrAbc.c:174
Vec_Ptr_t * Ptr_AbcDeriveInputs(Abc_Ntk_t *pNtk)
Definition bacPtrAbc.c:165
Vec_Ptr_t * Ptr_AbcDeriveBoxes(Abc_Ntk_t *pNtk)
Definition bacPtrAbc.c:153
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ptr_AbcDeriveOutputs()

Vec_Ptr_t * Ptr_AbcDeriveOutputs ( Abc_Ntk_t * pNtk)

Definition at line 174 of file bacPtrAbc.c.

175{
176 Abc_Obj_t * pObj; int i;
177 Vec_Ptr_t * vSigs = Vec_PtrAllocExact( Abc_NtkPoNum(pNtk) );
178 Abc_NtkForEachPo( pNtk, pObj, i )
179 Vec_PtrPush( vSigs, Ptr_AbcObjName(pObj) );
180 assert( Ptr_CheckArray(vSigs) );
181 return vSigs;
182}
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ptr_AbcObjName()

char * Ptr_AbcObjName ( Abc_Obj_t * pObj)

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

Synopsis [Create Ptr from Abc_Ntk_t.]

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file bacPtrAbc.c.

95{
96 if ( Abc_ObjIsNet(pObj) || Abc_ObjIsBox(pObj) )
97 return Abc_ObjName(pObj);
98 if ( Abc_ObjIsCi(pObj) || Abc_ObjIsNode(pObj) )
99 return Ptr_AbcObjName(Abc_ObjFanout0(pObj));
100 if ( Abc_ObjIsCo(pObj) )
101 return Ptr_AbcObjName(Abc_ObjFanin0(pObj));
102 assert( 0 );
103 return NULL;
104}
ABC_DLL char * Abc_ObjName(Abc_Obj_t *pNode)
DECLARATIONS ///.
Definition abcNames.c:49
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ptr_HopToType()

ABC_NAMESPACE_IMPL_START char * Ptr_HopToType ( Abc_Obj_t * pObj)

DECLARATIONS ///.

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

FileName [bacPtrAbc.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Hierarchical word-level netlist.]

Synopsis [Simple interface with external tools.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Node type conversions.]

Description []

SideEffects []

SeeAlso []

Definition at line 47 of file bacPtrAbc.c.

48{
49 static word uTruth, uTruths6[3] = {
50 ABC_CONST(0xAAAAAAAAAAAAAAAA),
51 ABC_CONST(0xCCCCCCCCCCCCCCCC),
52 ABC_CONST(0xF0F0F0F0F0F0F0F0),
53 };
54 assert( Abc_ObjIsNode(pObj) );
55 uTruth = Hop_ManComputeTruth6( (Hop_Man_t *)Abc_ObjNtk(pObj)->pManFunc, (Hop_Obj_t *)pObj->pData, Abc_ObjFaninNum(pObj) );
56/*
57 if ( uTruth == 0 ) return "BAC_BOX_C0";
58 if ( uTruth == ~(word)0 ) return "BAC_BOX_C1";
59 if ( uTruth == uTruths6[0] ) return "BAC_BOX_BUF";
60 if ( uTruth == ~uTruths6[0] ) return "BAC_BOX_INV";
61 if ( uTruth == (uTruths6[0] & uTruths6[1]) ) return "BAC_BOX_AND";
62 if ( uTruth ==~(uTruths6[0] & uTruths6[1]) ) return "BAC_BOX_NAND";
63 if ( uTruth == (uTruths6[0] | uTruths6[1]) ) return "BAC_BOX_OR";
64 if ( uTruth ==~(uTruths6[0] | uTruths6[1]) ) return "BAC_BOX_NOR";
65 if ( uTruth == (uTruths6[0] ^ uTruths6[1]) ) return "BAC_BOX_XOR";
66 if ( uTruth ==~(uTruths6[0] ^ uTruths6[1]) ) return "BAC_BOX_XNOR";
67*/
68 if ( uTruth == 0 ) return "Const0T";
69 if ( uTruth == ~(word)0 ) return "Const1T";
70 if ( uTruth == uTruths6[0] ) return "BufT";
71 if ( uTruth == ~uTruths6[0] ) return "InvT";
72 if ( uTruth == (uTruths6[0] & uTruths6[1]) ) return "AndT";
73 if ( uTruth ==~(uTruths6[0] & uTruths6[1]) ) return "NandT";
74 if ( uTruth == (uTruths6[0] | uTruths6[1]) ) return "OrT";
75 if ( uTruth ==~(uTruths6[0] | uTruths6[1]) ) return "NorT";
76 if ( uTruth == (uTruths6[0] ^ uTruths6[1]) ) return "XorT";
77 if ( uTruth ==~(uTruths6[0] ^ uTruths6[1]) ) return "XnorT";
78 assert( 0 );
79 return NULL;
80}
#define ABC_CONST(number)
PARAMETERS ///.
Definition abc_global.h:240
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition hop.h:49
word Hop_ManComputeTruth6(Hop_Man_t *p, Hop_Obj_t *pObj, int nVars)
Definition hopTruth.c:256
struct Hop_Obj_t_ Hop_Obj_t
Definition hop.h:50
unsigned __int64 word
DECLARATIONS ///.
Definition kitPerm.c:36
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Ptr_ManCountNtk()

int Ptr_ManCountNtk ( Vec_Ptr_t * vNtk)

Definition at line 255 of file bacPtrAbc.c.

256{
257 Vec_Ptr_t * vInputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 1);
258 Vec_Ptr_t * vOutputs = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 2);
259 Vec_Ptr_t * vNodes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 3);
260 Vec_Ptr_t * vBoxes = (Vec_Ptr_t *)Vec_PtrEntry(vNtk, 4);
261 Vec_Ptr_t * vBox; int i, Counter = 0;
262 assert( Vec_PtrSize(vNodes) == 0 );
263 Counter += Vec_PtrSize(vInputs);
264 Counter += Vec_PtrSize(vOutputs);
265 Vec_PtrForEachEntry( Vec_Ptr_t *, vBoxes, vBox, i )
266 Counter += Vec_PtrSize(vBox)/2;
267 return Counter;
268}
Here is the caller graph for this function:

◆ Ptr_ManExperiment()

void Ptr_ManExperiment ( Abc_Ntk_t * pNtk)

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

Synopsis []

Description []

SideEffects []

SeeAlso []

Definition at line 217 of file bacPtrAbc.c.

218{
219 abctime clk = Abc_Clock();
220 char * pFileName = Extra_FileNameGenericAppend(pNtk->pDesign->pName, "_out.blif");
221 Vec_Ptr_t * vDes = Ptr_AbcDeriveDes( pNtk );
222 printf( "Converting to Ptr: Memory = %6.3f MB ", 1.0*Bac_PtrMemory(vDes)/(1<<20) );
223 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
224 Bac_PtrDumpBlif( pFileName, vDes );
225 printf( "Finished writing output file \"%s\". ", pFileName );
226 Abc_PrintTime( 1, "Time", Abc_Clock() - clk );
227 Bac_PtrFree( vDes );
228}
ABC_INT64_T abctime
Definition abc_global.h:332
Vec_Ptr_t * Ptr_AbcDeriveDes(Abc_Ntk_t *pNtk)
Definition bacPtrAbc.c:194
void Bac_PtrFree(Vec_Ptr_t *vDes)
Definition bacPtr.c:98
int Bac_PtrMemory(Vec_Ptr_t *vDes)
Definition bacPtr.c:138
void Bac_PtrDumpBlif(char *pFileName, Vec_Ptr_t *vDes)
Definition bacPtr.c:192
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
Here is the call graph for this function: