amapMerge.c 17.7 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    [amapMerge.c]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [Technology mapper for standard cells.]

  Synopsis    [Computing cuts for the node.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

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

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

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

#include "amapInt.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 47 48 49
////////////////////////////////////////////////////////////////////////
///                        DECLARATIONS                              ///
////////////////////////////////////////////////////////////////////////

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

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

  Synopsis    [Creates new cut and adds it to storage.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Amap_Cut_t * Amap_ManSetupPis( Amap_Man_t * p )
{
    Amap_Obj_t * pObj;
    Amap_Cut_t * pCut;
    int i, nBytes = sizeof(Amap_Cut_t) + sizeof(int);
Alan Mishchenko committed
50
    char * pBuffer = ABC_ALLOC( char, Amap_ManPiNum(p) * nBytes );
Alan Mishchenko committed
51 52 53 54 55 56
    Amap_ManForEachPi( p, pObj, i )
    {
        pCut = (Amap_Cut_t *)( pBuffer + i*nBytes );
        pCut->iMat = 0;
        pCut->fInv = 0;
        pCut->nFans = 1;
57
        pCut->Fans[0] = Abc_Var2Lit( pObj->Id, 0 );
Alan Mishchenko committed
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
        pObj->pData = pCut;
        pObj->nCuts = 1;
        pObj->EstRefs = (float)1.0;
    }
    return (Amap_Cut_t *)pBuffer;
}

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

  Synopsis    [Creates new cut and adds it to storage.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Amap_Cut_t * Amap_ManCutStore( Amap_Man_t * p, Amap_Cut_t * pCut, int fCompl )
{
    Amap_Cut_t * pNew;
    int iFan, nBytes = sizeof(Amap_Cut_t) + sizeof(int) * pCut->nFans + sizeof(Amap_Cut_t *);
    pNew = (Amap_Cut_t *)Aig_MmFlexEntryFetch( p->pMemTemp, nBytes );
    pNew->iMat  = pCut->iMat;
    pNew->fInv  = pCut->fInv ^ fCompl;
    pNew->nFans = pCut->nFans;
    memcpy( pNew->Fans, pCut->Fans, sizeof(int) * pCut->nFans );
    // add it to storage
86
    iFan = Abc_Var2Lit( pNew->iMat, pNew->fInv );
Alan Mishchenko committed
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175
    if ( p->ppCutsTemp[ iFan ] == NULL )
        Vec_IntPushOrder( p->vTemp, iFan );
    *Amap_ManCutNextP( pNew ) = p->ppCutsTemp[ iFan ];
    p->ppCutsTemp[ iFan ] = pNew;
    return pNew;
} 

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

  Synopsis    [Creates new cut and adds it to storage.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Amap_Cut_t * Amap_ManCutCreate( Amap_Man_t * p, 
    Amap_Cut_t * pCut0, Amap_Cut_t * pCut1, int iMat )
{
    Amap_Cut_t * pCut;
    int i, nSize  = pCut0->nFans + pCut1->nFans;
    int nBytes = sizeof(Amap_Cut_t) + sizeof(int) * nSize + sizeof(Amap_Cut_t *);
    assert( pCut0->iMat >= pCut1->iMat );
    pCut = (Amap_Cut_t *)Aig_MmFlexEntryFetch( p->pMemTemp, nBytes );
    pCut->iMat  = iMat;
    pCut->fInv  = 0;
    pCut->nFans = nSize;
    for ( i = 0; i < (int)pCut0->nFans; i++ )
        pCut->Fans[i] = pCut0->Fans[i];
    for ( i = 0; i < (int)pCut1->nFans; i++ )
        pCut->Fans[pCut0->nFans+i] = pCut1->Fans[i];
    // add it to storage
    if ( p->ppCutsTemp[ pCut->iMat ] == NULL )
        Vec_IntPushOrder( p->vTemp, pCut->iMat );
    *Amap_ManCutNextP( pCut ) = p->ppCutsTemp[ pCut->iMat ];
    p->ppCutsTemp[ pCut->iMat ] = pCut;
    return pCut;
} 

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

  Synopsis    [Creates new cut and adds it to storage.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Amap_Cut_t * Amap_ManCutCreate3( Amap_Man_t * p, 
    Amap_Cut_t * pCut0, Amap_Cut_t * pCut1, Amap_Cut_t * pCut2, int iMat )
{
    Amap_Cut_t * pCut;
    int i, nSize  = pCut0->nFans + pCut1->nFans + pCut2->nFans;
    int nBytes = sizeof(Amap_Cut_t) + sizeof(int) * nSize + sizeof(Amap_Cut_t *);
    pCut = (Amap_Cut_t *)Aig_MmFlexEntryFetch( p->pMemTemp, nBytes );
    pCut->iMat  = iMat;
    pCut->fInv  = 0;
    pCut->nFans = nSize;
    for ( i = 0; i < (int)pCut0->nFans; i++ )
        pCut->Fans[i] = pCut0->Fans[i];
    for ( i = 0; i < (int)pCut1->nFans; i++ )
        pCut->Fans[pCut0->nFans+i] = pCut1->Fans[i];
    for ( i = 0; i < (int)pCut2->nFans; i++ )
        pCut->Fans[pCut0->nFans+pCut1->nFans+i] = pCut2->Fans[i];
    // add it to storage
    if ( p->ppCutsTemp[ pCut->iMat ] == NULL )
        Vec_IntPushOrder( p->vTemp, pCut->iMat );
    *Amap_ManCutNextP( pCut ) = p->ppCutsTemp[ pCut->iMat ];
    p->ppCutsTemp[ pCut->iMat ] = pCut;
    return pCut;
} 

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

  Synopsis    [Removes cuts from the temporary storage.]

  Description [] 
               
  SideEffects []

  SeeAlso     [] 

***********************************************************************/
void Amap_ManCutSaveStored( Amap_Man_t * p, Amap_Obj_t * pNode )
{
Alan Mishchenko committed
176
    int nMaxCuts = 500;
Alan Mishchenko committed
177 178
    int * pBuffer;
    Amap_Cut_t * pNext, * pCut;
Alan Mishchenko committed
179
    int i, nWords, Entry, nCuts, nCuts2;
Alan Mishchenko committed
180 181 182 183 184 185 186 187 188
    assert( pNode->pData == NULL );
    // count memory needed
    nCuts = 1;
    nWords = 2;
    Vec_IntForEachEntry( p->vTemp, Entry, i )
    {
        for ( pCut = p->ppCutsTemp[Entry]; pCut; pCut = *Amap_ManCutNextP(pCut) )
        {
            nCuts++;
Alan Mishchenko committed
189 190
            if ( nCuts < nMaxCuts )
                nWords += pCut->nFans + 1;
Alan Mishchenko committed
191 192 193 194 195 196 197 198 199 200
        }
    }
    p->nBytesUsed += 4*nWords;
    // allocate memory
    pBuffer = (int *)Aig_MmFlexEntryFetch( p->pMemCuts, 4*nWords );
    pNext = (Amap_Cut_t *)pBuffer;
    // add the first cut
    pNext->iMat  = 0; 
    pNext->fInv  = 0;
    pNext->nFans = 1;
201
    pNext->Fans[0] = Abc_Var2Lit(pNode->Id, 0);
Alan Mishchenko committed
202
    pNext  = (Amap_Cut_t *)(pBuffer + 2);
Alan Mishchenko committed
203
    // add other cuts
Alan Mishchenko committed
204
    nCuts2 = 1;
Alan Mishchenko committed
205 206 207 208
    Vec_IntForEachEntry( p->vTemp, Entry, i )
    {
        for ( pCut = p->ppCutsTemp[Entry]; pCut; pCut = *Amap_ManCutNextP(pCut) )
        {
Alan Mishchenko committed
209 210 211 212 213 214
            nCuts2++;
            if ( nCuts2 < nMaxCuts )
            {
                memcpy( pNext, pCut, sizeof(int) * (pCut->nFans + 1) );
                pNext = (Amap_Cut_t *)((int *)pNext + pCut->nFans + 1);
            }
Alan Mishchenko committed
215 216 217
        }
        p->ppCutsTemp[Entry] = NULL;
    }
Alan Mishchenko committed
218
    assert( nCuts == nCuts2 );
Alan Mishchenko committed
219 220 221 222 223 224 225 226
    assert( (int *)pNext - pBuffer == nWords );
    // restore the storage
    Vec_IntClear( p->vTemp );
    Aig_MmFlexRestart( p->pMemTemp );
    for ( i = 0; i < 2*p->pLib->nNodes; i++ )
        if ( p->ppCutsTemp[i] != NULL )
            printf( "Amap_ManCutSaveStored(): Error!\n" );
    pNode->pData = (Amap_Cut_t *)pBuffer;
227
    pNode->nCuts = Abc_MinInt( nCuts, nMaxCuts-1 );
Alan Mishchenko committed
228
    assert( nCuts < (1<<20) );
Alan Mishchenko committed
229 230 231 232 233 234 235
//    printf("%d ", nCuts );
    // verify cuts
    pCut = NULL;
    Amap_NodeForEachCut( pNode, pNext, i )
//        for ( i = 0, pNext = (Amap_Cut_t *)pNode->pData; i < (int)pNode->nCuts; 
//        i++, pNext = Amap_ManCutNext(pNext) )
    {
Alan Mishchenko committed
236 237
        if ( i == nMaxCuts )
            break;
Alan Mishchenko committed
238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265
        assert( pCut == NULL || pCut->iMat <= pNext->iMat );
        pCut = pNext;
    }
}

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

  Synopsis    [Returns the number of possible new cuts.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
int Amap_ManMergeCountCuts( Amap_Man_t * p, Amap_Obj_t * pNode )
{
    Amap_Obj_t * pFanin0 = Amap_ObjFanin0( p, pNode );
    Amap_Obj_t * pFanin1 = Amap_ObjFanin1( p, pNode );
    Amap_Cut_t * pCut0, * pCut1;
    int Entry, c0, c1, iCompl0, iCompl1, iFan0, iFan1;
    int Counter = 1;
    Amap_NodeForEachCut( pFanin0, pCut0, c0 )
    Amap_NodeForEachCut( pFanin1, pCut1, c1 )
    {
        iCompl0 = pCut0->fInv ^ Amap_ObjFaninC0(pNode);
        iCompl1 = pCut1->fInv ^ Amap_ObjFaninC1(pNode);
266 267
        iFan0   = !pCut0->iMat? 0: Abc_Var2Lit( pCut0->iMat, iCompl0 );
        iFan1   = !pCut1->iMat? 0: Abc_Var2Lit( pCut1->iMat, iCompl1 );
Alan Mishchenko committed
268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302
        Entry = Amap_LibFindNode( p->pLib, iFan0, iFan1, pNode->Type == AMAP_OBJ_XOR );
        Counter += ( Entry >=0 );
//        if ( Entry >=0 )
//            printf( "Full: %d + %d = %d\n", iFan0, iFan1, Entry );
    }
    return Counter;
}

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

  Synopsis    [Print cuts.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Amap_ManPrintCuts( Amap_Obj_t * pNode )
{
    Amap_Cut_t * pCut;
    int c, i;
    printf( "NODE %5d : Type = ", pNode->Id );
    if ( pNode->Type == AMAP_OBJ_AND )
        printf( "AND" );
    else if ( pNode->Type == AMAP_OBJ_XOR )
        printf( "XOR" );
    else if ( pNode->Type == AMAP_OBJ_MUX )
        printf( "MUX" );
    printf( "  Cuts = %d\n", pNode->nCuts );
    Amap_NodeForEachCut( pNode, pCut, c )
    {
        printf( "%3d :  Mat= %3d  Inv=%d  ", c, pCut->iMat, pCut->fInv );
        for ( i = 0; i < (int)pCut->nFans; i++ )
303
            printf( "%d%c ", Abc_Lit2Var(pCut->Fans[i]), Abc_LitIsCompl(pCut->Fans[i])?'-':'+' );
Alan Mishchenko committed
304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327
        printf( "\n" );
    }
}

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

  Synopsis    [Derives cuts for one node.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Amap_ManMergeNodeChoice( Amap_Man_t * p, Amap_Obj_t * pNode )
{
    Amap_Obj_t * pTemp;
    Amap_Cut_t * pCut;
    int c;
    // go through the nodes of the choice node
    for ( pTemp = pNode; pTemp; pTemp = Amap_ObjChoice(p, pTemp) )
    {
        Amap_NodeForEachCut( pTemp, pCut, c )
Alan Mishchenko committed
328 329
        {
            if (!pCut) break;   // mikelee added; abort when pCut is NULL
Alan Mishchenko committed
330 331
            if ( pCut->iMat )
                Amap_ManCutStore( p, pCut, pNode->fPhase ^ pTemp->fPhase );
Alan Mishchenko committed
332
        }
Alan Mishchenko committed
333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
        pTemp->pData = NULL;
    }
    Amap_ManCutSaveStored( p, pNode );

//    Amap_ManPrintCuts( pNode );
}

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

  Synopsis    [Derives cuts for one node.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
int Amap_ManFindCut( Amap_Obj_t * pNode, Amap_Obj_t * pFanin, int fComplFanin, int Val, Vec_Ptr_t * vCuts )
{
    Amap_Cut_t * pCut;
    int c, iCompl, iFan;
    Vec_PtrClear( vCuts );
    Amap_NodeForEachCut( pFanin, pCut, c )
    {
        iCompl = pCut->fInv ^ fComplFanin;
359
        iFan   = !pCut->iMat? 0: Abc_Var2Lit( pCut->iMat, iCompl );
Alan Mishchenko committed
360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399
        if ( iFan == Val )
            Vec_PtrPush( vCuts, pCut );
    }
    return Vec_PtrSize(vCuts) == 0;
}

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

  Synopsis    [Derives cuts for one node.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Amap_ManMergeNodeCutsMux( Amap_Man_t * p, Amap_Obj_t * pNode )
{
    Vec_Int_t * vRules = p->pLib->vRules3;
    Amap_Obj_t * pFanin0 = Amap_ObjFanin0( p, pNode );
    Amap_Obj_t * pFanin1 = Amap_ObjFanin1( p, pNode );
    Amap_Obj_t * pFanin2 = Amap_ObjFanin2( p, pNode );
    int fComplFanin0 = Amap_ObjFaninC0( pNode );
    int fComplFanin1 = Amap_ObjFaninC1( pNode );
    int fComplFanin2 = Amap_ObjFaninC2( pNode );
    Amap_Cut_t * pCut0, * pCut1, * pCut2;
    int x, c0, c1, c2;
    assert( pNode->pData == NULL );
    assert( pNode->Type == AMAP_OBJ_MUX );
    assert( pNode->fRepr == 0 );
    // go through the rules
    for ( x = 0; x < Vec_IntSize(vRules); x += 4 )
    {
        if ( Amap_ManFindCut( pNode, pFanin0, fComplFanin0, Vec_IntEntry(vRules, x), p->vCuts0 ) )
            continue;
        if ( Amap_ManFindCut( pNode, pFanin1, fComplFanin1, Vec_IntEntry(vRules, x+1), p->vCuts1 ) )
            continue;
        if ( Amap_ManFindCut( pNode, pFanin2, fComplFanin2, Vec_IntEntry(vRules, x+2), p->vCuts2 ) )
            continue;
400 401 402
        Vec_PtrForEachEntry( Amap_Cut_t *, p->vCuts0, pCut0, c0 )
        Vec_PtrForEachEntry( Amap_Cut_t *, p->vCuts1, pCut1, c1 )
        Vec_PtrForEachEntry( Amap_Cut_t *, p->vCuts2, pCut2, c2 )
Alan Mishchenko committed
403 404 405 406 407 408
        {
            Amap_Nod_t * pNod = Amap_LibNod( p->pLib, Vec_IntEntry(vRules, x+3) );
            if ( pNod->pSets == NULL )
                continue;
            // complement literals
            if ( pCut0->nFans == 1 && (pCut0->fInv ^ fComplFanin0) )
409
                pCut0->Fans[0] = Abc_LitNot(pCut0->Fans[0]);
Alan Mishchenko committed
410
            if ( pCut1->nFans == 1 && (pCut1->fInv ^ fComplFanin1) )
411
                pCut1->Fans[0] = Abc_LitNot(pCut1->Fans[0]);
Alan Mishchenko committed
412
            if ( pCut2->nFans == 1 && (pCut2->fInv ^ fComplFanin2) )
413
                pCut2->Fans[0] = Abc_LitNot(pCut2->Fans[0]);
Alan Mishchenko committed
414 415 416 417
            // create new cut
            Amap_ManCutCreate3( p, pCut0, pCut1, pCut2, Vec_IntEntry(vRules, x+3) );
            // uncomplement literals
            if ( pCut0->nFans == 1 && (pCut0->fInv ^ fComplFanin0) )
418
                pCut0->Fans[0] = Abc_LitNot(pCut0->Fans[0]);
Alan Mishchenko committed
419
            if ( pCut1->nFans == 1 && (pCut1->fInv ^ fComplFanin1) )
420
                pCut1->Fans[0] = Abc_LitNot(pCut1->Fans[0]);
Alan Mishchenko committed
421
            if ( pCut2->nFans == 1 && (pCut2->fInv ^ fComplFanin2) )
422
                pCut2->Fans[0] = Abc_LitNot(pCut2->Fans[0]);
Alan Mishchenko committed
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459
        }
    }
    Amap_ManCutSaveStored( p, pNode );
    p->nCutsUsed += pNode->nCuts;
    p->nCutsTried3 += pFanin0->nCuts * pFanin1->nCuts * pFanin2->nCuts;

//    Amap_ManPrintCuts( pNode );
}

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

  Synopsis    [Derives cuts for one node.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Amap_ManMergeNodeCuts( Amap_Man_t * p, Amap_Obj_t * pNode )
{
    Amap_Obj_t * pFanin0 = Amap_ObjFanin0( p, pNode );
    Amap_Obj_t * pFanin1 = Amap_ObjFanin1( p, pNode );
    Amap_Cut_t * pCut0, * pCut1;
    int ** pRules, Entry, i, k, c, iCompl0, iCompl1, iFan0, iFan1;
    assert( pNode->pData == NULL );
    if ( pNode->Type == AMAP_OBJ_MUX )
    {
        Amap_ManMergeNodeCutsMux( p, pNode );
        return;
    }
    assert( pNode->Type != AMAP_OBJ_MUX );
    pRules = (pNode->Type == AMAP_OBJ_AND)? p->pLib->pRules: p->pLib->pRulesX;
    Amap_NodeForEachCut( pFanin0, pCut0, c )
    {
        iCompl0 = pCut0->fInv ^ Amap_ObjFaninC0(pNode);
460
        iFan0   = !pCut0->iMat? 0: Abc_Var2Lit( pCut0->iMat, iCompl0 );
Alan Mishchenko committed
461 462
        // complement literals
        if ( pCut0->nFans == 1 && iCompl0 )
463
            pCut0->Fans[0] = Abc_LitNot(pCut0->Fans[0]);
Alan Mishchenko committed
464 465 466 467 468 469 470
        // label resulting sets
        for ( i = 0; (Entry = pRules[iFan0][i]); i++ )
            p->pMatsTemp[Entry & 0xffff] = (Entry >> 16);
        // iterate through the cuts
        Amap_NodeForEachCut( pFanin1, pCut1, k )
        {
            iCompl1 = pCut1->fInv ^ Amap_ObjFaninC1(pNode);
471
            iFan1   = !pCut1->iMat? 0: Abc_Var2Lit( pCut1->iMat, iCompl1 );
Alan Mishchenko committed
472 473 474 475
            if ( p->pMatsTemp[iFan1] == 0 )
                continue;
            // complement literals
            if ( pCut1->nFans == 1 && iCompl1 )
476
                pCut1->Fans[0] = Abc_LitNot(pCut1->Fans[0]);
Alan Mishchenko committed
477 478 479 480 481 482 483
            // create new cut
            if ( iFan0 >= iFan1 )
                Amap_ManCutCreate( p, pCut0, pCut1, p->pMatsTemp[iFan1] );
            else
                Amap_ManCutCreate( p, pCut1, pCut0, p->pMatsTemp[iFan1] );
            // uncomplement literals
            if ( pCut1->nFans == 1 && iCompl1 )
484
                pCut1->Fans[0] = Abc_LitNot(pCut1->Fans[0]);
Alan Mishchenko committed
485 486 487
        }
        // uncomplement literals
        if ( pCut0->nFans == 1 && iCompl0 )
488
            pCut0->Fans[0] = Abc_LitNot(pCut0->Fans[0]);
Alan Mishchenko committed
489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516
        // label resulting sets
        for ( i = 0; (Entry = pRules[iFan0][i]); i++ )
            p->pMatsTemp[Entry & 0xffff] = 0;
    }
    Amap_ManCutSaveStored( p, pNode );
    p->nCutsUsed += pNode->nCuts;
    p->nCutsTried += pFanin0->nCuts * pFanin1->nCuts;
//    assert( (int)pNode->nCuts == Amap_ManMergeCountCuts(p, pNode) );
    if ( pNode->fRepr )
        Amap_ManMergeNodeChoice( p, pNode );

//    Amap_ManPrintCuts( pNode );
}

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

  Synopsis    [Derives cuts for all nodes.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Amap_ManMerge( Amap_Man_t * p )
{
    Amap_Obj_t * pObj;
517 518
    int i;
    clock_t clk = clock();
Alan Mishchenko committed
519 520 521 522 523
    p->pCutsPi = Amap_ManSetupPis( p );
    Amap_ManForEachNode( p, pObj, i )
        Amap_ManMergeNodeCuts( p, pObj );
    if ( p->pPars->fVerbose )
    {
524
        printf( "AIG object is %d bytes.  ", (int)sizeof(Amap_Obj_t) );
525
        printf( "Internal AIG = %5.2f MB.  Cuts = %5.2f MB.\n", 
Alan Mishchenko committed
526 527 528 529
            1.0*Amap_ManObjNum(p)*sizeof(Amap_Obj_t)/(1<<20), 1.0*p->nBytesUsed/(1<<20) );
        printf( "Node =%6d. Try =%9d. Try3 =%10d. Used =%7d. R =%6.2f.  ", 
            Amap_ManNodeNum(p), p->nCutsTried, p->nCutsTried3, p->nCutsUsed, 
            1.0*p->nCutsUsed/Amap_ManNodeNum(p) );
Alan Mishchenko committed
530
ABC_PRT( "Time ", clock() - clk );
Alan Mishchenko committed
531 532 533 534 535 536 537 538 539
    }
}


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


540 541
ABC_NAMESPACE_IMPL_END