summaryrefslogtreecommitdiffstats
path: root/src/misc/nm/nm.h
blob: c6344bbfa975d64d0151b7ac4f7b34423233beb8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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
82
83
84
85
86
87
88
89
90
91
92
/**CFilextern e****************************************************************

  FileName    [nm.h]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [Name manager.]

  Synopsis    [External declarations.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

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

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

***********************************************************************/
 
#ifndef __NM_H__
#define __NM_H__

#ifdef __cplusplus
extern "C" {
#endif

/*
    This manager is designed to store ID-to-name and name-to-ID mapping
    for Boolean networks and And-Inverter Graphs.
    
    In a netlist, net names are unique. In this case, there is a one-to-one
    mapping between IDs and names.

    In a logic network, which do not have nets, several objects may have
    the same name. For example, a latch output and a primary output.
    Another example, a primary input and an input to a black box.
    In this case, for each ID on an object there is only one name, 
    but for each name may be several IDs of objects having this name.

    The name manager maps ID-to-name uniquely but it allows one name to 
    be mapped into several IDs. When a query to find an ID of the object
    by its name is submitted, it is possible to specify the object type, 
    which will help select one of several IDs. If the type is -1, and 
    there is more than one object with the given name, any object with 
    the given name is returned.
*/

////////////////////////////////////////////////////////////////////////
///                          INCLUDES                                ///
////////////////////////////////////////////////////////////////////////

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

////////////////////////////////////////////////////////////////////////
///                         BASIC TYPES                              ///
////////////////////////////////////////////////////////////////////////

typedef struct Nm_Man_t_ Nm_Man_t;

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

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

/*=== nmApi.c ==========================================================*/
extern Nm_Man_t *   Nm_ManCreate( int nSize );
extern void         Nm_ManFree( Nm_Man_t * p );
extern int          Nm_ManNumEntries( Nm_Man_t * p );
extern char *       Nm_ManStoreIdName( Nm_Man_t * p, int ObjId, int Type, char * pName, char * pSuffix );
extern void         Nm_ManDeleteIdName( Nm_Man_t * p, int ObjId );
extern char *       Nm_ManCreateUniqueName( Nm_Man_t * p, int ObjId );
extern char *       Nm_ManFindNameById( Nm_Man_t * p, int ObjId );
extern int          Nm_ManFindIdByName( Nm_Man_t * p, char * pName, int Type );
extern int          Nm_ManFindIdByNameTwoTypes( Nm_Man_t * p, char * pName, int Type1, int Type2 );
extern Vec_Int_t *  Nm_ManReturnNameIds( Nm_Man_t * p );

#ifdef __cplusplus
}
#endif

#endif

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