tim.h 9.77 KB
Newer Older
Alan Mishchenko committed
1 2
/**CFile****************************************************************

Alan Mishchenko committed
3
  FileName    [tim.h]
Alan Mishchenko committed
4 5 6

  SystemName  [ABC: Logic synthesis and verification system.]

7
  PackageName [Hierarchy/timing manager.]
Alan Mishchenko committed
8 9 10 11 12 13 14 15 16

  Synopsis    [External declarations.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

  Date        [Ver. 1.0. Started - April 28, 2007.]

Alan Mishchenko committed
17
  Revision    [$Id: tim.h,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
Alan Mishchenko committed
18 19 20

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

21 22
#ifndef ABC__aig__tim__tim_h
#define ABC__aig__tim__tim_h
Alan Mishchenko committed
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
/*
    The data-structure Tim_Man_t implemented in this package stores two types 
    of information:
    (1) hierarchical information about the connectivity of a combinational 
    logic network with combinational logic node and combinational white boxes
    (2) timing information about input-to-output delays of each combinational 
    white box.

    This data-structure is closely coupled with the AIG manager extracted from 
    the same combinational logic network. The AIG manager represents combinational
    logic surrounding white boxes, and contains additional PIs/POs corresponding
    to the outputs/inputs of the white boxes.

    The manager Tim_Man_t is created by a call to Tim_ManStart(). The arguments 
    of this call are the total number of all combinational inputs/output in 
    the extracted AIG. (Note that this number is different from the number of 
    inputs/outputs of the combinational logic network, because the extracted AIG 
    will have additional inputs/output due to white boxes.)

    The extracted AIG and the corresponding Tim_Man_t may be created at the same 
    time or at separate times. The following guideline assumes concurrent creation.

    First, PIs of the AIG are created in 1-to-1 correspondence with the PIs 
    of the original network.
    Next, all nodes (logic nodes and white boxes) of the network are traversed 
    in a topologic order.
    When a white box is encountered, the TFI cone of box inputs are tranversed 
    and all new logic nodes encoutered added to the AIG.
    Then, the white box is created by the call to Tim_ManCreateBox().
    Then, new POs of the AIG are created in 1-to-1 correspondence with box inputs. 
    Then, new PIs of the AIG are created in 1-to-1 correspondence with box outputs.
    Finally, the TFO cone of the POs is traversed and all new logic nodes 
    encountered added to the AIG.
    In the end, the POs of the AIG is constructed in 1-to-1 correspondence with 
    the PIs of the original combinational logic network.

    Delay tables representing input-to-output delays of each type of white
    box should be computed in advance and given to the timing manager in one array
    through the API Tim_ManSetDelayTables().  When each box is constructed, the delay
    table ID of this box (which is the index of the table in the above array) is given 
    as the last argument 'iDelayTable' in Tim_ManCreateBox().

    A delay table is a one-dimensional array of floats whose size is: 3 + nInputs * nOutputs.
    The first entry is the delay table ID used by the boxes to refer to the table.
    The second and third entries are nInputs and nOutputs.
    The following 'nInputs * nOutputs' entries are delay numbers for each output, 
    that is, the first set of nInputs entries give delay of the first output.
    the second set of nInputs entries give delay of the second output, etc.

    The Tim_Man_t is typically associated with the AIG manager (pGia) using 
    pointer (pGia->pManTime). It is automatically deallocated when the host 
    AIG manager is deleted.
*/
77

Alan Mishchenko committed
78 79 80 81 82 83 84 85
////////////////////////////////////////////////////////////////////////
///                          INCLUDES                                ///
////////////////////////////////////////////////////////////////////////

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

86
ABC_NAMESPACE_HEADER_START
Alan Mishchenko committed
87

Alan Mishchenko committed
88 89 90 91
////////////////////////////////////////////////////////////////////////
///                         BASIC TYPES                              ///
////////////////////////////////////////////////////////////////////////

92
typedef struct Tim_Man_t_  Tim_Man_t;
Alan Mishchenko committed
93

Alan Mishchenko committed
94 95 96 97
////////////////////////////////////////////////////////////////////////
///                      MACRO DEFINITIONS                           ///
////////////////////////////////////////////////////////////////////////

Alan Mishchenko committed
98
#define TIM_ETERNITY 1000000000
Alan Mishchenko committed
99

Alan Mishchenko committed
100 101 102 103 104
////////////////////////////////////////////////////////////////////////
///                             ITERATORS                            ///
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
Alan Mishchenko committed
105 106 107 108
///                     SEQUENTIAL ITERATORS                         ///
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
Alan Mishchenko committed
109 110 111
///                    FUNCTION DECLARATIONS                         ///
////////////////////////////////////////////////////////////////////////

