abc-master
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
amap.h File Reference

Go to the source code of this file.

Data Structures

struct  Amap_Par_t_
 
struct  Amap_Out_t_
 

Typedefs

typedef
typedefABC_NAMESPACE_HEADER_START
struct Amap_Lib_t_ 
Amap_Lib_t
 INCLUDES ///. More...
 
typedef struct Amap_Par_t_ Amap_Par_t
 
typedef struct Amap_Out_t_ Amap_Out_t
 

Functions

void Amap_ManSetDefaultParams (Amap_Par_t *pPars)
 MACRO DEFINITIONS ///. More...
 
void Amap_LibFree (Amap_Lib_t *p)
 
void Amap_LibPrintSelectedGates (Amap_Lib_t *p, int fAllGates)
 
Amap_Lib_tAmap_LibReadAndPrepare (char *pFileName, char *pBuffer, int fVerbose, int fVeryVerbose)
 
int Amap_LibertyParse (char *pFileName, int fVerbose)
 
Vec_Str_tAmap_LibertyParseStr (char *pFileName, int fVerbose)
 

Typedef Documentation

typedef typedefABC_NAMESPACE_HEADER_START struct Amap_Lib_t_ Amap_Lib_t

INCLUDES ///.

CFile****************************************************************

FileName [amap.h]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Technology mapper for standard cells.]

Synopsis [External declarations.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
amap.h,v 1.00 2005/06/20 00:00:00 alanmi Exp

]PARAMETERS ///BASIC TYPES ///

Definition at line 42 of file amap.h.

typedef struct Amap_Out_t_ Amap_Out_t

Definition at line 58 of file amap.h.

typedef struct Amap_Par_t_ Amap_Par_t

Definition at line 44 of file amap.h.

Function Documentation

int Amap_LibertyParse ( char *  pFileName,
int  fVerbose 
)

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

Synopsis [Parses the standard cell library in Liberty format.]

Description [Writes the resulting file in Genlib format.]

SideEffects []

SeeAlso []

Definition at line 1012 of file amapLiberty.c.

1013 {
1014  Amap_Tree_t * p;
1015  char * pPos;
1016  abctime clk = Abc_Clock();
1017  int RetValue;
1018  p = Amap_LibertyStart( pFileName );
1019  if ( p == NULL )
1020  return 0;
1021  pPos = p->pContents;
1023  if ( Amap_LibertyBuildItem( p, &pPos, p->pContents + p->nContents ) == 0 )
1024  {
1025  if ( fVerbose )
1026  printf( "Parsing finished successfully.\n" );
1027 // Amap_LibertyPrintLiberty( p, "temp_.lib" );
1028  Amap_LibertyPrintGenlib( p, Extra_FileNameGenericAppend(pFileName, ".genlib"), fVerbose );
1029  RetValue = 1;
1030  }
1031  else
1032  {
1033  if ( p->pError )
1034  printf( "%s", p->pError );
1035  if ( fVerbose )
1036  printf( "Parsing failed.\n" );
1037  RetValue = 0;
1038  }
1039  if ( fVerbose )
1040  {
1041  printf( "Memory = %7.2f MB. ", 1.0*(p->nContents+p->nItermAlloc*sizeof(Amap_Item_t))/(1<<20) );
1042  ABC_PRT( "Time", Abc_Clock() - clk );
1043  }
1044  Amap_LibertyStop( p );
1045  return RetValue;
1046 }
int Amap_LibertyPrintGenlib(Amap_Tree_t *p, char *pFileName, int fVerbose)
Definition: amapLiberty.c:367
void Amap_LibertyStop(Amap_Tree_t *p)
Definition: amapLiberty.c:992
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * pContents
Definition: amapLiberty.c:63
static abctime Abc_Clock()
Definition: abc_global.h:279
void Amap_LibertyWipeOutComments(char *pBeg, char *pEnd)
Definition: amapLiberty.c:639
int Amap_LibertyBuildItem(Amap_Tree_t *p, char **ppPos, char *pEnd)
Definition: amapLiberty.c:845
char * pError
Definition: amapLiberty.c:69
Amap_Tree_t * Amap_LibertyStart(char *pFileName)
Definition: amapLiberty.c:951
#define ABC_PRT(a, t)
Definition: abc_global.h:220
char * Extra_FileNameGenericAppend(char *pBase, char *pSuffix)
ABC_INT64_T abctime
Definition: abc_global.h:278
Vec_Str_t* Amap_LibertyParseStr ( char *  pFileName,
int  fVerbose 
)

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

