ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
abcLib.c File Reference
#include "abc.h"
Include dependency graph for abcLib.c:

Go to the source code of this file.

Functions

ABC_NAMESPACE_IMPL_START Abc_Des_tAbc_DesCreate (char *pName)
 DECLARATIONS ///.
 
void Abc_DesCleanManPointer (Abc_Des_t *p, void *pMan)
 
void Abc_DesFree (Abc_Des_t *p, Abc_Ntk_t *pNtkSave)
 
Abc_Des_tAbc_DesDup (Abc_Des_t *p)
 
Abc_Des_tAbc_DesDupBlackboxes (Abc_Des_t *p, Abc_Ntk_t *pNtkSave)
 
void Abc_DesPrint (Abc_Des_t *p)
 
int Abc_DesAddModel (Abc_Des_t *p, Abc_Ntk_t *pNtk)
 
Abc_Ntk_tAbc_DesFindModelByName (Abc_Des_t *p, char *pName)
 
Abc_Ntk_tAbc_DesDeriveRoot (Abc_Des_t *p)
 
int Abc_DesFindTopLevelModels (Abc_Des_t *p)
 
void Abc_NodeStrashUsingNetwork_rec (Abc_Ntk_t *pNtkAig, Abc_Obj_t *pObj)
 
void Abc_NodeStrashUsingNetwork (Abc_Ntk_t *pNtkAig, Abc_Obj_t *pBox)
 

Function Documentation

◆ Abc_DesAddModel()

int Abc_DesAddModel ( Abc_Des_t * p,
Abc_Ntk_t * pNtk )

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

