mirror of https://github.com/YosysHQ/abc.git
Several changes to allow Liberty files without delay info.
This commit is contained in:
parent
962ad3b0b1
commit
00efa68053
|
|
@ -71,7 +71,7 @@ Abc_Ntk_t * Abc_NtkMap( Abc_Ntk_t * pNtk, double DelayTarget, double AreaMulti,
|
|||
assert( Abc_NtkIsStrash(pNtk) );
|
||||
// derive library from SCL
|
||||
// if the library is created here, it will be deleted when pSuperLib is deleted in Map_SuperLibFree()
|
||||
if ( Abc_FrameReadLibScl() )
|
||||
if ( Abc_FrameReadLibScl() && Abc_SclHasDelayInfo( Abc_FrameReadLibScl() ) )
|
||||
{
|
||||
pLib = Abc_SclDeriveGenlib( Abc_FrameReadLibScl(), Slew, Gain, nGatesMin, fVerbose );
|
||||
if ( Abc_FrameReadLibGen() )
|
||||
|
|
|
|||
|
|
@ -1034,7 +1034,7 @@ void Abc_NtkPrintGates( Abc_Ntk_t * pNtk, int fUseLibrary )
|
|||
}
|
||||
|
||||
// determine the longest gate name
|
||||
nGateNameLen = 0;
|
||||
nGateNameLen = 5;
|
||||
for ( i = 0; i < nGates; i++ )
|
||||
{
|
||||
Counter = Mio_GateReadValue( ppGates[i] );
|
||||
|
|
|
|||
|
|
@ -165,6 +165,7 @@ extern void Mio_LibraryTransferDelays( Mio_Library_t * pLibD, Mio_L
|
|||
/*=== sclUtil.c =========================================================*/
|
||||
extern Mio_Library_t * Abc_SclDeriveGenlibSimple( void * pScl );
|
||||
extern Mio_Library_t * Abc_SclDeriveGenlib( void * pScl, float Slew, float Gain, int nGatesMin, int fVerbose );
|
||||
extern int Abc_SclHasDelayInfo( void * pScl );
|
||||
|
||||
ABC_NAMESPACE_HEADER_END
|
||||
|
||||
|
|
|
|||
|
|
@ -958,6 +958,11 @@ int Scl_CommandBuffer( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
Abc_Print( -1, "Fanin phase information is not avaiable.\n" );
|
||||
return 1;
|
||||
}
|
||||
if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
|
||||
{
|
||||
Abc_Print( -1, "Library delay info is not available.\n" );
|
||||
return 1;
|
||||
}
|
||||
// modify the current network
|
||||
pNtkRes = Abc_SclBufferingPerform( pNtk, (SC_Lib *)pAbc->pLibScl, pPars );
|
||||
if ( pNtkRes == NULL )
|
||||
|
|
@ -1089,6 +1094,11 @@ int Scl_CommandBufferOld( Abc_Frame_t * pAbc, int argc, char ** argv )
|
|||
Abc_Print( -1, "Fanin phase information is not avaiable.\n" );
|
||||
return 1;
|
||||
}
|
||||
if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
|
||||
{
|
||||
Abc_Print( -1, "Library delay info is not available.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
// modify the current network
|
||||
if ( fAddInvs )
|
||||
|
|
@ -1428,9 +1438,9 @@ int Scl_CommandUpsize( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
|
||||
return 1;
|
||||
}
|
||||
if ( pAbc->pLibScl == NULL )
|
||||
if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
|
||||
{
|
||||
fprintf( pAbc->Err, "There is no Liberty library available.\n" );
|
||||
Abc_Print( -1, "Library delay info is not available.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -1605,9 +1615,9 @@ int Scl_CommandDnsize( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
|
||||
return 1;
|
||||
}
|
||||
if ( pAbc->pLibScl == NULL )
|
||||
if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
|
||||
{
|
||||
fprintf( pAbc->Err, "There is no Liberty library available.\n" );
|
||||
Abc_Print( -1, "Library delay info is not available.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
@ -1678,9 +1688,9 @@ int Scl_CommandPrintBuf( Abc_Frame_t * pAbc, int argc, char **argv )
|
|||
fprintf( pAbc->Err, "The current network is not in a topo order (run \"topo\").\n" );
|
||||
return 1;
|
||||
}
|
||||
if ( pAbc->pLibScl == NULL )
|
||||
if ( !pAbc->pLibScl || !Abc_SclHasDelayInfo(pAbc->pLibScl) )
|
||||
{
|
||||
fprintf( pAbc->Err, "There is no Liberty library available.\n" );
|
||||
Abc_Print( -1, "Library delay info is not available.\n" );
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -559,6 +559,8 @@ static inline SC_Timing * Scl_CellPinTime( SC_Cell * pCell, int iPin )
|
|||
pPin = SC_CellPin( pCell, pCell->n_inputs );
|
||||
assert( Vec_PtrSize(pPin->vRTimings) == pCell->n_inputs );
|
||||
pRTime = (SC_Timings *)Vec_PtrEntry( pPin->vRTimings, iPin );
|
||||
if ( Vec_PtrSize(pRTime->vTimings) == 0 )
|
||||
return NULL;
|
||||
assert( Vec_PtrSize(pRTime->vTimings) == 1 );
|
||||
return (SC_Timing *)Vec_PtrEntry( pRTime->vTimings, 0 );
|
||||
}
|
||||
|
|
@ -610,6 +612,7 @@ extern SC_Cell * Abc_SclFindInvertor( SC_Lib * p, int fFindBuff );
|
|||
extern SC_Cell * Abc_SclFindSmallestGate( SC_Cell * p, float CinMin );
|
||||
extern SC_WireLoad * Abc_SclFindWireLoadModel( SC_Lib * p, float Area );
|
||||
extern SC_WireLoad * Abc_SclFetchWireLoadModel( SC_Lib * p, char * pName );
|
||||
extern int Abc_SclHasDelayInfo( void * pScl );
|
||||
extern float Abc_SclComputeAverageSlew( SC_Lib * p );
|
||||
extern void Abc_SclDumpGenlib( char * pFileName, SC_Lib * p, float Slew, float Gain, int nGatesMin );
|
||||
extern void Abc_SclInstallGenlib( void * pScl, float Slew, float Gain, int nGatesMin );
|
||||
|
|
|
|||
|
|
@ -278,6 +278,31 @@ SC_WireLoad * Abc_SclFindWireLoadModel( SC_Lib * p, float Area )
|
|||
return Abc_SclFetchWireLoadModel( p, pWLoadUsed );
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Returns 1 if the library has delay info.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Abc_SclHasDelayInfo( void * pScl )
|
||||
{
|
||||
SC_Lib * p = (SC_Lib *)pScl;
|
||||
SC_Cell * pCell;
|
||||
SC_Timing * pTime;
|
||||
pCell = Abc_SclFindInvertor(p, 0);
|
||||
if ( pCell == NULL )
|
||||
return 0;
|
||||
pTime = Scl_CellPinTime( pCell, 0 );
|
||||
if ( pTime == NULL )
|
||||
return 0;
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Returns "average" slew.]
|
||||
|
|
@ -298,6 +323,8 @@ float Abc_SclComputeAverageSlew( SC_Lib * p )
|
|||
if ( pCell == NULL )
|
||||
return 0;
|
||||
pTime = Scl_CellPinTime( pCell, 0 );
|
||||
if ( pTime == NULL )
|
||||
return 0;
|
||||
vIndex = pTime->pCellRise->vIndex0; // slew
|
||||
return Vec_FltEntry( vIndex, Vec_FltSize(vIndex)/3 );
|
||||
}
|
||||
|
|
@ -313,7 +340,7 @@ float Abc_SclComputeAverageSlew( SC_Lib * p )
|
|||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Abc_SclComputeParametersPin( SC_Lib * p, SC_Cell * pCell, int iPin, float Slew, float * pLD, float * pPD )
|
||||
int Abc_SclComputeParametersPin( SC_Lib * p, SC_Cell * pCell, int iPin, float Slew, float * pLD, float * pPD )
|
||||
{
|
||||
SC_Pair Load0, Load1, Load2;
|
||||
SC_Pair ArrIn = { 0.0, 0.0 };
|
||||
|
|
@ -323,7 +350,9 @@ void Abc_SclComputeParametersPin( SC_Lib * p, SC_Cell * pCell, int iPin, float S
|
|||
SC_Pair ArrOut2 = { 0.0, 0.0 };
|
||||
SC_Pair SlewOut = { 0.0, 0.0 };
|
||||
SC_Timing * pTime = Scl_CellPinTime( pCell, iPin );
|
||||
Vec_Flt_t * vIndex = pTime->pCellRise->vIndex1; // capacitance
|
||||
Vec_Flt_t * vIndex = pTime ? pTime->pCellRise->vIndex1 : NULL; // capacitance
|
||||
if ( vIndex == NULL )
|
||||
return 0;
|
||||
// get load points
|
||||
Load0.rise = Load0.fall = 0.0;
|
||||
Load1.rise = Load1.fall = Vec_FltEntry( vIndex, 0 );
|
||||
|
|
@ -339,8 +368,9 @@ void Abc_SclComputeParametersPin( SC_Lib * p, SC_Cell * pCell, int iPin, float S
|
|||
*pLD = (ArrOut2.rise - ArrOut1.rise) / ((Load2.rise - Load1.rise) / SC_CellPinCap(pCell, iPin));
|
||||
// get constant
|
||||
*pPD = ArrOut0.rise;
|
||||
return 1;
|
||||
}
|
||||
void Abc_SclComputeParametersCell( SC_Lib * p, SC_Cell * pCell, float Slew, float * pLD, float * pPD )
|
||||
int Abc_SclComputeParametersCell( SC_Lib * p, SC_Cell * pCell, float Slew, float * pLD, float * pPD )
|
||||
{
|
||||
SC_Pin * pPin;
|
||||
float LD, PD, ld, pd;
|
||||
|
|
@ -348,11 +378,13 @@ void Abc_SclComputeParametersCell( SC_Lib * p, SC_Cell * pCell, float Slew, floa
|
|||
LD = PD = ld = pd = 0;
|
||||
SC_CellForEachPinIn( pCell, pPin, i )
|
||||
{
|
||||
Abc_SclComputeParametersPin( p, pCell, i, Slew, &ld, &pd );
|
||||
if ( !Abc_SclComputeParametersPin( p, pCell, i, Slew, &ld, &pd ) )
|
||||
return 0;
|
||||
LD += ld; PD += pd;
|
||||
}
|
||||
*pLD = LD / Abc_MaxInt(1, pCell->n_inputs);
|
||||
*pPD = PD / Abc_MaxInt(1, pCell->n_inputs);
|
||||
return 1;
|
||||
}
|
||||
void Abc_SclComputeParametersClass( SC_Lib * p, SC_Cell * pRepr, float Slew, float * pLD, float * pPD )
|
||||
{
|
||||
|
|
@ -513,13 +545,15 @@ void Abc_SclPrintCells( SC_Lib * p, float SlewInit, float Gain, int fInvOnly, in
|
|||
printf( "A =%8.2f ", pCell->area );
|
||||
if ( pCell->n_outputs == 1 )
|
||||
{
|
||||
Abc_SclComputeParametersCell( p, pCell, Slew, &LD, &PD );
|
||||
printf( "D =%6.1f ps ", 0.01 * Gain * LD + PD );
|
||||
printf( "LD =%6.1f ps ", LD );
|
||||
printf( "PD =%6.1f ps ", PD );
|
||||
printf( "C =%5.1f ff ", SC_CellPinCapAve(pCell) );
|
||||
printf( "Cm =%5.0f ff ", SC_CellPin(pCell, pCell->n_inputs)->max_out_cap );
|
||||
printf( "Sm =%5.1f ps ", SC_CellPin(pCell, pCell->n_inputs)->max_out_slew );
|
||||
if ( Abc_SclComputeParametersCell( p, pCell, Slew, &LD, &PD ) )
|
||||
{
|
||||
printf( "D =%6.1f ps ", 0.01 * Gain * LD + PD );
|
||||
printf( "LD =%6.1f ps ", LD );
|
||||
printf( "PD =%6.1f ps ", PD );
|
||||
printf( "C =%5.1f ff ", SC_CellPinCapAve(pCell) );
|
||||
printf( "Cm =%5.0f ff ", SC_CellPin(pCell, pCell->n_inputs)->max_out_cap );
|
||||
printf( "Sm =%5.1f ps ", SC_CellPin(pCell, pCell->n_inputs)->max_out_slew );
|
||||
}
|
||||
}
|
||||
printf( "\n" );
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue