abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ifCore.c
Go to the documentation of this file.
1 /**CFile****************************************************************
2 
3  FileName [ifCore.c]
4 
5  SystemName [ABC: Logic synthesis and verification system.]
6 
7  PackageName [FPGA mapping based on priority cuts.]
8 
9  Synopsis [The central part of the mapper.]
10 
11  Author [Alan Mishchenko]
12 
13  Affiliation [UC Berkeley]
14 
15  Date [Ver. 1.0. Started - November 21, 2006.]
16 
17  Revision [$Id: ifCore.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $]
18 
19 ***********************************************************************/
20 
21 #include "if.h"
22 
24 
25 
26 ////////////////////////////////////////////////////////////////////////
27 /// DECLARATIONS ///
28 ////////////////////////////////////////////////////////////////////////
29 
30 extern abctime s_MappingTime;
31 
32 ////////////////////////////////////////////////////////////////////////
33 /// FUNCTION DEFINITIONS ///
34 ////////////////////////////////////////////////////////////////////////
35 
36 /**Function*************************************************************
37 
38  Synopsis []
39 
40  Description []
41 
42  SideEffects []
43 
44  SeeAlso []
45 
46 ***********************************************************************/
48 {
49  memset( pPars, 0, sizeof(If_Par_t) );
50  pPars->nLutSize = -1;
51  pPars->nCutsMax = 8;
52  pPars->nFlowIters = 1;
53  pPars->nAreaIters = 2;
54  pPars->DelayTarget = -1;
55  pPars->Epsilon = (float)0.005;
56  pPars->fPreprocess = 1;
57  pPars->fArea = 0;
58  pPars->fFancy = 0;
59  pPars->fExpRed = 1;
60  pPars->fLatchPaths = 0;
61  pPars->fEdge = 1;
62  pPars->fPower = 0;
63  pPars->fCutMin = 0;
64  pPars->fBidec = 0;
65  pPars->fVerbose = 0;
66 }
67 
68 
69 /**Function*************************************************************
70 
71  Synopsis []
72 
73  Description []
74 
75  SideEffects []
76 
77  SeeAlso []
78 
79 ***********************************************************************/
81 {
82  p->pPars->fAreaOnly = p->pPars->fArea; // temporary
83  // create the CI cutsets
85  // allocate memory for other cutsets
87  // derive reverse top order
88  p->vObjsRev = If_ManReverseOrder( p );
89  return If_ManPerformMappingComb( p );
90 }
91 
92 
93 /**Function*************************************************************
94 
95  Synopsis []
96 
97  Description []
98 
99  SideEffects []
100 
101  SeeAlso []
102 
103 ***********************************************************************/
105 {
106  If_Obj_t * pObj;
107  abctime clkTotal = Abc_Clock();
108  int i;
109 
110  // set arrival times and fanout estimates
111  If_ManForEachCi( p, pObj, i )
112  {
113  If_ObjSetArrTime( pObj, p->pPars->pTimesArr ? p->pPars->pTimesArr[i] : (float)0.0 );
114  pObj->EstRefs = (float)1.0;
115  }
116 
117  // delay oriented mapping
118  if ( p->pPars->fPreprocess && !p->pPars->fArea )
119  {
120  // map for delay
121  If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 1, 1, "Delay" );
122  // map for delay second option
123  p->pPars->fFancy = 1;
125  If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 1, 0, "Delay-2" );
126  p->pPars->fFancy = 0;
127  // map for area
128  p->pPars->fArea = 1;
130  If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 1, 0, "Area" );
131  p->pPars->fArea = 0;
132  }
133  else
134  If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 0, 1, "Delay" );
135 
136  // try to improve area by expanding and reducing the cuts
137  if ( p->pPars->fExpRed )
139 
140  // area flow oriented mapping
141  for ( i = 0; i < p->pPars->nFlowIters; i++ )
142  {
143  If_ManPerformMappingRound( p, p->pPars->nCutsMax, 1, 0, 0, "Flow" );
144  if ( p->pPars->fExpRed )
146  }
147 
148  // area oriented mapping
149  for ( i = 0; i < p->pPars->nAreaIters; i++ )
150  {
151  If_ManPerformMappingRound( p, p->pPars->nCutsMax, 2, 0, 0, "Area" );
152  if ( p->pPars->fExpRed )
154  }
155 
156  if ( p->pPars->fVerbose )
157  {
158 // Abc_Print( 1, "Total memory = %7.2f MB. Peak cut memory = %7.2f MB. ",
159 // 1.0 * (p->nObjBytes + 2*sizeof(void *)) * If_ManObjNum(p) / (1<<20),
160 // 1.0 * p->nSetBytes * Mem_FixedReadMaxEntriesUsed(p->pMemSet) / (1<<20) );
161  Abc_PrintTime( 1, "Total time", Abc_Clock() - clkTotal );
162  }
163 // Abc_Print( 1, "Cross cut memory = %d.\n", Mem_FixedReadMaxEntriesUsed(p->pMemSet) );
164  s_MappingTime = Abc_Clock() - clkTotal;
165 // Abc_Print( 1, "Special POs = %d.\n", If_ManCountSpecialPos(p) );
166 
167 /*
168  {
169  static char * pLastName = NULL;
170  FILE * pTable = fopen( "fpga/ucsb/stats.txt", "a+" );
171  if ( pLastName == NULL || strcmp(pLastName, p->pName) )
172  {
173  fprintf( pTable, "\n" );
174  fprintf( pTable, "%s ", p->pName );
175 
176  fprintf( pTable, "%d ", If_ManCiNum(p) );
177  fprintf( pTable, "%d ", If_ManCoNum(p) );
178  fprintf( pTable, "%d ", If_ManAndNum(p) );
179 
180  ABC_FREE( pLastName );
181  pLastName = Abc_UtilStrsav( p->pName );
182  }
183 
184  fprintf( pTable, "%d ", (int)p->AreaGlo );
185  fprintf( pTable, "%d ", (int)p->RequiredGlo );
186  fclose( pTable );
187  }
188 */
189  p->pPars->FinalDelay = p->RequiredGlo;
190  return 1;
191 }
192 
193 ////////////////////////////////////////////////////////////////////////
194 /// END OF FILE ///
195 ////////////////////////////////////////////////////////////////////////
196 
197 
199 
char * memset()
int If_ManPerformMappingComb(If_Man_t *p)
Definition: ifCore.c:104
int nLutSize
Definition: if.h:103
void If_ManResetOriginalRefs(If_Man_t *p)
Definition: ifUtil.c:287
static Llb_Mgr_t * p
Definition: llb3Image.c:950
Definition: if.h:100
Definition: if.h:303
Vec_Ptr_t * vObjsRev
Definition: if.h:190
int fVerbose
Definition: if.h:140
ABC_NAMESPACE_IMPL_START abctime s_MappingTime
DECLARATIONS ///.
Definition: abcPrint.c:44
int If_ManPerformMappingRound(If_Man_t *p, int nCutsUsed, int Mode, int fPreprocess, int fFirst, char *pLabel)
Definition: ifMap.c:491
static abctime Abc_Clock()
Definition: abc_global.h:279
int fExpRed
Definition: if.h:116
int nFlowIters
Definition: if.h:105
static void Abc_PrintTime(int level, const char *pStr, abctime time)
Definition: abc_global.h:367
int fEdge
Definition: if.h:118
#define If_ManForEachCi(p, pObj, i)
Definition: if.h:445
void If_ManSetupSetAll(If_Man_t *p, int nCrossCut)
Definition: ifMan.c:675
int fPreprocess
Definition: if.h:113
int If_ManPerformMapping(If_Man_t *p)
Definition: ifCore.c:80
int fAreaOnly
Definition: if.h:145
Vec_Ptr_t * If_ManReverseOrder(If_Man_t *p)
Definition: ifUtil.c:363
float RequiredGlo
Definition: if.h:196
int fLatchPaths
Definition: if.h:117
Definition: if.h:180
void If_ManSetDefaultPars(If_Par_t *pPars)
FUNCTION DEFINITIONS ///.
Definition: ifCore.c:47
#define ABC_NAMESPACE_IMPL_END
Definition: abc_global.h:108
int If_ManCrossCut(If_Man_t *p)
Definition: ifUtil.c:316
float * pTimesArr
Definition: if.h:161
static void If_ObjSetArrTime(If_Obj_t *pObj, float ArrTime)
Definition: if.h:406
int fBidec
Definition: if.h:125
float Epsilon
Definition: if.h:110
#define ABC_NAMESPACE_IMPL_START
Definition: abc_global.h:107
int fFancy
Definition: if.h:115
void If_ManSetupCiCutSets(If_Man_t *p)
Definition: ifMan.c:548
float FinalDelay
Definition: if.h:159
If_Par_t * pPars
Definition: if.h:184
float DelayTarget
Definition: if.h:109
int nAreaIters
Definition: if.h:106
int fPower
Definition: if.h:119
int fCutMin
Definition: if.h:120
float EstRefs
Definition: if.h:324
int nCutsMax
Definition: if.h:104
int fArea
Definition: if.h:114
void If_ManImproveMapping(If_Man_t *p)
FUNCTION DEFINITIONS ///.
Definition: ifReduce.c:51
ABC_INT64_T abctime
Definition: abc_global.h:278