summaryrefslogtreecommitdiffstats
path: root/src/map
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2009-03-10 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2009-03-10 08:01:00 -0700
commit32314347bae6ddcd841a268e797ec4da45726abb (patch)
treee2e5fd1711f04a06d0da2b8003bc02cb9a5dd446 /src/map
parentc03f9b516bed2c06ec2bfc78617eba5fc9a11c32 (diff)
downloadabc-32314347bae6ddcd841a268e797ec4da45726abb.tar.gz
abc-32314347bae6ddcd841a268e797ec4da45726abb.tar.bz2
abc-32314347bae6ddcd841a268e797ec4da45726abb.zip
Version abc90310
Diffstat (limited to 'src/map')
-rw-r--r--src/map/amap/amapLiberty.c33
-rw-r--r--src/map/amap/amapParse.c10
-rw-r--r--src/map/if/ifCore.c9
-rw-r--r--src/map/if/ifMap.c4
-rw-r--r--src/map/if/ifSeq.c71
-rw-r--r--src/map/if/module.make1
-rw-r--r--src/map/mio/mio81214.zipbin16939 -> 0 bytes
7 files changed, 65 insertions, 63 deletions
diff --git a/src/map/amap/amapLiberty.c b/src/map/amap/amapLiberty.c
index 7f46ffdf..4177e27e 100644
--- a/src/map/amap/amapLiberty.c
+++ b/src/map/amap/amapLiberty.c
@@ -346,6 +346,7 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName )
{
FILE * pFile;
Amap_Item_t * pCell, * pArea, * pFunc, * pPin, * pOutput;
+ char * pForm;
int Counter;
if ( pFileName == NULL )
pFile = stdout;
@@ -408,6 +409,12 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName )
}
pOutput = Amap_LibertyCellOutput( p, pCell );
pFunc = Amap_LibertyPinFunction( p, pOutput );
+ pForm = Amap_LibertyGetStringFormula( p, pFunc->Head );
+ if ( !strcmp(pForm, "0") || !strcmp(pForm, "1") )
+ {
+ printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" with constant formula \"%s\".\n", Amap_LibertyGetString(p, pCell->Head), pForm );
+ continue;
+ }
fprintf( pFile, "GATE " );
fprintf( pFile, "%16s ", Amap_LibertyGetString(p, pCell->Head) );
@@ -542,13 +549,17 @@ static inline int Amap_LibertyCharIsSpace( char c )
SeeAlso []
***********************************************************************/
-static inline int Amap_LibertySkipSpaces( Amap_Tree_t * p, char ** ppPos, char * pEnd )
+static inline int Amap_LibertySkipSpaces( Amap_Tree_t * p, char ** ppPos, char * pEnd, int fStopAtNewLine )
{
char * pPos = *ppPos;
for ( ; pPos < pEnd; pPos++ )
{
if ( *pPos == '\n' )
+ {
p->nLines++;
+ if ( fStopAtNewLine )
+ break;
+ }
if ( !Amap_LibertyCharIsSpace(*pPos) )
break;
}
@@ -582,9 +593,9 @@ static inline int Amap_LibertySkipEntry( char ** ppPos, char * pEnd )
else
{
for ( ; pPos < pEnd; pPos++ )
- if ( *pPos == ' ' ||
- *pPos == ':' || *pPos == ';' ||
- *pPos == '(' || *pPos == ')' ||
+ if ( *pPos == ' ' || *pPos == '\r' || *pPos == '\n' ||
+ *pPos == ':' || *pPos == ';' ||
+ *pPos == '(' || *pPos == ')' ||
*pPos == '{' || *pPos == '}' )
break;
}
@@ -708,28 +719,28 @@ int Amap_LibertyBuildItem( Amap_Tree_t * p, char ** ppPos, char * pEnd )
Amap_Item_t * pItem;
Amap_Pair_t Key, Head, Body;
char * pNext, * pStop;
- if ( Amap_LibertySkipSpaces( p, ppPos, pEnd ) )
+ if ( Amap_LibertySkipSpaces( p, ppPos, pEnd, 0 ) )
return -2;
Key.Beg = *ppPos - p->pContents;
if ( Amap_LibertySkipEntry( ppPos, pEnd ) )
goto exit;
Key.End = *ppPos - p->pContents;
- if ( Amap_LibertySkipSpaces( p, ppPos, pEnd ) )
+ if ( Amap_LibertySkipSpaces( p, ppPos, pEnd, 0 ) )
goto exit;
pNext = *ppPos;
if ( *pNext == ':' )
{
*ppPos = pNext + 1;
- if ( Amap_LibertySkipSpaces( p, ppPos, pEnd ) )
+ if ( Amap_LibertySkipSpaces( p, ppPos, pEnd, 0 ) )
goto exit;
Head.Beg = *ppPos - p->pContents;
if ( Amap_LibertySkipEntry( ppPos, pEnd ) )
goto exit;
Head.End = *ppPos - p->pContents;
- if ( Amap_LibertySkipSpaces( p, ppPos, pEnd ) )
+ if ( Amap_LibertySkipSpaces( p, ppPos, pEnd, 1 ) )
goto exit;
pNext = *ppPos;
- if ( *pNext != ';' )
+ if ( *pNext != ';' && *pNext != '\n' )
goto exit;
*ppPos = pNext + 1;
// end of equation
@@ -747,7 +758,7 @@ int Amap_LibertyBuildItem( Amap_Tree_t * p, char ** ppPos, char * pEnd )
Head.Beg = pNext - p->pContents + 1;
Head.End = pStop - p->pContents;
*ppPos = pStop + 1;
- if ( Amap_LibertySkipSpaces( p, ppPos, pEnd ) )
+ if ( Amap_LibertySkipSpaces( p, ppPos, pEnd, 0 ) )
{
// end of list
pItem = Amap_LibertyNewItem( p, AMAP_LIBERTY_LIST );
@@ -883,7 +894,7 @@ int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose )
{
if ( fVerbose )
printf( "Parsing finished successfully.\n" );
-// Amap_LibertyPrintLiberty( p, "temp.lib" );
+// Amap_LibertyPrintLiberty( p, "temp_.lib" );
Amap_LibertyPrintGenlib( p, "temp.genlib" );
RetValue = 1;
}
diff --git a/src/map/amap/amapParse.c b/src/map/amap/amapParse.c
index 48dabca2..bfa8e6a5 100644
--- a/src/map/amap/amapParse.c
+++ b/src/map/amap/amapParse.c
@@ -35,6 +35,7 @@
#define AMAP_EQN_SYM_AND '*' // logic AND
#define AMAP_EQN_SYM_XOR '^' // logic XOR
#define AMAP_EQN_SYM_OR '+' // logic OR
+#define AMAP_EQN_SYM_OR2 '|' // logic OR
// the list of opcodes (also specifying operation precedence)
#define AMAP_EQN_OPER_NEG 10 // negation
@@ -180,6 +181,7 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
break;
case AMAP_EQN_SYM_AND:
case AMAP_EQN_SYM_OR:
+ case AMAP_EQN_SYM_OR2:
case AMAP_EQN_SYM_XOR:
if ( Flag != AMAP_EQN_FLAG_VAR )
{
@@ -189,7 +191,7 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
}
if ( *pTemp == AMAP_EQN_SYM_AND )
Vec_IntPush( pStackOp, AMAP_EQN_OPER_AND );
- else if ( *pTemp == AMAP_EQN_SYM_OR )
+ else if ( *pTemp == AMAP_EQN_SYM_OR || *pTemp == AMAP_EQN_SYM_OR2 )
Vec_IntPush( pStackOp, AMAP_EQN_OPER_OR );
else //if ( *pTemp == AMAP_EQN_SYM_XOR )
Vec_IntPush( pStackOp, AMAP_EQN_OPER_XOR );
@@ -246,9 +248,9 @@ Hop_Obj_t * Amap_ParseFormula( FILE * pOutput, char * pFormInit, Vec_Ptr_t * vVa
// scan the next name
for ( i = 0; pTemp[i] &&
pTemp[i] != ' ' && pTemp[i] != '\t' && pTemp[i] != '\r' && pTemp[i] != '\n' &&
- pTemp[i] != AMAP_EQN_SYM_AND && pTemp[i] != AMAP_EQN_SYM_OR &&
- pTemp[i] != AMAP_EQN_SYM_XOR && pTemp[i] != AMAP_EQN_SYM_NEGAFT &&
- pTemp[i] != AMAP_EQN_SYM_CLOSE; i++ )
+ pTemp[i] != AMAP_EQN_SYM_AND && pTemp[i] != AMAP_EQN_SYM_OR && pTemp[i] != AMAP_EQN_SYM_OR2 &&
+ pTemp[i] != AMAP_EQN_SYM_XOR && pTemp[i] != AMAP_EQN_SYM_NEGAFT && pTemp[i] != AMAP_EQN_SYM_CLOSE;
+ i++ )
{
if ( pTemp[i] == AMAP_EQN_SYM_NEG || pTemp[i] == AMAP_EQN_SYM_OPEN )
{
diff --git a/src/map/if/ifCore.c b/src/map/if/ifCore.c
index 0f0ca002..e3fd47f1 100644
--- a/src/map/if/ifCore.c
+++ b/src/map/if/ifCore.c
@@ -55,13 +55,10 @@ int If_ManPerformMapping( If_Man_t * p )
// try sequential mapping
if ( p->pPars->fSeqMap )
{
- int RetValue = 1;
- printf( "Currently sequential mapping is not performed.\n" );
-// RetValue = If_ManPerformMappingSeq( p );
- return RetValue;
-// return 1;
+// if ( p->pPars->fVerbose )
+ printf( "Performing sequential mapping without retiming.\n" );
+ return If_ManPerformMappingSeq( p );
}
-
return If_ManPerformMappingComb( p );
}
diff --git a/src/map/if/ifMap.c b/src/map/if/ifMap.c
index 2879081c..fd1078a6 100644
--- a/src/map/if/ifMap.c
+++ b/src/map/if/ifMap.c
@@ -169,7 +169,7 @@ void If_ObjPerformMappingAnd( If_Man_t * p, If_Obj_t * pObj, int Mode, int fPrep
If_ObjForEachCut( pObj, pCut, i )
p->pPars->pFuncUser( p, pObj, pCut );
- // ABC_FREE the cuts
+ // free the cuts
If_ManDerefNodeCutSet( p, pObj );
}
@@ -253,7 +253,7 @@ void If_ObjPerformMappingChoice( If_Man_t * p, If_Obj_t * pObj, int Mode, int fP
if ( Mode && pObj->nRefs > 0 )
If_CutAreaRef( p, If_ObjCutBest(pObj) );
- // ABC_FREE the cuts
+ // free the cuts
If_ManDerefChoiceCutSet( p, pObj );
}
diff --git a/src/map/if/ifSeq.c b/src/map/if/ifSeq.c
index 8d1de8c1..e4e27e71 100644
--- a/src/map/if/ifSeq.c
+++ b/src/map/if/ifSeq.c
@@ -124,6 +124,16 @@ int If_ManPerformMappingRoundSeq( If_Man_t * p, int nIter )
int fVeryVerbose = 0;
int fChange = 0;
+ if ( nIter == 1 )
+ {
+ // if some latches depend on PIs, update their values
+ Vec_PtrForEachEntry( p->vLatchOrder, pObj, i )
+ {
+ If_ObjSetLValue( pObj, If_ObjLValue(If_ObjFanin0(pObj)) - p->Period );
+ If_ObjSetArrTime( pObj, If_ObjLValue(pObj) );
+ }
+ }
+
// map the internal nodes
p->nCutsMerged = 0;
If_ManForEachNode( p, pObj, i )
@@ -158,13 +168,14 @@ int If_ManPerformMappingRoundSeq( If_Man_t * p, int nIter )
}
// compute area and delay
+ If_ManMarkMapping( p );
if ( fVeryVerbose )
{
p->RequiredGlo = If_ManDelayMax( p, 1 );
- p->AreaGlo = If_ManScanMapping(p);
+// p->AreaGlo = If_ManScanMapping(p);
printf( "S%d: Fi = %6.2f. Del = %6.2f. Area = %8.2f. Cuts = %8d. ",
nIter, (float)p->Period, p->RequiredGlo, p->AreaGlo, p->nCutsMerged );
- PRT( "T", clock() - clk );
+ ABC_PRT( "T", clock() - clk );
}
return fChange;
}
@@ -185,26 +196,26 @@ int If_ManBinarySearchPeriod( If_Man_t * p )
If_Obj_t * pObj;
int i, c, fConverged;
int fResetRefs = 0;
-
p->nAttempts++;
// reset initial LValues (PIs to 0; others to -inf)
If_ManForEachObj( p, pObj, i )
{
- if ( If_ObjIsPi(pObj) || If_ObjIsConst1(pObj) )
- {
- If_ObjSetLValue( pObj, (float)0.0 );
- If_ObjSetArrTime( pObj, (float)0.0 );
- }
- else
- {
- If_ObjSetLValue( pObj, (float)-IF_INFINITY );
- If_ObjSetArrTime( pObj, (float)-IF_INFINITY );
- }
+ If_ObjSetLValue( pObj, (float)-IF_INFINITY );
+ If_ObjSetArrTime( pObj, (float)-IF_INFINITY );
// undo any previous mapping, except for CIs
if ( If_ObjIsAnd(pObj) )
If_ObjCutBest(pObj)->nLeaves = 0;
}
+ pObj = If_ManConst1( p );
+ If_ObjSetLValue( pObj, (float)0.0 );
+ If_ObjSetArrTime( pObj, (float)0.0 );
+ If_ManForEachPi( p, pObj, i )
+ {
+ pObj = If_ManCi( p, i );
+ If_ObjSetLValue( pObj, (float)0.0 );
+ If_ObjSetArrTime( pObj, (float)0.0 );
+ }
// update all values iteratively
fConverged = 0;
@@ -223,9 +234,10 @@ int If_ManBinarySearchPeriod( If_Man_t * p )
}
// report the results
+ If_ManMarkMapping( p );
if ( p->pPars->fVerbose )
{
- p->AreaGlo = If_ManScanMapping(p);
+// p->AreaGlo = If_ManScanMapping(p);
printf( "Attempt = %2d. Iters = %3d. Area = %10.2f. Fi = %6.2f. ", p->nAttempts, c, p->AreaGlo, (float)p->Period );
if ( fConverged )
printf( " Feasible" );
@@ -279,15 +291,6 @@ void If_ManPerformMappingSeqPost( If_Man_t * p )
If_Obj_t * pObjLi, * pObjLo, * pObj;
int i;
- // link the latch outputs (CIs) directly to the drivers of latch inputs (COs)
- for ( i = 0; i < p->pPars->nLatches; i++ )
- {
- pObjLi = If_ManLi( p, i );
- pObjLo = If_ManLo( p, i );
-// printf( "%3d : %2d -> %2d \n", i,
-// (int)If_ObjLValue(If_ObjFanin0(pObjLo)), (int)If_ObjLValue(pObjLo) );
- }
-
// set arrival times
assert( p->pPars->pTimesArr != NULL );
If_ManForEachLatchOutput( p, pObjLo, i )
@@ -295,7 +298,7 @@ void If_ManPerformMappingSeqPost( If_Man_t * p )
// set the required times
assert( p->pPars->pTimesReq == NULL );
- p->pPars->pTimesReq = ALLOC( float, If_ManCoNum(p) );
+ p->pPars->pTimesReq = ABC_ALLOC( float, If_ManCoNum(p) );
If_ManForEachPo( p, pObj, i )
{
p->pPars->pTimesReq[i] = p->RequiredGlo2;
@@ -338,7 +341,7 @@ int If_ManPerformMappingSeq( If_Man_t * p )
// perform combinational mapping to get the upper bound on the clock period
If_ManPerformMappingRound( p, 1, 0, 0, NULL );
- p->RequiredGlo = If_ManDelayMax( p, 0 );
+ p->RequiredGlo = If_ManDelayMax( p, 0 );
p->RequiredGlo2 = p->RequiredGlo;
// set direct linking of latches with their inputs
@@ -373,24 +376,12 @@ int If_ManPerformMappingSeq( If_Man_t * p )
return 0;
}
}
- if ( p->pPars->fVerbose )
+// if ( p->pPars->fVerbose )
{
-/*
- {
- FILE * pTable;
- pTable = fopen( "iscas/stats_new.txt", "a+" );
-// fprintf( pTable, "%s ", pNtk->pName );
- fprintf( pTable, "%d ", p->Period );
- // fprintf( pTable, "%.2f ", (float)(s_MappingMem)/(float)(1<<20) );
-// fprintf( pTable, "%.2f", (float)(s_MappingTime)/(float)(CLOCKS_PER_SEC) );
-// fprintf( pTable, "\n" );
- fclose( pTable );
- }
-*/
printf( "The best clock period is %3d. ", p->Period );
- PRT( "Sequential time", clock() - clkTotal );
+ ABC_PRT( "Time", clock() - clkTotal );
}
- p->RequiredGlo = (float)PeriodBest;
+ p->RequiredGlo = (float)(PeriodBest);
// postprocess it using combinational mapping
If_ManPerformMappingSeqPost( p );
diff --git a/src/map/if/module.make b/src/map/if/module.make
index 7489d3b4..53ed7c03 100644
--- a/src/map/if/module.make
+++ b/src/map/if/module.make
@@ -4,6 +4,7 @@ SRC += src/map/if/ifCore.c \
src/map/if/ifMan.c \
src/map/if/ifMap.c \
src/map/if/ifReduce.c \
+ src/map/if/ifSeq.c \
src/map/if/ifTime.c \
src/map/if/ifTruth.c \
src/map/if/ifUtil.c
diff --git a/src/map/mio/mio81214.zip b/src/map/mio/mio81214.zip
deleted file mode 100644
index 12f766a9..00000000
--- a/src/map/mio/mio81214.zip
+++ /dev/null
Binary files differ