Synopsis [Parses the standard cell library in Liberty format.]

Description [Writes the resulting file in Genlib format.]

SideEffects []

SeeAlso []

Definition at line 1059 of file amapLiberty.c.

1060 {
1061  Amap_Tree_t * p;
1062  Vec_Str_t * vStr = NULL;
1063  char * pPos;
1064  abctime clk = Abc_Clock();
1065  int RetValue;
1066  p = Amap_LibertyStart( pFileName );
1067  if ( p == NULL )
1068  return 0;
1069  pPos = p->pContents;
1071  if ( Amap_LibertyBuildItem( p, &pPos, p->pContents + p->nContents ) == 0 )
1072  {
1073  if ( fVerbose )
1074  printf( "Parsing finished successfully.\n" );
1075 // Amap_LibertyPrintLiberty( p, "temp_.lib" );
1076  vStr = Amap_LibertyPrintGenlibStr( p, fVerbose );
1077  RetValue = 1;
1078  }
1079  else
1080  {
1081  if ( p->pError )
1082  printf( "%s", p->pError );
1083  if ( fVerbose )
1084  printf( "Parsing failed.\n" );
1085  RetValue = 0;
1086  }
1087  if ( fVerbose )
1088  {
1089  printf( "Memory = %7.2f MB. ", 1.0*(p->nContents+p->nItermAlloc*sizeof(Amap_Item_t))/(1<<20) );
1090  ABC_PRT( "Time", Abc_Clock() - clk );
1091  }
1092  Amap_LibertyStop( p );
1093  return vStr;
1094 }
void Amap_LibertyStop(Amap_Tree_t *p)
Definition: amapLiberty.c:992
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * pContents
Definition: amapLiberty.c:63
static abctime Abc_Clock()
Definition: abc_global.h:279
void Amap_LibertyWipeOutComments(char *pBeg, char *pEnd)
Definition: amapLiberty.c:639
Vec_Str_t * Amap_LibertyPrintGenlibStr(Amap_Tree_t *p, int fVerbose)
Definition: amapLiberty.c:478
int Amap_LibertyBuildItem(Amap_Tree_t *p, char **ppPos, char *pEnd)
Definition: amapLiberty.c:845
char * pError
Definition: amapLiberty.c:69
Amap_Tree_t * Amap_LibertyStart(char *pFileName)
Definition: amapLiberty.c:951
#define ABC_PRT(a, t)
Definition: abc_global.h:220
ABC_INT64_T abctime
Definition: abc_global.h:278
void Amap_LibFree ( Amap_Lib_t p)

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

Synopsis [Deallocs a library.]

Description []

SideEffects []

SeeAlso []

Definition at line 67 of file amapLib.c.

