summaryrefslogtreecommitdiffstats
path: root/src/temp/player/player.h
blob: 9ecad35b3dbecbc0c4db30bedcf81714025317c3 (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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/**CFile****************************************************************

  FileName    [player.h]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [PLA decomposition package.]

  Synopsis    [External declarations.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

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

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

***********************************************************************/

#ifndef __XYZ_H__
#define __XYZ_H__

#ifdef __cplusplus
extern "C" {
#endif

#include "ivy.h"
#include "esop.h"
#include "vec.h"

////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

typedef struct Pla_Man_t_  Pla_Man_t;
typedef struct Pla_Obj_t_  Pla_Obj_t;

// storage for node information
struct Pla_Obj_t_
{
    unsigned          fFixed :  1;  // fixed node
    unsigned          Depth  :  7;  // the depth in terms of LUTs/PLAs
    unsigned          nRefs  : 24;  // the number of references
    Vec_Int_t         vSupp[2];     // supports in two frames
    Esop_Cube_t *     pCover[2];    // esops in two frames
};

// storage for additional information
struct Pla_Man_t_
{
    // general characteristics
    int               nLutMax;      // the number of vars
    int               nPlaMax;      // the number of vars
    int               nCubesMax;    // the limit on the number of cubes in the intermediate covers
    Ivy_Man_t *       pManAig;      // the AIG manager
    Pla_Obj_t *       pPlaStrs;     // memory for structures
    Esop_Man_t *      pManMin;      // the cube manager
    // arrays to map local variables
    Vec_Int_t *       vComTo0;      // mapping of common variables into first fanin
    Vec_Int_t *       vComTo1;      // mapping of common variables into second fanin
    Vec_Int_t *       vPairs0;      // the first var in each pair of common vars
    Vec_Int_t *       vPairs1;      // the second var in each pair of common vars
    Vec_Int_t *       vTriv0;       // trival support of the first node
    Vec_Int_t *       vTriv1;       // trival support of the second node
    // statistics
    int               nNodes;       // the number of nodes processed
    int               nNodesLut;    // the number of nodes processed
    int               nNodesPla;    // the number of nodes processed
    int               nNodesBoth;   // the number of nodes processed
    int               nNodesDeref;  // the number of nodes processed
};

#define PLAYER_FANIN_LIMIT  128

#define PLA_MIN(a,b)        (((a) < (b))? (a) : (b))
#define PLA_MAX(a,b)        (((a) > (b))? (a) : (b))

#define PLA_EMPTY           ((Esop_Cube_t *)1)

static inline Pla_Man_t *   Ivy_ObjPlaMan( Ivy_Obj_t * pObj )   { return (Pla_Man_t *)Ivy_ObjMan(pObj)->pData;       }
static inline Pla_Obj_t *   Ivy_ObjPlaStr( Ivy_Obj_t * pObj )   { return Ivy_ObjPlaMan(pObj)->pPlaStrs + pObj->Id;   }

static inline unsigned *    Ivy_ObjGetTruth( Ivy_Obj_t * pObj )  
{ 
    Ivy_Man_t * p = Ivy_ObjMan(pObj);
    int Offset = Vec_IntEntry( p->vTruths, pObj->Id );
    return Offset < 0 ? NULL : p->pMemory + Offset;
    
}

////////////////////////////////////////////////////////////////////////
///                     FUNCTION DEFINITIONS                         ///
////////////////////////////////////////////////////////////////////////

/*=== playerAbc.c ==============================================================*/
extern void *        Abc_NtkPlayer( void * pNtk, int nLutMax, int nFaninMax, int fVerbose );
/*=== playerBuild.c ============================================================*/
extern Ivy_Man_t *   Pla_ManToAig( Ivy_Man_t * p );
/*=== playerCore.c =============================================================*/
extern Ivy_Man_t *   Pla_ManDecompose( Ivy_Man_t * p, int nLutMax, int nPlaMax, int fVerbose );
/*=== playerMan.c ==============================================================*/
extern Pla_Man_t *   Pla_ManAlloc( Ivy_Man_t * p, int nLutMax, int nPlaMax );
extern void          Pla_ManFree( Pla_Man_t * p );
extern void          Pla_ManFreeStr( Pla_Man_t * p, Pla_Obj_t * pStr );
/*=== playerUtil.c =============================================================*/
extern int           Pla_ManMergeTwoSupports( Pla_Man_t * p, Vec_Int_t * vSupp0, Vec_Int_t * vSupp1, Vec_Int_t * vSupp );
extern Esop_Cube_t * Pla_ManAndTwoCovers( Pla_Man_t * p, Esop_Cube_t * pCover0, Esop_Cube_t * pCover1, int nSupp, int fStopAtLimit );
extern Esop_Cube_t * Pla_ManExorTwoCovers( Pla_Man_t * p, Esop_Cube_t * pCover0, Esop_Cube_t * pCover1, int nSupp, int fStopAtLimit );
extern void          Pla_ManComputeStats( Ivy_Man_t * pAig, Vec_Int_t * vNodes );

#ifdef __cplusplus
}
#endif

#endif

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