From 3309ccabd4b5938b82690194d3bdd0cb1cb0461a Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sat, 26 Aug 2023 17:12:50 +0700 Subject: [PATCH] Cleaning up AIG output in EQN format. --- src/base/abc/abcNetlist.c | 2 +- src/base/abci/abcGen.c | 2 +- src/base/io/ioWriteEqn.c | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/base/abc/abcNetlist.c b/src/base/abc/abcNetlist.c index 75aa51ad9..8a2e9f184 100644 --- a/src/base/abc/abcNetlist.c +++ b/src/base/abc/abcNetlist.c @@ -220,7 +220,7 @@ Abc_Ntk_t * Abc_NtkLogicToNetlist( Abc_Ntk_t * pNtk ) if ( pObj->pCopy->pCopy ) // the net of the new object is already created continue; // create the new net - sprintf( Buffer, "new_%s_", Abc_ObjName(pObj) ); + sprintf( Buffer, "new_%s", Abc_ObjName(pObj) ); //pNet = Abc_NtkFindOrCreateNet( pNtkNew, Abc_ObjName(pObj) ); // here we create net names such as "n48", where 48 is the ID of the node pNet = Abc_NtkFindOrCreateNet( pNtkNew, Buffer ); Abc_ObjAddFanin( pNet, pObj->pCopy ); diff --git a/src/base/abci/abcGen.c b/src/base/abci/abcGen.c index bea20a6d7..7ffa90625 100644 --- a/src/base/abci/abcGen.c +++ b/src/base/abci/abcGen.c @@ -706,7 +706,7 @@ void Abc_GenRandom( char * pFileName, int nPis ) unsigned * pTruth; int i, b, w, nWords = Abc_TruthWordNum( nPis ); int nDigitsIn; - Aig_ManRandom( 1 ); + //Aig_ManRandom( 1 ); pTruth = ABC_ALLOC( unsigned, nWords ); for ( w = 0; w < nWords; w++ ) pTruth[w] = Aig_ManRandom( 0 ); diff --git a/src/base/io/ioWriteEqn.c b/src/base/io/ioWriteEqn.c index fb8ca43ee..b874effe0 100644 --- a/src/base/io/ioWriteEqn.c +++ b/src/base/io/ioWriteEqn.c @@ -85,6 +85,10 @@ void Io_WriteEqn( Abc_Ntk_t * pNtk, char * pFileName ) SeeAlso [] ***********************************************************************/ +char * Io_NamePrepro( char * pName ) +{ + return strncmp(pName, "new_", 4) ? pName : pName + 4; +} void Io_NtkWriteEqnOne( FILE * pFile, Abc_Ntk_t * pNtk ) { Vec_Vec_t * vLevels; @@ -108,10 +112,10 @@ void Io_NtkWriteEqnOne( FILE * pFile, Abc_Ntk_t * pNtk ) Abc_NtkForEachNode( pNtk, pNode, i ) { Extra_ProgressBarUpdate( pProgress, i, NULL ); - fprintf( pFile, "%s = ", Abc_ObjName(Abc_ObjFanout0(pNode)) ); + fprintf( pFile, "%s = ", Io_NamePrepro( Abc_ObjName(Abc_ObjFanout0(pNode)) ) ); // set the input names Abc_ObjForEachFanin( pNode, pFanin, k ) - Hop_IthVar((Hop_Man_t *)pNtk->pManFunc, k)->pData = Abc_ObjName(pFanin); + Hop_IthVar((Hop_Man_t *)pNtk->pManFunc, k)->pData = Io_NamePrepro( Abc_ObjName(pFanin) ); // write the formula Hop_ObjPrintEqn( pFile, (Hop_Obj_t *)pNode->pData, vLevels, 0 ); fprintf( pFile, ";\n" );