#include <stdio.h>
Go to the source code of this file.
|
static Vec_Mem_t * | Vec_MemAlloc (int nEntrySize, int LogPageSze) |
| FUNCTION DEFINITIONS ///. More...
|
|
static void | Vec_MemFree (Vec_Mem_t *p) |
|
static void | Vec_MemFreeP (Vec_Mem_t **p) |
|
static Vec_Mem_t * | Vec_MemDup (Vec_Mem_t *pVec) |
|
static void | Vec_MemFill (Vec_Mem_t *pVec, int nEntries) |
|
static void | Vec_MemClean (Vec_Mem_t *pVec, int nEntries) |
|
static int | Vec_MemEntrySize (Vec_Mem_t *p) |
|
static int | Vec_MemEntryNum (Vec_Mem_t *p) |
|
static int | Vec_MemPageSize (Vec_Mem_t *p) |
|
static int | Vec_MemPageNum (Vec_Mem_t *p) |
|
static double | Vec_MemMemory (Vec_Mem_t *p) |
|
static word * | Vec_MemReadEntry (Vec_Mem_t *p, int i) |
|
static word * | Vec_MemReadEntryLast (Vec_Mem_t *p) |
|
static void | Vec_MemWriteEntry (Vec_Mem_t *p, int i, word *pEntry) |
|
static word * | Vec_MemGetEntry (Vec_Mem_t *p, int i) |
|
static void | Vec_MemSetEntry (Vec_Mem_t *p, int i, word *pEntry) |
|
static void | Vec_MemPush (Vec_Mem_t *p, word *pEntry) |
|
static void | Vec_MemShrink (Vec_Mem_t *p, int nEntriesNew) |
|
static void | Vec_MemDumpDigit (FILE *pFile, int HexDigit) |
|
static void | Vec_MemDump (FILE *pFile, Vec_Mem_t *pVec) |
|
static void | Vec_MemHashAlloc (Vec_Mem_t *p, int nTableSize) |
|
static void | Vec_MemHashFree (Vec_Mem_t *p) |
|
static unsigned | Vec_MemHashKey (Vec_Mem_t *p, word *pEntry) |
|
static int * | Vec_MemHashLookup (Vec_Mem_t *p, word *pEntry) |
|
static void | Vec_MemHashResize (Vec_Mem_t *p) |
|
static int | Vec_MemHashInsert (Vec_Mem_t *p, word *pEntry) |
|
static Vec_Mem_t * | Vec_MemAllocForTT (int nVars, int fCompl) |
|
static void | Vec_MemAddMuxTT (Vec_Mem_t *p, int nVars) |
|
static void | Vec_MemDumpTruthTables (Vec_Mem_t *p, char *pName, int nLutSize) |
|
MACRO DEFINITIONS ///.
Definition at line 68 of file vecMem.h.
INCLUDES ///.
CFile****************************************************************
FileName [vecMem.h]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [Resizable arrays.]
Synopsis [Resizable array of memory pieces.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - July 20, 2012.]
Revision [
- Id:
- vecMem.h,v 1.00 2012/07/20 00:00:00 alanmi Exp
]PARAMETERS ///BASIC TYPES ///
Definition at line 50 of file vecMem.h.
static void Vec_MemAddMuxTT |
( |
Vec_Mem_t * |
p, |
|
|
int |
nVars |
|
) |
| |
|
inlinestatic |
Definition at line 394 of file vecMem.h.
396 int Value,
nWords = (nVars <= 6 ? 1 : (1 << (nVars - 6)));
398 memset( uTruth, 0xCA,
sizeof(
word) * nWords );
#define ABC_ALLOC(type, num)
unsigned __int64 word
DECLARATIONS ///.
static int Vec_MemHashInsert(Vec_Mem_t *p, word *pEntry)
static Vec_Mem_t* Vec_MemAlloc |
( |
int |
nEntrySize, |
|
|
int |
LogPageSze |
|
) |
| |
|
inlinestatic |
FUNCTION DEFINITIONS ///.
Function*************************************************************
Synopsis [Allocates a memory vector.]
Description [Entry size is in terms of 8-byte words. Page size is log2 of the number of entries on one page.]
SideEffects []
SeeAlso []
Definition at line 87 of file vecMem.h.
91 p->nEntrySize = nEntrySize;
92 p->LogPageSze = LogPageSze;
93 p->PageMask = (1 << p->LogPageSze) - 1;
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
#define ABC_CALLOC(type, num)
static Vec_Mem_t* Vec_MemAllocForTT |
( |
int |
nVars, |
|
|
int |
fCompl |
|
) |
| |
|
inlinestatic |
Function*************************************************************
Synopsis [Allocates memory vector for storing truth tables.]
Description []
SideEffects []
SeeAlso []
Definition at line 378 of file vecMem.h.
380 int Value,
nWords = (nVars <= 6 ? 1 : (1 << (nVars - 6)));
384 memset( uTruth, 0x00,
sizeof(
word) * nWords );
387 memset( uTruth, 0x55,
sizeof(
word) * nWords );
389 memset( uTruth, 0xAA,
sizeof(
word) * nWords );
static void Vec_MemHashAlloc(Vec_Mem_t *p, int nTableSize)
static Vec_Mem_t * Vec_MemAlloc(int nEntrySize, int LogPageSze)
FUNCTION DEFINITIONS ///.
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
#define ABC_ALLOC(type, num)
unsigned __int64 word
DECLARATIONS ///.
static int Vec_MemHashInsert(Vec_Mem_t *p, word *pEntry)
static void Vec_MemClean |
( |
Vec_Mem_t * |
pVec, |
|
|
int |
nEntries |
|
) |
| |
|
inlinestatic |
static void Vec_MemDump |
( |
FILE * |
pFile, |
|
|
Vec_Mem_t * |
pVec |
|
) |
| |
|
inlinestatic |
Definition at line 279 of file vecMem.h.
283 if ( pFile == stdout )
287 for ( w = pVec->nEntrySize - 1; w >= 0; w-- )
288 for ( d = 15; d >= 0; d-- )
290 fprintf( pFile,
"\n" );
#define Vec_MemForEachEntry(p, pEntry, i)
MACRO DEFINITIONS ///.
static int Vec_MemEntryNum(Vec_Mem_t *p)
unsigned __int64 word
DECLARATIONS ///.
static void Vec_MemDumpDigit(FILE *pFile, int HexDigit)
static void Vec_MemDumpDigit |
( |
FILE * |
pFile, |
|
|
int |
HexDigit |
|
) |
| |
|
inlinestatic |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 271 of file vecMem.h.
273 assert( HexDigit >= 0 && HexDigit < 16 );
275 fprintf( pFile,
"%d", HexDigit );
277 fprintf( pFile,
"%c",
'A' + HexDigit-10 );
static void Vec_MemDumpTruthTables |
( |
Vec_Mem_t * |
p, |
|
|
char * |
pName, |
|
|
int |
nLutSize |
|
) |
| |
|
inlinestatic |
Definition at line 402 of file vecMem.h.
405 char pFileName[1000];
406 sprintf( pFileName,
"tt_%s_%02d.txt", pName ? pName : NULL, nLutSize );
407 pFile = pName ? fopen( pFileName,
"wb" ) : stdout;
409 if ( pFile != stdout )
411 printf(
"Dumped %d %d-var truth tables into file \"%s\" (%.2f MB).\n",
static int Vec_MemEntrySize(Vec_Mem_t *p)
static int Vec_MemEntryNum(Vec_Mem_t *p)
static void Vec_MemDump(FILE *pFile, Vec_Mem_t *pVec)
Definition at line 112 of file vecMem.h.
typedefABC_NAMESPACE_IMPL_START struct Vec_Mem_t_ Vec_Mem_t
DECLARATIONS ///.
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 147 of file vecMem.h.
149 return p->nEntrySize;
static void Vec_MemFill |
( |
Vec_Mem_t * |
pVec, |
|
|
int |
nEntries |
|
) |
| |
|
inlinestatic |
Function*************************************************************
Synopsis [Duplicates the integer array.]
Description []
SideEffects []
SeeAlso []
Definition at line 129 of file vecMem.h.
Definition at line 97 of file vecMem.h.
100 for ( i = 0; i <=
p->iPage; i++ )
Definition at line 105 of file vecMem.h.
static void Vec_MemFree(Vec_Mem_t *p)
Definition at line 206 of file vecMem.h.
209 if ( i >=
p->nEntries )
211 int k, iPageNew = (i >>
p->LogPageSze);
212 if (
p->iPage < iPageNew )
215 if ( iPageNew >=
p->nPageAlloc )
216 p->ppPages =
ABC_REALLOC(
word *,
p->ppPages, (
p->nPageAlloc =
p->nPageAlloc ? 2 *
p->nPageAlloc : iPageNew + 32) );
218 for ( k =
p->iPage + 1; k <= iPageNew; k++ )
#define ABC_REALLOC(type, obj, num)
#define ABC_ALLOC(type, num)
unsigned __int64 word
DECLARATIONS ///.
static word * Vec_MemReadEntry(Vec_Mem_t *p, int i)
static void Vec_MemHashAlloc |
( |
Vec_Mem_t * |
p, |
|
|
int |
nTableSize |
|
) |
| |
|
inlinestatic |
Function*************************************************************
Synopsis [Hashing entries in the memory vector.]
Description []
SideEffects []
SeeAlso []
Definition at line 305 of file vecMem.h.
307 assert(
p->vTable == NULL &&
p->vNexts == NULL );
static int Abc_PrimeCudd(unsigned int p)
static Vec_Int_t * Vec_IntStartFull(int nSize)
static Vec_Int_t * Vec_IntAlloc(int nCap)
FUNCTION DEFINITIONS ///.
Definition at line 311 of file vecMem.h.
static void Vec_IntFreeP(Vec_Int_t **p)
Definition at line 351 of file vecMem.h.
static void Vec_MemHashResize(Vec_Mem_t *p)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static int Vec_IntSize(Vec_Int_t *p)
static int * Vec_MemHashLookup(Vec_Mem_t *p, word *pEntry)
static void Vec_MemPush(Vec_Mem_t *p, word *pEntry)
Definition at line 318 of file vecMem.h.
320 static int s_Primes[8] = { 1699, 4177, 5147, 5647, 6343, 7103, 7873, 8147 };
321 int i, nData = 2 *
p->nEntrySize;
322 unsigned * pData = (
unsigned *)pEntry;
324 for ( i = 0; i < nData; i++ )
325 uHash += pData[i] * s_Primes[i & 0x7];
static int s_Primes[MAX_PRIMES]
static int Vec_IntSize(Vec_Int_t *p)
Definition at line 328 of file vecMem.h.
static unsigned Vec_MemHashKey(Vec_Mem_t *p, word *pEntry)
unsigned __int64 word
DECLARATIONS ///.
static int * Vec_IntEntryP(Vec_Int_t *p, int i)
static word * Vec_MemReadEntry(Vec_Mem_t *p, int i)
static void Vec_MemHashResize |
( |
Vec_Mem_t * |
p | ) |
|
|
static |
Definition at line 336 of file vecMem.h.
static int Abc_PrimeCudd(unsigned int p)
#define Vec_MemForEachEntry(p, pEntry, i)
MACRO DEFINITIONS ///.
unsigned __int64 word
DECLARATIONS ///.
static void Vec_IntFill(Vec_Int_t *p, int nSize, int Fill)
static void Vec_IntPush(Vec_Int_t *p, int Entry)
static int Vec_IntSize(Vec_Int_t *p)
static void Vec_IntClear(Vec_Int_t *p)
static int * Vec_MemHashLookup(Vec_Mem_t *p, word *pEntry)
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 175 of file vecMem.h.
177 return (
double)
sizeof(
word) *
p->nEntrySize * (1 <<
p->LogPageSze) * (
p->iPage + 1) + (
double)
sizeof(
word *) *
p->nPageAlloc + (
double)
sizeof(
Vec_Mem_t);
unsigned __int64 word
DECLARATIONS ///.
typedefABC_NAMESPACE_HEADER_START struct Vec_Mem_t_ Vec_Mem_t
INCLUDES ///.
Definition at line 155 of file vecMem.h.
157 return p->LogPageSze;
Definition at line 233 of file vecMem.h.
236 memmove( pPlace, pEntry,
sizeof(
word) *
p->nEntrySize );
unsigned __int64 word
DECLARATIONS ///.
static word * Vec_MemGetEntry(Vec_Mem_t *p, int i)
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 191 of file vecMem.h.
193 assert( i >= 0 && i < p->nEntries );
194 return p->ppPages[i >>
p->LogPageSze] +
p->nEntrySize * (i &
p->PageMask);
Definition at line 196 of file vecMem.h.
static word * Vec_MemReadEntry(Vec_Mem_t *p, int i)
static void Vec_MemSetEntry |
( |
Vec_Mem_t * |
p, |
|
|
int |
i, |
|
|
word * |
pEntry |
|
) |
| |
|
inlinestatic |
Definition at line 228 of file vecMem.h.
231 memmove( pPlace, pEntry,
sizeof(
word) *
p->nEntrySize );
unsigned __int64 word
DECLARATIONS ///.
static word * Vec_MemGetEntry(Vec_Mem_t *p, int i)
static void Vec_MemShrink |
( |
Vec_Mem_t * |
p, |
|
|
int |
nEntriesNew |
|
) |
| |
|
inlinestatic |
Function*************************************************************
Synopsis []
Description []
SideEffects []
SeeAlso []
Definition at line 250 of file vecMem.h.
252 int i, iPageOld =
p->iPage;
253 assert( nEntriesNew <= p->nEntries );
254 p->nEntries = nEntriesNew;
255 p->iPage = (nEntriesNew >>
p->LogPageSze);
256 for ( i =
p->iPage + 1; i <= iPageOld; i++ )
static void Vec_MemWriteEntry |
( |
Vec_Mem_t * |
p, |
|
|
int |
i, |
|
|
word * |
pEntry |
|
) |
| |
|
inlinestatic |
Definition at line 201 of file vecMem.h.
204 memmove( pPlace, pEntry,
sizeof(
word) *
p->nEntrySize );
unsigned __int64 word
DECLARATIONS ///.
static word * Vec_MemReadEntry(Vec_Mem_t *p, int i)