mirror of
https://github.com/YosysHQ/abc.git
synced 2026-09-04 08:33:58 +02:00
Added features 'map -M <float>' to control the use of large gates.
This commit is contained in:
@@ -345,7 +345,7 @@ char * Amap_LibertyGetStringFormula( Amap_Tree_t * p, Amap_Pair_t Pair )
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName )
|
||||
int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName, int fVerbose )
|
||||
{
|
||||
FILE * pFile;
|
||||
Amap_Item_t * pCell, * pArea, * pFunc, * pPin, * pOutput;
|
||||
@@ -390,24 +390,28 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName )
|
||||
continue;
|
||||
if ( Amap_LibertyCellIsFlop(p, pCell) )
|
||||
{
|
||||
printf( "Amap_LibertyPrintGenlib() skipped sequential cell \"%s\".\n", Amap_LibertyGetString(p, pCell->Head) );
|
||||
if ( fVerbose )
|
||||
printf( "Amap_LibertyPrintGenlib() skipped sequential cell \"%s\".\n", Amap_LibertyGetString(p, pCell->Head) );
|
||||
continue;
|
||||
}
|
||||
Counter = Amap_LibertyCellCountOutputs( p, pCell );
|
||||
if ( Counter == 0 )
|
||||
{
|
||||
printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" without logic function.\n", Amap_LibertyGetString(p, pCell->Head) );
|
||||
if ( fVerbose )
|
||||
printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" without logic function.\n", Amap_LibertyGetString(p, pCell->Head) );
|
||||
continue;
|
||||
}
|
||||
if ( Counter > 1 )
|
||||
{
|
||||
printf( "Amap_LibertyPrintGenlib() skipped multi-output cell \"%s\".\n", Amap_LibertyGetString(p, pCell->Head) );
|
||||
if ( fVerbose )
|
||||
printf( "Amap_LibertyPrintGenlib() skipped multi-output cell \"%s\".\n", Amap_LibertyGetString(p, pCell->Head) );
|
||||
continue;
|
||||
}
|
||||
pArea = Amap_LibertyCellArea( p, pCell );
|
||||
if ( pArea == NULL )
|
||||
{
|
||||
printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" with unspecified area.\n", Amap_LibertyGetString(p, pCell->Head) );
|
||||
if ( fVerbose )
|
||||
printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" with unspecified area.\n", Amap_LibertyGetString(p, pCell->Head) );
|
||||
continue;
|
||||
}
|
||||
pOutput = Amap_LibertyCellOutput( p, pCell );
|
||||
@@ -415,7 +419,8 @@ int Amap_LibertyPrintGenlib( Amap_Tree_t * p, char * pFileName )
|
||||
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 );
|
||||
if ( fVerbose )
|
||||
printf( "Amap_LibertyPrintGenlib() skipped cell \"%s\" with constant formula \"%s\".\n", Amap_LibertyGetString(p, pCell->Head), pForm );
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -900,7 +905,7 @@ int Amap_LibertyParse( char * pFileName, char * pFileGenlib, int fVerbose )
|
||||
if ( fVerbose )
|
||||
printf( "Parsing finished successfully.\n" );
|
||||
// Amap_LibertyPrintLiberty( p, "temp_.lib" );
|
||||
Amap_LibertyPrintGenlib( p, "temp.genlib" );
|
||||
Amap_LibertyPrintGenlib( p, "temp.genlib", fVerbose );
|
||||
RetValue = 1;
|
||||
}
|
||||
else
|
||||
|
||||
@@ -434,7 +434,8 @@ int Amap_LibParseEquations( Amap_Lib_t * p, int fVerbose )
|
||||
pTruth = Hop_ManConvertAigToTruth( pMan, pObj, pGate->nPins, vTruth, 0 );
|
||||
if ( Kit_TruthSupportSize(pTruth, pGate->nPins) < (int)pGate->nPins )
|
||||
{
|
||||
printf( "Skipping gate \"%s\" because its output \"%s\" does not depend on all input variables.\n", pGate->pName, pGate->pForm );
|
||||
if ( fVerbose )
|
||||
printf( "Skipping gate \"%s\" because its output \"%s\" does not depend on all input variables.\n", pGate->pName, pGate->pForm );
|
||||
continue;
|
||||
}
|
||||
pGate->pFunc = (unsigned *)Aig_MmFlexEntryFetch( p->pMemGates, sizeof(unsigned)*Abc_TruthWordNum(pGate->nPins) );
|
||||
@@ -459,7 +460,7 @@ int Amap_LibParseEquations( Amap_Lib_t * p, int fVerbose )
|
||||
***********************************************************************/
|
||||
void Amap_LibParseTest( char * pFileName )
|
||||
{
|
||||
int fVerbose = 1;
|
||||
int fVerbose = 0;
|
||||
Amap_Lib_t * p;
|
||||
clock_t clk = clock();
|
||||
p = Amap_LibReadFile( pFileName, fVerbose );
|
||||
|
||||
+3
-3
@@ -161,7 +161,7 @@ int Mio_CommandReadLiberty( Abc_Frame_t * pAbc, int argc, char **argv )
|
||||
pErr = Abc_FrameReadErr(pAbc);
|
||||
|
||||
// set the defaults
|
||||
fVerbose = 1;
|
||||
fVerbose = 0;
|
||||
Extra_UtilGetoptReset();
|
||||
while ( (c = Extra_UtilGetopt(argc, argv, "vh")) != EOF )
|
||||
{
|
||||
@@ -295,7 +295,7 @@ int Mio_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
|
||||
}
|
||||
// add the fixed number (wire delay) to all delays in the library
|
||||
if ( WireDelay != 0.0 )
|
||||
Mio_LibraryShift( pLib, WireDelay );
|
||||
Mio_LibraryShiftDelay( pLib, WireDelay );
|
||||
|
||||
// free the current superlib because it depends on the old Mio library
|
||||
if ( Abc_FrameReadLibSuper() )
|
||||
@@ -309,7 +309,7 @@ int Mio_CommandReadLibrary( Abc_Frame_t * pAbc, int argc, char **argv )
|
||||
Abc_FrameSetLibGen( pLib );
|
||||
|
||||
// set the new network
|
||||
pLib = (Mio_Library_t *)Amap_LibReadAndPrepare( FileName, 1, 0 );
|
||||
pLib = (Mio_Library_t *)Amap_LibReadAndPrepare( FileName, 0, 0 );
|
||||
if ( pLib == NULL )
|
||||
{
|
||||
fprintf( pErr, "Reading GENLIB library has failed.\n" );
|
||||
|
||||
+2
-1
@@ -149,7 +149,8 @@ extern void Mio_DeriveGateDelays( Mio_Gate_t * pGate,
|
||||
float ** ptPinDelays, int nPins, int nInputs, float tDelayZero,
|
||||
float * ptDelaysRes, float * ptPinDelayMax );
|
||||
extern Mio_Gate_t * Mio_GateCreatePseudo( int nInputs );
|
||||
extern void Mio_LibraryShift( Mio_Library_t * pLib, double Shift );
|
||||
extern void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift );
|
||||
extern void Mio_LibraryShiftArea( Mio_Library_t * pLib, double Shift );
|
||||
|
||||
ABC_NAMESPACE_HEADER_END
|
||||
|
||||
|
||||
+24
-1
@@ -16,6 +16,7 @@
|
||||
|
||||
***********************************************************************/
|
||||
|
||||
#include <math.h>
|
||||
#include "mioInt.h"
|
||||
#include "base/main/main.h"
|
||||
#include "exp.h"
|
||||
@@ -591,7 +592,7 @@ Mio_Gate_t * Mio_GateCreatePseudo( int nInputs )
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Mio_LibraryShift( Mio_Library_t * pLib, double Shift )
|
||||
void Mio_LibraryShiftDelay( Mio_Library_t * pLib, double Shift )
|
||||
{
|
||||
Mio_Gate_t * pGate;
|
||||
Mio_Pin_t * pPin;
|
||||
@@ -607,6 +608,28 @@ void Mio_LibraryShift( Mio_Library_t * pLib, double Shift )
|
||||
}
|
||||
}
|
||||
|
||||
/**Function*************************************************************
|
||||
|
||||
Synopsis [Multiply areas of all gates by values proportional to fanin count.]
|
||||
|
||||
Description []
|
||||
|
||||
SideEffects []
|
||||
|
||||
SeeAlso []
|
||||
|
||||
***********************************************************************/
|
||||
void Mio_LibraryShiftArea( Mio_Library_t * pLib, double Shift )
|
||||
{
|
||||
Mio_Gate_t * pGate;
|
||||
Mio_LibraryForEachGate( pLib, pGate )
|
||||
{
|
||||
// printf( "Before %8.3f ", pGate->dArea );
|
||||
pGate->dArea *= pow( pGate->nInputs, Shift );
|
||||
// printf( "After %8.3f Inputs = %d. Factor = %8.3f\n", pGate->dArea, pGate->nInputs, pow( pGate->nInputs, Shift ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
/// END OF FILE ///
|
||||
|
||||
Reference in New Issue
Block a user