ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
mapperLib.c File Reference
#include <unistd.h>
#include "mapperInt.h"
#include "map/super/super.h"
Include dependency graph for mapperLib.c:

Go to the source code of this file.

Macros

#define _DEFAULT_SOURCE
 

Functions

ABC_NAMESPACE_IMPL_START Map_SuperLib_tMap_SuperLibCreate (Mio_Library_t *pGenlib, Vec_Str_t *vStr, char *pFileName, char *pExcludeFile, int fAlgorithm, int fVerbose)
 DECLARATIONS ///.
 
void Map_SuperLibFree (Map_SuperLib_t *p)
 
int Map_SuperLibDeriveFromGenlib (Mio_Library_t *pLib, int fVerbose)
 
int Map_SuperLibDeriveFromGenlib2 (Mio_Library_t *pLib, int fVerbose)
 

Macro Definition Documentation

◆ _DEFAULT_SOURCE

#define _DEFAULT_SOURCE

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 [

Id
mapperLib.c,v 1.6 2005/01/23 06:59:44 alanmi Exp

]

Definition at line 22 of file mapperLib.c.

Function Documentation

◆ Map_SuperLibCreate()

ABC_NAMESPACE_IMPL_START Map_SuperLib_t * Map_SuperLibCreate ( Mio_Library_t * pGenlib,
Vec_Str_t * vStr,
char * pFileName,
char * pExcludeFile,
int fAlgorithm,
int fVerbose )

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 61 of file mapperLib.c.

