summaryrefslogtreecommitdiffstats
path: root/src/map/if/ifCore.c
blob: c40ed893d3662445bb2581b2b706a94da8c9384f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
53
54
55
56
57
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
86
87
88
89
/**CFile****************************************************************

  FileName    [ifCore.c]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [FPGA mapping based on priority cuts.]

  Synopsis    [The central part of the mapper.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

  Date        [Ver. 1.0. Started - November 21, 2006.]

  Revision    [$Id: ifCore.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $]

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

#include "if.h"

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

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

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

  Synopsis    []

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
int If_ManPerformMapping( If_Man_t * p )
{
    If_Obj_t * pObj;
    int nItersFlow = 1;
    int nItersArea = 2;
    int clkTotal = clock();
    int i;
    // set arrival times and trivial cuts at const 1 and PIs
    If_ManConst1(p)->Cuts[0].Delay = 0.0;
    If_ManForEachPi( p, pObj, i )
        pObj->Cuts[0].Delay = p->pPars->pTimesArr[i];
    // set the fanout estimates of the PIs
    If_ManForEachPi( p, pObj, i )
        pObj->EstRefs = (float)1.0;
    // delay oriented mapping
    if ( p->pPars->fPreprocess && !p->pPars->fArea && p->pPars->nCutsMax >= 4  )
        If_ManPerformMappingPreprocess( p );
    else
        If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 1, "Delay" );
    // try to improve area by expanding and reducing the cuts
    if ( p->pPars->fExpRed && !p->pPars->fTruth )
        If_ManImproveMapping( p );
    // area flow oriented mapping
    for ( i = 0; i < nItersFlow; i++ )
    {
        If_ManPerformMappingRound( p, p->pPars->nCutsMax, 1, 1, "Flow" );
        if ( p->pPars->fExpRed && !p->pPars->fTruth )
            If_ManImproveMapping( p );
    }
    // area oriented mapping
    for ( i = 0; i < nItersArea; i++ )
    {
        If_ManPerformMappingRound( p, p->pPars->nCutsMax, 2, 1, "Area" );
        if ( p->pPars->fExpRed && !p->pPars->fTruth )
            If_ManImproveMapping( p );
    }
    if ( p->pPars->fVerbose )
    {
        PRT( "Total time", clock() - clkTotal );
    }
    return 1;
}

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