diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-12-07 01:31:41 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-12-07 01:31:41 -0800 |
commit | e9abb0f489857b71cc95af33024456a616c1e2df (patch) | |
tree | 89e8836a95470a591baa4bc676a241f1663f4d10 /src/map/mio | |
parent | 0f29ba75f6ec80b3eb1da4ef6b86157c7d5b8983 (diff) | |
download | abc-e9abb0f489857b71cc95af33024456a616c1e2df.tar.gz abc-e9abb0f489857b71cc95af33024456a616c1e2df.tar.bz2 abc-e9abb0f489857b71cc95af33024456a616c1e2df.zip |
Adding code to support gate profiles.
Diffstat (limited to 'src/map/mio')
-rw-r--r-- | src/map/mio/mio.h | 7 | ||||
-rw-r--r-- | src/map/mio/mioApi.c | 4 | ||||
-rw-r--r-- | src/map/mio/mioInt.h | 1 | ||||
-rw-r--r-- | src/map/mio/mioUtils.c | 39 |
4 files changed, 50 insertions, 1 deletions
diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index de9fb199..35b5641c 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -153,11 +153,15 @@ extern word Mio_GateReadTruth ( Mio_Gate_t * pGate ); extern int Mio_GateReadValue ( Mio_Gate_t * pGate ); extern int Mio_GateReadCell ( Mio_Gate_t * pGate ); extern int Mio_GateReadProfile ( Mio_Gate_t * pGate ); +extern int Mio_GateReadProfile2 ( Mio_Gate_t * pGate ); extern char * Mio_GateReadPinName ( Mio_Gate_t * pGate, int iPin ); extern float Mio_GateReadPinDelay ( Mio_Gate_t * pGate, int iPin ); extern void Mio_GateSetValue ( Mio_Gate_t * pGate, int Value ); extern void Mio_GateSetCell ( Mio_Gate_t * pGate, int Cell ); extern void Mio_GateSetProfile ( Mio_Gate_t * pGate, int Prof ); +extern void Mio_GateSetProfile2 ( Mio_Gate_t * pGate, int Prof ); +extern void Mio_GateIncProfile2 ( Mio_Gate_t * pGate ); +extern void Mio_GateDecProfile2 ( Mio_Gate_t * pGate ); extern int Mio_GateIsInv ( Mio_Gate_t * pGate ); extern char * Mio_PinReadName ( Mio_Pin_t * pPin ); extern Mio_PinPhase_t Mio_PinReadPhase ( Mio_Pin_t * pPin ); @@ -204,6 +208,9 @@ extern void Mio_LibraryTransferDelays( Mio_Library_t * pLibD, Mio_L extern void Mio_LibraryTransferCellIds(); extern void Mio_LibraryReadProfile( FILE * pFile, Mio_Library_t * pLib ); extern void Mio_LibraryWriteProfile( FILE * pFile, Mio_Library_t * pLib ); +extern void Mio_LibraryTransferProfile( Mio_Library_t * pLibDst, Mio_Library_t * pLibSrc ); +extern int Mio_LibraryHasProfile( Mio_Library_t * pLib ); +extern void Mio_LibraryCleanProfile2( Mio_Library_t * pLib ); /*=== sclUtil.c =========================================================*/ extern Mio_Library_t * Abc_SclDeriveGenlibSimple( void * pScl ); diff --git a/src/map/mio/mioApi.c b/src/map/mio/mioApi.c index 8fc11666..3d24f4d6 100644 --- a/src/map/mio/mioApi.c +++ b/src/map/mio/mioApi.c @@ -180,9 +180,13 @@ word * Mio_GateReadTruthP ( Mio_Gate_t * pGate ) { return int Mio_GateReadValue ( Mio_Gate_t * pGate ) { return pGate->Value; } int Mio_GateReadCell ( Mio_Gate_t * pGate ) { return pGate->Cell; } int Mio_GateReadProfile ( Mio_Gate_t * pGate ) { return pGate->Profile; } +int Mio_GateReadProfile2( Mio_Gate_t * pGate ) { return pGate->Profile2; } void Mio_GateSetValue ( Mio_Gate_t * pGate, int Value ) { pGate->Value = Value; } void Mio_GateSetCell ( Mio_Gate_t * pGate, int Cell ) { pGate->Cell = Cell; } void Mio_GateSetProfile ( Mio_Gate_t * pGate, int Prof ) { pGate->Profile = Prof; } +void Mio_GateSetProfile2 ( Mio_Gate_t * pGate, int Prof ) { pGate->Profile2 = Prof; } +void Mio_GateIncProfile2 ( Mio_Gate_t * pGate ) { pGate->Profile2++; } +void Mio_GateDecProfile2 ( Mio_Gate_t * pGate ) { pGate->Profile2--; } int Mio_GateIsInv ( Mio_Gate_t * pGate ) { return pGate->uTruth == ABC_CONST(0x5555555555555555); } /**Function************************************************************* diff --git a/src/map/mio/mioInt.h b/src/map/mio/mioInt.h index 394187c5..541a7a7f 100644 --- a/src/map/mio/mioInt.h +++ b/src/map/mio/mioInt.h @@ -96,6 +96,7 @@ struct Mio_GateStruct_t_ int Cell; // cell id int nInputs; // the number of inputs int Profile; // the number of occurrences + int Profile2; // the number of occurrences double dDelayMax; // the maximum delay char * pSop; // sum-of-products Vec_Int_t * vExpr; // boolean expression diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c index 5c8e1569..14b8b45d 100644 --- a/src/map/mio/mioUtils.c +++ b/src/map/mio/mioUtils.c @@ -413,16 +413,22 @@ Mio_Gate_t ** Mio_CollectRoots( Mio_Library_t * pLib, int nInputs, float tDelay, { Mio_Gate_t * pGate; Mio_Gate_t ** ppGates; - int i, nGates, iGate; + int i, nGates, iGate, fProfile; nGates = Mio_LibraryReadGateNum( pLib ); ppGates = ABC_ALLOC( Mio_Gate_t *, nGates ); iGate = 0; + // check if profile is entered + fProfile = Mio_LibraryHasProfile( pLib ); + if ( fProfile ) + printf( "Mio_CollectRoots(): Using gate profile to select gates for mapping.\n" ); // for each functionality, select gate with the smallest area // if equal areas, select gate with lexicographically smaller name Mio_LibraryForEachGate( pLib, pGate ) { if ( pGate->nInputs > nInputs ) continue; + if ( fProfile && Mio_GateReadProfile(pGate) == 0 && pGate->nInputs > 1 ) + continue; if ( tDelay > 0.0 && pGate->dDelayMax > (double)tDelay ) continue; if ( pGate->uTruth == 0 || pGate->uTruth == ~(word)0 ) @@ -1388,6 +1394,37 @@ void Mio_LibraryWriteProfile( FILE * pFile, Mio_Library_t * pLib ) fprintf( pFile, "%-24s %6d\n", Mio_GateReadName(pGate), Mio_GateReadProfile(pGate) ); } +int Mio_LibraryHasProfile( Mio_Library_t * pLib ) +{ + Mio_Gate_t * pGate; + Mio_LibraryForEachGate( pLib, pGate ) + if ( Mio_GateReadProfile(pGate) > 0 ) + return 1; + return 0; +} + +void Mio_LibraryTransferProfile( Mio_Library_t * pLibDst, Mio_Library_t * pLibSrc ) +{ + Mio_Gate_t * pGateSrc, * pGateDst; + Mio_LibraryForEachGate( pLibSrc, pGateSrc ) + if ( Mio_GateReadProfile(pGateSrc) > 0 ) + { + pGateDst = Mio_LibraryReadGateByName( pLibDst, Mio_GateReadName(pGateSrc), NULL ); + if ( pGateDst == NULL ) + { + printf( "Cannot find gate \"%s\" in library \"%s\".\n", Mio_GateReadName(pGateSrc), Mio_LibraryReadName(pLibDst) ); + continue; + } + Mio_GateSetProfile( pGateDst, Mio_GateReadProfile(pGateSrc) ); + } +} + +void Mio_LibraryCleanProfile2( Mio_Library_t * pLib ) +{ + Mio_Gate_t * pGate; + Mio_LibraryForEachGate( pLib, pGate ) + Mio_GateSetProfile2( pGate, 0 ); +} //////////////////////////////////////////////////////////////////////// /// END OF FILE /// |