Skip to content

Commit

Permalink
Switch to reverse the order of bits.
Browse files Browse the repository at this point in the history
  • Loading branch information
alanminko committed Jan 19, 2024
1 parent 922ee4f commit 8da884d
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
2 changes: 1 addition & 1 deletion src/aig/gia/gia.h
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ extern void Gia_ManPrintStatsMiter( Gia_Man_t * p, int fVerbose )
extern void Gia_ManSetRegNum( Gia_Man_t * p, int nRegs );
extern void Gia_ManReportImprovement( Gia_Man_t * p, Gia_Man_t * pNew );
extern void Gia_ManPrintNpnClasses( Gia_Man_t * p );
extern void Gia_ManDumpVerilog( Gia_Man_t * p, char * pFileName, Vec_Int_t * vObjs, int fVerBufs, int fInter, int fInterComb, int fAssign );
extern void Gia_ManDumpVerilog( Gia_Man_t * p, char * pFileName, Vec_Int_t * vObjs, int fVerBufs, int fInter, int fInterComb, int fAssign, int fReverse );
/*=== giaMem.c ===========================================================*/
extern Gia_MmFixed_t * Gia_MmFixedStart( int nEntrySize, int nEntriesMax );
extern void Gia_MmFixedStop( Gia_MmFixed_t * p, int fVerbose );
Expand Down
28 changes: 14 additions & 14 deletions src/aig/gia/giaMan.c
Original file line number Diff line number Diff line change
Expand Up @@ -1408,17 +1408,17 @@ void Gia_ManWriteNames( FILE * pFile, char c, int n, Vec_Ptr_t * vNames, int Sta
fFirst = 0;
}
}
void Gia_ManDumpVerilog( Gia_Man_t * p, char * pFileName, Vec_Int_t * vObjs, int fVerBufs, int fInter, int fInterComb, int fAssign )
void Gia_ManDumpVerilog( Gia_Man_t * p, char * pFileName, Vec_Int_t * vObjs, int fVerBufs, int fInter, int fInterComb, int fAssign, int fReverse )
{
if ( fInterComb )
{
if ( fAssign ) {
extern void Gia_ManDumpInterfaceAssign( Gia_Man_t * p, char * pFileName );
Gia_ManDumpInterfaceAssign( p, pFileName );
extern void Gia_ManDumpInterfaceAssign( Gia_Man_t * p, char * pFileName, int fReverse );
Gia_ManDumpInterfaceAssign( p, pFileName, fReverse );
}
else {
extern void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName );
Gia_ManDumpInterface( p, pFileName );
extern void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName, int fReverse );
Gia_ManDumpInterface( p, pFileName, fReverse );
}
}
else
Expand Down Expand Up @@ -1855,7 +1855,7 @@ void Gia_ManDumpIoList( Gia_Man_t * p, FILE * pFile, int fOuts )
Vec_IntFree( vArray );
}
}
void Gia_ManDumpIoRanges( Gia_Man_t * p, FILE * pFile, int fOuts )
void Gia_ManDumpIoRanges( Gia_Man_t * p, FILE * pFile, int fOuts, int fReverse )
{
Vec_Ptr_t * vNames = fOuts ? p->vNamesOut : p->vNamesIn;
if ( p->vNamesOut == NULL )
Expand All @@ -1874,7 +1874,7 @@ void Gia_ManDumpIoRanges( Gia_Man_t * p, FILE * pFile, int fOuts )
int NumEnd = Gia_ManReadRangeNum( pNameLast, Size );
fprintf( pFile, " %s ", fOuts ? "output" : "input" );
if ( NumBeg != -1 && iName < iNameNext-1 )
fprintf( pFile, "[%d:%d] ", NumEnd, NumBeg );
fprintf( pFile, "[%d:%d] ", fReverse ? NumBeg : NumEnd, fReverse ? NumEnd : NumBeg );
Gia_ManPrintOneName( pFile, pName, Size );
fprintf( pFile, ";\n" );
}
Expand All @@ -1893,7 +1893,7 @@ void Gia_ManDumpIoRanges( Gia_Man_t * p, FILE * pFile, int fOuts )
SeeAlso []
***********************************************************************/
void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName )
void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName, int fReverse )
{
Gia_Obj_t * pObj;
Vec_Bit_t * vInvs, * vUsed;
Expand All @@ -1920,8 +1920,8 @@ void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName )
fprintf( pFile, ", " );
Gia_ManDumpIoList( p, pFile, 1 );
fprintf( pFile, " );\n\n" );
Gia_ManDumpIoRanges( p, pFile, 0 );
Gia_ManDumpIoRanges( p, pFile, 1 );
Gia_ManDumpIoRanges( p, pFile, 0, fReverse );
Gia_ManDumpIoRanges( p, pFile, 1, fReverse );
fprintf( pFile, "\n" );

