diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2011-03-18 19:48:42 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2011-03-18 19:48:42 -0700 |
commit | 3a6f8688e2655a6cf37ccd99ddba33b7f504c264 (patch) | |
tree | a99d26442f19e4505c085cd3e52820d0e0e1f3e7 /src/base | |
parent | ca5d7eef2f5fbaaf5b57f32bc0b4088682ec2323 (diff) | |
download | abc-3a6f8688e2655a6cf37ccd99ddba33b7f504c264.tar.gz abc-3a6f8688e2655a6cf37ccd99ddba33b7f504c264.tar.bz2 abc-3a6f8688e2655a6cf37ccd99ddba33b7f504c264.zip |
Added printing MFFC sizes and deriving TT from SOP.
Diffstat (limited to 'src/base')
-rw-r--r-- | src/base/abc/abc.h | 3 | ||||
-rw-r--r-- | src/base/abc/abcSop.c | 52 | ||||
-rw-r--r-- | src/base/abci/abc.c | 26 | ||||
-rw-r--r-- | src/base/abci/abcPrint.c | 11 |
4 files changed, 84 insertions, 8 deletions
diff --git a/src/base/abc/abc.h b/src/base/abc/abc.h index fbd6b479..74c4b01a 100644 --- a/src/base/abc/abc.h +++ b/src/base/abc/abc.h @@ -748,7 +748,7 @@ extern ABC_DLL void Abc_NtkPrintStats( Abc_Ntk_t * pNtk, int fFact extern ABC_DLL void Abc_NtkPrintIo( FILE * pFile, Abc_Ntk_t * pNtk ); extern ABC_DLL void Abc_NtkPrintLatch( FILE * pFile, Abc_Ntk_t * pNtk ); extern ABC_DLL void Abc_NtkPrintFanio( FILE * pFile, Abc_Ntk_t * pNtk ); -extern ABC_DLL void Abc_NtkPrintFanioNew( FILE * pFile, Abc_Ntk_t * pNtk ); +extern ABC_DLL void Abc_NtkPrintFanioNew( FILE * pFile, Abc_Ntk_t * pNtk, int fMffc ); extern ABC_DLL void Abc_NodePrintFanio( FILE * pFile, Abc_Obj_t * pNode ); extern ABC_DLL void Abc_NtkPrintFactor( FILE * pFile, Abc_Ntk_t * pNtk, int fUseRealNames ); extern ABC_DLL void Abc_NodePrintFactor( FILE * pFile, Abc_Obj_t * pNode, int fUseRealNames ); @@ -836,6 +836,7 @@ extern ABC_DLL char * Abc_SopEncoderPos( Mem_Flex_t * pMan, int iVal extern ABC_DLL char * Abc_SopEncoderLog( Mem_Flex_t * pMan, int iBit, int nValues ); extern ABC_DLL char * Abc_SopDecoderPos( Mem_Flex_t * pMan, int nValues ); extern ABC_DLL char * Abc_SopDecoderLog( Mem_Flex_t * pMan, int nValues ); +extern ABC_DLL word Abc_SopToTruth( char * pSop, int nInputs ); /*=== abcStrash.c ==========================================================*/ extern ABC_DLL Abc_Ntk_t * Abc_NtkStrash( Abc_Ntk_t * pNtk, int fAllNodes, int fCleanup, int fRecord ); extern ABC_DLL Abc_Obj_t * Abc_NodeStrash( Abc_Ntk_t * pNtkNew, Abc_Obj_t * pNode, int fRecord ); diff --git a/src/base/abc/abcSop.c b/src/base/abc/abcSop.c index e562a32a..2a4cf7d2 100644 --- a/src/base/abc/abcSop.c +++ b/src/base/abc/abcSop.c @@ -1149,6 +1149,58 @@ char * Abc_SopDecoderLog( Mem_Flex_t * pMan, int nValues ) return pResult; } +/**Function************************************************************* + + Synopsis [Computes truth table of the node.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +word Abc_SopToTruth( char * pSop, int nInputs ) +{ + static word Truth[8] = { + 0xAAAAAAAAAAAAAAAA, + 0xCCCCCCCCCCCCCCCC, + 0xF0F0F0F0F0F0F0F0, + 0xFF00FF00FF00FF00, + 0xFFFF0000FFFF0000, + 0xFFFFFFFF00000000, + 0x0000000000000000, + 0xFFFFFFFFFFFFFFFF + }; + word Cube, Result = 0; + int v, lit = 0; + int nVars = Abc_SopGetVarNum(pSop); + assert( nVars >= 0 && nVars <= 6 ); + assert( nVars == nInputs ); + do { + Cube = Truth[7]; + for ( v = 0; v < nVars; v++, lit++ ) + { + if ( pSop[lit] == '1' ) + Cube &= Truth[v]; + else if ( pSop[lit] == '0' ) + Cube &= ~Truth[v]; + else if ( pSop[lit] != '-' ) + assert( 0 ); + } + Result |= Cube; + assert( pSop[lit] == ' ' ); + lit++; + lit++; + assert( pSop[lit] == '\n' ); + lit++; + } while ( pSop[lit] ); + if ( Abc_SopIsComplement(pSop) ) + Result = ~Result; + return Result; +} + + //////////////////////////////////////////////////////////////////////// /// END OF FILE /// //////////////////////////////////////////////////////////////////////// diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c index c525cda1..123bed95 100644 --- a/src/base/abci/abc.c +++ b/src/base/abci/abc.c @@ -1231,15 +1231,20 @@ int Abc_CommandPrintFanio( Abc_Frame_t * pAbc, int argc, char ** argv ) { Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc); int c; + int fMffc; int fVerbose; // set defaults + fMffc = 0; fVerbose = 0; Extra_UtilGetoptReset(); - while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF ) + while ( ( c = Extra_UtilGetopt( argc, argv, "mvh" ) ) != EOF ) { switch ( c ) { + case 'm': + fMffc ^= 1; + break; case 'v': fVerbose ^= 1; break; @@ -1260,12 +1265,13 @@ int Abc_CommandPrintFanio( Abc_Frame_t * pAbc, int argc, char ** argv ) if ( fVerbose ) Abc_NtkPrintFanio( stdout, pNtk ); else - Abc_NtkPrintFanioNew( stdout, pNtk ); + Abc_NtkPrintFanioNew( stdout, pNtk, fMffc ); return 0; usage: - Abc_Print( -2, "usage: print_fanio [-vh]\n" ); + Abc_Print( -2, "usage: print_fanio [-mvh]\n" ); Abc_Print( -2, "\t prints the statistics about fanins/fanouts of all nodes\n" ); + Abc_Print( -2, "\t-m : toggles printing MFFC sizes instead of fanouts [default = %s]\n", fMffc? "yes": "no" ); Abc_Print( -2, "\t-v : toggles verbose way of printing the stats [default = %s]\n", fVerbose? "yes": "no" ); Abc_Print( -2, "\t-h : print the command usage\n"); return 1; @@ -8682,8 +8688,10 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) /* { - extern Abc_Ntk_t * Au_ManTransformTest( Abc_Ntk_t * pAig ); - pNtkRes = Au_ManTransformTest( pNtk ); +// extern Abc_Ntk_t * Au_ManTransformTest( Abc_Ntk_t * pAig ); + extern Abc_Ntk_t * Au_ManResubTest( Abc_Ntk_t * pAig ); +// pNtkRes = Au_ManTransformTest( pNtk ); + pNtkRes = Au_ManResubTest( pNtk ); if ( pNtkRes == NULL ) { Abc_Print( -1, "Command has failed.\n" ); @@ -8693,12 +8701,20 @@ int Abc_CommandTest( Abc_Frame_t * pAbc, int argc, char ** argv ) Abc_FrameReplaceCurrentNetwork( pAbc, pNtkRes ); } */ + /* { extern void Au_DsdVecTest( int nVars ); Au_DsdVecTest( 6 ); } */ +{ +// extern void Au_NtkReadFour( Abc_Ntk_t * pNtk ); +// extern void Au_Data4VerifyFour(); +// Au_NtkReadFour( pNtk ); +// Au_Data4VerifyFour(); +} + // Abc_NtkCheckAbsorb( pNtk, 4 ); /* diff --git a/src/base/abci/abcPrint.c b/src/base/abci/abcPrint.c index bd5f986f..3b0ab94a 100644 --- a/src/base/abci/abcPrint.c +++ b/src/base/abci/abcPrint.c @@ -535,7 +535,7 @@ void Abc_NtkPrintFanio( FILE * pFile, Abc_Ntk_t * pNtk ) SeeAlso [] ***********************************************************************/ -void Abc_NtkPrintFanioNew( FILE * pFile, Abc_Ntk_t * pNtk ) +void Abc_NtkPrintFanioNew( FILE * pFile, Abc_Ntk_t * pNtk, int fMffc ) { char Buffer[100]; Abc_Obj_t * pNode; @@ -548,9 +548,13 @@ void Abc_NtkPrintFanioNew( FILE * pFile, Abc_Ntk_t * pNtk ) nFaninsAll = nFanoutsAll = 0; Abc_NtkForEachNode( pNtk, pNode, i ) { + if ( fMffc && Abc_ObjFanoutNum(pNode) == 1 ) + continue; nFanins = Abc_ObjFaninNum(pNode); if ( Abc_NtkIsNetlist(pNtk) ) nFanouts = Abc_ObjFanoutNum( Abc_ObjFanout0(pNode) ); + else if ( fMffc ) + nFanouts = Abc_NodeMffcSize(pNode); else nFanouts = Abc_ObjFanoutNum(pNode); nFaninsAll += nFanins; @@ -567,12 +571,15 @@ void Abc_NtkPrintFanioNew( FILE * pFile, Abc_Ntk_t * pNtk ) // count the number of fanins and fanouts Abc_NtkForEachNode( pNtk, pNode, i ) { + if ( fMffc && Abc_ObjFanoutNum(pNode) == 1 ) + continue; nFanins = Abc_ObjFaninNum(pNode); if ( Abc_NtkIsNetlist(pNtk) ) nFanouts = Abc_ObjFanoutNum( Abc_ObjFanout0(pNode) ); + else if ( fMffc ) + nFanouts = Abc_NodeMffcSize(pNode); else nFanouts = Abc_ObjFanoutNum(pNode); -// nFanouts = Abc_NodeMffcSize(pNode); if ( nFanins < 10 ) Vec_IntAddToEntry( vFanins, nFanins, 1 ); |