summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--abclib.dsp4
-rw-r--r--src/map/if/if.h1
-rw-r--r--src/map/if/ifCache.c121
-rw-r--r--src/map/if/ifDsd.c2
-rw-r--r--src/map/if/ifMan.c4
-rw-r--r--src/map/if/ifMap.c2
-rw-r--r--src/map/if/module.make1
7 files changed, 134 insertions, 1 deletions
diff --git a/abclib.dsp b/abclib.dsp
index cfdfb1be..ace73806 100644
--- a/abclib.dsp
+++ b/abclib.dsp
@@ -2303,6 +2303,10 @@ SOURCE=.\src\map\if\if.h
# End Source File
# Begin Source File
+SOURCE=.\src\map\if\ifCache.c
+# End Source File
+# Begin Source File
+
SOURCE=.\src\map\if\ifCom.c
# End Source File
# Begin Source File
diff --git a/src/map/if/if.h b/src/map/if/if.h
index 20d5b643..591361ba 100644
--- a/src/map/if/if.h
+++ b/src/map/if/if.h
@@ -237,6 +237,7 @@ struct If_Man_t_
Vec_Str_t * vTtPerms; // mapping of truth table into permutations
int nBestCutSmall[2];
int nCountNonDec[2];
+ Vec_Int_t * vCutData; // cut data storage
// timing manager
Tim_Man_t * pManTim;
diff --git a/src/map/if/ifCache.c b/src/map/if/ifCache.c
new file mode 100644
index 00000000..231e495c
--- /dev/null
+++ b/src/map/if/ifCache.c
@@ -0,0 +1,121 @@
+/**CFile****************************************************************
+
+ FileName [ifCache.c]
+
+ SystemName [ABC: Logic synthesis and verification system.]
+
+ PackageName [FPGA mapping based on priority cuts.]
+
+ Synopsis []
+
+ Author [Alan Mishchenko]
+
+ Affiliation [UC Berkeley]
+
+ Date [Ver. 1.0. Started - November 21, 2006.]
+
+ Revision [$Id: ifCache.c,v 1.00 2006/11/21 00:00:00 alanmi Exp $]
+
+***********************************************************************/
+
+#include "if.h"
+#include "misc/vec/vecHsh.h"
+
+ABC_NAMESPACE_IMPL_START
+
+////////////////////////////////////////////////////////////////////////
+/// DECLARATIONS ///
+////////////////////////////////////////////////////////////////////////
+
+////////////////////////////////////////////////////////////////////////
+/// FUNCTION DEFINITIONS ///
+////////////////////////////////////////////////////////////////////////
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void If_ManCacheRecord( If_Man_t * p, int iDsd0, int iDsd1, int nShared, int iDsd )
+{
+ if ( p->vCutData == NULL )
+ p->vCutData = Vec_IntAlloc( 10000 );
+ if ( iDsd0 > iDsd1 )
+ ABC_SWAP( int, iDsd0, iDsd1 );
+ Vec_IntPush( p->vCutData, iDsd0 );
+ Vec_IntPush( p->vCutData, iDsd1 );
+ Vec_IntPush( p->vCutData, nShared );
+ Vec_IntPush( p->vCutData, iDsd );
+// printf( "%6d %6d %6d %6d\n", iDsd0, iDsd1, nShared, iDsd );
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline int Vec_IntCountUnique( Vec_Int_t * p )
+{
+ int i, Count = 0, Max = Vec_IntFindMax(p);
+ unsigned char * pPres = ABC_CALLOC( unsigned char, Max+1 );
+ for ( i = 0; i < p->nSize; i++ )
+ if ( pPres[p->pArray[i]] == 0 )
+ pPres[p->pArray[i]] = 1, Count++;
+ ABC_FREE( pPres );
+ return Count;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+void If_ManCacheAnalize( If_Man_t * p )
+{
+ Vec_Int_t * vRes, * vTest[32];
+ int i, Entry, uUnique;
+ vRes = Hsh_IntManHashArray( p->vCutData, 4 );
+ for ( i = 0; i <= p->pPars->nLutSize; i++ )
+ vTest[i] = Vec_IntAlloc( 1000 );
+ Vec_IntForEachEntry( vRes, Entry, i )
+ Vec_IntPush( vTest[Vec_IntEntry(p->vCutData, 4*i+2)], Entry );
+ for ( i = 0; i <= p->pPars->nLutSize; i++ )
+ {
+ uUnique = Vec_IntCountUnique(vTest[i]);
+ printf( "%2d-var entries = %8d. (%6.2f %%) Unique entries = %8d. (%6.2f %%)\n",
+ i, Vec_IntSize(vTest[i]), 100.0*Vec_IntSize(vTest[i])/Vec_IntSize(vRes),
+ uUnique, 100.0*uUnique/Vec_IntSize(vTest[i]) );
+ }
+ for ( i = 0; i <= p->pPars->nLutSize; i++ )
+ Vec_IntFree( vTest[i] );
+ uUnique = Vec_IntCountUnique(vRes);
+ printf( "Total entries = %8d. (%6.2f %%) Unique entries = %8d. (%6.2f %%)\n",
+ Vec_IntSize(p->vCutData)/4, 100.0, uUnique, 100.0*uUnique/(Vec_IntSize(p->vCutData)/4) );
+ Vec_IntFree( vRes );
+}
+
+////////////////////////////////////////////////////////////////////////
+/// END OF FILE ///
+////////////////////////////////////////////////////////////////////////
+
+
+ABC_NAMESPACE_IMPL_END
+
diff --git a/src/map/if/ifDsd.c b/src/map/if/ifDsd.c
index 1b3dc0f2..fc1944f6 100644
--- a/src/map/if/ifDsd.c
+++ b/src/map/if/ifDsd.c
@@ -781,7 +781,7 @@ abctime clk;
if ( *pSpot )
return (int)*pSpot;
clk = Abc_Clock();
- if ( truthId >= 0 && truthId == Vec_PtrSize(p->vTtDecs) )
+ if ( p->LutSize && truthId >= 0 && truthId == Vec_PtrSize(p->vTtDecs) )
{
Vec_Int_t * vSets = Dau_DecFindSets_int( pTruth, nLits, p->pSched );
// printf( "%d ", Vec_IntSize(vSets) );
diff --git a/src/map/if/ifMan.c b/src/map/if/ifMan.c
index 686af7ae..a822f0bb 100644
--- a/src/map/if/ifMan.c
+++ b/src/map/if/ifMan.c
@@ -141,6 +141,9 @@ void If_ManRestart( If_Man_t * p )
***********************************************************************/
void If_ManStop( If_Man_t * p )
{
+ extern void If_ManCacheAnalize( If_Man_t * p );
+ if ( p->pPars->fVerbose && p->vCutData )
+ If_ManCacheAnalize( p );
/*
if ( p->pIfDsdMan )
{
@@ -190,6 +193,7 @@ void If_ManStop( If_Man_t * p )
Vec_IntFreeP( &p->vLags );
Vec_IntFreeP( &p->vTtDsds );
Vec_StrFreeP( &p->vTtPerms );
+ Vec_IntFreeP( &p->vCutData );
Vec_MemHashFree( p->vTtMem );
Vec_MemFreeP( &p->vTtMem );
Mem_FixedStop( p->pMemObj, 0 );
diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c
index 5a2cd99d..fe4b146b 100644
--- a/src/map/if/ifMap.c
+++ b/src/map/if/ifMap.c
@@ -219,6 +219,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
// p->timeTruth += Abc_Clock() - clk;
if ( p->pPars->fUseDsd )
{
+ extern void If_ManCacheRecord( If_Man_t * p, int iDsd0, int iDsd1, int nShared, int iDsd );
int truthId = Abc_Lit2Var(pCut->iCutFunc);
if ( Vec_IntSize(p->vTtDsds) <= truthId || Vec_IntEntry(p->vTtDsds, truthId) == -1 )
{
@@ -239,6 +240,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
for ( v = 0; v < (int)pCut->nLeaves; v++ )
pCut->pPerm[v] = (unsigned char)Vec_StrEntry( p->vTtPerms, truthId * p->pPars->nLutSize + v );
}
+ If_ManCacheRecord( p, pCut0->iCutDsd, pCut1->iCutDsd, p->nShared, pCut->iCutDsd );
}
// run user functions
pCut->fUseless = 0;
diff --git a/src/map/if/module.make b/src/map/if/module.make
index 5311fb5f..8518406d 100644
--- a/src/map/if/module.make
+++ b/src/map/if/module.make
@@ -1,4 +1,5 @@
SRC += src/map/if/ifCom.c \
+ src/map/if/ifCache.c \
src/map/if/ifCore.c \
src/map/if/ifCut.c \
src/map/if/ifDec07.c \