amapCore.c 3.21 KB
Newer Older
Alan Mishchenko committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
/**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 $]

***********************************************************************/

#include "amapInt.h"
22 23 24 25
#include "main.h"

ABC_NAMESPACE_IMPL_START

Alan Mishchenko committed
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52

////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

////////////////////////////////////////////////////////////////////////
///                     FUNCTION DEFINITIONS                         ///
////////////////////////////////////////////////////////////////////////

/**Function*************************************************************

  Synopsis    [This procedure sets default parameters.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Amap_ManSetDefaultParams( Amap_Par_t * p )
{
    memset( p, 0, sizeof(Amap_Par_t) );
    p->nIterFlow = 1;            // iterations of area flow
    p->nIterArea = 4;            // iteratoins of exact area
    p->fUseMuxes = 0;            // enables the use of MUXes
    p->fUseXors  = 1;            // enables the use of XORs
53
    p->fFreeInvs = 0;            // assume inverters are free (area = 0)
Alan Mishchenko committed
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
    p->fEpsilon  = (float)0.001; // used to compare floating point numbers
    p->fVerbose  = 0;            // verbosity flag
}

/**Function*************************************************************

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Vec_Ptr_t * Amap_ManTest( Aig_Man_t * pAig, Amap_Par_t * pPars )
{
71
//    extern void * Abc_FrameReadLibGen2();
Alan Mishchenko committed
72 73 74 75
    Vec_Ptr_t * vRes;
    Amap_Man_t * p;
    Amap_Lib_t * pLib;
    int clkTotal = clock();
76
    pLib = (Amap_Lib_t *)Abc_FrameReadLibGen2();
Alan Mishchenko committed
77 78 79 80 81 82 83 84 85 86 87
    if ( pLib == NULL )
    {
        printf( "Library is not available.\n" );
        return NULL;
    }
    p = Amap_ManStart( Aig_ManNodeNum(pAig) );
    p->pPars = pPars;
    p->pLib  = pLib;
    p->fAreaInv = pPars->fFreeInvs? 0.0 : pLib->pGateInv->dArea;
    p->fUseMux = pPars->fUseMuxes && pLib->fHasMux;
    p->fUseXor = pPars->fUseXors && pLib->fHasXor;
Alan Mishchenko committed
88 89
    p->ppCutsTemp = ABC_CALLOC( Amap_Cut_t *, 2 * pLib->nNodes );
    p->pMatsTemp = ABC_CALLOC( int, 2 * pLib->nNodes );
Alan Mishchenko committed
90 91 92 93 94 95 96
    Amap_ManCreate( p, pAig );
    Amap_ManMap( p );
    vRes = NULL;
    vRes = Amap_ManProduceMapped( p );
    Amap_ManStop( p );
if ( pPars->fVerbose )
{
Alan Mishchenko committed
97
ABC_PRT( "Total runtime", clock() - clkTotal );
Alan Mishchenko committed
98 99 100 101 102 103 104 105 106 107
}
    return vRes;
}


////////////////////////////////////////////////////////////////////////
///                       END OF FILE                                ///
////////////////////////////////////////////////////////////////////////


108 109
ABC_NAMESPACE_IMPL_END