diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-12-05 18:10:43 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-12-05 18:10:43 -0800 |
commit | 0f29ba75f6ec80b3eb1da4ef6b86157c7d5b8983 (patch) | |
tree | c4984999130dc532991ad02b1c44c9b1c6ce565d /src/map/mio/mioUtils.c | |
parent | 56880eab5294d8a13e012eeca1e68255f0bf0e68 (diff) | |
download | abc-0f29ba75f6ec80b3eb1da4ef6b86157c7d5b8983.tar.gz abc-0f29ba75f6ec80b3eb1da4ef6b86157c7d5b8983.tar.bz2 abc-0f29ba75f6ec80b3eb1da4ef6b86157c7d5b8983.zip |
Adding commands to read/write/print gate profiles.
Diffstat (limited to 'src/map/mio/mioUtils.c')
-rw-r--r-- | src/map/mio/mioUtils.c | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c index 623b7c84..5c8e1569 100644 --- a/src/map/mio/mioUtils.c +++ b/src/map/mio/mioUtils.c @@ -1345,6 +1345,49 @@ void Mio_LibraryTransferCellIds() } } +/**Function************************************************************* + + Synopsis [] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +void Mio_LibraryReadProfile( FILE * pFile, Mio_Library_t * pLib ) +{ + Mio_Gate_t * pGate; + char pBuffer[1000]; + while ( fgets( pBuffer, 1000, pFile ) != NULL ) + { + char * pToken = strtok( pBuffer, " \t\n" ); + if ( pToken == NULL ) + continue; + if ( pToken[0] == '#' ) + continue; + // read gate + pGate = Mio_LibraryReadGateByName( pLib, pToken, NULL ); + if ( pGate == NULL ) + { + printf( "Cannot find gate \"%s\" in library \"%s\".\n", Mio_GateReadName(pGate), Mio_LibraryReadName(pLib) ); + continue; + } + // read profile + pToken = strtok( NULL, " \t\n" ); + Mio_GateSetProfile( pGate, atoi(pToken) ); + } +} + +void Mio_LibraryWriteProfile( FILE * pFile, Mio_Library_t * pLib ) +{ + Mio_Gate_t * pGate; + Mio_LibraryForEachGate( pLib, pGate ) + if ( Mio_GateReadProfile(pGate) > 0 ) + fprintf( pFile, "%-24s %6d\n", Mio_GateReadName(pGate), Mio_GateReadProfile(pGate) ); +} + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// |