#include "mapperInt.h"
Go to the source code of this file.
Functions | |
Map_SuperLib_t * | Map_SuperLibCreate (char *pFileName, char *pExcludeFile, bool fAlgorithm, bool fVerbose) |
void | Map_SuperLibFree (Map_SuperLib_t *p) |
int | Map_SuperLibDeriveFromGenlib (Mio_Library_t *pLib) |
Map_SuperLib_t* Map_SuperLibCreate | ( | char * | pFileName, | |
char * | pExcludeFile, | |||
bool | fAlgorithm, | |||
bool | fVerbose | |||
) |
CFile****************************************************************
FileName [mapperLib.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 [Reads in the supergate library and prepares it for use.]
Description [The supergates library comes in a .super file. This file contains descriptions of supergates along with some relevant information. This procedure reads the supergate file, canonicizes the supergates, and constructs an additional lookup table, which can be used to map truth tables of the cuts into the pair (phase, supergate). The phase indicates how the current truth table should be phase assigned to match the canonical form of the supergate. The resulting phase is the bitwise EXOR of the phase needed to canonicize the supergate and the phase needed to transform the truth table into its canonical form.]
SideEffects []
SeeAlso []
Definition at line 48 of file mapperLib.c.
00049 { 00050 Map_SuperLib_t * p; 00051 int clk; 00052 00053 // start the supergate library 00054 p = ALLOC( Map_SuperLib_t, 1 ); 00055 memset( p, 0, sizeof(Map_SuperLib_t) ); 00056 p->pName = pFileName; 00057 p->fVerbose = fVerbose; 00058 p->mmSupers = Extra_MmFixedStart( sizeof(Map_Super_t) ); 00059 p->mmEntries = Extra_MmFixedStart( sizeof(Map_HashEntry_t) ); 00060 p->mmForms = Extra_MmFlexStart(); 00061 Map_MappingSetupTruthTables( p->uTruths ); 00062 00063 // start the hash table 00064 p->tTableC = Map_SuperTableCreate( p ); 00065 p->tTable = Map_SuperTableCreate( p ); 00066 00067 // read the supergate library from file 00068 clk = clock(); 00069 if ( fAlgorithm ) 00070 { 00071 if ( !Map_LibraryReadTree( p, pFileName, pExcludeFile ) ) 00072 { 00073 Map_SuperLibFree( p ); 00074 return NULL; 00075 } 00076 } 00077 else 00078 { 00079 if ( pExcludeFile != 0 ) 00080 { 00081 printf ("Error: Exclude file support not present for old format. Stop.\n"); 00082 return NULL; 00083 } 00084 if ( !Map_LibraryRead( p, pFileName ) ) 00085 { 00086 Map_SuperLibFree( p ); 00087 return NULL; 00088 } 00089 } 00090 assert( p->nVarsMax > 0 ); 00091 00092 // report the stats 00093 if ( fVerbose ) { 00094 printf( "Loaded %d unique %d-input supergates from \"%s\". ", 00095 p->nSupersReal, p->nVarsMax, pFileName ); 00096 PRT( "Time", clock() - clk ); 00097 } 00098 00099 // assign the interver parameters 00100 p->pGateInv = Mio_LibraryReadInv( p->pGenlib ); 00101 p->tDelayInv.Rise = Mio_LibraryReadDelayInvRise( p->pGenlib ); 00102 p->tDelayInv.Fall = Mio_LibraryReadDelayInvFall( p->pGenlib ); 00103 p->tDelayInv.Worst = MAP_MAX( p->tDelayInv.Rise, p->tDelayInv.Fall ); 00104 p->AreaInv = Mio_LibraryReadAreaInv( p->pGenlib ); 00105 p->AreaBuf = Mio_LibraryReadAreaBuf( p->pGenlib ); 00106 00107 // assign the interver supergate 00108 p->pSuperInv = (Map_Super_t *)Extra_MmFixedEntryFetch( p->mmSupers ); 00109 memset( p->pSuperInv, 0, sizeof(Map_Super_t) ); 00110 p->pSuperInv->Num = -1; 00111 p->pSuperInv->nGates = 1; 00112 p->pSuperInv->nFanins = 1; 00113 p->pSuperInv->nFanLimit = 10; 00114 p->pSuperInv->pFanins[0] = p->ppSupers[0]; 00115 p->pSuperInv->pRoot = p->pGateInv; 00116 p->pSuperInv->Area = p->AreaInv; 00117 p->pSuperInv->tDelayMax = p->tDelayInv; 00118 p->pSuperInv->tDelaysR[0].Rise = MAP_NO_VAR; 00119 p->pSuperInv->tDelaysR[0].Fall = p->tDelayInv.Rise; 00120 p->pSuperInv->tDelaysF[0].Rise = p->tDelayInv.Fall; 00121 p->pSuperInv->tDelaysF[0].Fall = MAP_NO_VAR; 00122 return p; 00123 }
int Map_SuperLibDeriveFromGenlib | ( | Mio_Library_t * | pLib | ) |
Function*************************************************************
Synopsis [Derives the library from the genlib library.]
Description []
SideEffects []
SeeAlso []
Definition at line 168 of file mapperLib.c.
00169 { 00170 Abc_Frame_t * pAbc = Abc_FrameGetGlobalFrame(); 00171 char * pNameGeneric; 00172 char FileNameGenlib[100]; 00173 char FileNameSuper[100]; 00174 char CommandSuper[500]; 00175 char CommandRead[500]; 00176 FILE * pFile; 00177 00178 if ( pLib == NULL ) 00179 return 0; 00180 00181 // write the current library into the file 00182 sprintf( FileNameGenlib, "%s_temp", Mio_LibraryReadName(pLib) ); 00183 pFile = fopen( FileNameGenlib, "w" ); 00184 Mio_WriteLibrary( pFile, pLib, 0 ); 00185 fclose( pFile ); 00186 00187 // get the file name with the library 00188 pNameGeneric = Extra_FileNameGeneric( Mio_LibraryReadName(pLib) ); 00189 sprintf( FileNameSuper, "%s.super", pNameGeneric ); 00190 free( pNameGeneric ); 00191 00192 sprintf( CommandSuper, "super -l 1 -i 5 -d 10000000 -a 10000000 -t 100 %s", FileNameGenlib ); 00193 if ( Cmd_CommandExecute( pAbc, CommandSuper ) ) 00194 { 00195 fprintf( stdout, "Cannot execute command \"%s\".\n", CommandSuper ); 00196 return 0; 00197 } 00198 //#ifdef WIN32 00199 // _unlink( FileNameGenlib ); 00200 //#else 00201 // unlink( FileNameGenlib ); 00202 //#endif 00203 00204 sprintf( CommandRead, "read_super %s", FileNameSuper ); 00205 if ( Cmd_CommandExecute( pAbc, CommandRead ) ) 00206 { 00207 #ifdef WIN32 00208 _unlink( FileNameSuper ); 00209 #else 00210 unlink( FileNameSuper ); 00211 #endif 00212 fprintf( stdout, "Cannot execute command \"%s\".\n", CommandRead ); 00213 return 0; 00214 } 00215 00216 /* // don't remove the intermediate file 00217 #ifdef WIN32 00218 _unlink( FileNameSuper ); 00219 #else 00220 unlink( FileNameSuper ); 00221 #endif 00222 */ 00223 return 1; 00224 }
void Map_SuperLibFree | ( | Map_SuperLib_t * | p | ) |
Function*************************************************************
Synopsis [Deallocates the supergate library.]
Description []
SideEffects []
SeeAlso []
Definition at line 137 of file mapperLib.c.
00138 { 00139 if ( p == NULL ) return; 00140 if ( p->pGenlib ) 00141 { 00142 assert( p->pGenlib == Abc_FrameReadLibGen() ); 00143 Mio_LibraryDelete( p->pGenlib ); 00144 Abc_FrameSetLibGen( NULL ); 00145 } 00146 if ( p->tTableC ) 00147 Map_SuperTableFree( p->tTableC ); 00148 if ( p->tTable ) 00149 Map_SuperTableFree( p->tTable ); 00150 Extra_MmFixedStop( p->mmSupers ); 00151 Extra_MmFixedStop( p->mmEntries ); 00152 Extra_MmFlexStop( p->mmForms ); 00153 FREE( p->ppSupers ); 00154 FREE( p ); 00155 }