112
/*=== timBox.c ===========================================================*/
113
extern void            Tim_ManCreateBox( Tim_Man_t * p, int firstIn, int nIns, int firstOut, int nOuts, int iDelayTable, int fBlack );
114 115 116
extern int             Tim_ManBoxForCi( Tim_Man_t * p, int iCo );
extern int             Tim_ManBoxForCo( Tim_Man_t * p, int iCi );
extern int             Tim_ManBoxInputFirst( Tim_Man_t * p, int iBox );
117
extern int             Tim_ManBoxInputLast( Tim_Man_t * p, int iBox );
118
extern int             Tim_ManBoxOutputFirst( Tim_Man_t * p, int iBox );
119
extern int             Tim_ManBoxOutputLast( Tim_Man_t * p, int iBox );
120 121
extern int             Tim_ManBoxInputNum( Tim_Man_t * p, int iBox );
extern int             Tim_ManBoxOutputNum( Tim_Man_t * p, int iBox );
122
extern int             Tim_ManBoxDelayTableId( Tim_Man_t * p, int iBox );
123
extern float *         Tim_ManBoxDelayTable( Tim_Man_t * p, int iBox );
124
extern int             Tim_ManBoxIsBlack( Tim_Man_t * p, int iBox );
125 126
extern int             Tim_ManBoxCopy( Tim_Man_t * p, int iBox );
extern void            Tim_ManBoxSetCopy( Tim_Man_t * p, int iBox, int iCopy );
127
extern int             Tim_ManBoxFindFromCiNum( Tim_Man_t * p, int iCiNum );
128
/*=== timDump.c ===========================================================*/
129 130
extern Vec_Str_t *     Tim_ManSave( Tim_Man_t * p, int fHieOnly );
extern Tim_Man_t *     Tim_ManLoad( Vec_Str_t * p, int fHieOnly );
131
/*=== timMan.c ===========================================================*/
Alan Mishchenko committed
132
extern Tim_Man_t *     Tim_ManStart( int nCis, int nCos );
133
extern Tim_Man_t *     Tim_ManDup( Tim_Man_t * p, int fUnitDelay );
134
extern Tim_Man_t *     Tim_ManTrim( Tim_Man_t * p, Vec_Int_t * vBoxPres );
135
extern Tim_Man_t *     Tim_ManReduce( Tim_Man_t * p, Vec_Int_t * vBoxesLeft, int nTermsDiff );
136
extern Vec_Int_t *     Tim_ManAlignTwo( Tim_Man_t * pSpec, Tim_Man_t * pImpl );
137
extern void            Tim_ManCreate( Tim_Man_t * p, void * pLib, Vec_Flt_t * vInArrs, Vec_Flt_t * vOutReqs );
138 139
extern float *         Tim_ManGetArrTimes( Tim_Man_t * p );
extern float *         Tim_ManGetReqTimes( Tim_Man_t * p );
Alan Mishchenko committed
140
extern void            Tim_ManStop( Tim_Man_t * p );
141
extern void            Tim_ManStopP( Tim_Man_t ** p );
Alan Mishchenko committed
142
extern void            Tim_ManPrint( Tim_Man_t * p );
143
extern void            Tim_ManPrintStats( Tim_Man_t * p, int nAnd2Delay );
144 145 146 147 148
extern int             Tim_ManCiNum( Tim_Man_t * p );
extern int             Tim_ManCoNum( Tim_Man_t * p );
extern int             Tim_ManPiNum( Tim_Man_t * p );
extern int             Tim_ManPoNum( Tim_Man_t * p );
extern int             Tim_ManBoxNum( Tim_Man_t * p );
149
extern int             Tim_ManBlackBoxNum( Tim_Man_t * p );
150
extern void            Tim_ManBlackBoxIoNum( Tim_Man_t * p, int * pnBbIns, int * pnBbOuts );
151 152
extern int             Tim_ManDelayTableNum( Tim_Man_t * p );
extern void            Tim_ManSetDelayTables( Tim_Man_t * p, Vec_Ptr_t * vDelayTables );
Alan Mishchenko committed
153 154
extern void            Tim_ManTravIdDisable( Tim_Man_t * p );
extern void            Tim_ManTravIdEnable( Tim_Man_t * p );
155 156 157 158 159 160 161 162 163 164 165 166
/*=== timTime.c ===========================================================*/
extern void            Tim_ManInitPiArrival( Tim_Man_t * p, int iPi, float Delay );
extern void            Tim_ManInitPoRequired( Tim_Man_t * p, int iPo, float Delay );
extern void            Tim_ManInitPiArrivalAll( Tim_Man_t * p, float Delay );
extern void            Tim_ManInitPoRequiredAll( Tim_Man_t * p, float Delay );
extern void            Tim_ManSetCoArrival( Tim_Man_t * p, int iCo, float Delay );
extern void            Tim_ManSetCiRequired( Tim_Man_t * p, int iCi, float Delay );
extern void            Tim_ManSetCoRequired( Tim_Man_t * p, int iCo, float Delay );
extern float           Tim_ManGetCiArrival( Tim_Man_t * p, int iCi );
extern float           Tim_ManGetCoRequired( Tim_Man_t * p, int iCo );
/*=== timTrav.c ===========================================================*/
extern void            Tim_ManIncrementTravId( Tim_Man_t * p );
Alan Mishchenko committed
167 168
extern void            Tim_ManSetCurrentTravIdBoxInputs( Tim_Man_t * p, int iBox );
extern void            Tim_ManSetCurrentTravIdBoxOutputs( Tim_Man_t * p, int iBox );
Alan Mishchenko committed
169 170 171 172
extern void            Tim_ManSetPreviousTravIdBoxInputs( Tim_Man_t * p, int iBox );
extern void            Tim_ManSetPreviousTravIdBoxOutputs( Tim_Man_t * p, int iBox );
extern int             Tim_ManIsCiTravIdCurrent( Tim_Man_t * p, int iCi );
extern int             Tim_ManIsCoTravIdCurrent( Tim_Man_t * p, int iCo );
173 174 175 176


ABC_NAMESPACE_HEADER_END

Alan Mishchenko committed
177 178 179 180 181 182 183 184


#endif

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