00001
00019 #include "mapperInt.h"
00020
00021
00025
00029
00047 int Map_Mapping( Map_Man_t * p )
00048 {
00049 int fShowSwitching = 1;
00050 int fUseAreaFlow = 1;
00051 int fUseExactArea = !p->fSwitching;
00052 int fUseExactAreaWithPhase = !p->fSwitching;
00053 int clk;
00054
00056
00057
00058 p->vAnds = Map_MappingDfs( p, 1 );
00059 if ( p->fVerbose )
00060 Map_MappingReportChoices( p );
00061 Map_MappingSetChoiceLevels( p );
00062
00063
00064
00065 clk = clock();
00066 Map_MappingCuts( p );
00067 p->timeCuts = clock() - clk;
00068
00069 clk = clock();
00070 Map_MappingTruths( p );
00071 p->timeTruth = clock() - clk;
00073
00074
00076
00077 clk = clock();
00078 p->fMappingMode = 0;
00079 if ( !Map_MappingMatches( p ) )
00080 return 0;
00081 p->timeMatch = clock() - clk;
00082
00083 Map_MappingSetRefs( p );
00084 p->AreaBase = Map_MappingGetArea( p, p->vMapping );
00085 if ( p->fVerbose )
00086 {
00087 printf( "Delay : %s = %8.2f Flow = %11.1f Area = %11.1f %4.1f %% ",
00088 fShowSwitching? "Switch" : "Delay",
00089 fShowSwitching? Map_MappingGetSwitching(p,p->vMapping) : p->fRequiredGlo,
00090 Map_MappingGetAreaFlow(p), p->AreaBase, 0.0 );
00091 PRT( "Time", p->timeMatch );
00092 }
00094
00095 if ( !p->fAreaRecovery )
00096 {
00097 if ( p->fVerbose )
00098 Map_MappingPrintOutputArrivals( p );
00099 return 1;
00100 }
00101
00103
00104 clk = clock();
00105 if ( fUseAreaFlow )
00106 {
00107
00108 Map_TimeComputeRequiredGlobal( p );
00109
00110 p->fMappingMode = 1;
00111 Map_MappingMatches( p );
00112
00113 Map_MappingSetRefs( p );
00114 p->AreaFinal = Map_MappingGetArea( p, p->vMapping );
00115 if ( p->fVerbose )
00116 {
00117 printf( "AreaFlow : %s = %8.2f Flow = %11.1f Area = %11.1f %4.1f %% ",
00118 fShowSwitching? "Switch" : "Delay",
00119 fShowSwitching? Map_MappingGetSwitching(p,p->vMapping) : p->fRequiredGlo,
00120 Map_MappingGetAreaFlow(p), p->AreaFinal,
00121 100.0*(p->AreaBase-p->AreaFinal)/p->AreaBase );
00122 PRT( "Time", clock() - clk );
00123 }
00124 }
00125 p->timeArea += clock() - clk;
00127
00129
00130 clk = clock();
00131 if ( fUseExactArea )
00132 {
00133
00134 Map_TimeComputeRequiredGlobal( p );
00135
00136 p->fMappingMode = 2;
00137 Map_MappingMatches( p );
00138
00139 Map_MappingSetRefs( p );
00140 p->AreaFinal = Map_MappingGetArea( p, p->vMapping );
00141 if ( p->fVerbose )
00142 {
00143 printf( "Area : %s = %8.2f Flow = %11.1f Area = %11.1f %4.1f %% ",
00144 fShowSwitching? "Switch" : "Delay",
00145 fShowSwitching? Map_MappingGetSwitching(p,p->vMapping) : p->fRequiredGlo,
00146 0.0, p->AreaFinal,
00147 100.0*(p->AreaBase-p->AreaFinal)/p->AreaBase );
00148 PRT( "Time", clock() - clk );
00149 }
00150 }
00151 p->timeArea += clock() - clk;
00153
00155
00156 clk = clock();
00157 if ( fUseExactAreaWithPhase )
00158 {
00159
00160 Map_TimeComputeRequiredGlobal( p );
00161
00162 p->fMappingMode = 3;
00163 Map_MappingMatches( p );
00164
00165 Map_MappingSetRefs( p );
00166 p->AreaFinal = Map_MappingGetArea( p, p->vMapping );
00167 if ( p->fVerbose )
00168 {
00169 printf( "Area : %s = %8.2f Flow = %11.1f Area = %11.1f %4.1f %% ",
00170 fShowSwitching? "Switch" : "Delay",
00171 fShowSwitching? Map_MappingGetSwitching(p,p->vMapping) : p->fRequiredGlo,
00172 0.0, p->AreaFinal,
00173 100.0*(p->AreaBase-p->AreaFinal)/p->AreaBase );
00174 PRT( "Time", clock() - clk );
00175 }
00176 }
00177 p->timeArea += clock() - clk;
00179
00181
00182 clk = clock();
00183 if ( p->fSwitching )
00184 {
00185
00186 Map_TimeComputeRequiredGlobal( p );
00187
00188 p->fMappingMode = 4;
00189 Map_MappingMatches( p );
00190
00191 Map_MappingSetRefs( p );
00192 p->AreaFinal = Map_MappingGetArea( p, p->vMapping );
00193 if ( p->fVerbose )
00194 {
00195 printf( "Switching: %s = %8.2f Flow = %11.1f Area = %11.1f %4.1f %% ",
00196 fShowSwitching? "Switch" : "Delay",
00197 fShowSwitching? Map_MappingGetSwitching(p,p->vMapping) : p->fRequiredGlo,
00198 0.0, p->AreaFinal,
00199 100.0*(p->AreaBase-p->AreaFinal)/p->AreaBase );
00200 PRT( "Time", clock() - clk );
00201 }
00202
00203
00204 Map_TimeComputeRequiredGlobal( p );
00205
00206 p->fMappingMode = 4;
00207 Map_MappingMatches( p );
00208
00209 Map_MappingSetRefs( p );
00210 p->AreaFinal = Map_MappingGetArea( p, p->vMapping );
00211 if ( p->fVerbose )
00212 {
00213 printf( "Switching: %s = %8.2f Flow = %11.1f Area = %11.1f %4.1f %% ",
00214 fShowSwitching? "Switch" : "Delay",
00215 fShowSwitching? Map_MappingGetSwitching(p,p->vMapping) : p->fRequiredGlo,
00216 0.0, p->AreaFinal,
00217 100.0*(p->AreaBase-p->AreaFinal)/p->AreaBase );
00218 PRT( "Time", clock() - clk );
00219 }
00220 }
00221 p->timeArea += clock() - clk;
00223
00224
00225 if ( p->fVerbose )
00226 Map_MappingPrintOutputArrivals( p );
00227 return 1;
00228 }