#include "mapperInt.h"
Go to the source code of this file.
Functions | |
int | Map_Mapping (Map_Man_t *p) |
int Map_Mapping | ( | Map_Man_t * | p | ) |
CFile****************************************************************
FileName [mapperCore.c]
PackageName [MVSIS 1.3: Multi-valued logic synthesis system.]
Synopsis [Generic technology mapping engine.]
Author [MVSIS Group]
Affiliation [UC Berkeley]
Date [Ver. 2.0. Started - June 1, 2004.]
Revision [
] DECLARATIONS /// FUNCTION DEFINITIONS ///Function*************************************************************
Synopsis [Performs technology mapping for the given object graph.]
Description [The object graph is stored in the mapping manager. First, the AND nodes that fanout into POs are collected in the DFS order. Two preprocessing steps are performed: the k-feasible cuts are computed for each node and the truth tables are computed for each cut. Next, the delay-optimal matches are assigned for each node, followed by several iterations of area recoveryd: using area flow (global optimization) and using exact area at a node (local optimization).]
SideEffects []
SeeAlso []
Definition at line 47 of file mapperCore.c.
00048 { 00049 int fShowSwitching = 1; 00050 int fUseAreaFlow = 1; 00051 int fUseExactArea = !p->fSwitching; 00052 int fUseExactAreaWithPhase = !p->fSwitching; 00053 int clk; 00054 00056 // perform pre-mapping computations 00057 // collect the nodes reachable from POs in the DFS order (including the choices) 00058 p->vAnds = Map_MappingDfs( p, 1 ); 00059 if ( p->fVerbose ) 00060 Map_MappingReportChoices( p ); 00061 Map_MappingSetChoiceLevels( p ); // should always be called before mapping! 00062 // return 1; 00063 00064 // compute the cuts of nodes in the DFS order 00065 clk = clock(); 00066 Map_MappingCuts( p ); 00067 p->timeCuts = clock() - clk; 00068 // derive the truth tables 00069 clk = clock(); 00070 Map_MappingTruths( p ); 00071 p->timeTruth = clock() - clk; 00073 //PRT( "Truths", clock() - clk ); 00074 00076 // compute the minimum-delay mapping 00077 clk = clock(); 00078 p->fMappingMode = 0; 00079 if ( !Map_MappingMatches( p ) ) 00080 return 0; 00081 p->timeMatch = clock() - clk; 00082 // compute the references and collect the nodes used in the mapping 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 // perform area recovery using area flow 00104 clk = clock(); 00105 if ( fUseAreaFlow ) 00106 { 00107 // compute the required times 00108 Map_TimeComputeRequiredGlobal( p ); 00109 // recover area flow 00110 p->fMappingMode = 1; 00111 Map_MappingMatches( p ); 00112 // compute the references and collect the nodes used in the mapping 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 // perform area recovery using exact area 00130 clk = clock(); 00131 if ( fUseExactArea ) 00132 { 00133 // compute the required times 00134 Map_TimeComputeRequiredGlobal( p ); 00135 // recover area 00136 p->fMappingMode = 2; 00137 Map_MappingMatches( p ); 00138 // compute the references and collect the nodes used in the mapping 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 // perform area recovery using exact area 00156 clk = clock(); 00157 if ( fUseExactAreaWithPhase ) 00158 { 00159 // compute the required times 00160 Map_TimeComputeRequiredGlobal( p ); 00161 // recover area 00162 p->fMappingMode = 3; 00163 Map_MappingMatches( p ); 00164 // compute the references and collect the nodes used in the mapping 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 // perform area recovery using exact area 00182 clk = clock(); 00183 if ( p->fSwitching ) 00184 { 00185 // compute the required times 00186 Map_TimeComputeRequiredGlobal( p ); 00187 // recover switching activity 00188 p->fMappingMode = 4; 00189 Map_MappingMatches( p ); 00190 // compute the references and collect the nodes used in the mapping 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 // compute the required times 00204 Map_TimeComputeRequiredGlobal( p ); 00205 // recover switching activity 00206 p->fMappingMode = 4; 00207 Map_MappingMatches( p ); 00208 // compute the references and collect the nodes used in the mapping 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 // print the arrival times of the latest outputs 00225 if ( p->fVerbose ) 00226 Map_MappingPrintOutputArrivals( p ); 00227 return 1; 00228 }