src/aig/ivy/ivyMem.c File Reference

#include "ivy.h"
Include dependency graph for ivyMem.c:

Go to the source code of this file.

Defines

#define IVY_PAGE_SIZE   12
#define IVY_PAGE_MASK   4095

Functions

void Ivy_ManStartMemory (Ivy_Man_t *p)
void Ivy_ManStopMemory (Ivy_Man_t *p)
void Ivy_ManAddMemory (Ivy_Man_t *p)

Define Documentation

#define IVY_PAGE_MASK   4095

Definition at line 29 of file ivyMem.c.

#define IVY_PAGE_SIZE   12

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

] DECLARATIONS ///

Definition at line 28 of file ivyMem.c.


Function Documentation

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 86 of file ivyMem.c.

00087 {
00088     char * pMemory;
00089     int i, nBytes;
00090     int EntrySizeMax = 128;
00091     assert( sizeof(Ivy_Obj_t) <= EntrySizeMax );
00092     assert( p->pListFree == NULL );
00093 //    assert( (Ivy_ManObjNum(p) & IVY_PAGE_MASK) == 0 );
00094     // allocate new memory page
00095     nBytes = sizeof(Ivy_Obj_t) * (1<<IVY_PAGE_SIZE) + EntrySizeMax;
00096     pMemory = ALLOC( char, nBytes );
00097     Vec_PtrPush( p->vChunks, pMemory );
00098     // align memory at the 32-byte boundary
00099     pMemory = pMemory + EntrySizeMax - (((int)pMemory) & (EntrySizeMax-1));
00100     // remember the manager in the first entry
00101     Vec_PtrPush( p->vPages, pMemory );
00102     // break the memory down into nodes
00103     p->pListFree = (Ivy_Obj_t *)pMemory;
00104     for ( i = 1; i <= IVY_PAGE_MASK; i++ )
00105     {
00106         *((char **)pMemory) = pMemory + sizeof(Ivy_Obj_t);
00107         pMemory += sizeof(Ivy_Obj_t);
00108     }
00109     *((char **)pMemory) = NULL;
00110 }

void Ivy_ManStartMemory ( Ivy_Man_t p  ) 

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

Synopsis [Starts the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file ivyMem.c.

00047 {
00048     p->vChunks = Vec_PtrAlloc( 128 );
00049     p->vPages = Vec_PtrAlloc( 128 );
00050 }

void Ivy_ManStopMemory ( Ivy_Man_t p  ) 

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

Synopsis [Stops the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file ivyMem.c.

00064 {
00065     void * pMemory;
00066     int i;
00067     Vec_PtrForEachEntry( p->vChunks, pMemory, i )
00068         free( pMemory );
00069     Vec_PtrFree( p->vChunks );
00070     Vec_PtrFree( p->vPages );
00071     p->pListFree = NULL;
00072 }


Generated on Tue Jan 5 12:18:24 2010 for abc70930 by  doxygen 1.6.1