abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
attr.h File Reference
#include "misc/extra/extra.h"

Go to the source code of this file.

Data Structures

struct  Attr_ManStruct_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Attr_ManStruct_t_ 
Attr_Man_t
 INCLUDES ///. More...
 

Functions

static Attr_Man_tAttr_ManAlloc (int nAttrSize, int fManMem)
 MACRO DEFINITIONS ///. More...
 
static Attr_Man_tAttr_ManStartInt (int nAttrs)
 
static Attr_Man_tAttr_ManStartPtr (int nAttrs)
 
static Attr_Man_tAttr_ManStartPtrMem (int nAttrs, int nAttrSize)
 
static void Attr_ManStop (Attr_Man_t *p)
 
static int Attr_ManReadAttrInt (Attr_Man_t *p, int Id)
 
static void * Attr_ManReadAttrPtr (Attr_Man_t *p, int Id)
 
static void Attr_ManWriteAttrInt (Attr_Man_t *p, int Id, int Attr)
 
static void Attr_ManWriteAttrPtr (Attr_Man_t *p, int Id, void *pAttr)
 
static int * Attr_ManFetchSpotInt (Attr_Man_t *p, int Id)
 
static void ** Attr_ManFetchSpotPtr (Attr_Man_t *p, int Id)
 
static int Attr_ManFetchAttrInt (Attr_Man_t *p, int Id)
 
static void * Attr_ManFetchAttrPtr (Attr_Man_t *p, int Id)
 
static void Attr_ManSetAttrInt (Attr_Man_t *p, int Id, int Attr)
 
static void Attr_ManSetAttrPtr (Attr_Man_t *p, int Id, void *pAttr)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Attr_ManStruct_t_ Attr_Man_t

INCLUDES ///.

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