fprintf( pFile, " wire " );
Expand Down Expand Up @@ -2004,7 +2004,7 @@ void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName )
Vec_BitFree( vInvs );
Vec_BitFree( vUsed );
}
void Gia_ManDumpInterfaceAssign( Gia_Man_t * p, char * pFileName )
void Gia_ManDumpInterfaceAssign( Gia_Man_t * p, char * pFileName, int fReverse )
{
Gia_Obj_t * pObj;
Vec_Bit_t * vInvs, * vUsed;
Expand All @@ -2031,8 +2031,8 @@ void Gia_ManDumpInterfaceAssign( Gia_Man_t * p, char * pFileName )
fprintf( pFile, ", " );
Gia_ManDumpIoList( p, pFile, 1 );
fprintf( pFile, " );\n\n" );
Gia_ManDumpIoRanges( p, pFile, 0 );
Gia_ManDumpIoRanges( p, pFile, 1 );
Gia_ManDumpIoRanges( p, pFile, 0, fReverse );
Gia_ManDumpIoRanges( p, pFile, 1, fReverse );
fprintf( pFile, "\n" );

fprintf( pFile, " wire " );
Expand Down Expand Up @@ -2189,7 +2189,7 @@ void Gia_GenSandwich( char ** pFNames, int nFNames, char * pFileName )
fprintf( pFile, "endmodule\n" );
fclose( pFile );
for ( i = 0; i < nFNames; i++ ) {
Gia_ManDumpVerilog( pGias[i], Extra_FileNameGenericAppend(pGias[i]->pSpec, ".v"), NULL, 0, 0, 1, 0 );
Gia_ManDumpVerilog( pGias[i], Extra_FileNameGenericAppend(pGias[i]->pSpec, ".v"), NULL, 0, 0, 1, 0, 0 );
printf( "Dumped Verilog file \"%s\"\n", Extra_FileNameGenericAppend(pGias[i]->pSpec, ".v") );
}
Gia_FreeMany( pGias, nFNames );
Expand Down
11 changes: 8 additions & 3 deletions src/base/abci/abc.c
Original file line number Diff line number Diff line change
Expand Up @@ -32070,9 +32070,10 @@ int Abc_CommandAbc9Write( Abc_Frame_t * pAbc, int argc, char ** argv )
int fMiniAig = 0;
int fMiniLut = 0;
int fWriteNewLine = 0;
int fReverse = 0;
int fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "upicabmlnvh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "upicabmlnrvh" ) ) != EOF )
{
switch ( c )
{
Expand Down Expand Up @@ -32103,6 +32104,9 @@ int Abc_CommandAbc9Write( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'n':
fWriteNewLine ^= 1;
break;
case 'r':
fReverse ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
Expand Down Expand Up @@ -32132,7 +32136,7 @@ int Abc_CommandAbc9Write( Abc_Frame_t * pAbc, int argc, char ** argv )
Gia_ManStop( pGia );
}
else if ( fVerilog )
Gia_ManDumpVerilog( pAbc->pGia, pFileName, NULL, fVerBufs, fInter, fInterComb, fAssign );
Gia_ManDumpVerilog( pAbc->pGia, pFileName, NULL, fVerBufs, fInter, fInterComb, fAssign, fReverse );
else if ( fMiniAig )
Gia_ManWriteMiniAig( pAbc->pGia, pFileName );
else if ( fMiniLut )
Expand All @@ -32142,7 +32146,7 @@ int Abc_CommandAbc9Write( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;

usage:
Abc_Print( -2, "usage: &w [-upicabmlnvh] <file>\n" );
Abc_Print( -2, "usage: &w [-upicabmlnrvh] <file>\n" );
Abc_Print( -2, "\t writes the current AIG into the AIGER file\n" );
Abc_Print( -2, "\t-u : toggle writing canonical AIG structure [default = %s]\n", fUnique? "yes" : "no" );
Abc_Print( -2, "\t-p : toggle writing Verilog with 'and' and 'not' [default = %s]\n", fVerilog? "yes" : "no" );
Expand All @@ -32153,6 +32157,7 @@ int Abc_CommandAbc9Write( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -2, "\t-m : toggle writing MiniAIG rather than AIGER [default = %s]\n", fMiniAig? "yes" : "no" );
Abc_Print( -2, "\t-l : toggle writing MiniLUT rather than AIGER [default = %s]\n", fMiniLut? "yes" : "no" );
Abc_Print( -2, "\t-n : toggle writing \'\\n\' after \'c\' in the AIGER file [default = %s]\n", fWriteNewLine? "yes": "no" );
Abc_Print( -2, "\t-r : toggle reversing the order of input/output bits [default = %s]\n", fReverse? "yes": "no" );
Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
Abc_Print( -2, "\t<file> : the file name\n");
Expand Down

0 comments on commit 8da884d

Please sign in to comment.