diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2015-12-14 00:44:33 -0800 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2015-12-14 00:44:33 -0800 |
commit | 19586f105cd15279084541a5edf033724a32be49 (patch) | |
tree | 1a468a5de4856992b461532b3cc78911e363ff03 /src/map/mio | |
parent | 64afe6e9f861f8c570ba68c3a2d47ec92ebad96f (diff) | |
download | abc-19586f105cd15279084541a5edf033724a32be49.tar.gz abc-19586f105cd15279084541a5edf033724a32be49.tar.bz2 abc-19586f105cd15279084541a5edf033724a32be49.zip |
Adding code to support gate profiles.
Diffstat (limited to 'src/map/mio')
-rw-r--r-- | src/map/mio/mio.h | 5 | ||||
-rw-r--r-- | src/map/mio/mioApi.c | 54 | ||||
-rw-r--r-- | src/map/mio/mioUtils.c | 42 |
3 files changed, 71 insertions, 30 deletions
diff --git a/src/map/mio/mio.h b/src/map/mio/mio.h index 35b5641c..e4e15c6f 100644 --- a/src/map/mio/mio.h +++ b/src/map/mio/mio.h @@ -162,6 +162,8 @@ extern void Mio_GateSetProfile ( Mio_Gate_t * pGate, int Pro 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 void Mio_GateAddToProfile ( Mio_Gate_t * pGate, int Prof ); +extern void Mio_GateAddToProfile2 ( Mio_Gate_t * pGate, int Prof ); 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 ); @@ -209,12 +211,13 @@ 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 void Mio_LibraryTransferProfile2( 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 ); -extern Mio_Library_t * Abc_SclDeriveGenlib( void * pScl, float Slew, float Gain, int nGatesMin, int fVerbose ); +extern Mio_Library_t * Abc_SclDeriveGenlib( void * pScl, void * pMio, float Slew, float Gain, int nGatesMin, int fVerbose ); extern int Abc_SclHasDelayInfo( void * pScl ); diff --git a/src/map/mio/mioApi.c b/src/map/mio/mioApi.c index 3d24f4d6..82b76a27 100644 --- a/src/map/mio/mioApi.c +++ b/src/map/mio/mioApi.c @@ -163,31 +163,33 @@ char * Mio_LibraryReadSopByName( Mio_Library_t * pLib, char * pName ) SeeAlso [] ***********************************************************************/ -char * Mio_GateReadName ( Mio_Gate_t * pGate ) { return pGate->pName; } -char * Mio_GateReadOutName ( Mio_Gate_t * pGate ) { return pGate->pOutName; } -double Mio_GateReadArea ( Mio_Gate_t * pGate ) { return pGate->dArea; } -char * Mio_GateReadForm ( Mio_Gate_t * pGate ) { return pGate->pForm; } -Mio_Pin_t * Mio_GateReadPins ( Mio_Gate_t * pGate ) { return pGate->pPins; } -Mio_Library_t * Mio_GateReadLib ( Mio_Gate_t * pGate ) { return pGate->pLib; } -Mio_Gate_t * Mio_GateReadNext ( Mio_Gate_t * pGate ) { return pGate->pNext; } -Mio_Gate_t * Mio_GateReadTwin ( Mio_Gate_t * pGate ) { return pGate->pTwin; } -int Mio_GateReadPinNum ( Mio_Gate_t * pGate ) { return pGate->nInputs; } -double Mio_GateReadDelayMax( Mio_Gate_t * pGate ) { return pGate->dDelayMax; } -char * Mio_GateReadSop ( Mio_Gate_t * pGate ) { return pGate->pSop; } -Vec_Int_t * Mio_GateReadExpr ( Mio_Gate_t * pGate ) { return pGate->vExpr; } -word Mio_GateReadTruth ( Mio_Gate_t * pGate ) { return pGate->nInputs <= 6 ? pGate->uTruth : 0; } -word * Mio_GateReadTruthP ( Mio_Gate_t * pGate ) { return pGate->nInputs <= 6 ? NULL: pGate->pTruth; } -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); } +char * Mio_GateReadName ( Mio_Gate_t * pGate ) { return pGate->pName; } +char * Mio_GateReadOutName ( Mio_Gate_t * pGate ) { return pGate->pOutName; } +double Mio_GateReadArea ( Mio_Gate_t * pGate ) { return pGate->dArea; } +char * Mio_GateReadForm ( Mio_Gate_t * pGate ) { return pGate->pForm; } +Mio_Pin_t * Mio_GateReadPins ( Mio_Gate_t * pGate ) { return pGate->pPins; } +Mio_Library_t * Mio_GateReadLib ( Mio_Gate_t * pGate ) { return pGate->pLib; } +Mio_Gate_t * Mio_GateReadNext ( Mio_Gate_t * pGate ) { return pGate->pNext; } +Mio_Gate_t * Mio_GateReadTwin ( Mio_Gate_t * pGate ) { return pGate->pTwin; } +int Mio_GateReadPinNum ( Mio_Gate_t * pGate ) { return pGate->nInputs; } +double Mio_GateReadDelayMax ( Mio_Gate_t * pGate ) { return pGate->dDelayMax; } +char * Mio_GateReadSop ( Mio_Gate_t * pGate ) { return pGate->pSop; } +Vec_Int_t * Mio_GateReadExpr ( Mio_Gate_t * pGate ) { return pGate->vExpr; } +word Mio_GateReadTruth ( Mio_Gate_t * pGate ) { return pGate->nInputs <= 6 ? pGate->uTruth : 0; } +word * Mio_GateReadTruthP ( Mio_Gate_t * pGate ) { return pGate->nInputs <= 6 ? NULL: pGate->pTruth; } +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--; } +void Mio_GateAddToProfile ( Mio_Gate_t * pGate, int Prof ) { pGate->Profile += Prof; } +void Mio_GateAddToProfile2( Mio_Gate_t * pGate, int Prof ) { pGate->Profile2 += Prof; } +int Mio_GateIsInv ( Mio_Gate_t * pGate ) { return pGate->uTruth == ABC_CONST(0x5555555555555555); } /**Function************************************************************* @@ -208,7 +210,7 @@ double Mio_PinReadDelayBlockRise ( Mio_Pin_t * pPin ) { return p double Mio_PinReadDelayFanoutRise( Mio_Pin_t * pPin ) { return pPin->dDelayFanoutRise;} double Mio_PinReadDelayBlockFall ( Mio_Pin_t * pPin ) { return pPin->dDelayBlockFall; } double Mio_PinReadDelayFanoutFall( Mio_Pin_t * pPin ) { return pPin->dDelayFanoutFall;} -double Mio_PinReadDelayBlockMax ( Mio_Pin_t * pPin ) { return pPin->dDelayBlockMax; } +double Mio_PinReadDelayBlockMax ( Mio_Pin_t * pPin ) { return pPin->dDelayBlockMax; } Mio_Pin_t * Mio_PinReadNext ( Mio_Pin_t * pPin ) { return pPin->pNext; } /**Function************************************************************* diff --git a/src/map/mio/mioUtils.c b/src/map/mio/mioUtils.c index 14b8b45d..c7c6c6dc 100644 --- a/src/map/mio/mioUtils.c +++ b/src/map/mio/mioUtils.c @@ -1403,19 +1403,55 @@ int Mio_LibraryHasProfile( Mio_Library_t * pLib ) return 0; } + void Mio_LibraryTransferProfile( Mio_Library_t * pLibDst, Mio_Library_t * pLibSrc ) { Mio_Gate_t * pGateSrc, * pGateDst; + Mio_LibraryForEachGate( pLibDst, pGateDst ) + Mio_GateSetProfile( pGateDst, 0 ); Mio_LibraryForEachGate( pLibSrc, pGateSrc ) if ( Mio_GateReadProfile(pGateSrc) > 0 ) { + // find gate by name 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; + // find gate by function + Mio_LibraryForEachGate( pLibDst, pGateDst ) + if ( pGateDst->uTruth == pGateSrc->uTruth ) + break; + if ( pGateDst == NULL ) + { + printf( "Cannot find gate \"%s\" in library \"%s\".\n", Mio_GateReadName(pGateSrc), Mio_LibraryReadName(pLibDst) ); + continue; + } + } + Mio_GateAddToProfile( pGateDst, Mio_GateReadProfile(pGateSrc) ); + } +} +void Mio_LibraryTransferProfile2( Mio_Library_t * pLibDst, Mio_Library_t * pLibSrc ) +{ + Mio_Gate_t * pGateSrc, * pGateDst; + Mio_LibraryForEachGate( pLibDst, pGateDst ) + Mio_GateSetProfile2( pGateDst, 0 ); + Mio_LibraryForEachGate( pLibSrc, pGateSrc ) + if ( Mio_GateReadProfile2(pGateSrc) > 0 ) + { + // find gate by name + pGateDst = Mio_LibraryReadGateByName( pLibDst, Mio_GateReadName(pGateSrc), NULL ); + if ( pGateDst == NULL ) + { + // find gate by function + Mio_LibraryForEachGate( pLibDst, pGateDst ) + if ( pGateDst->uTruth == pGateSrc->uTruth ) + break; + 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) ); + Mio_GateAddToProfile2( pGateDst, Mio_GateReadProfile2(pGateSrc) ); } } |