FileName [attr.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Network attributes.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

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

Revision [

Id:
attr.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 44 of file attr.h.

Function Documentation

static Attr_Man_t* Attr_ManAlloc ( int  nAttrSize,
int  fManMem 
)
inlinestatic

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS /// Function*************************************************************

Synopsis [Allocates the attribute manager.]

Description [The manager is simple if it does not need memory manager.]

SideEffects []

SeeAlso []

Definition at line 83 of file attr.h.

84 {
85  Attr_Man_t * p;
86  p = ALLOC( Attr_Man_t, 1 );
87  memset( p, 0, sizeof(Attr_Man_t) );
88  p->nAttrSize = nAttrSize;
89  if ( fManMem )
90  p->pManMem = Extra_MmFixedStart( nAttrSize );
91  return p;
92 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
typedefABC_NAMESPACE_HEADER_START struct Attr_ManStruct_t_ Attr_Man_t
INCLUDES ///.
Definition: attr.h:44
#define ALLOC(type, num)
Definition: avl.h:27
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
static int Attr_ManFetchAttrInt ( Attr_Man_t p,
int  Id 
)
inlinestatic

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

Synopsis [Returns or creates the attribute of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 351 of file attr.h.

352 {
353  return *Attr_ManFetchSpotInt( p, Id );
354 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int * Attr_ManFetchSpotInt(Attr_Man_t *p, int Id)
Definition: attr.h:288
static void* Attr_ManFetchAttrPtr ( Attr_Man_t p,
int  Id 
)
inlinestatic

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

Synopsis [Returns or creates the attribute of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 367 of file attr.h.

368 {
369  return *Attr_ManFetchSpotPtr( p, Id );
370 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void ** Attr_ManFetchSpotPtr(Attr_Man_t *p, int Id)
Definition: attr.h:316
static int* Attr_ManFetchSpotInt ( Attr_Man_t p,
int  Id 
)
inlinestatic

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

Synopsis [Returns or creates the pointer to the attribute of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 288 of file attr.h.

289 {
290  assert( p->fUseInt );
291  if ( Id >= p->nAttrs )
292  {
293  // save the old size
294  int i, nAttrsOld = p->nAttrs;
295  // get the new size
296  p->nAttrs = p->nAttrs? 2*p->nAttrs : 1024;
297  p->pAttrs = realloc( p->pAttrs, sizeof(int) * p->nAttrs );
298  // fill in the empty spots
299  for ( i = nAttrsOld; i < p->nAttrs; i++ )
300  ((int *)p->pAttrs)[Id] = 0;
301  }
302  return ((int *)p->pAttrs) + Id;
303 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * realloc()
#define assert(ex)
Definition: util_old.h:213
static void** Attr_ManFetchSpotPtr ( Attr_Man_t p,
int  Id 
)
inlinestatic

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

Synopsis [Returns or creates the pointer to the attribute of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 316 of file attr.h.

317 {
318  assert( !p->fUseInt );
319  if ( Id >= p->nAttrs )
320  {
321  // save the old size
322  int i, nAttrsOld = p->nAttrs;
323  // get the new size
324  p->nAttrs = p->nAttrs? 2*p->nAttrs : 1024;
325  p->pAttrs = realloc( p->pAttrs, sizeof(void *) * p->nAttrs );
326  // fill in the empty spots
327  for ( i = nAttrsOld; i < p->nAttrs; i++ )
328  p->pAttrs[Id] = NULL;
329  }
330  // if memory manager is available but entry is not created, create it
331  if ( p->pManMem && p->pAttrs[Id] != NULL )
332  {
333  p->pAttrs[Id] = Extra_MmFixedEntryFetch( p->pManMem );
334  memset( p->pAttrs[Id], 0, p->nAttrSize );
335  }
336  return p->pAttrs + Id;
337 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * realloc()
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
#define assert(ex)
Definition: util_old.h:213
static int Attr_ManReadAttrInt ( Attr_Man_t p,
int  Id 
)
inlinestatic

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

Synopsis [Reads the attribute of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 215 of file attr.h.

216 {
217  assert( p->fUseInt );
218  if ( Id >= p->nAttrs )
219  return 0;
220  return ((int *)p->pAttrs)[Id];
221 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void* Attr_ManReadAttrPtr ( Attr_Man_t p,
int  Id 
)
inlinestatic

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

Synopsis [Reads the attribute of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 234 of file attr.h.

235 {
236  assert( !p->fUseInt );
237  if ( Id >= p->nAttrs )
238  return NULL;
239  return p->pAttrs[Id];
240 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Attr_ManSetAttrInt ( Attr_Man_t p,
int  Id,
int  Attr 
)
inlinestatic

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

Synopsis [Sets the attribute of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 383 of file attr.h.

384 {
385  *Attr_ManFetchSpotInt( p, Id ) = Attr;
386 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static int * Attr_ManFetchSpotInt(Attr_Man_t *p, int Id)
Definition: attr.h:288
static void Attr_ManSetAttrPtr ( Attr_Man_t p,
int  Id,
void *  pAttr 
)
inlinestatic

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

Synopsis [Sets the attribute of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 399 of file attr.h.

400 {
401  assert( p->pManMem == NULL );
402  *Attr_ManFetchSpotPtr( p, Id ) = pAttr;
403 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void ** Attr_ManFetchSpotPtr(Attr_Man_t *p, int Id)
Definition: attr.h:316
#define assert(ex)
Definition: util_old.h:213
static Attr_Man_t* Attr_ManStartInt ( int  nAttrs)
inlinestatic

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

Synopsis [Start the attribute manager for integers.]

Description []

SideEffects []

SeeAlso []

Definition at line 105 of file attr.h.

106 {
107  Attr_Man_t * p;
108  p = Attr_ManAlloc( sizeof(int), 0 );
109  p->nAttrs = nAttrs;
110  p->pAttrs = (void **)ALLOC( int, nAttrs );
111  memset( (int *)p->pAttrs, 0, sizeof(int) * nAttrs );
112  p->fUseInt = 1;
113  return p;
114 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Attr_Man_t * Attr_ManAlloc(int nAttrSize, int fManMem)
MACRO DEFINITIONS ///.
Definition: attr.h:83
typedefABC_NAMESPACE_HEADER_START struct Attr_ManStruct_t_ Attr_Man_t
INCLUDES ///.
Definition: attr.h:44
#define ALLOC(type, num)
Definition: avl.h:27
static Attr_Man_t* Attr_ManStartPtr ( int  nAttrs)
inlinestatic

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

Synopsis [Start the attribute manager for pointers.]

Description []

SideEffects []

SeeAlso []

Definition at line 127 of file attr.h.

128 {
129  Attr_Man_t * p;
130  p = Attr_ManAlloc( sizeof(void *), 0 );
131  p->nAttrs = nAttrs;
132  p->pAttrs = ALLOC( void *, nAttrs );
133  memset( p->pAttrs, 0, sizeof(void *) * nAttrs );
134  return p;
135 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Attr_Man_t * Attr_ManAlloc(int nAttrSize, int fManMem)
MACRO DEFINITIONS ///.
Definition: attr.h:83
typedefABC_NAMESPACE_HEADER_START struct Attr_ManStruct_t_ Attr_Man_t
INCLUDES ///.
Definition: attr.h:44
#define ALLOC(type, num)
Definition: avl.h:27
static Attr_Man_t* Attr_ManStartPtrMem ( int  nAttrs,
int  nAttrSize 
)
inlinestatic

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

Synopsis [Start the attribute manager for the fixed entry size.]

Description []

SideEffects []

SeeAlso []

Definition at line 148 of file attr.h.

149 {
150  Attr_Man_t * p;
151  int i;
152  p = Attr_ManAlloc( nAttrSize, 1 );
153  p->nAttrs = nAttrs;
154  p->pAttrs = ALLOC( void *, nAttrs );
155  for ( i = 0; i < p->nAttrs; i++ )
156  {
157  p->pAttrs[i] = Extra_MmFixedEntryFetch( p->pManMem );
158  memset( p->pAttrs[i], 0, nAttrSize );
159  }
160  return p;
161 }
char * memset()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Attr_Man_t * Attr_ManAlloc(int nAttrSize, int fManMem)
MACRO DEFINITIONS ///.
Definition: attr.h:83
typedefABC_NAMESPACE_HEADER_START struct Attr_ManStruct_t_ Attr_Man_t
INCLUDES ///.
Definition: attr.h:44
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
#define ALLOC(type, num)
Definition: avl.h:27
static void Attr_ManStop ( Attr_Man_t p)
inlinestatic

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

Synopsis [Stop the attribute manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 174 of file attr.h.

175 {
176  // free the attributes of objects
177  if ( p->pFuncFreeObj )
178  {
179  int i;
180  if ( p->fUseInt )
181  {
182  for ( i = 0; i < p->nAttrs; i++ )
183  if ( ((int *)p->pAttrs)[i] )
184  p->pFuncFreeObj( p->pManAttr, (void *)((int *)p->pAttrs)[i] );
185  }
186  else
187  {
188  for ( i = 0; i < p->nAttrs; i++ )
189  if ( p->pAttrs[i] )
190  p->pFuncFreeObj( p->pManAttr, p->pAttrs[i] );
191  }
192  }
193  // free the attribute manager
194  if ( p->pManAttr && p->pFuncFreeMan )
195  p->pFuncFreeMan( p->pManAttr );
196  // free the memory manager
197  if ( p->pManMem )
198  Extra_MmFixedStop( p->pManMem);
199  // free the attribute manager
200  FREE( p->pAttrs );
201  free( p );
202 }
VOID_HACK free()
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Extra_MmFixedStop(Extra_MmFixed_t *p)
#define FREE(obj)
Definition: avl.h:31
static void Attr_ManWriteAttrInt ( Attr_Man_t p,
int  Id,
int  Attr 
)
inlinestatic

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

Synopsis [Writes the attribute of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 253 of file attr.h.

254 {
255  assert( p->fUseInt );
256  ((int *)p->pAttrs)[Id] = Attr;
257 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213
static void Attr_ManWriteAttrPtr ( Attr_Man_t p,
int  Id,
void *  pAttr 
)
inlinestatic

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

Synopsis [Writes the attribute of the given object.]

Description []

SideEffects []

SeeAlso []

Definition at line 270 of file attr.h.

271 {
272  assert( !p->fUseInt );
273  assert( p->pManMem == NULL );
274  p->pAttrs[Id] = pAttr;
275 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
#define assert(ex)
Definition: util_old.h:213