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/mioUtils.c | |
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/mioUtils.c')
-rw-r--r-- | src/map/mio/mioUtils.c | 39 |
1 files changed, 38 insertions, 1 deletions
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 /// |