nmInt.h 3.3 KB
Newer Older
Alan Mishchenko committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
/**CFile****************************************************************

  FileName    [nmInt.h]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [Name manager.]

  Synopsis    [Internal declarations.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

  Date        [Ver. 1.0. Started - June 20, 2005.]

  Revision    [$Id: nmInt.h,v 1.00 2005/06/20 00:00:00 alanmi Exp $]

***********************************************************************/
 
21 22
#ifndef ABC__misc__nm__nmInt_h
#define ABC__misc__nm__nmInt_h
Alan Mishchenko committed
23

24

Alan Mishchenko committed
25 26 27 28
////////////////////////////////////////////////////////////////////////
///                          INCLUDES                                ///
////////////////////////////////////////////////////////////////////////

29 30
#include "misc/extra/extra.h"
#include "misc/vec/vec.h"
Alan Mishchenko committed
31 32 33 34 35 36
#include "nm.h"

////////////////////////////////////////////////////////////////////////
///                         PARAMETERS                               ///
////////////////////////////////////////////////////////////////////////

37 38 39 40


ABC_NAMESPACE_HEADER_START

Alan Mishchenko committed
41

Alan Mishchenko committed
42 43 44 45 46 47 48
////////////////////////////////////////////////////////////////////////
///                         BASIC TYPES                              ///
////////////////////////////////////////////////////////////////////////

typedef struct Nm_Entry_t_ Nm_Entry_t;
struct Nm_Entry_t_
{
49 50
    unsigned         Type;          // object type
    unsigned         ObjId;         // object ID
Alan Mishchenko committed
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
    Nm_Entry_t *     pNextI2N;      // the next entry in the ID hash table
    Nm_Entry_t *     pNextN2I;      // the next entry in the name hash table
    Nm_Entry_t *     pNameSake;     // the next entry with the same name
    char             Name[0];       // name of the object
};

struct Nm_Man_t_
{
    Nm_Entry_t **    pBinsI2N;      // mapping IDs into names
    Nm_Entry_t **    pBinsN2I;      // mapping names into IDs 
    int              nBins;         // the number of bins in tables
    int              nEntries;      // the number of entries
    int              nSizeFactor;   // determined how much larger the table should be
    int              nGrowthFactor; // determined how much the table grows after resizing
    Extra_MmFlex_t * pMem;          // memory manager for entries (and names)
};

////////////////////////////////////////////////////////////////////////
///                      MACRO DEFINITIONS                           ///
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
///                    FUNCTION DECLARATIONS                         ///
////////////////////////////////////////////////////////////////////////

/*=== nmTable.c ==========================================================*/
extern int              Nm_ManTableAdd( Nm_Man_t * p, Nm_Entry_t * pEntry );
extern int              Nm_ManTableDelete( Nm_Man_t * p, int ObjId );
extern Nm_Entry_t *     Nm_ManTableLookupId( Nm_Man_t * p, int ObjId );
extern Nm_Entry_t *     Nm_ManTableLookupName( Nm_Man_t * p, char * pName, int Type );

82 83 84 85 86


ABC_NAMESPACE_HEADER_END


Alan Mishchenko committed
87 88 89 90 91 92 93 94

#endif

////////////////////////////////////////////////////////////////////////
///                       END OF FILE                                ///
////////////////////////////////////////////////////////////////////////