src/aig/hop/hopMem.c File Reference

#include "hop.h"
Include dependency graph for hopMem.c:

Go to the source code of this file.

Defines

#define IVY_PAGE_SIZE   12
#define IVY_PAGE_MASK   4095

Functions

void Hop_ManStartMemory (Hop_Man_t *p)
void Hop_ManStopMemory (Hop_Man_t *p)
void Hop_ManAddMemory (Hop_Man_t *p)

Define Documentation

#define IVY_PAGE_MASK   4095

Definition at line 29 of file hopMem.c.

#define IVY_PAGE_SIZE   12

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

] DECLARATIONS ///

Definition at line 28 of file hopMem.c.


Function Documentation

void Hop_ManAddMemory ( Hop_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 hopMem.c.

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

void Hop_ManStartMemory ( Hop_Man_t p  ) 

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

Synopsis [Starts the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file hopMem.c.

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

void Hop_ManStopMemory ( Hop_Man_t p  ) 

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

Synopsis [Stops the internal memory manager.]

Description []

SideEffects []

SeeAlso []

Definition at line 63 of file hopMem.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:21 2010 for abc70930 by  doxygen 1.6.1