62{
64 abctime clk;
65
66 // start the supergate library
68 memset( p, 0, sizeof(Map_SuperLib_t) );
69 p->pName = Abc_UtilStrsav(pFileName);
70 p->fVerbose = fVerbose;
71 p->mmSupers = Extra_MmFixedStart( sizeof(Map_Super_t) );
72 p->mmEntries = Extra_MmFixedStart( sizeof(Map_HashEntry_t) );
73 p->mmForms = Extra_MmFlexStart();
75
76 // start the hash table
77 p->tTableC = Map_SuperTableCreate( p );
78 p->tTable = Map_SuperTableCreate( p );
79
80 // read the supergate library from file
81clk = Abc_Clock();
82 if ( vStr != NULL )
83 {
84 // read the supergate library from file
85 int Status = Map_LibraryReadFileTreeStr( p, pGenlib, vStr, pFileName );
86 if ( Status == 0 )
87 {
89 return NULL;
90 }
91 // prepare the info about the library
93 if ( Status == 0 )
94 {
96 return NULL;
97 }
98 assert( p->nVarsMax > 0 );
99 }
100 else if ( fAlgorithm )
101 {
102 if ( !Map_LibraryReadTree( p, pGenlib, pFileName, pExcludeFile ) )
103 {
105 return NULL;
106 }
107 }
108 else
109 {
110 if ( pExcludeFile != 0 )
111 {
113 printf ("Error: Exclude file support not present for old format. Stop.\n");
114 return NULL;
115 }
116 if ( !Map_LibraryRead( p, pFileName ) )
117 {
119 return NULL;
120 }
121 }
122 assert( p->nVarsMax > 0 );
123
124 // report the stats
125 if ( fVerbose )
126 {
127 printf( "Loaded %d unique %d-input supergates from \"%s\". ",
128 p->nSupersReal, p->nVarsMax, pFileName );
129 ABC_PRT( "Time", Abc_Clock() - clk );
130 }
131
132 // assign the interver parameters
133 p->pGateInv = Mio_LibraryReadInv( p->pGenlib );
134 p->tDelayInv.Rise = Mio_LibraryReadDelayInvRise( p->pGenlib );
135 p->tDelayInv.Fall = Mio_LibraryReadDelayInvFall( p->pGenlib );
136 p->tDelayInv.Worst = MAP_MAX( p->tDelayInv.Rise, p->tDelayInv.Fall );
137 p->AreaInv = Mio_LibraryReadAreaInv( p->pGenlib );
138 p->AreaBuf = Mio_LibraryReadAreaBuf( p->pGenlib );
139
140 // assign the interver supergate
141 p->pSuperInv = (Map_Super_t *)Extra_MmFixedEntryFetch( p->mmSupers );
142 memset( p->pSuperInv, 0, sizeof(Map_Super_t) );
143 p->pSuperInv->Num = -1;
144 p->pSuperInv->nGates = 1;
145 p->pSuperInv->nFanins = 1;
146 p->pSuperInv->nFanLimit = 10;
147 p->pSuperInv->pFanins[0] = p->ppSupers[0];
148 p->pSuperInv->pRoot = p->pGateInv;
149 p->pSuperInv->Area = p->AreaInv;
150 p->pSuperInv->tDelayMax = p->tDelayInv;
151 p->pSuperInv->tDelaysR[0].Rise = MAP_NO_VAR;
152 p->pSuperInv->tDelaysR[0].Fall = p->tDelayInv.Rise;
153 p->pSuperInv->tDelaysF[0].Rise = p->tDelayInv.Fall;
154 p->pSuperInv->tDelaysF[0].Fall = MAP_NO_VAR;
155 return p;
156}
ABC_INT64_T abctime
Definition abc_global.h:332
#define ABC_PRT(a, t)
Definition abc_global.h:255
#define ABC_ALLOC(type, num)
Definition abc_global.h:264
Cube * p
Definition exorList.c:222
char * Extra_MmFixedEntryFetch(Extra_MmFixed_t *p)
Extra_MmFixed_t * Extra_MmFixedStart(int nEntrySize)
Extra_MmFlex_t * Extra_MmFlexStart()
#define MAP_MAX(a, b)
Definition mapperInt.h:58
int Map_LibraryRead(Map_SuperLib_t *p, char *pFileName)
FUNCTION DEFINITIONS ///.
Definition mapperSuper.c:50
#define MAP_NO_VAR
Definition mapperInt.h:54
int Map_LibraryReadTree(Map_SuperLib_t *pLib, Mio_Library_t *pGenlib, char *pFileName, char *pExcludeFile)
Definition mapperTree.c:525
int Map_LibraryDeriveGateInfo(Map_SuperLib_t *pLib, st__table *tExcludeGate)
Definition mapperTree.c:586
int Map_LibraryReadFileTreeStr(Map_SuperLib_t *pLib, Mio_Library_t *pGenlib, Vec_Str_t *vStr, char *pFileName)
Definition mapperTree.c:391
Map_HashTable_t * Map_SuperTableCreate(Map_SuperLib_t *pLib)
FUNCTION DEFINITIONS ///.
Definition mapperTable.c:48
void Map_SuperLibFree(Map_SuperLib_t *p)
Definition mapperLib.c:170
struct Map_SuperStruct_t_ Map_Super_t
Definition mapper.h:45
struct Map_SuperLibStruct_t_ Map_SuperLib_t
Definition mapper.h:46
struct Map_HashEntryStruct_t_ Map_HashEntry_t
Definition mapper.h:48
void Map_MappingSetupTruthTables(unsigned uTruths[][2])
float Mio_LibraryReadDelayInvFall(Mio_Library_t *pLib)
Definition mioApi.c:58
float Mio_LibraryReadAreaBuf(Mio_Library_t *pLib)
Definition mioApi.c:66
float Mio_LibraryReadAreaInv(Mio_Library_t *pLib)
Definition mioApi.c:65
float Mio_LibraryReadDelayInvRise(Mio_Library_t *pLib)
Definition mioApi.c:57
Mio_Gate_t * Mio_LibraryReadInv(Mio_Library_t *pLib)
Definition mioApi.c:50
#define assert(ex)
Definition util_old.h:213
char * memset()
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_SuperLibDeriveFromGenlib()

int Map_SuperLibDeriveFromGenlib ( Mio_Library_t * pLib,
int fVerbose )

Function*************************************************************

Synopsis [Derives the library from the genlib library.]

Description []

SideEffects []

SeeAlso []

Definition at line 202 of file mapperLib.c.