Synopsis [Create the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 226 of file abcLib.c.

227{
228 if ( st__is_member( p->tModules, (char *)pNtk->pName ) )
229 return 0;
230 st__insert( p->tModules, (char *)pNtk->pName, (char *)pNtk );
231 assert( pNtk->Id == 0 );
232 pNtk->Id = Vec_PtrSize(p->vModules);
233 Vec_PtrPush( p->vModules, pNtk );
234 pNtk->pDesign = p;
235 return 1;
236}
Cube * p
Definition exorList.c:222
int st__insert(st__table *table, const char *key, char *value)
Definition st.c:171
#define st__is_member(table, key)
Definition st.h:70
char * pName
Definition abc.h:158
Abc_Des_t * pDesign
Definition abc.h:180
int Id
Definition abc.h:184
#define assert(ex)
Definition util_old.h:213
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_DesCleanManPointer()

void Abc_DesCleanManPointer ( Abc_Des_t * p,
void * pMan )

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

Synopsis [Removes all pointers to the manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 70 of file abcLib.c.

71{
72 Abc_Ntk_t * pTemp;
73 int i;
74 if ( p == NULL )
75 return;
76 if ( p->pManFunc == pMan )
77 p->pManFunc = NULL;
78 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pTemp, i )
79 if ( pTemp->pManFunc == pMan )
80 pTemp->pManFunc = NULL;
81}
struct Abc_Ntk_t_ Abc_Ntk_t
Definition abc.h:115
void * pManFunc
Definition abc.h:191
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55

◆ Abc_DesCreate()

ABC_NAMESPACE_IMPL_START Abc_Des_t * Abc_DesCreate ( char * pName)

DECLARATIONS ///.

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

FileName [abcLib.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network and node package.]

Synopsis [Functions to manipulate verilog libraries.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

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

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

Synopsis [Create the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 45 of file abcLib.c.

46{
47 Abc_Des_t * p;
48 p = ABC_ALLOC( Abc_Des_t, 1 );
49 memset( p, 0, sizeof(Abc_Des_t) );
50 p->pName = Abc_UtilStrsav( pName );
51 p->tModules = st__init_table( strcmp, st__strhash );
52 p->vTops = Vec_PtrAlloc( 100 );
53 p->vModules = Vec_PtrAlloc( 100 );
54 p->pManFunc = Hop_ManStart();
55 p->pLibrary = NULL;
56 return p;
57}
struct Abc_Des_t_ Abc_Des_t
BASIC TYPES ///.
Definition abc.h:114
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
Hop_Man_t * Hop_ManStart()
DECLARATIONS ///.
Definition hopMan.c:45
int st__strhash(const char *string, int modulus)
Definition st.c:449
st__table * st__init_table(st__compare_func_type compare, st__hash_func_type hash)
Definition st.c:72
char * memset()
int strcmp()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_DesDeriveRoot()

Abc_Ntk_t * Abc_DesDeriveRoot ( Abc_Des_t * p)

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

Synopsis [Frees the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 269 of file abcLib.c.

270{
271 Abc_Ntk_t * pNtk;
272 if ( Vec_PtrSize(p->vModules) > 1 )
273 {
274 printf( "The design includes more than one module and is currently not used.\n" );
275 return NULL;
276 }
277 pNtk = (Abc_Ntk_t *)Vec_PtrEntry( p->vModules, 0 ); Vec_PtrClear( p->vModules );
278 pNtk->pManFunc = p->pManFunc; p->pManFunc = NULL;
279 return pNtk;
280}

◆ Abc_DesDup()

Abc_Des_t * Abc_DesDup ( Abc_Des_t * p)

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

Synopsis [Duplicated the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 133 of file abcLib.c.

134{
135 Abc_Des_t * pNew;
136 Abc_Ntk_t * pTemp;
137 Abc_Obj_t * pObj;
138 int i, k;
139 pNew = Abc_DesCreate( p->pName );
140 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pTemp, i )
141 Abc_DesAddModel( pNew, Abc_NtkDup(pTemp) );
142 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vTops, pTemp, i )
143 Vec_PtrPush( pNew->vTops, pTemp->pCopy );
144 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pTemp, i )
145 pTemp->pCopy->pAltView = pTemp->pAltView ? pTemp->pAltView->pCopy : NULL;
146 // update box models
147 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pTemp, i )
148 Abc_NtkForEachBox( pTemp, pObj, k )
149 if ( Abc_ObjIsWhitebox(pObj) || Abc_ObjIsBlackbox(pObj) )
150 pObj->pCopy->pData = Abc_ObjModel(pObj)->pCopy;
151 return pNew;
152}
int Abc_DesAddModel(Abc_Des_t *p, Abc_Ntk_t *pNtk)
Definition abcLib.c:226
ABC_NAMESPACE_IMPL_START Abc_Des_t * Abc_DesCreate(char *pName)
DECLARATIONS ///.
Definition abcLib.c:45
struct Abc_Obj_t_ Abc_Obj_t
Definition abc.h:116
#define Abc_NtkForEachBox(pNtk, pObj, i)
Definition abc.h:498
ABC_DLL Abc_Ntk_t * Abc_NtkDup(Abc_Ntk_t *pNtk)
Definition abcNtk.c:472
Vec_Ptr_t * vTops
Definition abc.h:224
Abc_Ntk_t * pCopy
Definition abc.h:204
Abc_Ntk_t * pAltView
Definition abc.h:181
void * pData
Definition abc.h:145
Abc_Obj_t * pCopy
Definition abc.h:148
Here is the call graph for this function:

◆ Abc_DesDupBlackboxes()

Abc_Des_t * Abc_DesDupBlackboxes ( Abc_Des_t * p,
Abc_Ntk_t * pNtkSave )

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

Synopsis [Frees the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 165 of file abcLib.c.

166{
167 Abc_Des_t * pNew;
168 Abc_Ntk_t * pNtkTemp;
169 int i;
170 assert( Vec_PtrSize(p->vTops) > 0 );
171 assert( Vec_PtrSize(p->vModules) > 1 );
172 pNew = Abc_DesCreate( p->pName );
173// pNew->pManFunc = pNtkSave->pManFunc;
174 Vec_PtrPush( pNew->vTops, pNtkSave );
175 Vec_PtrPush( pNew->vModules, pNtkSave );
176 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtkTemp, i )
177 if ( Abc_NtkHasBlackbox( pNtkTemp ) )
178 Vec_PtrPush( pNew->vModules, Abc_NtkDup(pNtkTemp) );
179 return pNew;
180}
Vec_Ptr_t * vModules
Definition abc.h:225
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_DesFindModelByName()

Abc_Ntk_t * Abc_DesFindModelByName ( Abc_Des_t * p,
char * pName )

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

Synopsis [Create the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 249 of file abcLib.c.

250{
251 Abc_Ntk_t * pNtk;
252 if ( ! st__is_member( p->tModules, (char *)pName ) )
253 return NULL;
254 st__lookup( p->tModules, (char *)pName, (char **)&pNtk );
255 return pNtk;
256}
int st__lookup(st__table *table, const char *key, char **value)
Definition st.c:114
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_DesFindTopLevelModels()

int Abc_DesFindTopLevelModels ( Abc_Des_t * p)

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

Synopsis [Detects the top-level models.]

Description []

SideEffects []

SeeAlso []

Definition at line 293 of file abcLib.c.

294{
295 Abc_Ntk_t * pNtk, * pNtkBox;
296 Abc_Obj_t * pObj;
297 int i, k;
298 assert( Vec_PtrSize( p->vModules ) > 0 );
299 // clear the models
300 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtk, i )
301 pNtk->fHieVisited = 0;
302 // mark all the models reachable from other models
303 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtk, i )
304 {
305 Abc_NtkForEachBox( pNtk, pObj, k )
306 {
307 if ( Abc_ObjIsLatch(pObj) )
308 continue;
309 if ( pObj->pData == NULL )
310 continue;
311 pNtkBox = (Abc_Ntk_t *)pObj->pData;
312 pNtkBox->fHieVisited = 1;
313 }
314 }
315 // collect the models that are not marked
316 Vec_PtrClear( p->vTops );
317 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtk, i )
318 {
319 if ( pNtk->fHieVisited == 0 )
320 Vec_PtrPush( p->vTops, pNtk );
321 else
322 pNtk->fHieVisited = 0;
323 }
324 return Vec_PtrSize( p->vTops );
325}
int fHieVisited
Definition abc.h:182
Here is the caller graph for this function:

