summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2020-03-29 20:32:06 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2020-03-29 20:32:06 -0700
commit1b83b4b2736a2402647a7036a76362860bc1a0ee (patch)
treecf5e1e8dacce1b65ecfad54c6a23b6481ad260c5
parent8654192586079916c614dc3a4c62a1cdfd459fee (diff)
downloadabc-1b83b4b2736a2402647a7036a76362860bc1a0ee.tar.gz
abc-1b83b4b2736a2402647a7036a76362860bc1a0ee.tar.bz2
abc-1b83b4b2736a2402647a7036a76362860bc1a0ee.zip
Various changes.
-rw-r--r--src/base/abci/abc.c12
-rw-r--r--src/base/acb/acbUtil.c21
-rw-r--r--src/misc/util/abc_global.h6
3 files changed, 24 insertions, 15 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index 61f7f06b..cd0bf509 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -7154,9 +7154,9 @@ usage:
***********************************************************************/
int Abc_CommandRunSim( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- extern void Acb_NtkRunSim( char * pFileName[4], int nWords, int nBeam, int LevL, int LevU, int fOrder, int fFancy, int fVerbose );
+ extern void Acb_NtkRunSim( char * pFileName[4], int nWords, int nBeam, int LevL, int LevU, int fOrder, int fFancy, int fUseBuf, int fVerbose );
char * pFileNames[4] = {NULL, NULL, "out.v", NULL};
- int c, nWords = 4, nBeam = 4, LevL = 0, LevU = 0, fOrder = 0, fFancy = 0, fVerbose = 0;
+ int c, nWords = 4, nBeam = 4, LevL = -1, LevU = -1, fOrder = 0, fFancy = 0, fUseBuf = 0, fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "WBLUofvh" ) ) != EOF )
{
@@ -7212,6 +7212,9 @@ int Abc_CommandRunSim( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'f':
fFancy ^= 1;
break;
+ case 'b':
+ fUseBuf ^= 1;
+ break;
case 'v':
fVerbose ^= 1;
break;
@@ -7229,11 +7232,11 @@ int Abc_CommandRunSim( Abc_Frame_t * pAbc, int argc, char ** argv )
Gia_ManRandom(1);
for ( c = 0; c < argc - globalUtilOptind; c++ )
pFileNames[c] = argv[globalUtilOptind+c];
- Acb_NtkRunSim( pFileNames, nWords, nBeam, LevL, LevU, fOrder, fFancy, fVerbose );
+ Acb_NtkRunSim( pFileNames, nWords, nBeam, LevL, LevU, fOrder, fFancy, fUseBuf, fVerbose );
return 0;
usage:
- Abc_Print( -2, "usage: runsim [-WBLU] [-ofvh] [-N <num>] <file1> <file2> <file3>\n" );
+ Abc_Print( -2, "usage: runsim [-WBLU] [-ofbvh] [-N <num>] <file1> <file2> <file3>\n" );
Abc_Print( -2, "\t experimental simulation command\n" );
Abc_Print( -2, "\t-W <num> : the number of words of simulation info [default = %d]\n", nWords );
Abc_Print( -2, "\t-B <num> : the beam width parameter [default = %d]\n", nBeam );
@@ -7241,6 +7244,7 @@ usage:
Abc_Print( -2, "\t-U <num> : the upper bound on level [default = %d]\n", LevU );
Abc_Print( -2, "\t-o : toggle using a different node ordering [default = %s]\n", fOrder? "yes": "no" );
Abc_Print( -2, "\t-f : toggle using experimental feature [default = %s]\n", fFancy? "yes": "no" );
+ Abc_Print( -2, "\t-b : toggle using buffers [default = %s]\n", fUseBuf? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
diff --git a/src/base/acb/acbUtil.c b/src/base/acb/acbUtil.c
index 39c97859..11af9c01 100644
--- a/src/base/acb/acbUtil.c
+++ b/src/base/acb/acbUtil.c
@@ -503,7 +503,7 @@ Vec_Int_t * Acb_NtkFindNodes2( Acb_Ntk_t * p )
Acb_NtkFindNodes2_rec( p, Acb_ObjFanin(p, iObj, 0), vNodes );
return vNodes;
}
-int Acb_ObjToGia2( Gia_Man_t * pNew, Acb_Ntk_t * p, int iObj, Vec_Int_t * vTemp, int fUseXors )
+int Acb_ObjToGia2( Gia_Man_t * pNew, int fUseBuf, Acb_Ntk_t * p, int iObj, Vec_Int_t * vTemp, int fUseXors )
{
//char * pName = Abc_NamStr( p->pDesign->pStrs, Acb_ObjName(p, iObj) );
int * pFanin, iFanin, k, Type, Res;
@@ -521,8 +521,7 @@ int Acb_ObjToGia2( Gia_Man_t * pNew, Acb_Ntk_t * p, int iObj, Vec_Int_t * vTemp,
return 1;
if ( Type == ABC_OPER_BIT_BUF || Type == ABC_OPER_BIT_INV )
{
- Res = fUseXors ? Gia_ManAppendBuf(pNew, Vec_IntEntry(vTemp, 0)) : Vec_IntEntry(vTemp, 0);
- //Res = Vec_IntEntry(vTemp, 0);
+ Res = fUseBuf ? Gia_ManAppendBuf(pNew, Vec_IntEntry(vTemp, 0)) : Vec_IntEntry(vTemp, 0);
return Abc_LitNotCond( Res, Type == ABC_OPER_BIT_INV );
}
if ( Type == ABC_OPER_BIT_AND || Type == ABC_OPER_BIT_NAND )
@@ -549,7 +548,7 @@ int Acb_ObjToGia2( Gia_Man_t * pNew, Acb_Ntk_t * p, int iObj, Vec_Int_t * vTemp,
assert( 0 );
return -1;
}
-Gia_Man_t * Acb_NtkToGia2( Acb_Ntk_t * p, int fUseXors, Vec_Int_t * vTargets, int nTargets )
+Gia_Man_t * Acb_NtkToGia2( Acb_Ntk_t * p, int fUseBuf, int fUseXors, Vec_Int_t * vTargets, int nTargets )
{
Gia_Man_t * pNew, * pOne;
Vec_Int_t * vFanins, * vNodes;
@@ -569,7 +568,7 @@ Gia_Man_t * Acb_NtkToGia2( Acb_Ntk_t * p, int fUseXors, Vec_Int_t * vTargets, in
vNodes = Acb_NtkFindNodes2( p );
Vec_IntForEachEntry( vNodes, iObj, i )
if ( Acb_ObjCopy(p, iObj) == -1 ) // skip targets assigned above
- Acb_ObjSetCopy( p, iObj, Acb_ObjToGia2(pNew, p, iObj, vFanins, fUseXors) );
+ Acb_ObjSetCopy( p, iObj, Acb_ObjToGia2(pNew, fUseBuf, p, iObj, vFanins, fUseXors) );
Vec_IntFree( vNodes );
Vec_IntFree( vFanins );
Acb_NtkForEachCo( p, iObj, i )
@@ -661,7 +660,7 @@ Vec_Int_t * Acb_NtkCollectUser( Acb_Ntk_t * p, Vec_Ptr_t * vUser )
***********************************************************************/
int Acb_NtkExtract( char * pFileName0, char * pFileName1, int fUseXors, int fVerbose,
- Gia_Man_t ** ppGiaF, Gia_Man_t ** ppGiaG, Vec_Int_t ** pvNodes, Vec_Ptr_t ** pvNodesR, Vec_Bit_t ** pvPolar )
+ Gia_Man_t ** ppGiaF, Gia_Man_t ** ppGiaG, int fUseBuf, Vec_Int_t ** pvNodes, Vec_Ptr_t ** pvNodesR, Vec_Bit_t ** pvPolar )
{
extern Acb_Ntk_t * Acb_VerilogSimpleRead( char * pFileName, char * pFileNameW );
Acb_Ntk_t * pNtkF = Acb_VerilogSimpleRead( pFileName0, NULL );
@@ -670,8 +669,8 @@ int Acb_NtkExtract( char * pFileName0, char * pFileName1, int fUseXors, int fVer
if ( pNtkF && pNtkG )
{
int nTargets = Vec_IntSize(&pNtkF->vTargets);
- Gia_Man_t * pGiaF = Acb_NtkToGia2( pNtkF, fUseXors, &pNtkF->vTargets, 0 );
- Gia_Man_t * pGiaG = Acb_NtkToGia2( pNtkG, 0, NULL, nTargets );
+ Gia_Man_t * pGiaF = Acb_NtkToGia2( pNtkF, fUseBuf, fUseXors, &pNtkF->vTargets, 0 );
+ Gia_Man_t * pGiaG = Acb_NtkToGia2( pNtkG, 0, 0, NULL, nTargets );
assert( Acb_NtkCiNum(pNtkF) == Acb_NtkCiNum(pNtkG) );
assert( Acb_NtkCoNum(pNtkF) == Acb_NtkCoNum(pNtkG) );
*ppGiaF = pGiaF;
@@ -919,12 +918,12 @@ void Acb_NtkInsert( char * pFileNameIn, char * pFileNameOut, Vec_Ptr_t * vNames,
SeeAlso []
***********************************************************************/
-void Acb_NtkRunSim( char * pFileName[4], int nWords, int nBeam, int LevL, int LevU, int fOrder, int fFancy, int fVerbose )
+void Acb_NtkRunSim( char * pFileName[4], int nWords, int nBeam, int LevL, int LevU, int fOrder, int fFancy, int fUseBuf, int fVerbose )
{
- extern int Gia_Sim4Try( char * pFileName0, char * pFileName1, char * pFileName2, int nWords, int nBeam, int LevL, int LevU, int fOrder, int fFancy, int fVerbose );
+ extern int Gia_Sim4Try( char * pFileName0, char * pFileName1, char * pFileName2, int nWords, int nBeam, int LevL, int LevU, int fOrder, int fFancy, int fUseBuf, int fVerbose );
extern void Acb_NtkRunEco( char * pFileNames[4], int fCheck, int fVerbose );
char * pFileNames[4] = { pFileName[2], pFileName[1], NULL, pFileName[2] };
- if ( Gia_Sim4Try( pFileName[0], pFileName[1], pFileName[2], nWords, nBeam, LevL, LevU, fOrder, fFancy, fVerbose ) )
+ if ( Gia_Sim4Try( pFileName[0], pFileName[1], pFileName[2], nWords, nBeam, LevL, LevU, fOrder, fFancy, fUseBuf, fVerbose ) )
Acb_NtkRunEco( pFileNames, 1, fVerbose );
}
diff --git a/src/misc/util/abc_global.h b/src/misc/util/abc_global.h
index 7b7029be..d7c5bea7 100644
--- a/src/misc/util/abc_global.h
+++ b/src/misc/util/abc_global.h
@@ -502,6 +502,12 @@ static inline void * Abc_FileReadContents( char * pFileName, int * pnFileSize )
fclose( pFile );
return (void *)pBuffer;
}
+static inline void Abc_ReverseOrder( int * pA, int nA )
+{
+ int i;
+ for ( i = 0; i < nA/2; i++ )
+ ABC_SWAP( int, pA[i], pA[nA-1-i] );
+}
// sorting