203{
204 Map_SuperLib_t * pLibSuper;
205 Vec_Str_t * vStr;
206 char * pFileName;
207 if ( pLib == NULL )
208 return 0;
209
210 // compute supergates
211 vStr = Super_PrecomputeStr( pLib, 5, 1, 100000000, 10000000, 10000000, 100, 1, 0 );
212 if ( vStr == NULL )
213 return 0;
214
215 // create supergate library
216 pFileName = Extra_FileNameGenericAppend( Mio_LibraryReadName(pLib), ".super" );
217 pLibSuper = Map_SuperLibCreate( pLib, vStr, pFileName, NULL, 1, 0 );
218 Vec_StrFree( vStr );
219
220 // replace the library
222 Abc_FrameSetLibSuper( pLibSuper );
223 return 1;
224}
ABC_DLL void Abc_FrameSetLibSuper(void *pLib)
Definition mainFrame.c:97
ABC_DLL void * Abc_FrameReadLibSuper()
Definition mainFrame.c:61
struct Vec_Str_t_ Vec_Str_t
Definition bblif.c:46
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
ABC_NAMESPACE_IMPL_START Map_SuperLib_t * Map_SuperLibCreate(Mio_Library_t *pGenlib, Vec_Str_t *vStr, char *pFileName, char *pExcludeFile, int fAlgorithm, int fVerbose)
DECLARATIONS ///.
Definition mapperLib.c:61
char * Mio_LibraryReadName(Mio_Library_t *pLib)
DECLARATIONS ///.
Definition mioApi.c:43
Vec_Str_t * Super_PrecomputeStr(Mio_Library_t *pLibGen, int nVarsMax, int nLevels, int nGatesMax, float tDelayMax, float tAreaMax, int TimeLimit, int fSkipInv, int fVerbose)
Definition superGate.c:175
Here is the call graph for this function:
Here is the caller graph for this function:

◆ Map_SuperLibDeriveFromGenlib2()

int Map_SuperLibDeriveFromGenlib2 ( Mio_Library_t * pLib,
int fVerbose )

Function*************************************************************

Synopsis [Derives the library from the genlib library.]

Description []

SideEffects []

SeeAlso []

Definition at line 237 of file mapperLib.c.

238{
240 char * pFileName;
241 if ( pLib == NULL )
242 return 0;
243 // compute supergates
244 pFileName = Extra_FileNameGenericAppend(Mio_LibraryReadName(pLib), ".super");
245 Super_Precompute( pLib, 5, 1, 100000000, 10000000, 10000000, 100, 1, 0, pFileName );
246 // assuming that it terminated successfully
247 if ( Cmd_CommandExecute( pAbc, pFileName ) )
248 {
249 fprintf( stdout, "Cannot execute command \"read_super %s\".\n", pFileName );
250 return 0;
251 }
252 return 1;
253}
typedefABC_NAMESPACE_HEADER_START struct Abc_Frame_t_ Abc_Frame_t
INCLUDES ///.
Definition abcapis.h:38
ABC_DLL Abc_Frame_t * Abc_FrameGetGlobalFrame()
Definition mainFrame.c:643
ABC_DLL int Cmd_CommandExecute(Abc_Frame_t *pAbc, const char *sCommand)
Definition cmdApi.c:193
void Super_Precompute(Mio_Library_t *pLibGen, int nVarsMax, int nLevels, int nGatesMax, float tDelayMax, float tAreaMax, int TimeLimit, int fSkipInv, int fVerbose, char *pFileName)
FUNCTION DEFINITIONS ///.
Definition superGate.c:140
Here is the call graph for this function:

◆ Map_SuperLibFree()

void Map_SuperLibFree ( Map_SuperLib_t * p)

Function*************************************************************

Synopsis [Deallocates the supergate library.]

Description []

SideEffects []

SeeAlso []

Definition at line 170 of file mapperLib.c.

171{
172 if ( p == NULL ) return;
173 if ( p->pGenlib )
174 {
175 if ( p->pGenlib != Abc_FrameReadLibGen() )
176 Mio_LibraryDelete( p->pGenlib );
177 p->pGenlib = NULL;
178 }
179 if ( p->tTableC )
180 Map_SuperTableFree( p->tTableC );
181 if ( p->tTable )
182 Map_SuperTableFree( p->tTable );
183 Extra_MmFixedStop( p->mmSupers );
184 Extra_MmFixedStop( p->mmEntries );
185 Extra_MmFlexStop( p->mmForms );
186 ABC_FREE( p->ppSupers );
187 ABC_FREE( p->pName );
188 ABC_FREE( p );
189}
#define ABC_FREE(obj)
Definition abc_global.h:267
ABC_DLL void * Abc_FrameReadLibGen()
Definition mainFrame.c:59
void Extra_MmFixedStop(Extra_MmFixed_t *p)
void Extra_MmFlexStop(Extra_MmFlex_t *p)
void Map_SuperTableFree(Map_HashTable_t *p)
Definition mapperTable.c:74
void Mio_LibraryDelete(Mio_Library_t *pLib)
DECLARATIONS ///.
Definition mioUtils.c:51
Here is the call graph for this function:
Here is the caller graph for this function: