Commit 52e5b91c by Alan Mishchenko

Version abc61204

parent 44d220d2
......@@ -7,9 +7,9 @@ CP := cp
PROG := abc
MODULES := src/base/abc src/base/abci src/base/cmd src/base/io src/base/main src/base/ver \
src/aig/ivy src/aig/hop src/aig/rwt src/aig/deco src/mem/deco src/aig/ec \
src/aig/ivy src/aig/hop src/aig/rwt src/aig/deco src/aig/mem src/aig/ec \
src/bdd/cudd src/bdd/dsd src/bdd/epd src/bdd/mtr src/bdd/parse src/bdd/reo \
src/map/fpga src/map/pga src/map/mapper src/map/mio src/map/super src/map/if \
src/map/fpga src/map/mapper src/map/mio src/map/super src/map/if \
src/misc/extra src/misc/mvc src/misc/st src/misc/util src/misc/espresso src/misc/nm src/misc/vec src/misc/hash \
src/opt/cut src/opt/dec src/opt/fxu src/opt/rwr src/opt/sim src/opt/ret \
src/sat/asat src/sat/bsat src/sat/csat src/sat/msat src/sat/fraig
......
......@@ -1826,6 +1826,18 @@ SOURCE=.\src\map\if\ifMap.c
# End Source File
# Begin Source File
SOURCE=.\src\map\if\ifReduce.c
# End Source File
# Begin Source File
SOURCE=.\src\map\if\ifSelect.c
# End Source File
# Begin Source File
SOURCE=.\src\map\if\ifSeq.c
# End Source File
# Begin Source File
SOURCE=.\src\map\if\ifUtil.c
# End Source File
# End Group
......
SRC += src/hop/rwt/rwtDec.c \
src/hop/rwt/rwtMan.c \
src/hop/rwt/rwtUtil.c
SRC += src/aig/rwt/rwtDec.c \
src/aig/rwt/rwtMan.c \
src/aig/rwt/rwtUtil.c
......@@ -7090,7 +7090,7 @@ int Abc_CommandFpga( Abc_Frame_t * pAbc, int argc, char ** argv )
fRecovery = 1;
fSwitching = 0;
fLatchPaths = 0;
fVerbose = 1;
fVerbose = 0;
DelayTarget =-1;
nLutSize =-1;
Extra_UtilGetoptReset();
......@@ -7392,18 +7392,20 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
// set defaults
memset( pPars, 0, sizeof(If_Par_t) );
pPars->Mode = 0;
pPars->nLutSize = 5;
pPars->nLutSize = 4;
// pPars->pLutLib = Abc_FrameReadLibLut();
pPars->nCutsMax = 10;
pPars->nCutsMax = 20;
pPars->fPreprocess = 1;
pPars->fArea = 0;
pPars->fFancy = 0;
pPars->fLatchPaths = 0;
pPars->fExpRed = 1;
pPars->fSeq = 0;
pPars->nLatches = 0;
pPars->DelayTarget = -1;
pPars->fVerbose = 1;
pPars->fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "MKCDaflsvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "MKCDpaflrsvh" ) ) != EOF )
{
switch ( c )
{
......@@ -7451,6 +7453,9 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( pPars->DelayTarget <= 0.0 )
goto usage;
break;
case 'p':
pPars->fPreprocess ^= 1;
break;
case 'a':
pPars->fArea ^= 1;
break;
......@@ -7460,6 +7465,9 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'l':
pPars->fLatchPaths ^= 1;
break;
case 'r':
pPars->fExpRed ^= 1;
break;
case 's':
pPars->fSeq ^= 1;
break;
......@@ -7478,6 +7486,12 @@ int Abc_CommandIf( Abc_Frame_t * pAbc, int argc, char ** argv )
return 1;
}
if ( pPars->fSeq )
{
fprintf( pErr, "Sequential mapping is currently being implemented.\n" );
goto usage;
}
if ( pPars->Mode < 0 || pPars->Mode > 4 )
{
fprintf( pErr, "Incorrect mapping mode.\n" );
......@@ -7547,7 +7561,7 @@ usage:
sprintf( LutSize, "library" );
else
sprintf( LutSize, "%d", pPars->nLutSize );
fprintf( pErr, "usage: if [-M num] [-K num] [-C num] [-D float] [-aflsvh]\n" );
fprintf( pErr, "usage: if [-M num] [-K num] [-C num] [-D float] [-pafrsvh]\n" );
fprintf( pErr, "\t performs FPGA mapping of the network as follows:\n" );
fprintf( pErr, "\t 1 - delay only\n" );
fprintf( pErr, "\t 2 - area only\n" );
......@@ -7557,9 +7571,11 @@ usage:
fprintf( pErr, "\t-K num : the number of LUT inputs (2 < num < 32) [default = %s]\n", LutSize );
fprintf( pErr, "\t-C num : the max number of cuts to use (1 < num < 2^12) [default = %d]\n", pPars->nCutsMax );
fprintf( pErr, "\t-D float : sets the delay constraint for the mapping [default = %s]\n", Buffer );
fprintf( pErr, "\t-p : toggles preprocessing using several starting points [default = %s]\n", pPars->fPreprocess? "yes": "no" );
fprintf( pErr, "\t-a : toggles area-oriented mapping [default = %s]\n", pPars->fArea? "yes": "no" );
fprintf( pErr, "\t-f : toggles one fancy feature [default = %s]\n", pPars->fFancy? "yes": "no" );
fprintf( pErr, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" );
// fprintf( pErr, "\t-l : optimizes latch paths for delay, other paths for area [default = %s]\n", pPars->fLatchPaths? "yes": "no" );
fprintf( pErr, "\t-r : enables expansion/reduction of the best cuts [default = %s]\n", pPars->fExpRed? "yes": "no" );
fprintf( pErr, "\t-s : toggles sequential mapping [default = %s]\n", pPars->fSeq? "yes": "no" );
fprintf( pErr, "\t-v : toggles verbose output [default = %s]\n", pPars->fVerbose? "yes": "no" );
fprintf( pErr, "\t-h : prints the command usage\n");
......
......@@ -55,7 +55,11 @@ Abc_Ntk_t * Abc_NtkIf( Abc_Ntk_t * pNtk, If_Par_t * pPars )
// print a warning about choice nodes
if ( Abc_NtkGetChoiceNum( pNtk ) )
printf( "Performing FPGA mapping with choices.\n" );
{
// printf( "Performing FPGA mapping with choices.\n" );
printf( "Currently mapping with choices is not enabled.\n" );
return NULL;
}
// get timing information
pPars->pTimesArr = Abc_NtkGetCiArrivalFloats(pNtk);
......@@ -223,7 +227,6 @@ Abc_Obj_t * Abc_NodeFromIf_rec( Abc_Ntk_t * pNtkNew, If_Man_t * pIfMan, If_Obj_t
return pNodeNew;
}
/**Function*************************************************************
Synopsis [Recursively derives the truth table for the cut.]
......
......@@ -148,18 +148,18 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored )
// print the statistic into a file
{
FILE * pTable;
pTable = fopen( "fpga/fpga_stats.txt", "a+" );
pTable = fopen( "a/fpga_stats.txt", "a+" );
fprintf( pTable, "%s ", pNtk->pName );
fprintf( pTable, "%d ", Abc_NtkLevel(pNtk) );
fprintf( pTable, "%d ", Abc_NtkNodeNum(pNtk) );
fprintf( pTable, "%.2f ", (float)(s_MappingMem)/(float)(1<<20) );
fprintf( pTable, "%.2f", (float)(s_MappingTime)/(float)(CLOCKS_PER_SEC) );
// fprintf( pTable, "%.2f ", (float)(s_MappingMem)/(float)(1<<20) );
// fprintf( pTable, "%.2f", (float)(s_MappingTime)/(float)(CLOCKS_PER_SEC) );
fprintf( pTable, "\n" );
fclose( pTable );
}
*/
/*
// print the statistic into a file
{
static int Counter = 0;
......@@ -176,6 +176,7 @@ void Abc_NtkPrintStats( FILE * pFile, Abc_Ntk_t * pNtk, int fFactored )
fprintf( pTable, "\n" );
fclose( pTable );
}
*/
/*
// print the statistic into a file
......
......@@ -57,8 +57,8 @@ void Fpga_Init( Abc_Frame_t * pAbc )
{
// set the default library
//Fpga_LutLib_t s_LutLib = { "lutlib", 6, {0,1,2,4,8,16,32}, {0,1,2,3,4,5,6} };
Fpga_LutLib_t s_LutLib = { "lutlib", 5, {0,1,1,1,1,1}, {0,1,1,1,1,1} };
// Fpga_LutLib_t s_LutLib = { "lutlib", 4, {0,1,1,1,1}, {0,1,1,1,1} };
// Fpga_LutLib_t s_LutLib = { "lutlib", 5, {0,1,1,1,1,1}, {0,1,1,1,1,1} };
Fpga_LutLib_t s_LutLib = { "lutlib", 4, {0,1,1,1,1}, {0,1,1,1,1} };
//Fpga_LutLib_t s_LutLib = { "lutlib", 3, {0,1,1,1}, {0,1,1,1} };
Abc_FrameSetLibLut( Fpga_LutLibDup(&s_LutLib) );
......
......@@ -55,7 +55,7 @@ typedef enum {
IF_BO, // 6: box output
IF_BOX, // 7: box
IF_VOID // 8: unused object
} Hop_Type_t;
} If_Type_t;
////////////////////////////////////////////////////////////////////////
/// BASIC TYPES ///
......@@ -75,8 +75,10 @@ struct If_Par_t_
If_Lib_t * pLutLib; // the LUT library
int nCutsMax; // the max number of cuts
int fVerbose; // the verbosity flag
int fPreprocess; // preprossing
int fArea; // area-oriented mapping
int fFancy; // a fancy feature
int fExpRed; // expand/reduce of the best cuts
int fLatchPaths; // reset timing on latch paths
int fSeq; // sequential mapping
int nLatches; // the number of latches
......@@ -115,6 +117,7 @@ struct If_Man_t_
int nCutsUsed; // the number of cuts currently used
int nCutsMerged; // the total number of cuts merged
int nCutsMax; // the maximum number of cuts at a node
float Fi; // the current value of the clock period (for seq mapping)
// memory management
Mem_Fixed_t * pMem; // memory manager
int nEntrySize; // the size of the entry
......@@ -127,15 +130,16 @@ struct If_Man_t_
// priority cut
struct If_Cut_t_
{
float Delay; // the delay of the cut
float Area; // the area of the cut
If_Cut_t * pOne; // the parent cut
If_Cut_t * pTwo; // the parent cut
char fCompl0; // the complemented attribute
char fCompl1; // the complemented attribute
char Phase; // the complemented attribute
char nLeaves; // the number of leaves
int * pLeaves; // the array of fanins
float Delay; // delay of the cut
float Area; // area (or area-flow) of the cut
If_Cut_t * pOne; // parent cut
If_Cut_t * pTwo; // parent cut
unsigned uSign; // cut signature
char fCompl0; // complemented attribute
char fCompl1; // complemented attribute
char Phase; // complemented attribute
char nLeaves; // number of leaves
int * pLeaves; // array of fanins
};
// node extension
......@@ -149,8 +153,7 @@ struct If_Obj_t_
unsigned Level : 24; // logic level of the node
int Id; // integer ID
int nRefs; // the number of references
short nCuts; // the number of cuts
short iCut; // the number of the best cut
int nCuts; // the number of cuts
If_Obj_t * pFanin0; // the first fanin
If_Obj_t * pFanin1; // the second fanin
If_Obj_t * pEquiv; // the choice node
......@@ -188,7 +191,8 @@ static inline void If_ObjSetChoice( If_Obj_t * pObj, If_Obj_t * pEqu ) { p
static inline If_Cut_t * If_ObjCut( If_Obj_t * pObj, int iCut ) { return pObj->Cuts + iCut; }
static inline If_Cut_t * If_ObjCutTriv( If_Obj_t * pObj ) { return pObj->Cuts; }
static inline If_Cut_t * If_ObjCutBest( If_Obj_t * pObj ) { return pObj->Cuts + pObj->iCut; }
static inline If_Cut_t * If_ObjCutBest( If_Obj_t * pObj ) { return pObj->Cuts + 1; }
static inline unsigned If_ObjCutSign( unsigned ObjId ) { return (1 << (ObjId % 31)); }
static inline void * If_CutData( If_Cut_t * pCut ) { return *(void **)pCut; }
static inline void If_CutSetData( If_Cut_t * pCut, void * pData ) { *(void **)pCut = pData; }
......@@ -239,6 +243,7 @@ static inline float If_CutLutArea( If_Man_t * p, If_Cut_t * pCut ) { r
/*=== ifCore.c ==========================================================*/
extern int If_ManPerformMapping( If_Man_t * p );
extern int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fRequired );
/*=== ifMan.c ==========================================================*/
extern If_Man_t * If_ManStart( If_Par_t * pPars );
extern void If_ManStop( If_Man_t * p );
......@@ -247,6 +252,19 @@ extern If_Obj_t * If_ManCreatePo( If_Man_t * p, If_Obj_t * pDriver, int fCo
extern If_Obj_t * If_ManCreateAnd( If_Man_t * p, If_Obj_t * pFan0, int fCompl0, If_Obj_t * pFan1, int fCompl1 );
/*=== ifMap.c ==========================================================*/
extern void If_ObjPerformMapping( If_Man_t * p, If_Obj_t * pObj, int Mode );
extern float If_CutAreaDerefed( If_Man_t * p, If_Cut_t * pCut, int nLevels );
extern float If_CutAreaRefed( If_Man_t * p, If_Cut_t * pCut, int nLevels );
extern float If_CutDeref( If_Man_t * p, If_Cut_t * pCut, int nLevels );
extern float If_CutRef( If_Man_t * p, If_Cut_t * pCut, int nLevels );
extern void If_CutPrint( If_Man_t * p, If_Cut_t * pCut );
extern float If_CutDelay( If_Man_t * p, If_Cut_t * pCut );
extern float If_CutFlow( If_Man_t * p, If_Cut_t * pCut );
extern int If_CutMerge( If_Cut_t * pCut0, If_Cut_t * pCut1, If_Cut_t * pCut, int nLimit );
extern void If_CutCopy( If_Cut_t * pCutDest, If_Cut_t * pCutSrc );
/*=== ifReduce.c ==========================================================*/
extern void If_ManImproveMapping( If_Man_t * p );
/*=== ifSelect.c ==========================================================*/
extern void If_ManPerformMappingPreprocess( If_Man_t * p );
/*=== ifUtil.c ==========================================================*/
extern float If_ManDelayMax( If_Man_t * p );
extern void If_ManCleanNodeCopy( If_Man_t * p );
......
......@@ -24,8 +24,6 @@
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
static int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
......@@ -44,7 +42,7 @@ static int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode );
int If_ManPerformMapping( If_Man_t * p )
{
If_Obj_t * pObj;
int nItersFlow = 2;
int nItersFlow = 1;
int nItersArea = 1;
int clkTotal = clock();
int i;
......@@ -56,13 +54,27 @@ int If_ManPerformMapping( If_Man_t * p )
If_ManForEachPi( p, pObj, i )
pObj->EstRefs = (float)1.0;
// delay oriented mapping
If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0 );
if ( p->pPars->fPreprocess && !p->pPars->fArea && p->pPars->nCutsMax >= 4 )
If_ManPerformMappingPreprocess( p );
else
If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 1 );
// try to improve area by expanding and reducing the cuts
if ( p->pPars->fExpRed )
If_ManImproveMapping( p );
// area flow oriented mapping
for ( i = 0; i < nItersFlow; i++ )
If_ManPerformMappingRound( p, p->pPars->nCutsMax, 1 );
{
If_ManPerformMappingRound( p, p->pPars->nCutsMax, 1, 1 );
if ( p->pPars->fExpRed )
If_ManImproveMapping( p );
}
// area oriented mapping
for ( i = 0; i < nItersArea; i++ )
If_ManPerformMappingRound( p, p->pPars->nCutsMax, 2 );
{
If_ManPerformMappingRound( p, p->pPars->nCutsMax, 2, 1 );
if ( p->pPars->fExpRed )
If_ManImproveMapping( p );
}
if ( p->pPars->fVerbose )
{
PRT( "Total time", clock() - clkTotal );
......@@ -81,7 +93,7 @@ int If_ManPerformMapping( If_Man_t * p )
SeeAlso []
***********************************************************************/
int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode )
int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode, int fRequired )
{
If_Obj_t * pObj;
int i, clk = clock();
......@@ -94,15 +106,18 @@ int If_ManPerformMappingRound( If_Man_t * p, int nCutsUsed, int Mode )
If_ManForEachNode( p, pObj, i )
If_ObjPerformMapping( p, pObj, Mode );
// compute required times and stats
If_ManComputeRequired( p, Mode==0 );
if ( p->pPars->fVerbose )
if ( fRequired )
{
char Symb = (Mode == 0)? 'D' : ((Mode == 1)? 'F' : 'A');
printf( "%c: Del = %6.2f. Area = %8.2f. Cuts = %6d. Lim = %2d. Ave = %5.2f. ",
Symb, p->RequiredGlo, p->AreaGlo, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
PRT( "T", clock() - clk );
If_ManComputeRequired( p, Mode==0 );
if ( p->pPars->fVerbose )
{
char Symb = (Mode == 0)? 'D' : ((Mode == 1)? 'F' : 'A');
printf( "%c: Del = %6.2f. Area = %8.2f. Cuts = %6d. Lim = %2d. Ave = %5.2f. ",
Symb, p->RequiredGlo, p->AreaGlo, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
PRT( "T", clock() - clk );
// printf( "Max number of cuts = %d. Average number of cuts = %5.2f.\n",
// p->nCutsMax, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
}
}
return 1;
}
......
......@@ -191,6 +191,7 @@ If_Obj_t * If_ManCreateAnd( If_Man_t * p, If_Obj_t * pFan0, int fCompl0, If_Obj_
***********************************************************************/
If_Obj_t * If_ManSetupObj( If_Man_t * p )
{
If_Cut_t * pCut;
If_Obj_t * pObj;
int i, * pArrays;
// get memory for the object
......@@ -204,10 +205,12 @@ If_Obj_t * If_ManSetupObj( If_Man_t * p )
pObj->Id = Vec_PtrSize(p->vObjs);
Vec_PtrPush( p->vObjs, pObj );
// assign elementary cut
pCut = pObj->Cuts;
pCut->nLeaves = 1;
pCut->pLeaves[0] = p->pPars->fSeq? (pObj->Id << 8) : pObj->Id;
pCut->uSign = If_ObjCutSign( pCut->pLeaves[0] );
// set the number of cuts
pObj->nCuts = 1;
pObj->Cuts[0].nLeaves = 1;
pObj->Cuts[0].pLeaves[0] = pObj->Id;
pObj->iCut = 0;
// set the required times
pObj->Required = IF_FLOAT_LARGE;
return pObj;
......
/**CFile****************************************************************
FileName [ifSelect.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [FPGA mapping based on priority cuts.]
Synopsis [Selects what mapping to use.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - November 21, 2006.]
Revision [$Id: ifSelect.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $]
***********************************************************************/
#include "if.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
static void If_ManPerformMappingMoveBestCut( If_Man_t * p, int iPosNew, int iPosOld );
static void If_ManPerformMappingAdjust( If_Man_t * p, int nCuts );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Merges the results of delay, relaxed delay and area-based mapping.]
Description [Delay target may be different from minimum delay!!!]
SideEffects []
SeeAlso []
***********************************************************************/
void If_ManPerformMappingPreprocess( If_Man_t * p )
{
float delayArea, delayDelay, delayPure;
int clk = clock();
assert( p->pPars->nCutsMax >= 4 );
// perform min-area mapping and move the cut to the end
p->pPars->fArea = 1;
If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 0 );
p->pPars->fArea = 0;
delayArea = If_ManDelayMax( p );
if ( p->pPars->DelayTarget != -1 && delayArea < p->pPars->DelayTarget - p->fEpsilon )
delayArea = p->pPars->DelayTarget;
If_ManPerformMappingMoveBestCut( p, p->pPars->nCutsMax - 1, 1 );
// perfrom min-delay mapping and move the cut to the end
p->pPars->fFancy = 1;
If_ManPerformMappingRound( p, p->pPars->nCutsMax - 1, 0, 0 );
p->pPars->fFancy = 0;
delayDelay = If_ManDelayMax( p );
if ( p->pPars->DelayTarget != -1 && delayDelay < p->pPars->DelayTarget - p->fEpsilon )
delayDelay = p->pPars->DelayTarget;
If_ManPerformMappingMoveBestCut( p, p->pPars->nCutsMax - 2, 1 );
// perform min-area mapping
If_ManPerformMappingRound( p, p->pPars->nCutsMax - 2, 0, 0 );
delayPure = If_ManDelayMax( p );
if ( p->pPars->DelayTarget != -1 && delayPure < p->pPars->DelayTarget - p->fEpsilon )
delayPure = p->pPars->DelayTarget;
// decide what to do
if ( delayPure < delayDelay - p->fEpsilon && delayPure < delayArea - p->fEpsilon )
{
// copy the remaining two cuts
if ( p->pPars->nCutsMax > 4 )
{
If_ManPerformMappingMoveBestCut( p, 2, p->pPars->nCutsMax - 2 );
If_ManPerformMappingMoveBestCut( p, 3, p->pPars->nCutsMax - 1 );
}
If_ManComputeRequired( p, 1 );
If_ManPerformMappingAdjust( p, 4 );
}
else if ( delayDelay < delayArea - p->fEpsilon )
{
If_ManPerformMappingMoveBestCut( p, 1, p->pPars->nCutsMax - 2 );
If_ManPerformMappingMoveBestCut( p, 2, p->pPars->nCutsMax - 1 );
If_ManComputeRequired( p, 1 );
If_ManPerformMappingAdjust( p, 3 );
}
else
{
If_ManPerformMappingMoveBestCut( p, 1, p->pPars->nCutsMax - 1 );
If_ManComputeRequired( p, 1 );
If_ManPerformMappingAdjust( p, 2 );
}
If_ManComputeRequired( p, 1 );
if ( p->pPars->fVerbose )
{
printf( "S: Del = %6.2f. Area = %8.2f. Cuts = %6d. Lim = %2d. Ave = %5.2f. ",
p->RequiredGlo, p->AreaGlo, p->nCutsMerged, p->nCutsUsed, 1.0 * p->nCutsMerged / If_ManAndNum(p) );
PRT( "T", clock() - clk );
}
}
/**Function*************************************************************
Synopsis [Moves the best cut to the given position.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void If_ManPerformMappingMoveBestCut( If_Man_t * p, int iPosNew, int iPosOld )
{
If_Obj_t * pObj;
int i;
assert( iPosOld != iPosNew );
assert( iPosOld > 0 && iPosOld < p->pPars->nCutsMax );
assert( iPosNew > 0 && iPosNew < p->pPars->nCutsMax );
If_ManForEachNode( p, pObj, i )
If_CutCopy( pObj->Cuts + iPosNew, pObj->Cuts + iPosOld );
}
/**Function*************************************************************
Synopsis [Adjusts mapping for the given cuts.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void If_ManPerformMappingAdjust( If_Man_t * p, int nCuts )
{
If_Cut_t * pCut, * pCutBest;
If_Obj_t * pObj;
int i, c;
assert( nCuts >= 2 && nCuts <= 4 );
If_ManForEachNode( p, pObj, i )
{
pCutBest = NULL;
for ( c = 1; c < nCuts; c++ )
{
pCut = pObj->Cuts + c;
pCut->Delay = If_CutDelay( p, pCut );
pCut->Area = If_CutFlow( p, pCut );
assert( pCutBest || pCut->Delay < pObj->Required + p->fEpsilon );
if ( pCutBest == NULL ||
(pCut->Delay < pObj->Required + p->fEpsilon &&
pCut->Area < pCutBest->Area - p->fEpsilon) )
pCutBest = pCut;
}
assert( pCutBest != NULL );
// check if we need to move
if ( pCutBest != pObj->Cuts + 1 )
If_CutCopy( pObj->Cuts + 1, pCutBest );
// set the number of cuts
pObj->nCuts = 2;
}
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
/**CFile****************************************************************
FileName [ifSeq.c]
SystemName [ABC: Logic synthesis and verification system.]
PackageName [FPGA mapping based on priority cuts.]
Synopsis [Sequential mapping.]
Author [Alan Mishchenko]
Affiliation [UC Berkeley]
Date [Ver. 1.0. Started - November 21, 2006.]
Revision [$Id: ifSeq.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $]
***********************************************************************/
#include "if.h"
////////////////////////////////////////////////////////////////////////
/// DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
static void If_ObjPerformMappingLI( If_Man_t * p, If_Obj_t * pLatch );
static void If_ObjPerformMappingLO( If_Man_t * p, If_Obj_t * pLatch, If_Obj_t * pObj );
static int If_ManMappingSeqConverged( If_Man_t * p );
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
/**Function*************************************************************
Synopsis [Performs sequential mapping.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int If_ManPerformMappingSeq( If_Man_t * p )
{
If_Obj_t * pObj, * pLatch;
int i, clkTotal = clock();
// set the number of cuts used
p->nCutsUsed = p->pPars->nCutsMax;
// 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
p->pPars->fFancy = 1;
If_ManPerformMappingRound( p, p->pPars->nCutsMax, 0, 0 );
p->pPars->fFancy = 0;
// perform iterations over the circuit
while ( !If_ManMappingSeqConverged( p ) )
{
// assign cuts to latches
If_ManForEachLatch( p, pLatch, i )
If_ObjPerformMappingLI( p, pLatch );
// assign cuts to primary inputs
If_ManForEachLatch( p, pLatch, i )
If_ObjPerformMappingLO( p, pLatch, If_ManPi(p, If_ManPiNum(p) - If_ManPoNum(p) + i) );
// map the nodes
If_ManForEachNode( p, pObj, i )
If_ObjPerformMapping( p, pObj, 0 );
}
if ( p->pPars->fVerbose )
{
PRT( "Total time", clock() - clkTotal );
}
return 1;
}
/**Function*************************************************************
Synopsis [Performs sequential mapping.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void If_CutLift( If_Cut_t * pCut )
{
int i;
for ( i = 0; i < pCut->nLeaves; i++ )
pCut->pLeaves[i] = ((pCut->pLeaves[i] >> 8) << 8) | ((pCut->pLeaves[i] & 255) + 1);
}
/**Function*************************************************************
Synopsis [Performs sequential mapping.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void If_ObjPerformMappingLI( If_Man_t * p, If_Obj_t * pLatch )
{
If_Obj_t * pFanin;
int c;
assert( If_ObjIsPo(pLatch) );
pFanin = If_ObjFanin0(pLatch);
for ( c = 0; c < pFanin->nCuts; c++ )
If_CutCopy( pLatch->Cuts + c, pFanin->Cuts + c );
}
/**Function*************************************************************
Synopsis [Performs sequential mapping.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
void If_ObjPerformMappingLO( If_Man_t * p, If_Obj_t * pLatch, If_Obj_t * pObj )
{
If_Cut_t * pCut;
int c, Limit = IF_MIN( p->nCuts + 1, p->nCutsUsed );
assert( If_ObjIsPo(pLatch) );
for ( c = 1; c < Limit; c++ )
{
pCut = pObj->Cuts + c;
If_CutCopy( pCut, pLatch->Cuts + c - 1 );
If_CutLift( pCut );
pCut->Delay -= p->Fi;
}
}
/**Function*************************************************************
Synopsis [Performs sequential mapping.]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
int If_ManMappingSeqConverged( If_Man_t * p )
{
return 0;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////
SRC += src/map/if/ifCore.c \
src/map/if/ifCut.c \
src/map/if/ifMan.c \
src/map/if/ifMap.c \
src/map/if/ifReduce.c \
src/map/if/ifSelect.c \
src/map/if/ifSeq.c \
src/map/if/ifUtil.c
......@@ -64,7 +64,8 @@ void Prove_ParamsSetDefault( Prove_Params_t * pParams )
pParams->nBddSizeLimit = 1000000; // the number of BDD nodes when construction is aborted
pParams->fBddReorder = 1; // enables dynamic BDD variable reordering
// last-gasp mitering
pParams->nMiteringLimitLast = 1000000; // final mitering limit
// pParams->nMiteringLimitLast = 1000000; // final mitering limit
pParams->nMiteringLimitLast = 0; // final mitering limit
// global SAT solver limits
pParams->nTotalBacktrackLimit = 0; // global limit on the number of backtracks
pParams->nTotalInspectLimit = 0; // global limit on the number of clause inspects
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment