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

Go to the source code of this file.

Macros

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

Functions

void Ivy_ManStartMemory (Ivy_Man_t *p)
 FUNCTION DEFINITIONS ///.
 
void Ivy_ManStopMemory (Ivy_Man_t *p)
 
void Ivy_ManAddMemory (Ivy_Man_t *p)
 

Macro Definition Documentation

◆ IVY_PAGE_MASK

#define IVY_PAGE_MASK   4095

Definition at line 32 of file ivyMem.c.

◆ IVY_PAGE_SIZE

#define IVY_PAGE_SIZE   12

DECLARATIONS ///.

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

FileName [ivyMem.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [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
ivyMem.c,v 1.00 2006/05/11 00:00:00 alanmi Exp

]

Definition at line 31 of file ivyMem.c.

Function Documentation

◆ Ivy_ManAddMemory()

void Ivy_ManAddMemory ( Ivy_Man_t * p)

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 ivyMem.c.

90{
91 char * pMemory;
92 int i, nBytes;
93 int EntrySizeMax = 128;
94 assert( sizeof(Ivy_Obj_t) <= EntrySizeMax );
95 assert( p->pListFree == NULL );
96// assert( (Ivy_ManObjNum(p) & IVY_PAGE_MASK) == 0 );
97 // allocate new memory page
98 nBytes = sizeof(Ivy_Obj_t) * (1<<IVY_PAGE_SIZE) + EntrySizeMax;
99 pMemory = ABC_ALLOC( char, nBytes );
100 Vec_PtrPush( p->vChunks, pMemory );
101 // align memory at the 32-byte boundary
102 pMemory = pMemory + EntrySizeMax - (((int)(ABC_PTRUINT_T)pMemory) & (EntrySizeMax-1));
103 // remember the manager in the first entry
104 Vec_PtrPush( p->vPages, pMemory );
105 // break the memory down into nodes
106 p->pListFree = (Ivy_Obj_t *)pMemory;
107 for ( i = 1; i <= IVY_PAGE_MASK; i++ )
108 {
109 *((char **)pMemory) = pMemory + sizeof(Ivy_Obj_t);
110 pMemory += sizeof(Ivy_Obj_t);
111 }
112 *((char **)pMemory) = NULL;
113}
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
Cube * p
Definition exorList.c:222
#define IVY_PAGE_SIZE
DECLARATIONS ///.
Definition hopMem.c:31
#define IVY_PAGE_MASK
Definition hopMem.c:32
struct Ivy_Obj_t_ Ivy_Obj_t
Definition ivy.h:47
#define assert(ex)
Definition util_old.h:213

◆ Ivy_ManStartMemory()

void Ivy_ManStartMemory ( Ivy_Man_t * p)

FUNCTION DEFINITIONS ///.

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

Synopsis [Starts the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 49 of file ivyMem.c.

50{
51 p->vChunks = Vec_PtrAlloc( 128 );
52 p->vPages = Vec_PtrAlloc( 128 );
53}
Here is the caller graph for this function:

◆ Ivy_ManStopMemory()

void Ivy_ManStopMemory ( Ivy_Man_t * p)

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

Synopsis [Stops the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 66 of file ivyMem.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}
#define ABC_FREE(obj)
Definition abc_global.h:267
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition vecPtr.h:55
Here is the caller graph for this function: