abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
timInt.h
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [timInt.h]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [Hierarchy/timing manager.]
8 
9  Synopsis [Internal declarations.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - April 28, 2007.]
16 
17  Revision [$Id: timInt.h,v 1.00 2007/04/28 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #ifndef ABC__aig__tim__timInt_h
22 #define ABC__aig__tim__timInt_h
23 
24 
25 ////////////////////////////////////////////////////////////////////////
26 /// INCLUDES ///
27 ////////////////////////////////////////////////////////////////////////
28 
29 #include <stdio.h>
30 #include <stdlib.h>
31 #include <string.h>
32 #include <assert.h>
33 
34 #include "misc/vec/vec.h"
35 #include "misc/mem/mem.h"
36 #include "tim.h"
37 
38 ////////////////////////////////////////////////////////////////////////
39 /// PARAMETERS ///
40 ////////////////////////////////////////////////////////////////////////
41 
43 
44 ////////////////////////////////////////////////////////////////////////
45 /// BASIC TYPES ///
46 ////////////////////////////////////////////////////////////////////////
47 
48 typedef struct Tim_Box_t_ Tim_Box_t;
49 typedef struct Tim_Obj_t_ Tim_Obj_t;
50 
51 // timing manager
52 struct Tim_Man_t_
53 {
54  Vec_Ptr_t * vBoxes; // the timing boxes
55  Vec_Ptr_t * vDelayTables; // pointers to the delay tables
56  Mem_Flex_t * pMemObj; // memory manager for boxes
57  int nTravIds; // traversal ID of the manager
58  int fUseTravId; // enables the use of traversal ID
59  int nCis; // the number of PIs
60  int nCos; // the number of POs
61  Tim_Obj_t * pCis; // timing info for the PIs
62  Tim_Obj_t * pCos; // timing info for the POs
63 };
64 
65 // timing box
66 struct Tim_Box_t_
67 {
68  int iBox; // the unique ID of this box
69  int TravId; // traversal ID of this box
70  int nInputs; // the number of box inputs (POs)
71  int nOutputs; // the number of box outputs (PIs)
72  int iDelayTable; // index of the delay table
73  int iCopy; // copy of this box
74  int fBlack; // this is black box
75  int Inouts[0]; // the int numbers of PIs and POs
76 };
77 
78 // timing object
79 struct Tim_Obj_t_
80 {
81  int Id; // the ID of this object
82  int TravId; // traversal ID of this object
83  int iObj2Box; // mapping of the object into its box
84  int iObj2Num; // mapping of the object into its number in the box
85  float timeArr; // arrival time of the object
86  float timeReq; // required time of the object
87 };
88 
89 ////////////////////////////////////////////////////////////////////////
90 /// MACRO DEFINITIONS ///
91 ////////////////////////////////////////////////////////////////////////
92 
93 static inline Tim_Obj_t * Tim_ManCi( Tim_Man_t * p, int i ) { assert( i < p->nCis ); return p->pCis + i; }
94 static inline Tim_Obj_t * Tim_ManCo( Tim_Man_t * p, int i ) { assert( i < p->nCos ); return p->pCos + i; }
95 static inline Tim_Box_t * Tim_ManBox( Tim_Man_t * p, int i ) { return (Tim_Box_t *)Vec_PtrEntry(p->vBoxes, i); }
96 
97 static inline Tim_Box_t * Tim_ManCiBox( Tim_Man_t * p, int i ) { return Tim_ManCi(p,i)->iObj2Box < 0 ? NULL : (Tim_Box_t *)Vec_PtrEntry( p->vBoxes, Tim_ManCi(p,i)->iObj2Box ); }
98 static inline Tim_Box_t * Tim_ManCoBox( Tim_Man_t * p, int i ) { return Tim_ManCo(p,i)->iObj2Box < 0 ? NULL : (Tim_Box_t *)Vec_PtrEntry( p->vBoxes, Tim_ManCo(p,i)->iObj2Box ); }
99 
100 static inline Tim_Obj_t * Tim_ManBoxInput( Tim_Man_t * p, Tim_Box_t * pBox, int i ) { assert( i < pBox->nInputs ); return p->pCos + pBox->Inouts[i]; }
101 static inline Tim_Obj_t * Tim_ManBoxOutput( Tim_Man_t * p, Tim_Box_t * pBox, int i ) { assert( i < pBox->nOutputs ); return p->pCis + pBox->Inouts[pBox->nInputs+i]; }
102 
103 ////////////////////////////////////////////////////////////////////////
104 /// ITERATORS ///
105 ////////////////////////////////////////////////////////////////////////
106 
107 #define Tim_ManForEachCi( p, pObj, i ) \
108  for ( i = 0; (i < (p)->nCis) && ((pObj) = (p)->pCis + i); i++ )
109 #define Tim_ManForEachCo( p, pObj, i ) \
110  for ( i = 0; (i < (p)->nCos) && ((pObj) = (p)->pCos + i); i++ )
111 
112 #define Tim_ManForEachPi( p, pObj, i ) \
113  Tim_ManForEachCi( p, pObj, i ) if ( pObj->iObj2Box >= 0 ) {} else
114 #define Tim_ManForEachPo( p, pObj, i ) \
115  Tim_ManForEachCo( p, pObj, i ) if ( pObj->iObj2Box >= 0 ) {} else
116 
117 #define Tim_ManForEachBox( p, pBox, i ) \
118  Vec_PtrForEachEntry( Tim_Box_t *, p->vBoxes, pBox, i )
119 
120 #define Tim_ManBoxForEachInput( p, pBox, pObj, i ) \
121  for ( i = 0; (i < (pBox)->nInputs) && ((pObj) = Tim_ManBoxInput(p, pBox, i)); i++ )
122 #define Tim_ManBoxForEachOutput( p, pBox, pObj, i ) \
123  for ( i = 0; (i < (pBox)->nOutputs) && ((pObj) = Tim_ManBoxOutput(p, pBox, i)); i++ )
124 
125 #define Tim_ManForEachTable( p, pTable, i ) \
126  Vec_PtrForEachEntry( float *, p->vDelayTables, pTable, i )
127 
128 ////////////////////////////////////////////////////////////////////////
129 /// SEQUENTIAL ITERATORS ///
130 ////////////////////////////////////////////////////////////////////////
131 
132 ////////////////////////////////////////////////////////////////////////
133 /// FUNCTION DECLARATIONS ///
134 ////////////////////////////////////////////////////////////////////////
135 
136 /*=== time.c ===========================================================*/
137 
138 
140 
141 
142 
143 #endif
144 
145 ////////////////////////////////////////////////////////////////////////
146 /// END OF FILE ///
147 ////////////////////////////////////////////////////////////////////////
148 
int nOutputs
Definition: timInt.h:71
float timeArr
Definition: timInt.h:85
Mem_Flex_t * pMemObj
Definition: timInt.h:56
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
int nCos
Definition: timInt.h:60
Tim_Obj_t * pCos
Definition: timInt.h:62
static Tim_Box_t * Tim_ManCiBox(Tim_Man_t *p, int i)
Definition: timInt.h:97
Vec_Ptr_t * vBoxes
Definition: timInt.h:54
static Tim_Box_t * Tim_ManCoBox(Tim_Man_t *p, int i)
Definition: timInt.h:98
Tim_Obj_t * pCis
Definition: timInt.h:61
static Tim_Obj_t * Tim_ManBoxOutput(Tim_Man_t *p, Tim_Box_t *pBox, int i)
Definition: timInt.h:101
float timeReq
Definition: timInt.h:86
int iDelayTable
Definition: timInt.h:72
int fUseTravId
Definition: timInt.h:58
int iObj2Num
Definition: timInt.h:84
#define ABC_NAMESPACE_HEADER_START
NAMESPACES ///.
Definition: abc_global.h:105
int iBox
Definition: timInt.h:68
static Tim_Obj_t * Tim_ManCi(Tim_Man_t *p, int i)
MACRO DEFINITIONS ///.
Definition: timInt.h:93
static Tim_Box_t * Tim_ManBox(Tim_Man_t *p, int i)
Definition: timInt.h:95
#define ABC_NAMESPACE_HEADER_END
Definition: abc_global.h:106
int TravId
Definition: timInt.h:82
int iCopy
Definition: timInt.h:73
int fBlack
Definition: timInt.h:74
static void * Vec_PtrEntry(Vec_Ptr_t *p, int i)
Definition: vecPtr.h:362
int Id
Definition: timInt.h:81
static Tim_Obj_t * Tim_ManCo(Tim_Man_t *p, int i)
Definition: timInt.h:94
int nInputs
Definition: timInt.h:70
Vec_Ptr_t * vDelayTables
Definition: timInt.h:55
int nCis
Definition: timInt.h:59
int iObj2Box
Definition: timInt.h:83
#define assert(ex)
Definition: util_old.h:213
typedefABC_NAMESPACE_HEADER_START struct Tim_Man_t_ Tim_Man_t
INCLUDES ///.
Definition: tim.h:92
static Tim_Obj_t * Tim_ManBoxInput(Tim_Man_t *p, Tim_Box_t *pBox, int i)
Definition: timInt.h:100
int nTravIds
Definition: timInt.h:57
typedefABC_NAMESPACE_HEADER_START struct Tim_Box_t_ Tim_Box_t
INCLUDES ///.
Definition: timInt.h:48
int Inouts[0]
Definition: timInt.h:75
int TravId
Definition: timInt.h:69