◆ Abc_DesFree()

void Abc_DesFree ( Abc_Des_t * p,
Abc_Ntk_t * pNtkSave )

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

Synopsis [Frees the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 94 of file abcLib.c.

95{
96 Abc_Ntk_t * pNtk;
97 int i;
98 if ( p->pName )
99 ABC_FREE( p->pName );
100 if ( p->pManFunc )
101 Hop_ManStop( (Hop_Man_t *)p->pManFunc );
102 if ( p->tModules )
103 st__free_table( p->tModules );
104 if ( p->vModules )
105 {
106 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtk, i )
107 {
108 if ( pNtk == pNtkSave )
109 continue;
110 pNtk->pDesign = NULL;
111 if ( (pNtkSave && pNtk->pManFunc == pNtkSave->pManFunc) || (pNtk->pManFunc == p->pManFunc) )
112 pNtk->pManFunc = NULL;
113 Abc_NtkDelete( pNtk );
114 }
115 Vec_PtrFree( p->vModules );
116 }
117 if ( p->vTops )
118 Vec_PtrFree( p->vTops );
119 ABC_FREE( p );
120}
ABC_DLL void Abc_NtkDelete(Abc_Ntk_t *pNtk)
Definition abcNtk.c:1421
#define ABC_FREE(obj)
Definition abc_global.h:267
typedefABC_NAMESPACE_HEADER_START struct Hop_Man_t_ Hop_Man_t
INCLUDES ///.
Definition hop.h:49
void Hop_ManStop(Hop_Man_t *p)
Definition hopMan.c:84
void st__free_table(st__table *table)
Definition st.c:81
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Abc_DesPrint()

void Abc_DesPrint ( Abc_Des_t * p)

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

Synopsis [Prints the library.]

Description []

SideEffects []

SeeAlso []

Definition at line 194 of file abcLib.c.

195{
196 Abc_Ntk_t * pNtk;
197 Abc_Obj_t * pObj;
198 int i, k;
199 printf( "Models of design %s:\n", p->pName );
200 Vec_PtrForEachEntry( Abc_Ntk_t *, p->vModules, pNtk, i )
201 {
202 printf( "%2d : %20s ", i+1, pNtk->pName );
203 printf( "nd = %6d lat = %6d whitebox = %3d blackbox = %3d\n",
204 Abc_NtkNodeNum(pNtk), Abc_NtkLatchNum(pNtk),
205 Abc_NtkWhiteboxNum(pNtk), Abc_NtkBlackboxNum(pNtk) );
206 if ( Abc_NtkBlackboxNum(pNtk) == 0 )
207 continue;
208 Abc_NtkForEachWhitebox( pNtk, pObj, k )
209 printf( " %20s (whitebox)\n", Abc_NtkName((Abc_Ntk_t *)pObj->pData) );
210 Abc_NtkForEachBlackbox( pNtk, pObj, k )
211 printf( " %20s (blackbox)\n", Abc_NtkName((Abc_Ntk_t *)pObj->pData) );
212 }
213}
#define Abc_NtkForEachBlackbox(pNtk, pObj, i)
Definition abc.h:512
#define Abc_NtkForEachWhitebox(pNtk, pObj, i)
Definition abc.h:509

