summaryrefslogtreecommitdiffstats
path: root/src/map/pga/pgaInt.h
blob: da9aa9a99629db89d2ef9350beed3454ad93f3f9 (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
124
125
126
127
128
129
130
131
132
/**CFile****************************************************************

  FileName    [pgaInt.h]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [FPGA mapper.]

  Synopsis    [Internal declarations.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

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

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

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

#ifndef __PGA_INT_H__
#define __PGA_INT_H__

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

#include <stdio.h>
#include "abc.h"
#include "fraig.h"
#include "fpga.h"
#include "cut.h"
#include "pga.h"

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

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

typedef struct Pga_NodeStruct_t_     Pga_Node_t;
typedef struct Pga_MatchStruct_t_    Pga_Match_t;

struct Pga_ManStruct_t_
{
    // mapping parameters
    Pga_Params_t *     pParams;       // input data
    // mapping structures
    Pga_Node_t *       pMemory;       // the memory for all mapping structures
    Vec_Ptr_t *        vStructs;      // mapping structures one-to-one with ABC nodes
    Vec_Ptr_t *        vOrdering;     // mapping nodes ordered by level
    // k-feasible cuts
    int                nVarsMax;      // the "k" of k-feasible cuts
    Cut_Man_t *        pManCut;       // the cut manager
    // LUT library
    float *            pLutDelays;    // the delay of the LUTs
    float *            pLutAreas;     // the areas of the LUTs
    float              Epsilon;
    // global parameters
    float              AreaGlobal;    // the total area of this mapping
    float              ArrivalGlobal; // the largest delay of any path
    float              RequiredGlobal;// the global required time (may be different from largest delay)
    float              RequiredUser;  // the required time given by the user
    // runtime stats
    int                timeToMap;     // the time to start the mapper
    int                timeCuts;      // the time to compute the cuts
    int                timeDelay;     // the time to compute delay
    int                timeAreaFlow;  // the time to perform area flow optimization
    int                timeArea;      // the time to perform area flow optimization
    int                timeToNet;     // the time to transform back to network
    int                timeTotal;     // the total time
    int                time1;         // temporary
    int                time2;         // temporary
};

struct Pga_MatchStruct_t_
{
    Cut_Cut_t *        pCut;          // the best cut
    float              Delay;         // the arrival time of this cut
    float              Area;          // the area of this cut
};

struct Pga_NodeStruct_t_
{
    int                Id;            // ID of the node 
    int                nRefs;         // the number of references
    float              EstRefs;       // the estimated reference counter
    float              Required;      // the required time
    float              Switching;     // the switching activity
    Pga_Match_t        Match;         // the best match at the node
};

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

static inline Pga_Node_t * Pga_Node( Pga_Man_t * p, int Id )  { return p->vStructs->pArray[Id]; }

// iterator through the CIs
#define Pga_ManForEachCi( p, pCi, i )                                    \
    for ( i = 0; (i < Abc_NtkCiNum(p->pParams->pNtk)) && (((pCi) = Pga_Node(p, Abc_NtkCi(p->pParams->pNtk,i)->Id)), 1); i++ )
// iterator through the CO derivers
#define Pga_ManForEachCoDriver( p, pCo, i )                              \
    for ( i = 0; (i < Abc_NtkCoNum(p->pParams->pNtk)) && (((pCo) = Pga_Node(p, Abc_ObjFaninId0(Abc_NtkCo(p->pParams->pNtk,i)))), 1); i++ )
// iterators through the CIs and internal nodes
#define Pga_ManForEachObjDirect( p, pNode, i )                           \
    Vec_PtrForEachEntry( p->vOrdering, pNode, i )
#define Pga_ManForEachObjReverse( p, pNode, i )                           \
    Vec_PtrForEachEntryReverse( p->vOrdering, pNode, i )

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

/*=== pgaMatch.c ==========================================================*/
extern void        Pga_MappingMatches( Pga_Man_t * p, int Mode );
/*=== pgaUtil.c ==========================================================*/
extern Vec_Ptr_t * Pga_MappingResults( Pga_Man_t * p );
extern float       Pga_TimeComputeArrivalMax( Pga_Man_t * p );
extern void        Pga_MappingComputeRequired( Pga_Man_t * p );
extern float       Pga_MappingSetRefsAndArea( Pga_Man_t * p );
extern float       Pga_MappingGetSwitching( Pga_Man_t * p );
extern void        Pga_MappingPrintOutputArrivals( Pga_Man_t * p );

#endif

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