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

Go to the source code of this file.

Macros

#define IVY_PAGE_SIZE   12
 DECLARATIONS ///. More...
 
#define IVY_PAGE_MASK   4095
 

Functions

void Hop_ManStartMemory (Hop_Man_t *p)
 FUNCTION DEFINITIONS ///. More...
 
void Hop_ManStopMemory (Hop_Man_t *p)
 
void Hop_ManAddMemory (Hop_Man_t *p)
 MACRO DEFINITIONS ///. More...
 

Macro Definition Documentation

#define IVY_PAGE_MASK   4095

Definition at line 32 of file hopMem.c.

#define IVY_PAGE_SIZE   12

DECLARATIONS ///.

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

FileName [hopMem.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Minimalistic And-Inverter Graph package.]

Synopsis [Memory management for the AIG nodes.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - May 11, 2006.]

Revision [

Id:
hopMem.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

]

Definition at line 31 of file hopMem.c.

Function Documentation

void Hop_ManAddMemory ( Hop_Man_t p)

MACRO DEFINITIONS ///.

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

Synopsis [Allocates additional memory for the nodes.]

Description [Allocates IVY_PAGE_SIZE nodes. Aligns memory by 32 bytes. Records the pointer to the AIG manager in the -1 entry.]

SideEffects []

SeeAlso []

Definition at line 89 of file hopMem.c.

90 {
91  char * pMemory;
92  int i, nBytes;
93  assert( sizeof(Hop_Obj_t) <= 64 );
94  assert( p->pListFree == NULL );
95 // assert( (Hop_ManObjNum(p) & IVY_PAGE_MASK) == 0 );
96  // allocate new memory page
97  nBytes = sizeof(Hop_Obj_t) * (1<<IVY_PAGE_SIZE) + 64;
98  pMemory = ABC_ALLOC( char, nBytes );
99  Vec_PtrPush( p->vChunks, pMemory );
100  // align memory at the 32-byte boundary
101  pMemory = pMemory + 64 - (((int)(ABC_PTRUINT_T)pMemory) & 63);
102  // remember the manager in the first entry
103  Vec_PtrPush( p->vPages, pMemory );
104  // break the memory down into nodes
105  p->pListFree = (Hop_Obj_t *)pMemory;
106  for ( i = 1; i <= IVY_PAGE_MASK; i++ )
107  {
108  *((char **)pMemory) = pMemory + sizeof(Hop_Obj_t);
109  pMemory += sizeof(Hop_Obj_t);
110  }
111  *((char **)pMemory) = NULL;
112 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_PtrPush(Vec_Ptr_t *p, void *Entry)
Definition: vecPtr.h:606
#define ABC_ALLOC(type, num)
Definition: abc_global.h:229
Definition: hop.h:65
for(p=first;p->value< newval;p=p->next)
#define IVY_PAGE_MASK
Definition: hopMem.c:32
#define assert(ex)
Definition: util_old.h:213
#define IVY_PAGE_SIZE
DECLARATIONS ///.
Definition: hopMem.c:31
struct Hop_Obj_t_ Hop_Obj_t
Definition: hop.h:50
void Hop_ManStartMemory ( Hop_Man_t p)

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file hopMem.c.

50 {
51  p->vChunks = Vec_PtrAlloc( 128 );
52  p->vPages = Vec_PtrAlloc( 128 );
53 }
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static Vec_Ptr_t * Vec_PtrAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition: vecPtr.h:83
void Hop_ManStopMemory ( Hop_Man_t p)

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

Synopsis [Stops the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file hopMem.c.

67 {
68  void * pMemory;
69  int i;
70  Vec_PtrForEachEntry( void *, p->vChunks, pMemory, i )
71  ABC_FREE( pMemory );
72  Vec_PtrFree( p->vChunks );
73  Vec_PtrFree( p->vPages );
74  p->pListFree = NULL;
75 }
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
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223