◆ Abc_NodeStrashUsingNetwork()

void Abc_NodeStrashUsingNetwork ( Abc_Ntk_t * pNtkAig,
Abc_Obj_t * pBox )

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

Synopsis [Derive the AIG of the logic in the netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 366 of file abcLib.c.

367{
368 Abc_Ntk_t * pNtkGate;
369 Abc_Obj_t * pObj;
370 unsigned * pPolarity;
371 int i, fCompl;
372 assert( Abc_ObjIsBox(pBox) );
373 pNtkGate = (Abc_Ntk_t *)pBox->pData;
374 pPolarity = (unsigned *)pBox->pNext;
375 assert( Abc_NtkIsNetlist(pNtkGate) );
376 assert( Abc_NtkLatchNum(pNtkGate) == 0 );
377 Abc_NtkCleanCopy( pNtkGate );
378 // set the PI values
379 Abc_NtkForEachPi( pNtkGate, pObj, i )
380 {
381 fCompl = (pPolarity && Abc_InfoHasBit(pPolarity, i));
382 pObj->pCopy = Abc_ObjNotCond( Abc_ObjFanin(pBox,i)->pCopy, fCompl );
383 Abc_ObjFanout0(pObj)->pCopy = pObj->pCopy;
384 }
385 // build recursively and set the PO values
386 Abc_NtkForEachPo( pNtkGate, pObj, i )
387 {
388 Abc_NodeStrashUsingNetwork_rec( pNtkAig, Abc_ObjFanin0Ntk(Abc_ObjFanin0(pObj)) );
389 Abc_ObjFanout(pBox,i)->pCopy = Abc_ObjFanin0(pObj)->pCopy;
390 }
391//printf( "processing %d\n", pBox->Id );
392}
void Abc_NodeStrashUsingNetwork_rec(Abc_Ntk_t *pNtkAig, Abc_Obj_t *pObj)
Definition abcLib.c:339
#define Abc_NtkForEachPo(pNtk, pPo, i)
Definition abc.h:520
#define Abc_NtkForEachPi(pNtk, pPi, i)
Definition abc.h:516
ABC_DLL void Abc_NtkCleanCopy(Abc_Ntk_t *pNtk)
Definition abcUtil.c:540
Abc_Obj_t * pNext
Definition abc.h:131
Here is the call graph for this function:

◆ Abc_NodeStrashUsingNetwork_rec()

void Abc_NodeStrashUsingNetwork_rec ( Abc_Ntk_t * pNtkAig,
Abc_Obj_t * pObj )

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

Synopsis [Derive the AIG of the logic in the netlist.]

Description []

SideEffects []

SeeAlso []

Definition at line 339 of file abcLib.c.

340{
341 Abc_Obj_t * pFanin;
342 int i;
343 assert( !Abc_ObjIsNet(pObj) );
344 if ( pObj->pCopy )
345 return;
346 // call for the fanins
347 Abc_ObjForEachFanin( pObj, pFanin, i )
348 Abc_NodeStrashUsingNetwork_rec( pNtkAig, Abc_ObjFanin0Ntk(Abc_ObjFanin0(pObj)) );
349 // compute for the node
350 pObj->pCopy = Abc_NodeStrash( pNtkAig, pObj, 0 );
351 // set for the fanout net
352 Abc_ObjFanout0(pObj)->pCopy = pObj->pCopy;
353}
ABC_DLL Abc_Obj_t * Abc_NodeStrash(Abc_Ntk_t *pNtkNew, Abc_Obj_t *pNode, int fRecord)
Definition abcStrash.c:468
#define Abc_ObjForEachFanin(pObj, pFanin, i)
Definition abc.h:527
Here is the call graph for this function:
Here is the caller graph for this function: