ntlCore.c 4.32 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    [ntlCore.c]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [Netlist representation.]

  Synopsis    [DFS traversal.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

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

  Revision    [$Id: ntlCore.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]

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

#include "ntl.h"
Alan Mishchenko committed
22
#include "dch.h"
23 24 25 26
#include "dar.h"

ABC_NAMESPACE_IMPL_START

Alan Mishchenko committed
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46

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

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

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

  Synopsis    [Extracts AIG from the netlist.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Alan Mishchenko committed
47
Aig_Man_t * Ntl_ManPerformChoicing( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fConstruct, int nConfMax, int nLevelMax, int fVerbose )
Alan Mishchenko committed
48
{
49 50 51
//    extern Aig_Man_t * Dar_ManBalance( Aig_Man_t * pAig, int fUpdateLevel );
//    extern Aig_Man_t * Dar_ManCompress( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fPower, int fVerbose );
//    extern Aig_Man_t * Dar_ManChoice( Aig_Man_t * pAig, int fBalance, int fUpdateLevel, int fConstruct, int nConfMax, int nLevelMax, int fVerbose );
Alan Mishchenko committed
52
    Aig_Man_t * pTemp;
53

Alan Mishchenko committed
54 55 56 57
    // perform synthesis
//printf( "Pre-synthesis AIG:  " );
//Aig_ManPrintStats( pAig );
//    pTemp = Dar_ManBalance( pAig, 1 );
Alan Mishchenko committed
58
//    pTemp = Dar_ManCompress( pAig, 1, 1, 0, 0 );
Alan Mishchenko committed
59
    pTemp = Dar_ManChoice( pAig, fBalance, fUpdateLevel, fConstruct, nConfMax, nLevelMax, fVerbose );
Alan Mishchenko committed
60 61
//printf( "Post-synthesis AIG: " );
//Aig_ManPrintStats( pTemp );
62

Alan Mishchenko committed
63 64 65 66 67
    return pTemp;
}

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

Alan Mishchenko committed
68 69 70 71 72 73 74 75 76 77 78
  Synopsis    [Extracts AIG from the netlist.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Aig_Man_t * Ntl_ManPerformChoicingNew( Aig_Man_t * pAig, Dch_Pars_t * pPars )
{
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94
//    extern Aig_Man_t * Dar_ManChoiceNew( Aig_Man_t * pAig, Dch_Pars_t * pPars );
    Aig_Man_t * pTemp;
/*
    Aig_Obj_t * pObj;
    int i;
    Aig_ManForEachPi( pAig, pObj, i )
        printf( "%d ", pObj->Level );
    printf( "\n" );
*/
    pTemp = Dar_ManChoiceNew( pAig, pPars );
/*
    Aig_ManForEachPi( pTemp, pObj, i )
        printf( "%d ", pObj->Level );
    printf( "\n" );
*/
    return pTemp;
Alan Mishchenko committed
95 96 97 98
}

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

Alan Mishchenko committed
99 100 101 102 103 104 105 106 107 108 109
  Synopsis    [Testing procedure for insertion of mapping into the netlist.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
int Ntl_ManInsertTest( Ntl_Man_t * p, Aig_Man_t * pAig )
{
Alan Mishchenko committed
110
    Ntl_Man_t * pNew;
Alan Mishchenko committed
111 112 113
    Vec_Ptr_t * vMapping;
    int RetValue;
    vMapping = Ntl_MappingFromAig( pAig );
Alan Mishchenko committed
114 115 116
    pNew = Ntl_ManInsertMapping( p, vMapping, pAig );
    RetValue = (pNew != NULL);
    Ntl_ManFree( pNew );
Alan Mishchenko committed
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
    Vec_PtrFree( vMapping );
    return RetValue;
}

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

  Synopsis    [Testing procedure for insertion of mapping into the netlist.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
int Ntl_ManInsertTestIf( Ntl_Man_t * p, Aig_Man_t * pAig )
{
Alan Mishchenko committed
134
    Ntl_Man_t * pNew;
Alan Mishchenko committed
135 136 137
    Vec_Ptr_t * vMapping;
    int RetValue;
    vMapping = Ntl_MappingIf( p, pAig );
Alan Mishchenko committed
138 139 140
    pNew = Ntl_ManInsertMapping( p, vMapping, pAig );
    RetValue = (pNew != NULL);
    Ntl_ManFree( pNew );
Alan Mishchenko committed
141 142 143 144 145 146 147 148 149 150
    Vec_PtrFree( vMapping );
    return RetValue;
}


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


151 152
ABC_NAMESPACE_IMPL_END