68 {
69  if ( p == NULL )
70  return;
71  if ( p->vSelect )
72  Vec_PtrFree( p->vSelect );
73  if ( p->vSorted )
74  Vec_PtrFree( p->vSorted );
75  if ( p->vGates )
76  Vec_PtrFree( p->vGates );
77  if ( p->vRules )
78  Vec_VecFree( (Vec_Vec_t *)p->vRules );
79  if ( p->vRulesX )
80  Vec_VecFree( (Vec_Vec_t *)p->vRulesX );
81  if ( p->vRules3 )
82  Vec_IntFree( p->vRules3 );
83  Aig_MmFlexStop( p->pMemGates, 0 );
84  Aig_MmFlexStop( p->pMemSet, 0 );
85  ABC_FREE( p->pRules );
86  ABC_FREE( p->pRulesX );
87  ABC_FREE( p->pNodes );
88  ABC_FREE( p->pName );
89  ABC_FREE( p );
90 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Vec_t_ Vec_Vec_t
INCLUDES ///.
Definition: vecVec.h:42
static Llb_Mgr_t * p
Definition: llb3Image.c:950
static void Vec_VecFree(Vec_Vec_t *p)
Definition: vecVec.h:347
#define ABC_FREE(obj)
Definition: abc_global.h:232
void Aig_MmFlexStop(Aig_MmFlex_t *p, int fVerbose)
Definition: aigMem.c:337
static void Vec_IntFree(Vec_Int_t *p)
Definition: bblif.c:235
static void Vec_PtrFree(Vec_Ptr_t *p)
Definition: vecPtr.h:223
void Amap_LibPrintSelectedGates ( Amap_Lib_t p,
int  fAllGates 
)

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

Synopsis [Selects gates useful for area-only mapping.]

Description []

SideEffects []

SeeAlso []

Definition at line 302 of file amapLib.c.

303 {
304  Vec_Ptr_t * vArray;
305  Amap_Gat_t * pGate;
306  int i;
307  vArray = fAllGates? p->vGates : p->vSelect;
308  Vec_PtrForEachEntry( Amap_Gat_t *, vArray, pGate, i )
309  {
310  printf( "%3d :%12s %d %9.2f ", i, pGate->pName, pGate->nPins, pGate->dArea );
311  printf( "%4s=%40s ", pGate->pOutName, pGate->pForm );
312  printf( "DSD: " );
313  Kit_DsdPrintFromTruth( pGate->pFunc, pGate->nPins );
314  printf( "\n" );
315  }
316 }
typedefABC_NAMESPACE_HEADER_START struct Vec_Ptr_t_ Vec_Ptr_t
INCLUDES ///.
Definition: vecPtr.h:42
char * pForm
Definition: amapInt.h:157
static Llb_Mgr_t * p
Definition: llb3Image.c:950
char * pOutName
Definition: amapInt.h:155
void Kit_DsdPrintFromTruth(unsigned *pTruth, int nVars)
Definition: kitDsd.c:490
unsigned * pFunc
Definition: amapInt.h:158
unsigned nPins
Definition: amapInt.h:161
double dArea
Definition: amapInt.h:156
char * pName
Definition: amapInt.h:154
#define Vec_PtrForEachEntry(Type, vVec, pEntry, i)
MACRO DEFINITIONS ///.
Definition: vecPtr.h:55
Amap_Lib_t* Amap_LibReadAndPrepare ( char *  pFileName,
char *  pBuffer,
int  fVerbose,
int  fVeryVerbose 
)

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

Synopsis [Parses equations for the gates.]

Description []

SideEffects []

SeeAlso []

Definition at line 329 of file amapLib.c.

330 {
331  Amap_Lib_t * p;
332  abctime clk = Abc_Clock();
333  if ( pBuffer == NULL )
334  p = Amap_LibReadFile( pFileName, fVerbose );
335  else
336  {
337  p = Amap_LibReadBuffer( pBuffer, fVerbose );
338  if ( p )
339  p->pName = Abc_UtilStrsav( pFileName );
340  }
341  if ( fVerbose )
342  printf( "Read %d gates from file \"%s\".\n", Vec_PtrSize(p->vGates), pFileName );
343  if ( p == NULL )
344  return NULL;
345  if ( !Amap_LibParseEquations( p, fVerbose ) )
346  {
347  Amap_LibFree( p );
348  return NULL;
349  }
350  p->vSorted = Amap_LibSortGatesByArea( p );
351  p->vSelect = Amap_LibSelectGates( p, fVerbose );
352  if ( fVerbose )
353  {
354  printf( "Selected %d functionally unique gates. ", Vec_PtrSize(p->vSelect) );
355  ABC_PRT( "Time", Abc_Clock() - clk );
356 // Amap_LibPrintSelectedGates( p, 0 );
357  }
358  clk = Abc_Clock();
359  Amap_LibCreateRules( p, fVeryVerbose );
360  if ( fVerbose )
361  {
362  printf( "Created %d rules and %d matches. ", p->nNodes, p->nSets );
363  ABC_PRT( "Time", Abc_Clock() - clk );
364  }
365  return p;
366 }
Amap_Lib_t * Amap_LibReadFile(char *pFileName, int fVerbose)
Definition: amapRead.c:473
static Llb_Mgr_t * p
Definition: llb3Image.c:950
void Amap_LibFree(Amap_Lib_t *p)
Definition: amapLib.c:67
static abctime Abc_Clock()
Definition: abc_global.h:279
static int Vec_PtrSize(Vec_Ptr_t *p)
Definition: vecPtr.h:295
Vec_Ptr_t * Amap_LibSortGatesByArea(Amap_Lib_t *pLib)
Definition: amapLib.c:220
typedefABC_NAMESPACE_HEADER_START struct Amap_Lib_t_ Amap_Lib_t
INCLUDES ///.
Definition: amap.h:42
Vec_Ptr_t * Amap_LibSelectGates(Amap_Lib_t *p, int fVerbose)
Definition: amapLib.c:261
#define ABC_PRT(a, t)
Definition: abc_global.h:220
Amap_Lib_t * Amap_LibReadBuffer(char *pBuffer, int fVerbose)
Definition: amapRead.c:446
int Amap_LibParseEquations(Amap_Lib_t *p, int fVerbose)
Definition: amapParse.c:392
void Amap_LibCreateRules(Amap_Lib_t *p, int fVeryVerbose)
Definition: amapRule.c:426
ABC_INT64_T abctime
Definition: abc_global.h:278
char * Abc_UtilStrsav(char *s)
Definition: starter.c:47
void Amap_ManSetDefaultParams ( Amap_Par_t p)

MACRO DEFINITIONS ///.

FUNCTION DECLARATIONS ///

MACRO DEFINITIONS ///.

CFile****************************************************************

FileName [amapCore.c]

SystemName [ABC: Logic synthesis and verification system.]

PackageName [Technology mapper for standard cells.]

Synopsis [Core mapping procedures.]

Author [Alan Mishchenko]

Affiliation [UC Berkeley]

Date [Ver. 1.0. Started - June 20, 2005.]

Revision [

Id:
amapCore.c,v 1.00 2005/06/20 00:00:00 alanmi Exp

]FUNCTION DEFINITIONS /// Function*************************************************************

Synopsis [This procedure sets default parameters.]

Description []

SideEffects []

SeeAlso []

Definition at line 46 of file amapCore.c.

47 {
48  memset( p, 0, sizeof(Amap_Par_t) );
49  p->nIterFlow = 1; // iterations of area flow
50  p->nIterArea = 4; // iteratoins of exact area
51  p->nCutsMax = 500; // the maximum number of cuts at a node
52  p->fUseMuxes = 0; // enables the use of MUXes
53  p->fUseXors = 1; // enables the use of XORs
54  p->fFreeInvs = 0; // assume inverters are free (area = 0)
55  p->fEpsilon = (float)0.001; // used to compare floating point numbers
56  p->fVerbose = 0; // verbosity flag
57 }
char * memset()
int nIterArea
Definition: amap.h:48
int fVerbose
Definition: amap.h:55
int nIterFlow
Definition: amap.h:47
int fUseXors
Definition: amap.h:51
int nCutsMax
Definition: amap.h:49
int fUseMuxes
Definition: amap.h:50
int fFreeInvs
Definition: amap.h:52
float fEpsilon
Definition: amap.h:53