intFrames.c 4.09 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 22
/**CFile****************************************************************

  FileName    [intFrames.c]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [Interpolation engine.]

  Synopsis    [Sequential AIG unrolling for interpolation.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

  Date        [Ver. 1.0. Started - June 24, 2008.]

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

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

#include "intInt.h"

23 24 25
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
////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

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

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

  Synopsis    [Create timeframes of the manager for interpolation.]

  Description [The resulting manager is combinational. The primary inputs
  corresponding to register outputs are ordered first. The only POs of the 
  manager is the property output of the last timeframe.]
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
47
Aig_Man_t * Inter_ManFramesInter( Aig_Man_t * pAig, int nFrames, int fAddRegOuts, int fUseTwoFrames )
Alan Mishchenko committed
48 49 50
{
    Aig_Man_t * pFrames;
    Aig_Obj_t * pObj, * pObjLi, * pObjLo;
51
    Aig_Obj_t * pLastPo = NULL;
Alan Mishchenko committed
52 53
    int i, f;
    assert( Saig_ManRegNum(pAig) > 0 );
54
    assert( Saig_ManPoNum(pAig)-Saig_ManConstrNum(pAig) == 1 );
Alan Mishchenko committed
55 56 57 58 59 60 61 62 63 64 65 66
    pFrames = Aig_ManStart( Aig_ManNodeNum(pAig) * nFrames );
    // map the constant node
    Aig_ManConst1(pAig)->pData = Aig_ManConst1( pFrames );
    // create variables for register outputs
    if ( fAddRegOuts )
    {
        Saig_ManForEachLo( pAig, pObj, i )
            pObj->pData = Aig_ManConst0( pFrames );
    }
    else
    {
        Saig_ManForEachLo( pAig, pObj, i )
67
            pObj->pData = Aig_ObjCreateCi( pFrames );
Alan Mishchenko committed
68 69 70 71 72 73
    }
    // add timeframes
    for ( f = 0; f < nFrames; f++ )
    {
        // create PI nodes for this frame
        Saig_ManForEachPi( pAig, pObj, i )
74
            pObj->pData = Aig_ObjCreateCi( pFrames );
Alan Mishchenko committed
75 76 77
        // add internal nodes of this frame
        Aig_ManForEachNode( pAig, pObj, i )
            pObj->pData = Aig_And( pFrames, Aig_ObjChild0Copy(pObj), Aig_ObjChild1Copy(pObj) );
78 79 80 81 82
        // add outputs for constraints
        Saig_ManForEachPo( pAig, pObj, i )
        {
            if ( i < Saig_ManPoNum(pAig)-Saig_ManConstrNum(pAig) )
                continue;
83
            Aig_ObjCreateCo( pFrames, Aig_Not( Aig_ObjChild0Copy(pObj) ) );
84
        }
Alan Mishchenko committed
85 86
        if ( f == nFrames - 1 )
            break;
87 88 89
        // remember the last PO
        pObj = Aig_ManCo( pAig, 0 );
        pLastPo = Aig_ObjChild0Copy(pObj);
Alan Mishchenko committed
90 91 92 93 94 95 96 97 98 99 100
        // save register inputs
        Saig_ManForEachLi( pAig, pObj, i )
            pObj->pData = Aig_ObjChild0Copy(pObj);
        // transfer to register outputs
        Saig_ManForEachLiLo(  pAig, pObjLi, pObjLo, i )
            pObjLo->pData = pObjLi->pData;
    }
    // create POs for each register output
    if ( fAddRegOuts )
    {
        Saig_ManForEachLi( pAig, pObj, i )
101
            Aig_ObjCreateCo( pFrames, Aig_ObjChild0Copy(pObj) );
Alan Mishchenko committed
102 103 104 105
    }
    // create the only PO of the manager
    else
    {
106
        pObj = Aig_ManCo( pAig, 0 );
107 108 109 110 111 112
        // add the last PO
        if ( pLastPo == NULL || !fUseTwoFrames )
            pLastPo = Aig_ObjChild0Copy(pObj);
        else
            pLastPo = Aig_Or( pFrames, pLastPo, Aig_ObjChild0Copy(pObj) );
        Aig_ObjCreateCo( pFrames, pLastPo );
Alan Mishchenko committed
113 114 115 116 117 118 119 120 121 122
    }
    Aig_ManCleanup( pFrames );
    return pFrames;
}

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


123 124
ABC_NAMESPACE_IMPL_END