00001
00019 #include "fpgaInt.h"
00020
00024
00025 static int Fpga_MappingPostProcess( Fpga_Man_t * p );
00026
00027 extern int s_MappingTime;
00028 extern int s_MappingMem;
00029
00030
00034
00050 int Fpga_Mapping( Fpga_Man_t * p )
00051 {
00052 int clk, clkTotal = clock();
00053
00054
00055 p->vAnds = Fpga_MappingDfs( p, 1 );
00056 Fpga_ManReportChoices( p );
00057 Fpga_MappingSetChoiceLevels( p );
00058
00059
00060 clk = clock();
00061 Fpga_MappingCuts( p );
00062 p->timeCuts = clock() - clk;
00063
00064
00065 clk = clock();
00066 if ( !Fpga_MappingMatches( p, 1 ) )
00067 return 0;
00068 p->timeMatch = clock() - clk;
00069
00070
00071 clk = clock();
00072 if ( !Fpga_MappingPostProcess( p ) )
00073 return 0;
00074 p->timeRecover = clock() - clk;
00075
00076
00077 s_MappingTime = clock() - clkTotal;
00078 s_MappingMem = Fpga_CutCountAll(p) * (sizeof(Fpga_Cut_t) - sizeof(int) * (FPGA_MAX_LEAVES - p->nVarsMax));
00079
00080
00081
00082
00083
00084 if ( p->fVerbose )
00085 {
00086 PRT( "Total time", clock() - clkTotal );
00087 }
00088 return 1;
00089 }
00090
00106 int Fpga_MappingPostProcess( Fpga_Man_t * p )
00107 {
00108 int fShowSwitching = 0;
00109 int fRecoverAreaFlow = 1;
00110 int fRecoverArea = 1;
00111 float aAreaTotalCur, aAreaTotalCur2;
00112 int Iter, clk;
00113
00114
00115
00116
00117
00118 Iter = 1;
00119 aAreaTotalCur = Fpga_MappingSetRefsAndArea( p );
00120 if ( p->fVerbose )
00121 {
00122 printf( "Iteration %dD : Area = %8.1f ", Iter++, aAreaTotalCur );
00123 if ( fShowSwitching )
00124 printf( "Switch = %8.1f ", Fpga_MappingGetSwitching(p,p->vMapping) );
00125 else
00126 printf( "Delay = %5.2f ", Fpga_TimeComputeArrivalMax(p) );
00127
00128 PRT( "Time", p->timeMatch );
00129 }
00130
00131 if ( !p->fAreaRecovery )
00132 return 1;
00133
00134 if ( fRecoverAreaFlow )
00135 {
00136 clk = clock();
00137
00138 Fpga_TimeComputeRequiredGlobal( p, 1 );
00139
00140 Fpga_MappingMatches( p, 0 );
00141
00142
00143 aAreaTotalCur = Fpga_MappingAreaTrav( p );
00144
00145
00146 if ( p->fVerbose )
00147 {
00148 printf( "Iteration %dF : Area = %8.1f ", Iter++, aAreaTotalCur );
00149 if ( fShowSwitching )
00150 printf( "Switch = %8.1f ", Fpga_MappingGetSwitching(p,p->vMapping) );
00151 else
00152 printf( "Delay = %5.2f ", Fpga_TimeComputeArrivalMax(p) );
00153 PRT( "Time", clock() - clk );
00154 }
00155 }
00156
00157
00158 aAreaTotalCur2 = Fpga_MappingSetRefsAndArea( p );
00159 assert( aAreaTotalCur == aAreaTotalCur2 );
00160
00161 if ( fRecoverArea )
00162 {
00163 clk = clock();
00164
00165 Fpga_TimeComputeRequiredGlobal( p, 0 );
00166
00167 if ( p->fSwitching )
00168 Fpga_MappingMatchesSwitch( p );
00169 else
00170 Fpga_MappingMatchesArea( p );
00171
00172 aAreaTotalCur = Fpga_MappingSetRefsAndArea( p );
00173 if ( p->fVerbose )
00174 {
00175 printf( "Iteration %d%s : Area = %8.1f ", Iter++, (p->fSwitching?"S":"A"), aAreaTotalCur );
00176 if ( fShowSwitching )
00177 printf( "Switch = %8.1f ", Fpga_MappingGetSwitching(p,p->vMapping) );
00178 else
00179 printf( "Delay = %5.2f ", Fpga_TimeComputeArrivalMax(p) );
00180 PRT( "Time", clock() - clk );
00181 }
00182 }
00183
00184 p->fAreaGlo = aAreaTotalCur;
00185 return 1;
00186 }
00187
00188