summaryrefslogtreecommitdiffstats
path: root/src/base/abcs/abcFpgaSeq.c
blob: d68c208206c2be56e0234c1be92755f2dd422294 (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
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
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
/**CFile****************************************************************

  FileName    [abcFpgaSeq.c]

  SystemName  [ABC: Logic synthesis and verification system.]

  PackageName [Network and node package.]

  Synopsis    [Mapping for FPGAs using sequential cuts.]

  Author      [Alan Mishchenko]
  
  Affiliation [UC Berkeley]

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

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

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

#include "abcs.h"

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

Abc_Ntk_t * Abc_NtkMapSeq( Abc_Ntk_t * pNtk, int fVerbose ) { return 0; }

extern Cut_Man_t *     Abc_NtkSeqCuts( Abc_Ntk_t * pNtk, Cut_Params_t * pParams );
extern void            Abc_NtkFpgaSeqRetimeDelayLags( Seq_FpgaMan_t * p );

static Seq_FpgaMan_t * Abc_NtkFpgaSeqStart( Abc_Ntk_t * pNtk, int fVerbose );
static void            Abc_NtkFpgaSeqStop( Seq_FpgaMan_t * p );

static Abc_Ntk_t *     Abc_NtkFpgaSeqConstruct( Seq_FpgaMan_t * p );
static void            Abc_NtkFpgaSeqRetime( Seq_FpgaMan_t * p, Abc_Ntk_t * pNtkNew );

////////////////////////////////////////////////////////////////////////
///                     FUNCTION DEFITIONS                           ///
////////////////////////////////////////////////////////////////////////

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

  Synopsis    [Retimes AIG for optimal delay.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Abc_Ntk_t * Abc_NtkFpgaSeq( Abc_Ntk_t * pNtk, int fVerbose )
{
    Abc_Ntk_t * pNtkNew;
    Seq_FpgaMan_t * p;
    Cut_Params_t Params, * pParams = &Params;
    int clk;

    assert( Abc_NtkIsSeq( pNtk ) );

    // get the sequential FPGA manager
    p = Abc_NtkFpgaSeqStart( pNtk, fVerbose );

    // create the cuts
    memset( pParams, 0, sizeof(Cut_Params_t) );
    pParams->nVarsMax  = 5;     // the max cut size ("k" of the k-feasible cuts)
    pParams->nKeepMax  = 1000;  // the max number of cuts kept at a node
    pParams->fTruth    = 0;     // compute truth tables
    pParams->fFilter   = 1;     // filter dominated cuts
    pParams->fSeq      = 1;     // compute sequential cuts
    pParams->fVerbose  = 0;     // the verbosiness flag

clk = clock();
    p->pMan = Abc_NtkSeqCuts( pNtk, pParams );
p->timeCuts += clock() - clk;

    // find best arrival times (p->vArrivals) and free the cuts
    // select mapping (p->vMapping) and remember best cuts (p->vMapCuts) 
clk = clock();
    Abc_NtkFpgaSeqRetimeDelayLags( p );
p->timeDelay += clock() - clk;

return NULL;

    // construct the network
clk = clock();
    pNtkNew = Abc_NtkFpgaSeqConstruct( p );
p->timeNtk += clock() - clk;

    // retime the network
clk = clock();
    Abc_NtkFpgaSeqRetime( p, pNtkNew );
p->timeRet += clock() - clk;

    // remove temporaries
    Abc_NtkFpgaSeqStop( p );

    // check the resulting network
    if ( !Abc_NtkCheck( pNtkNew ) )
        fprintf( stdout, "Abc_NtkFpgaSeq(): Network check has failed.\n" );
    return pNtkNew;
}

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

  Synopsis    [Starts sequential FPGA mapper.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Seq_FpgaMan_t * Abc_NtkFpgaSeqStart( Abc_Ntk_t * pNtk, int fVerbose )
{
    Seq_FpgaMan_t * p;
    // create the FPGA mapping manager
    p = ALLOC( Seq_FpgaMan_t, 1 );
    memset( p, 0, sizeof(Seq_FpgaMan_t) );
    p->pNtk      = pNtk;
    p->pMan      = NULL;
    p->vArrivals = Vec_IntAlloc( 0 );
    p->vBestCuts = Vec_PtrAlloc( 0 );
    p->vMapping  = Vec_PtrAlloc( 0 );
    p->vMapCuts  = Vec_PtrAlloc( 0 );
    p->vLagsMap  = Vec_StrStart( Abc_NtkObjNumMax(pNtk) );
    p->fVerbose  = fVerbose;
    return p;
}

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

  Synopsis    [Stops sequential FPGA mapper.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Abc_NtkFpgaSeqStop( Seq_FpgaMan_t * p )
{
    if ( p->fVerbose )
    {
        printf( "Sequential FPGA mapping stats:\n" );
//        printf( "Total allocated   = %8d.\n", p->nCutsAlloc );
//        printf( "Cuts per node     = %8.1f\n", ((float)(p->nCutsCur-p->nCutsTriv))/p->nNodes );
        PRT( "Cuts   ", p->timeCuts );
        PRT( "Arrival", p->timeDelay );
        PRT( "Network", p->timeNtk );
        PRT( "Retime ", p->timeRet );
    }
    Vec_IntFree( p->vArrivals );
    Vec_PtrFree( p->vBestCuts );
    Vec_PtrFree( p->vMapping );
    Vec_VecFree( (Vec_Vec_t *)p->vMapCuts );
    Vec_StrFree( p->vLagsMap );
    free( p );
}


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

  Synopsis    [Construct the final network after mapping.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
Abc_Ntk_t * Abc_NtkFpgaSeqConstruct( Seq_FpgaMan_t * p )
{
    Abc_Ntk_t * pNtk = NULL;
    return pNtk;
}

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

  Synopsis    [Retimes the final network after mapping.]

  Description []
               
  SideEffects []

  SeeAlso     []

***********************************************************************/
void Abc_NtkFpgaSeqRetime( Seq_FpgaMan_t * p, Abc_Ntk_t * pNtkNew )
{
}

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