summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-09-08 19:53:49 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-09-08 19:53:49 -0700
commit97751e43b71792ded1947d98945e1e832325be6d (patch)
tree2b88dea48591c73d70bc4172f449de9a6b77bd5b /src
parentf623b04da47aaa2810c06b880f85354becef288e (diff)
downloadabc-97751e43b71792ded1947d98945e1e832325be6d.tar.gz
abc-97751e43b71792ded1947d98945e1e832325be6d.tar.bz2
abc-97751e43b71792ded1947d98945e1e832325be6d.zip
New constraint manager and memory reporting 'ps'.
Diffstat (limited to 'src')
-rw-r--r--src/aig/gia/giaMan.c7
-rw-r--r--src/aig/gia/giaNf.c29
-rw-r--r--src/base/abc/abc.h2
-rw-r--r--src/base/abc/abcHie.c2
-rw-r--r--src/base/abc/abcNames.c44
-rw-r--r--src/base/abci/abc.c14
-rw-r--r--src/base/abci/abcMini.c2
-rw-r--r--src/base/abci/abcPrint.c34
-rw-r--r--src/base/main/mainInt.h1
-rw-r--r--src/map/mapper/mapperMatch.c13
-rw-r--r--src/map/mapper/mapperTime.c38
-rw-r--r--src/map/scl/scl.c92
-rw-r--r--src/map/scl/sclCon.h289
-rw-r--r--src/map/scl/sclUtil.c9
-rw-r--r--src/misc/vec/vecPtr.h12
15 files changed, 550 insertions, 38 deletions
diff --git a/src/aig/gia/giaMan.c b/src/aig/gia/giaMan.c
index c4da925e..f88feb8d 100644
--- a/src/aig/gia/giaMan.c
+++ b/src/aig/gia/giaMan.c
@@ -163,6 +163,13 @@ double Gia_ManMemory( Gia_Man_t * p )
Memory += sizeof(int) * Gia_ManCoNum(p);
Memory += sizeof(int) * p->nHTable * (p->pHTable != NULL);
Memory += sizeof(int) * Gia_ManObjNum(p) * (p->pRefs != NULL);
+ Memory += Vec_IntMemory( p->vLevels );
+ Memory += Vec_IntMemory( p->vCellMapping );
+ Memory += Vec_IntMemory( &p->vCopies );
+ Memory += Vec_FltMemory( p->vInArrs );
+ Memory += Vec_FltMemory( p->vOutReqs );
+ Memory += Vec_PtrMemory( p->vNamesIn );
+ Memory += Vec_PtrMemory( p->vNamesOut );
return Memory;
}
diff --git a/src/aig/gia/giaNf.c b/src/aig/gia/giaNf.c
index 668c75f1..0ea2ec89 100644
--- a/src/aig/gia/giaNf.c
+++ b/src/aig/gia/giaNf.c
@@ -28,6 +28,8 @@
#include "misc/vec/vecMem.h"
#include "misc/vec/vecWec.h"
#include "opt/dau/dau.h"
+#include "misc/util/utilNam.h"
+#include "map/scl/sclCon.h"
ABC_NAMESPACE_IMPL_START
@@ -110,6 +112,8 @@ struct Nf_Man_t_
static inline int Pf_Mat2Int( Pf_Mat_t Mat ) { union { int x; Pf_Mat_t y; } v; v.y = Mat; return v.x; }
static inline Pf_Mat_t Pf_Int2Mat( int Int ) { union { int x; Pf_Mat_t y; } v; v.x = Int; return v.y; }
+
+static inline word Nf_Flt2Wrd( float w ) { return MIO_NUMINV*w; }
static inline float Nf_Wrd2Flt( word w ) { return MIO_NUMINV*(unsigned)(w&0x3FFFFFFF) + MIO_NUMINV*(1<<30)*(unsigned)(w>>30); }
static inline Nf_Obj_t * Nf_ManObj( Nf_Man_t * p, int i ) { return p->pNfObjs + i; }
@@ -1396,6 +1400,7 @@ void Nf_ManSetOutputRequireds( Nf_Man_t * p, int fPropCompl )
{
Gia_Obj_t * pObj;
word Required = 0;
+ int fUseConMan = Scl_ConIsRunning() && Scl_ConHasOutReqs();
int i, iObj, fCompl, nLits = 2*Gia_ManObjNum(p->pGia);
Vec_WrdFill( &p->vRequired, nLits, NF_INFINITY );
// compute delay
@@ -1424,8 +1429,16 @@ void Nf_ManSetOutputRequireds( Nf_Man_t * p, int fPropCompl )
Required = Nf_ObjMatchD(p, iObj, fCompl)->D;
Required = p->pPars->fDoAverage ? Required * (100 + p->pPars->nRelaxRatio) / 100 : p->pPars->WordMapDelay;
// if external required time can be achieved, use it
- if ( p->pGia->vOutReqs && Vec_FltEntry(p->pGia->vOutReqs, i) > 0 && Required <= (word)(MIO_NUM * Vec_FltEntry(p->pGia->vOutReqs, i)) )
- Required = (word)(MIO_NUM * Vec_FltEntry(p->pGia->vOutReqs, i));
+ if ( fUseConMan )
+ {
+ if ( Scl_ConGetOutReq(i) > 0 && Required <= Scl_ConGetOutReq(i) )
+ Required = Scl_ConGetOutReq(i);
+ }
+ else
+ {
+ if ( p->pGia->vOutReqs && Vec_FltEntry(p->pGia->vOutReqs, i) > 0 && Required <= Nf_Flt2Wrd(Vec_FltEntry(p->pGia->vOutReqs, i)) )
+ Required = Nf_Flt2Wrd(Vec_FltEntry(p->pGia->vOutReqs, i));
+ }
// if external required cannot be achieved, set the earliest possible arrival time
// else if ( p->pGia->vOutReqs && Vec_FltEntry(p->pGia->vOutReqs, i) > 0 && Required > Vec_FltEntry(p->pGia->vOutReqs, i) )
// ptTime->Rise = ptTime->Fall = ptTime->Worst = Required;
@@ -2169,8 +2182,16 @@ Gia_Man_t * Nf_ManPerformMapping( Gia_Man_t * pGia, Jf_Par_t * pPars )
Nf_ManPrintInit( p );
Nf_ManComputeCuts( p );
Nf_ManPrintQuit( p );
- Gia_ManForEachCiId( p->pGia, Id, i )
- Nf_ObjPrepareCi( p, Id, p->pGia->vInArrs ? Vec_FltEntry(p->pGia->vInArrs, i) : 0.0 );
+ if ( Scl_ConIsRunning() )
+ {
+ Gia_ManForEachCiId( p->pGia, Id, i )
+ Nf_ObjPrepareCi( p, Id, Scl_ConGetInArr(i) );
+ }
+ else
+ {
+ Gia_ManForEachCiId( p->pGia, Id, i )
+ Nf_ObjPrepareCi( p, Id, Nf_Flt2Wrd(p->pGia->vInArrs ? Vec_FltEntry(p->pGia->vInArrs, i) : 0.0) );
+ }
for ( p->Iter = 0; p->Iter < p->pPars->nRounds; p->Iter++ )
{
Nf_ManComputeMapping( p );
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h
index bce318a5..727e492e 100644
--- a/src/base/abc/abc.h
+++ b/src/base/abc/abc.h
@@ -813,7 +813,7 @@ extern ABC_DLL void Abc_NtkDontCareFree( Odc_Man_t * p );
extern ABC_DLL int Abc_NtkDontCareCompute( Odc_Man_t * p, Abc_Obj_t * pNode, Vec_Ptr_t * vLeaves, unsigned * puTruth );
/*=== abcPrint.c ==========================================================*/
extern ABC_DLL float Abc_NtkMfsTotalSwitching( Abc_Ntk_t * pNtk );
-extern ABC_DLL void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf );
+extern ABC_DLL void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf, int fPrintMem );
extern ABC_DLL void Abc_NtkPrintIo( FILE * pFile, Abc_Ntk_t * pNtk, int fPrintFlops );
extern ABC_DLL void Abc_NtkPrintLatch( FILE * pFile, Abc_Ntk_t * pNtk );
extern ABC_DLL void Abc_NtkPrintFanio( FILE * pFile, Abc_Ntk_t * pNtk, int fUsePis );
diff --git a/src/base/abc/abcHie.c b/src/base/abc/abcHie.c
index c27b0bd3..8397301f 100644
--- a/src/base/abc/abcHie.c
+++ b/src/base/abc/abcHie.c
@@ -470,7 +470,7 @@ void Abc_NtkPrintBoxInfo( Abc_Ntk_t * pNtk )
Vec_IntAddToEntry( vCounts, Num, 1 );
}
-// Abc_NtkPrintStats( pModel, 0, 0, 0, 0, 0, 0, 0, 0 );
+// Abc_NtkPrintStats( pModel, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
printf( "MODULE " );
printf( "%-30s : ", Abc_NtkName(pModel) );
printf( "PI=%6d ", Abc_NtkPiNum(pModel) );
diff --git a/src/base/abc/abcNames.c b/src/base/abc/abcNames.c
index 27bd924a..b32093e9 100644
--- a/src/base/abc/abcNames.c
+++ b/src/base/abc/abcNames.c
@@ -355,6 +355,39 @@ void Abc_NtkOrderObjsByName( Abc_Ntk_t * pNtk, int fComb )
/**Function*************************************************************
+ Synopsis [Creates name manager storing input/output names.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+Abc_Nam_t * Abc_NtkNameMan( Abc_Ntk_t * p, int fOuts )
+{
+ if ( fOuts )
+ {
+ Abc_Obj_t * pObj; int i;
+ Abc_Nam_t * pStrsCo = Abc_NamStart( Abc_NtkCoNum(p), 24 );
+ Abc_NtkForEachCo( p, pObj, i )
+ Abc_NamStrFindOrAdd( pStrsCo, Abc_ObjName(pObj), NULL );
+ assert( Abc_NamObjNumMax(pStrsCo) == i + 1 );
+ return pStrsCo;
+ }
+ else
+ {
+ Abc_Obj_t * pObj; int i;
+ Abc_Nam_t * pStrsCi = Abc_NamStart( Abc_NtkCiNum(p), 24 );
+ Abc_NtkForEachCi( p, pObj, i )
+ Abc_NamStrFindOrAdd( pStrsCi, Abc_ObjName(pObj), NULL );
+ assert( Abc_NamObjNumMax(pStrsCi) == i + 1 );
+ return pStrsCi;
+ }
+}
+
+/**Function*************************************************************
+
Synopsis [Orders PIs/POs/latches alphabetically.]
Description []
@@ -376,18 +409,11 @@ int Abc_NodeCompareIndexes( Abc_Obj_t ** pp1, Abc_Obj_t ** pp2 )
void Abc_NtkTransferOrder( Abc_Ntk_t * pNtkOld, Abc_Ntk_t * pNtkNew )
{
Abc_Obj_t * pObj; int i;
- Abc_Nam_t * pStrsCi = Abc_NamStart( Abc_NtkCiNum(pNtkOld), 24 );
- Abc_Nam_t * pStrsCo = Abc_NamStart( Abc_NtkCoNum(pNtkOld), 24 );
+ Abc_Nam_t * pStrsCi = Abc_NtkNameMan( pNtkOld, 0 );
+ Abc_Nam_t * pStrsCo = Abc_NtkNameMan( pNtkOld, 1 );
assert( Abc_NtkPiNum(pNtkOld) == Abc_NtkPiNum(pNtkNew) );
assert( Abc_NtkPoNum(pNtkOld) == Abc_NtkPoNum(pNtkNew) );
assert( Abc_NtkLatchNum(pNtkOld) == Abc_NtkLatchNum(pNtkNew) );
- // save IDs of the names
- Abc_NtkForEachCi( pNtkOld, pObj, i )
- Abc_NamStrFindOrAdd( pStrsCi, Abc_ObjName(pObj), NULL );
- assert( Abc_NamObjNumMax(pStrsCi) == i + 1 );
- Abc_NtkForEachCo( pNtkOld, pObj, i )
- Abc_NamStrFindOrAdd( pStrsCo, Abc_ObjName(pObj), NULL );
- assert( Abc_NamObjNumMax(pStrsCo) == i + 1 );
// transfer to the new network
Abc_NtkForEachCi( pNtkNew, pObj, i )
{
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 1482dc8c..18427583 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -1184,6 +1184,7 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv )
int fPower;
int fGlitch;
int fSkipBuf;
+ int fPrintMem;
int c;
pNtk = Abc_FrameReadNtk(pAbc);
@@ -1198,8 +1199,9 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv )
fPower = 0;
fGlitch = 0;
fSkipBuf = 0;
+ fPrintMem = 0;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "fbdltmpgsh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "fbdltmpgsuh" ) ) != EOF )
{
switch ( c )
{
@@ -1230,6 +1232,9 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv )
case 's':
fSkipBuf ^= 1;
break;
+ case 'u':
+ fPrintMem ^= 1;
+ break;
case 'h':
goto usage;
default:
@@ -1247,7 +1252,7 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Cannot print LUT delay for a non-logic network.\n" );
return 1;
}
- Abc_NtkPrintStats( pNtk, fFactor, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf );
+ Abc_NtkPrintStats( pNtk, fFactor, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf, fPrintMem );
if ( fPrintTime )
{
pAbc->TimeTotal += pAbc->TimeCommand;
@@ -1257,7 +1262,7 @@ int Abc_CommandPrintStats( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
- Abc_Print( -2, "usage: print_stats [-fbdltmpgsh]\n" );
+ Abc_Print( -2, "usage: print_stats [-fbdltmpgsuh]\n" );
Abc_Print( -2, "\t prints the network statistics\n" );
Abc_Print( -2, "\t-f : toggles printing the literal count in the factored forms [default = %s]\n", fFactor? "yes": "no" );
Abc_Print( -2, "\t-b : toggles saving the best logic network in \"best.blif\" [default = %s]\n", fSaveBest? "yes": "no" );
@@ -1268,6 +1273,7 @@ usage:
Abc_Print( -2, "\t-p : toggles printing power dissipation due to switching [default = %s]\n", fPower? "yes": "no" );
Abc_Print( -2, "\t-g : toggles printing percentage of increased power due to glitching [default = %s]\n", fGlitch? "yes": "no" );
Abc_Print( -2, "\t-s : toggles not counting single-output nodes as nodes [default = %s]\n", fSkipBuf? "yes": "no" );
+ Abc_Print( -2, "\t-u : toggles printing memory usage [default = %s]\n", fPrintMem? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}
@@ -1348,7 +1354,7 @@ int Abc_CommandPrintExdc( Abc_Frame_t * pAbc, int argc, char ** argv )
}
else
Abc_Print( 1, "EXDC network statistics: \n" );
- Abc_NtkPrintStats( pNtk->pExdc, 0, 0, 0, 0, 0, 0, 0, 0 );
+ Abc_NtkPrintStats( pNtk->pExdc, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
return 0;
usage:
diff --git a/src/base/abci/abcMini.c b/src/base/abci/abcMini.c
index c8f3bca5..8f9e48fe 100644
--- a/src/base/abci/abcMini.c
+++ b/src/base/abci/abcMini.c
@@ -195,7 +195,7 @@ void Abc_NtkMiniAigTest( Abc_Ntk_t * pNtk )
p = Abc_NtkToMiniAig( pNtk );
pNtkNew = Abc_NtkFromMiniAig( p );
Mini_AigStop( p );
- Abc_NtkPrintStats( pNtkNew, 0, 0, 0, 0, 0, 0, 0, 0 );
+ Abc_NtkPrintStats( pNtkNew, 0, 0, 0, 0, 0, 0, 0, 0, 0 );
Abc_NtkDelete( pNtkNew );
// test dumping
diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c
index 3d2c2551..2d60c730 100644
--- a/src/base/abci/abcPrint.c
+++ b/src/base/abci/abcPrint.c
@@ -123,6 +123,34 @@ int Abc_NtkCompareAndSaveBest( Abc_Ntk_t * pNtk )
/**Function*************************************************************
+ Synopsis [Collects memory usage.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+double Abc_NtkMemory( Abc_Ntk_t * p )
+{
+ Abc_Obj_t * pObj; int i;
+ double Memory = sizeof(Abc_Ntk_t);
+ Memory += sizeof(Abc_Obj_t) * Abc_NtkObjNum(p);
+ Memory += Vec_PtrMemory(p->vPis);
+ Memory += Vec_PtrMemory(p->vPos);
+ Memory += Vec_PtrMemory(p->vCis);
+ Memory += Vec_PtrMemory(p->vCos);
+ Memory += Vec_PtrMemory(p->vObjs);
+ Memory += Vec_IntMemory(&p->vTravIds);
+ Memory += Vec_IntMemory(p->vLevelsR);
+ Abc_NtkForEachObj( p, pObj, i )
+ Memory += sizeof(int) * (Vec_IntCap(&pObj->vFanins) + Vec_IntCap(&pObj->vFanouts));
+ return Memory;
+}
+
+/**Function*************************************************************
+
Synopsis [Marks nodes for power-optimization.]
Description []
@@ -207,7 +235,7 @@ float Abc_NtkGetArea( Abc_Ntk_t * pNtk )
SeeAlso []
***********************************************************************/
-void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf )
+void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDumpResult, int fUseLutLib, int fPrintMuxes, int fPower, int fGlitch, int fSkipBuf, int fPrintMem )
{
int nSingles = fSkipBuf ? Abc_NtkGetBufNum(pNtk) : 0;
if ( fPrintMuxes && Abc_NtkIsStrash(pNtk) )
@@ -329,6 +357,8 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum
else
printf( "\nCurrently computes glitching only for K-LUT networks with K <= 6." );
}
+ if ( fPrintMem )
+ Abc_Print( 1," mem =%5.2f MB", Abc_NtkMemory(pNtk)/(1<<20) );
Abc_Print( 1,"\n" );
// print the statistic into a file
@@ -425,7 +455,7 @@ void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFactored, int fSaveBest, int fDum
fflush( stdout );
if ( pNtk->pExdc )
- Abc_NtkPrintStats( pNtk->pExdc, fFactored, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf );
+ Abc_NtkPrintStats( pNtk->pExdc, fFactored, fSaveBest, fDumpResult, fUseLutLib, fPrintMuxes, fPower, fGlitch, fSkipBuf, fPrintMem );
}
/**Function*************************************************************
diff --git a/src/base/main/mainInt.h b/src/base/main/mainInt.h
index 369b46f1..c1b687bc 100644
--- a/src/base/main/mainInt.h
+++ b/src/base/main/mainInt.h
@@ -94,6 +94,7 @@ struct Abc_Frame_t_
void * pLibGen2; // the current genlib
void * pLibSuper; // the current supergate library
void * pLibScl; // the current Liberty library
+ void * pAbcCon; // constraint manager
// timing constraints
char * pDrivingCell; // name of the driving cell
float MaxLoad; // maximum output load
diff --git a/src/map/mapper/mapperMatch.c b/src/map/mapper/mapperMatch.c
index 2b31d73a..e5e12fa8 100644
--- a/src/map/mapper/mapperMatch.c
+++ b/src/map/mapper/mapperMatch.c
@@ -18,6 +18,9 @@
#include "mapperInt.h"
+#include "misc/util/utilNam.h"
+#include "map/scl/sclCon.h"
+
ABC_NAMESPACE_IMPL_START
@@ -356,7 +359,15 @@ void Map_MappingSetPiArrivalTimes( Map_Man_t * p )
{
pNode = p->pInputs[i];
// set the arrival time of the positive phase
- pNode->tArrival[1] = p->pInputArrivals[i];
+ if ( Scl_ConIsRunning() )
+ {
+ float Time = Scl_ConGetInArrFloat( i );
+ pNode->tArrival[1].Fall = Time;
+ pNode->tArrival[1].Rise = Time;
+ pNode->tArrival[1].Worst = Time;
+ }
+ else
+ pNode->tArrival[1] = p->pInputArrivals[i];
pNode->tArrival[1].Rise += p->pNodeDelays ? p->pNodeDelays[pNode->Num] : 0;
pNode->tArrival[1].Fall += p->pNodeDelays ? p->pNodeDelays[pNode->Num] : 0;
pNode->tArrival[1].Worst += p->pNodeDelays ? p->pNodeDelays[pNode->Num] : 0;
diff --git a/src/map/mapper/mapperTime.c b/src/map/mapper/mapperTime.c
index b5a9ecde..7e805538 100644
--- a/src/map/mapper/mapperTime.c
+++ b/src/map/mapper/mapperTime.c
@@ -18,6 +18,9 @@
#include "mapperInt.h"
+#include "misc/util/utilNam.h"
+#include "map/scl/sclCon.h"
+
ABC_NAMESPACE_IMPL_START
////////////////////////////////////////////////////////////////////////
@@ -381,8 +384,9 @@ void Map_TimePropagateRequired( Map_Man_t * p )
}
void Map_TimeComputeRequiredGlobal( Map_Man_t * p )
{
+ int fUseConMan = Scl_ConIsRunning() && Scl_ConHasOutReqs();
Map_Time_t * ptTime, * ptTimeA;
- int fPhase, i;
+ int fPhase, i;
// update the required times according to the target
p->fRequiredGlo = Map_TimeComputeArrivalMax( p );
if ( p->DelayTarget != -1 )
@@ -416,15 +420,31 @@ void Map_TimeComputeRequiredGlobal( Map_Man_t * p )
ptTime = Map_Regular(p->pOutputs[i])->tRequired + fPhase;
ptTimeA = Map_Regular(p->pOutputs[i])->tArrival + fPhase;
- // if external required time can be achieved, use it
- if ( p->pOutputRequireds && p->pOutputRequireds[i].Worst > 0 && ptTimeA->Worst <= p->pOutputRequireds[i].Worst )//&& p->pOutputRequireds[i].Worst <= p->fRequiredGlo )
- ptTime->Rise = ptTime->Fall = ptTime->Worst = p->pOutputRequireds[i].Worst;
- // if external required cannot be achieved, set the earliest possible arrival time
- else if ( p->pOutputRequireds && p->pOutputRequireds[i].Worst > 0 && ptTimeA->Worst > p->pOutputRequireds[i].Worst )
- ptTime->Rise = ptTime->Fall = ptTime->Worst = ptTimeA->Worst;
- // otherwise, set the global required time
+ if ( fUseConMan )
+ {
+ float Value = Scl_ConGetOutReqFloat(i);
+ // if external required time can be achieved, use it
+ if ( Value > 0 && ptTimeA->Worst <= Value )//&& Value <= p->fRequiredGlo )
+ ptTime->Rise = ptTime->Fall = ptTime->Worst = Value;
+ // if external required cannot be achieved, set the earliest possible arrival time
+ else if ( Value > 0 && ptTimeA->Worst > Value )
+ ptTime->Rise = ptTime->Fall = ptTime->Worst = ptTimeA->Worst;
+ // otherwise, set the global required time
+ else
+ ptTime->Rise = ptTime->Fall = ptTime->Worst = p->fRequiredGlo;
+ }
else
- ptTime->Rise = ptTime->Fall = ptTime->Worst = p->fRequiredGlo;
+ {
+ // if external required time can be achieved, use it
+ if ( p->pOutputRequireds && p->pOutputRequireds[i].Worst > 0 && ptTimeA->Worst <= p->pOutputRequireds[i].Worst )//&& p->pOutputRequireds[i].Worst <= p->fRequiredGlo )
+ ptTime->Rise = ptTime->Fall = ptTime->Worst = p->pOutputRequireds[i].Worst;
+ // if external required cannot be achieved, set the earliest possible arrival time
+ else if ( p->pOutputRequireds && p->pOutputRequireds[i].Worst > 0 && ptTimeA->Worst > p->pOutputRequireds[i].Worst )
+ ptTime->Rise = ptTime->Fall = ptTime->Worst = ptTimeA->Worst;
+ // otherwise, set the global required time
+ else
+ ptTime->Rise = ptTime->Fall = ptTime->Worst = p->fRequiredGlo;
+ }
}
// visit nodes in the reverse topological order
Map_TimePropagateRequired( p );
diff --git a/src/map/scl/scl.c b/src/map/scl/scl.c
index bd917ca3..8f788628 100644
--- a/src/map/scl/scl.c
+++ b/src/map/scl/scl.c
@@ -21,6 +21,9 @@
#include "sclSize.h"
#include "base/main/mainInt.h"
+#include "misc/util/utilNam.h"
+#include "sclCon.h"
+
ABC_NAMESPACE_IMPL_START
@@ -47,9 +50,15 @@ static int Scl_CommandUpsize ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Scl_CommandDnsize ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Scl_CommandPrintBuf ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Scl_CommandReadConstr ( Abc_Frame_t * pAbc, int argc, char ** argv );
+static int Scl_CommandWriteConstr( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Scl_CommandPrintConstr( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Scl_CommandResetConstr( Abc_Frame_t * pAbc, int argc, char ** argv );
+static inline Scl_Con_t * Scl_ConGetMan( Abc_Frame_t * pAbc ) { return (Scl_Con_t *)pAbc->pAbcCon; }
+static inline void Scl_ConFreeMan( Abc_Frame_t * pAbc ) { if ( pAbc->pAbcCon ) Scl_ConFree(Scl_ConGetMan(pAbc)); }
+static inline void Scl_ConUpdateMan( Abc_Frame_t * pAbc, Scl_Con_t * p ) { Scl_ConFreeMan(pAbc); pAbc->pAbcCon = p; }
+ Scl_Con_t * Scl_ConReadMan() { return Scl_ConGetMan( Abc_FrameGetGlobalFrame() ); }
+
////////////////////////////////////////////////////////////////////////
/// FUNCTION DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
@@ -109,12 +118,14 @@ void Scl_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "SCL mapping", "dnsize", Scl_CommandDnsize, 1 );
Cmd_CommandAdd( pAbc, "SCL mapping", "print_buf", Scl_CommandPrintBuf, 0 );
Cmd_CommandAdd( pAbc, "SCL mapping", "read_constr", Scl_CommandReadConstr, 0 );
+ Cmd_CommandAdd( pAbc, "SCL mapping", "write_constr", Scl_CommandWriteConstr, 0 );
Cmd_CommandAdd( pAbc, "SCL mapping", "print_constr", Scl_CommandPrintConstr, 0 );
Cmd_CommandAdd( pAbc, "SCL mapping", "reset_constr", Scl_CommandResetConstr, 0 );
}
void Scl_End( Abc_Frame_t * pAbc )
{
Abc_SclLoad( NULL, (SC_Lib **)&pAbc->pLibScl );
+ Scl_ConUpdateMan( pAbc, NULL );
}
@@ -1799,7 +1810,9 @@ usage:
***********************************************************************/
int Scl_CommandReadConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
{
+ extern Abc_Nam_t * Abc_NtkNameMan( Abc_Ntk_t * p, int fOuts );
extern void Abc_SclReadTimingConstr( Abc_Frame_t * pAbc, char * pFileName, int fVerbose );
+ Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
FILE * pFile;
char * pFileName;
int c, fVerbose = 0;
@@ -1830,6 +1843,13 @@ int Scl_CommandReadConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
}
fclose( pFile );
Abc_SclReadTimingConstr( pAbc, pFileName, fVerbose );
+
+ // input constraint manager
+ if ( pNtk )
+ {
+ Scl_Con_t * pCon = Scl_ConRead( pFileName, Abc_NtkNameMan(pNtk, 0), Abc_NtkNameMan(pNtk, 1) );
+ if ( pCon ) Scl_ConUpdateMan( pAbc, pCon );
+ }
return 0;
usage:
@@ -1852,8 +1872,72 @@ usage:
SeeAlso []
***********************************************************************/
+int Scl_CommandWriteConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
+{
+ Scl_Con_t * pCon = Scl_ConGetMan( pAbc );
+ char * pFileName = NULL;
+ int c, fVerbose = 0;
+ Extra_UtilGetoptReset();
+ while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
+ {
+ switch ( c )
+ {
+ case 'v':
+ fVerbose ^= 1;
+ break;
+ case 'h':
+ goto usage;
+ default:
+ goto usage;
+ }
+ }
+ if ( pCon == NULL )
+ {
+ Abc_Print( 1, "Scl_CommandWriteConstr(): There is no constraint manager.\n" );
+ return 0;
+ }
+ if ( argc == globalUtilOptind + 1 )
+ pFileName = argv[globalUtilOptind];
+ else if ( argc == globalUtilOptind && pCon )
+ pFileName = Extra_FileNameGenericAppend( pCon->pFileName, "_out.constr" );
+ else
+ {
+ printf( "Output file name should be given on the command line.\n" );
+ return 0;
+ }
+ // perform writing
+ if ( !strcmp( Extra_FileNameExtension(pFileName), "constr" ) )
+ Scl_ConWrite( pCon, pFileName );
+ else
+ {
+ printf( "Scl_CommandWriteConstr(): Unrecognized output file extension.\n" );
+ return 0;
+ }
+ return 0;
+
+usage:
+ fprintf( pAbc->Err, "usage: write_constr [-vh] <file>\n" );
+ fprintf( pAbc->Err, "\t writes current timing constraints into a file\n" );
+ fprintf( pAbc->Err, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
+ fprintf( pAbc->Err, "\t-h : prints the command summary\n" );
+ fprintf( pAbc->Err, "\t<file> : the name of a file to read\n" );
+ return 1;
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
int Scl_CommandPrintConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
{
+ Scl_Con_t * pCon = Scl_ConGetMan( pAbc );
int c, fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
@@ -1869,8 +1953,10 @@ int Scl_CommandPrintConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
goto usage;
}
}
- printf( "Primary input driving cell = %s\n", Abc_FrameReadDrivingCell() );
- printf( "Primary output maximum load = %f\n", Abc_FrameReadMaxLoad() );
+ //printf( "Primary input driving cell = %s\n", Abc_FrameReadDrivingCell() );
+ //printf( "Primary output maximum load = %f\n", Abc_FrameReadMaxLoad() );
+
+ if ( pCon ) Scl_ConWrite( pCon, NULL );
return 0;
usage:
@@ -1912,6 +1998,8 @@ int Scl_CommandResetConstr( Abc_Frame_t * pAbc, int argc, char ** argv )
}
Abc_FrameSetDrivingCell( NULL );
Abc_FrameSetMaxLoad( 0 );
+
+ Scl_ConUpdateMan( pAbc, NULL );
return 0;
usage:
diff --git a/src/map/scl/sclCon.h b/src/map/scl/sclCon.h
new file mode 100644
index 00000000..982b4641
--- /dev/null
+++ b/src/map/scl/sclCon.h
@@ -0,0 +1,289 @@
+/**CFile****************************************************************
+
+ FileName [sclCon.h]
+
+ SystemName [ABC: Logic synthesis and verification system.]
+
+ PackageName [Standard-cell library representation.]
+
+ Synopsis [Constraint manager.]
+
+ Author [Alan Mishchenko]
+
+ Affiliation [UC Berkeley]
+
+ Date [Ver. 1.0. Started - August 24, 2012.]
+
+ Revision [$Id: sclCon.h,v 1.0 2012/08/24 00:00:00 alanmi Exp $]
+
+***********************************************************************/
+
+ABC_NAMESPACE_HEADER_START
+
+////////////////////////////////////////////////////////////////////////
+/// DECLARATIONS ///
+////////////////////////////////////////////////////////////////////////
+
+typedef struct Scl_Con_t_ Scl_Con_t;
+struct Scl_Con_t_
+{
+ char * pFileName; // constraint file name
+ char * pModelName; // current design name
+ char * pInCellDef; // default input driving gate
+ word tInArrDef; // default input arrival time
+ word tInSlewDef; // default input slew
+ word tInLoadDef; // default input load
+ word tOutReqDef; // default output required time
+ word tOutLoadDef; // default output load
+ Vec_Ptr_t vInCells; // input driving gates
+ Vec_Wrd_t vInArrs; // input arrival times
+ Vec_Wrd_t vInSlews; // input slews
+ Vec_Wrd_t vInLoads; // input loads
+ Vec_Wrd_t vOutReqs; // output required times
+ Vec_Wrd_t vOutLoads; // output loads
+ Abc_Nam_t * pNamI; // input names
+ Abc_Nam_t * pNamO; // output names
+};
+
+#define SCL_INPUT_CELL "input_cell"
+#define SCL_INPUT_ARR "input_arrival"
+#define SCL_INPUT_SLEW "input_slew"
+#define SCL_INPUT_LOAD "input_load"
+#define SCL_OUTPUT_REQ "output_required"
+#define SCL_OUTPUT_LOAD "output_load"
+
+#define SCL_DIRECTIVE(ITEM) "."ITEM
+#define SCL_DEF_DIRECTIVE(ITEM) ".default_"ITEM
+
+#define SCL_NUM 1000000
+#define SCL_NUMINV 0.000001
+#define SCL_INFINITY (~(word)0)
+
+static inline word Scl_Flt2Wrd( float w ) { return SCL_NUM*w; }
+static inline float Scl_Wrd2Flt( word w ) { return SCL_NUMINV*(unsigned)(w&0x3FFFFFFF) + SCL_NUMINV*(1<<30)*(unsigned)(w>>30); }
+
+////////////////////////////////////////////////////////////////////////
+/// FUNCTION DEFINITIONS ///
+////////////////////////////////////////////////////////////////////////
+
+/**Function*************************************************************
+
+ Synopsis [Manager construction.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline Scl_Con_t * Scl_ConAlloc( char * pFileName, Abc_Nam_t * pNamI, Abc_Nam_t * pNamO )
+{
+ Scl_Con_t * p = ABC_CALLOC( Scl_Con_t, 1 );
+ p->pFileName = Abc_UtilStrsav( pFileName );
+ p->pNamI = pNamI;
+ p->pNamO = pNamO;
+ p->pModelName = NULL;
+ p->pInCellDef = NULL;
+ p->tInArrDef = SCL_INFINITY;
+ p->tInSlewDef = SCL_INFINITY;
+ p->tInLoadDef = SCL_INFINITY;
+ p->tOutReqDef = SCL_INFINITY;
+ p->tOutLoadDef = SCL_INFINITY;
+ Vec_PtrFill( &p->vInCells, Abc_NamObjNumMax(pNamI)-1, NULL );
+ Vec_WrdFill( &p->vInArrs, Abc_NamObjNumMax(pNamI)-1, SCL_INFINITY );
+ Vec_WrdFill( &p->vInSlews, Abc_NamObjNumMax(pNamI)-1, SCL_INFINITY );
+ Vec_WrdFill( &p->vInLoads, Abc_NamObjNumMax(pNamI)-1, SCL_INFINITY );
+ Vec_WrdFill( &p->vOutReqs, Abc_NamObjNumMax(pNamO)-1, SCL_INFINITY );
+ Vec_WrdFill( &p->vOutLoads, Abc_NamObjNumMax(pNamO)-1, SCL_INFINITY );
+ return p;
+}
+static inline void Scl_ConFree( Scl_Con_t * p )
+{
+ Vec_PtrFreeData( &p->vInCells );
+ Vec_PtrErase( &p->vInCells );
+ Vec_WrdErase( &p->vInArrs );
+ Vec_WrdErase( &p->vInSlews );
+ Vec_WrdErase( &p->vInLoads );
+ Vec_WrdErase( &p->vOutReqs );
+ Vec_WrdErase( &p->vOutLoads );
+ Abc_NamDeref( p->pNamI );
+ Abc_NamDeref( p->pNamO );
+ ABC_FREE( p->pInCellDef );
+ ABC_FREE( p->pModelName );
+ ABC_FREE( p->pFileName );
+ ABC_FREE( p );
+}
+
+
+/**Function*************************************************************
+
+ Synopsis [Manager serialization.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline int Scl_ConParse( Scl_Con_t * p, Abc_Nam_t * pNamI, Abc_Nam_t * pNamO )
+{
+ char Buffer[1000];
+ char * pToken, * pToken2, * pToken3, * pName;
+ int i, Num = -1, nLines = 0; word Value;
+ FILE * pFile = fopen( p->pFileName, "rb" );
+ while ( fgets( Buffer, 1000, pFile ) )
+ {
+ nLines++;
+ pToken = strtok( Buffer, " \t\r\n" );
+ if ( pToken == NULL )
+ continue;
+ pToken2 = strtok( NULL, " \t\r\n" );
+ if ( pToken2 == NULL )
+ {
+ printf( "Line %d: Skipping directive \"%s\" without argument.\n", nLines, pToken );
+ continue;
+ }
+ pToken3 = strtok( NULL, " \t\r\n" );
+ if ( !strcmp(pToken, ".model") ) p->pModelName = Abc_UtilStrsav(pToken2);
+ else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_INPUT_CELL)) ) p->pInCellDef = Abc_UtilStrsav(pToken2);
+ else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_INPUT_ARR)) ) p->tInArrDef = Scl_Flt2Wrd(atof(pToken2));
+ else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_INPUT_SLEW)) ) p->tInSlewDef = Scl_Flt2Wrd(atof(pToken2));
+ else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_INPUT_LOAD)) ) p->tInLoadDef = Scl_Flt2Wrd(atof(pToken2));
+ else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_OUTPUT_REQ)) ) p->tOutReqDef = Scl_Flt2Wrd(atof(pToken2));
+ else if ( !strcmp(pToken, SCL_DEF_DIRECTIVE(SCL_OUTPUT_LOAD))) p->tOutLoadDef = Scl_Flt2Wrd(atof(pToken2));
+ else if ( pToken3 == NULL ) { printf( "Directive %s should be followed by two arguments.\n", pToken ); continue; }
+ else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_INPUT_CELL)) ) if ( (Num = Abc_NamStrFind(pNamI, pToken2)) > 0 ) Vec_PtrWriteEntry( &p->vInCells, Num-1, Abc_UtilStrsav(pToken3) ); else printf( "Line %d: Cannot find input \"%s\".\n", nLines, pToken2 );
+ else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_INPUT_ARR)) ) if ( (Num = Abc_NamStrFind(pNamI, pToken2)) > 0 ) Vec_WrdWriteEntry( &p->vInArrs, Num-1, Scl_Flt2Wrd(atof(pToken3)) ); else printf( "Line %d: Cannot find input \"%s\".\n", nLines, pToken2 );
+ else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_INPUT_SLEW)) ) if ( (Num = Abc_NamStrFind(pNamI, pToken2)) > 0 ) Vec_WrdWriteEntry( &p->vInSlews, Num-1, Scl_Flt2Wrd(atof(pToken3)) ); else printf( "Line %d: Cannot find input \"%s\".\n", nLines, pToken2 );
+ else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_INPUT_LOAD)) ) if ( (Num = Abc_NamStrFind(pNamI, pToken2)) > 0 ) Vec_WrdWriteEntry( &p->vInLoads, Num-1, Scl_Flt2Wrd(atof(pToken3)) ); else printf( "Line %d: Cannot find input \"%s\".\n", nLines, pToken2 );
+ else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_OUTPUT_REQ)) ) if ( (Num = Abc_NamStrFind(pNamO, pToken2)) > 0 ) Vec_WrdWriteEntry( &p->vOutReqs, Num-1, Scl_Flt2Wrd(atof(pToken3)) ); else printf( "Line %d: Cannot find output \"%s\".\n", nLines, pToken2 );
+ else if ( !strcmp(pToken, SCL_DIRECTIVE(SCL_OUTPUT_LOAD)) ) if ( (Num = Abc_NamStrFind(pNamO, pToken2)) > 0 ) Vec_WrdWriteEntry( &p->vOutLoads, Num-1, Scl_Flt2Wrd(atof(pToken3)) ); else printf( "Line %d: Cannot find output \"%s\".\n", nLines, pToken2 );
+ else printf( "Line %d: Skipping unrecognized directive \"%s\".\n", nLines, pToken );
+ }
+ // set missing defaults
+ if ( p->pInCellDef == NULL ) p->pInCellDef = NULL; // consider using buffer from the current library
+ if ( p->tInArrDef == SCL_INFINITY ) p->tInArrDef = 0;
+ if ( p->tInSlewDef == SCL_INFINITY ) p->tInSlewDef = 0;
+ if ( p->tInLoadDef == SCL_INFINITY ) p->tInLoadDef = 0;
+ if ( p->tOutReqDef == SCL_INFINITY ) p->tOutReqDef = 0;
+ if ( p->tOutLoadDef == SCL_INFINITY ) p->tOutLoadDef = 0;
+ // set individual defaults
+ if ( p->pInCellDef )
+ Vec_PtrForEachEntry(char *, &p->vInCells, pName, i) if ( pName == NULL ) Vec_PtrWriteEntry( &p->vInCells, i, Abc_UtilStrsav(p->pInCellDef) );
+ Vec_WrdForEachEntry( &p->vInArrs, Value, i ) if ( Value == SCL_INFINITY ) Vec_WrdWriteEntry( &p->vInArrs, i, p->tInArrDef );
+ Vec_WrdForEachEntry( &p->vInSlews, Value, i ) if ( Value == SCL_INFINITY ) Vec_WrdWriteEntry( &p->vInSlews, i, p->tInSlewDef );
+ Vec_WrdForEachEntry( &p->vInLoads, Value, i ) if ( Value == SCL_INFINITY ) Vec_WrdWriteEntry( &p->vInLoads, i, p->tInLoadDef );
+ Vec_WrdForEachEntry( &p->vOutReqs, Value, i ) if ( Value == SCL_INFINITY ) Vec_WrdWriteEntry( &p->vOutReqs, i, p->tOutReqDef );
+ Vec_WrdForEachEntry( &p->vOutLoads, Value, i ) if ( Value == SCL_INFINITY ) Vec_WrdWriteEntry( &p->vOutLoads, i, p->tOutLoadDef );
+
+ fclose( pFile );
+ return 1;
+}
+static inline Scl_Con_t * Scl_ConRead( char * pFileName, Abc_Nam_t * pNamI, Abc_Nam_t * pNamO )
+{
+ Scl_Con_t * p = Scl_ConAlloc( pFileName, pNamI, pNamO );
+ if ( Scl_ConParse(p, pNamI, pNamO) )
+ return p;
+ Scl_ConFree( p );
+ return NULL;
+}
+static inline void Scl_ConWrite( Scl_Con_t * p, char * pFileName )
+{
+ char * pName; word Value; int i;
+ FILE * pFile = pFileName ? fopen( pFileName, "wb" ) : stdout;
+ if ( pFile == NULL )
+ {
+ printf( "Cannot open output file \"%s\".\n", pFileName );
+ return;
+ }
+ fprintf( pFile, ".model %s\n", p->pModelName );
+
+ if ( p->pInCellDef ) fprintf( pFile, ".default_%s %s\n", SCL_INPUT_CELL, p->pInCellDef );
+ if ( p->tInArrDef != 0 ) fprintf( pFile, ".default_%s %.2f\n", SCL_INPUT_ARR, Scl_Wrd2Flt(p->tInArrDef) );
+ if ( p->tInSlewDef != 0 ) fprintf( pFile, ".default_%s %.2f\n", SCL_INPUT_SLEW, Scl_Wrd2Flt(p->tInSlewDef) );
+ if ( p->tInLoadDef != 0 ) fprintf( pFile, ".default_%s %.2f\n", SCL_INPUT_LOAD, Scl_Wrd2Flt(p->tInLoadDef) );
+ if ( p->tOutReqDef != 0 ) fprintf( pFile, ".default_%s %.2f\n", SCL_OUTPUT_REQ, Scl_Wrd2Flt(p->tOutReqDef) );
+ if ( p->tOutLoadDef != 0 ) fprintf( pFile, ".default_%s %.2f\n", SCL_OUTPUT_LOAD, Scl_Wrd2Flt(p->tOutLoadDef) );
+
+ Vec_PtrForEachEntry(char *, &p->vInCells, pName, i) if ( pName ) fprintf( pFile, ".%s %s %s\n", SCL_INPUT_CELL, Abc_NamStr(p->pNamI, i+1), pName );
+ Vec_WrdForEachEntry( &p->vInArrs, Value, i ) if ( Value != p->tInArrDef ) fprintf( pFile, ".%s %s %.2f\n", SCL_INPUT_ARR, Abc_NamStr(p->pNamI, i+1), Scl_Wrd2Flt(Value) );
+ Vec_WrdForEachEntry( &p->vInSlews, Value, i ) if ( Value != p->tInSlewDef ) fprintf( pFile, ".%s %s %.2f\n", SCL_INPUT_SLEW, Abc_NamStr(p->pNamI, i+1), Scl_Wrd2Flt(Value) );
+ Vec_WrdForEachEntry( &p->vInLoads, Value, i ) if ( Value != p->tInLoadDef ) fprintf( pFile, ".%s %s %.2f\n", SCL_INPUT_LOAD, Abc_NamStr(p->pNamI, i+1), Scl_Wrd2Flt(Value) );
+ Vec_WrdForEachEntry( &p->vOutReqs, Value, i ) if ( Value != p->tOutReqDef ) fprintf( pFile, ".%s %s %.2f\n", SCL_OUTPUT_REQ, Abc_NamStr(p->pNamO, i+1), Scl_Wrd2Flt(Value) );
+ Vec_WrdForEachEntry( &p->vOutLoads, Value, i ) if ( Value != p->tOutLoadDef ) fprintf( pFile, ".%s %s %.2f\n", SCL_OUTPUT_LOAD, Abc_NamStr(p->pNamO, i+1), Scl_Wrd2Flt(Value) );
+
+ if ( pFile != stdout )
+ fclose ( pFile );
+}
+
+/**Function*************************************************************
+
+ Synopsis [Internal APIs.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline int Scl_ConHasInCells_( Scl_Con_t * p ) { return Vec_PtrCountZero(&p->vInCells) != Vec_PtrSize(&p->vInCells); }
+static inline int Scl_ConHasInArrs_( Scl_Con_t * p ) { return Vec_WrdCountZero(&p->vInArrs) != Vec_WrdSize(&p->vInArrs); }
+static inline int Scl_ConHasInSlews_( Scl_Con_t * p ) { return Vec_WrdCountZero(&p->vInSlews) != Vec_WrdSize(&p->vInSlews); }
+static inline int Scl_ConHasInLoads_( Scl_Con_t * p ) { return Vec_WrdCountZero(&p->vInLoads) != Vec_WrdSize(&p->vInLoads); }
+static inline int Scl_ConHasOutReqs_( Scl_Con_t * p ) { return Vec_WrdCountZero(&p->vOutReqs) != Vec_WrdSize(&p->vOutReqs); }
+static inline int Scl_ConHasOutLoads_( Scl_Con_t * p ) { return Vec_WrdCountZero(&p->vOutLoads) != Vec_WrdSize(&p->vOutLoads); }
+
+static inline char * Scl_ConGetInCell_( Scl_Con_t * p, int i ) { return Vec_PtrEntry( &p->vInCells, i ); }
+static inline word Scl_ConGetInArr_( Scl_Con_t * p, int i ) { return Vec_WrdEntry( &p->vInArrs, i ); }
+static inline word Scl_ConGetInSlew_( Scl_Con_t * p, int i ) { return Vec_WrdEntry( &p->vInSlews, i ); }
+static inline word Scl_ConGetInLoad_( Scl_Con_t * p, int i ) { return Vec_WrdEntry( &p->vInLoads, i ); }
+static inline word Scl_ConGetOutReq_( Scl_Con_t * p, int i ) { return Vec_WrdEntry( &p->vOutReqs, i ); }
+static inline word Scl_ConGetOutLoad_( Scl_Con_t * p, int i ) { return Vec_WrdEntry( &p->vOutLoads, i ); }
+
+/**Function*************************************************************
+
+ Synopsis [External APIs.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+extern Scl_Con_t * Scl_ConReadMan();
+
+static inline int Scl_ConIsRunning() { return Scl_ConReadMan() != NULL; }
+
+static inline int Scl_ConHasInCells() { return Scl_ConHasInCells_ ( Scl_ConReadMan() ); }
+static inline int Scl_ConHasInArrs() { return Scl_ConHasInArrs_ ( Scl_ConReadMan() ); }
+static inline int Scl_ConHasInSlews() { return Scl_ConHasInSlews_ ( Scl_ConReadMan() ); }
+static inline int Scl_ConHasInLoads() { return Scl_ConHasInLoads_ ( Scl_ConReadMan() ); }
+static inline int Scl_ConHasOutReqs() { return Scl_ConHasOutReqs_ ( Scl_ConReadMan() ); }
+static inline int Scl_ConHasOutLoads() { return Scl_ConHasOutLoads_( Scl_ConReadMan() ); }
+
+static inline char * Scl_ConGetInCell( int i ) { return Scl_ConGetInCell_ ( Scl_ConReadMan(), i ); }
+static inline word Scl_ConGetInArr( int i ) { return Scl_ConGetInArr_ ( Scl_ConReadMan(), i ); }
+static inline word Scl_ConGetInSlew( int i ) { return Scl_ConGetInSlew_ ( Scl_ConReadMan(), i ); }
+static inline word Scl_ConGetInLoad( int i ) { return Scl_ConGetInLoad_ ( Scl_ConReadMan(), i ); }
+static inline word Scl_ConGetOutReq( int i ) { return Scl_ConGetOutReq_ ( Scl_ConReadMan(), i ); }
+static inline word Scl_ConGetOutLoad( int i ) { return Scl_ConGetOutLoad_( Scl_ConReadMan(), i ); }
+
+static inline float Scl_ConGetInArrFloat( int i ) { return Scl_Wrd2Flt( Scl_ConGetInArr(i) ); }
+static inline float Scl_ConGetInSlewFloat( int i ) { return Scl_Wrd2Flt( Scl_ConGetInSlew(i) ); }
+static inline float Scl_ConGetInLoadFloat( int i ) { return Scl_Wrd2Flt( Scl_ConGetInLoad(i) ); }
+static inline float Scl_ConGetOutReqFloat( int i ) { return Scl_Wrd2Flt( Scl_ConGetOutReq(i) ); }
+static inline float Scl_ConGetOutLoadFloat( int i ) { return Scl_Wrd2Flt( Scl_ConGetOutLoad(i) ); }
+
+
+////////////////////////////////////////////////////////////////////////
+/// END OF FILE ///
+////////////////////////////////////////////////////////////////////////
+
+
+ABC_NAMESPACE_HEADER_END
+
+
diff --git a/src/map/scl/sclUtil.c b/src/map/scl/sclUtil.c
index de33d50a..40d7c638 100644
--- a/src/map/scl/sclUtil.c
+++ b/src/map/scl/sclUtil.c
@@ -254,20 +254,21 @@ void Abc_SclReadTimingConstr( Abc_Frame_t * pAbc, char * pFileName, int fVerbose
pToken = strtok( Buffer, " \t\r\n" );
if ( pToken == NULL )
continue;
- if ( !strcmp(pToken, "set_driving_cell") )
+// if ( !strcmp(pToken, "set_driving_cell") )
+ if ( !strcmp(pToken, "default_input_cell") )
{
Abc_FrameSetDrivingCell( Abc_UtilStrsav(strtok(NULL, " \t\r\n")) );
if ( fVerbose )
printf( "Setting driving cell to be \"%s\".\n", Abc_FrameReadDrivingCell() );
}
- else if ( !strcmp(pToken, "set_load") )
+// else if ( !strcmp(pToken, "set_load") )
+ else if ( !strcmp(pToken, "default_output_load") )
{
Abc_FrameSetMaxLoad( atof(strtok(NULL, " \t\r\n")) );
if ( fVerbose )
printf( "Setting driving cell to be %f.\n", Abc_FrameReadMaxLoad() );
}
- else
- printf( "Unrecognized token \"%s\".\n", pToken );
+// else printf( "Unrecognized token \"%s\".\n", pToken );
}
fclose( pFile );
}
diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h
index b700d221..f40a7807 100644
--- a/src/misc/vec/vecPtr.h
+++ b/src/misc/vec/vecPtr.h
@@ -232,6 +232,18 @@ static inline Vec_Ptr_t * Vec_PtrDupArray( Vec_Ptr_t * pVec )
SeeAlso []
***********************************************************************/
+static inline void Vec_PtrZero( Vec_Ptr_t * p )
+{
+ p->pArray = NULL;
+ p->nSize = 0;
+ p->nCap = 0;
+}
+static inline void Vec_PtrErase( Vec_Ptr_t * p )
+{
+ ABC_FREE( p->pArray );
+ p->nSize = 0;
+ p->nCap = 0;
+}
static inline void Vec_PtrFree( Vec_Ptr_t * p )
{
ABC_FREE( p->pArray );