Switch to reverse the order of bits.

This commit is contained in:
Alan Mishchenko 2024-01-18 18:23:11 -08:00
parent 922ee4f93d
commit 8da884de85
3 changed files with 23 additions and 18 deletions

View File

@ -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_ManSetRegNum( Gia_Man_t * p, int nRegs );
extern void Gia_ManReportImprovement( Gia_Man_t * p, Gia_Man_t * pNew ); extern void Gia_ManReportImprovement( Gia_Man_t * p, Gia_Man_t * pNew );
extern void Gia_ManPrintNpnClasses( Gia_Man_t * p ); 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 ===========================================================*/ /*=== giaMem.c ===========================================================*/
extern Gia_MmFixed_t * Gia_MmFixedStart( int nEntrySize, int nEntriesMax ); extern Gia_MmFixed_t * Gia_MmFixedStart( int nEntrySize, int nEntriesMax );
extern void Gia_MmFixedStop( Gia_MmFixed_t * p, int fVerbose ); extern void Gia_MmFixedStop( Gia_MmFixed_t * p, int fVerbose );

View File

@ -1408,17 +1408,17 @@ void Gia_ManWriteNames( FILE * pFile, char c, int n, Vec_Ptr_t * vNames, int Sta
fFirst = 0; 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 ( fInterComb )
{ {
if ( fAssign ) { if ( fAssign ) {
extern void Gia_ManDumpInterfaceAssign( Gia_Man_t * p, char * pFileName ); extern void Gia_ManDumpInterfaceAssign( Gia_Man_t * p, char * pFileName, int fReverse );
Gia_ManDumpInterfaceAssign( p, pFileName ); Gia_ManDumpInterfaceAssign( p, pFileName, fReverse );
} }
else { else {
extern void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName ); extern void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName, int fReverse );
Gia_ManDumpInterface( p, pFileName ); Gia_ManDumpInterface( p, pFileName, fReverse );
} }
} }
else else
@ -1855,7 +1855,7 @@ void Gia_ManDumpIoList( Gia_Man_t * p, FILE * pFile, int fOuts )
Vec_IntFree( vArray ); 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; Vec_Ptr_t * vNames = fOuts ? p->vNamesOut : p->vNamesIn;
if ( p->vNamesOut == NULL ) if ( p->vNamesOut == NULL )
@ -1874,7 +1874,7 @@ void Gia_ManDumpIoRanges( Gia_Man_t * p, FILE * pFile, int fOuts )
int NumEnd = Gia_ManReadRangeNum( pNameLast, Size ); int NumEnd = Gia_ManReadRangeNum( pNameLast, Size );
fprintf( pFile, " %s ", fOuts ? "output" : "input" ); fprintf( pFile, " %s ", fOuts ? "output" : "input" );
if ( NumBeg != -1 && iName < iNameNext-1 ) 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 ); Gia_ManPrintOneName( pFile, pName, Size );
fprintf( pFile, ";\n" ); fprintf( pFile, ";\n" );
} }
@ -1893,7 +1893,7 @@ void Gia_ManDumpIoRanges( Gia_Man_t * p, FILE * pFile, int fOuts )
SeeAlso [] 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; Gia_Obj_t * pObj;
Vec_Bit_t * vInvs, * vUsed; Vec_Bit_t * vInvs, * vUsed;
@ -1920,8 +1920,8 @@ void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName )
fprintf( pFile, ", " ); fprintf( pFile, ", " );
Gia_ManDumpIoList( p, pFile, 1 ); Gia_ManDumpIoList( p, pFile, 1 );
fprintf( pFile, " );\n\n" ); fprintf( pFile, " );\n\n" );
Gia_ManDumpIoRanges( p, pFile, 0 ); Gia_ManDumpIoRanges( p, pFile, 0, fReverse );
Gia_ManDumpIoRanges( p, pFile, 1 ); Gia_ManDumpIoRanges( p, pFile, 1, fReverse );
fprintf( pFile, "\n" ); fprintf( pFile, "\n" );
fprintf( pFile, " wire " ); fprintf( pFile, " wire " );
@ -2004,7 +2004,7 @@ void Gia_ManDumpInterface( Gia_Man_t * p, char * pFileName )
Vec_BitFree( vInvs ); Vec_BitFree( vInvs );
Vec_BitFree( vUsed ); 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; Gia_Obj_t * pObj;
Vec_Bit_t * vInvs, * vUsed; Vec_Bit_t * vInvs, * vUsed;
@ -2031,8 +2031,8 @@ void Gia_ManDumpInterfaceAssign( Gia_Man_t * p, char * pFileName )
fprintf( pFile, ", " ); fprintf( pFile, ", " );
Gia_ManDumpIoList( p, pFile, 1 ); Gia_ManDumpIoList( p, pFile, 1 );
fprintf( pFile, " );\n\n" ); fprintf( pFile, " );\n\n" );
Gia_ManDumpIoRanges( p, pFile, 0 ); Gia_ManDumpIoRanges( p, pFile, 0, fReverse );
Gia_ManDumpIoRanges( p, pFile, 1 ); Gia_ManDumpIoRanges( p, pFile, 1, fReverse );
fprintf( pFile, "\n" ); fprintf( pFile, "\n" );
fprintf( pFile, " wire " ); fprintf( pFile, " wire " );
@ -2189,7 +2189,7 @@ void Gia_GenSandwich( char ** pFNames, int nFNames, char * pFileName )
fprintf( pFile, "endmodule\n" ); fprintf( pFile, "endmodule\n" );
fclose( pFile ); fclose( pFile );
for ( i = 0; i < nFNames; i++ ) { 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") ); printf( "Dumped Verilog file \"%s\"\n", Extra_FileNameGenericAppend(pGias[i]->pSpec, ".v") );
} }
Gia_FreeMany( pGias, nFNames ); Gia_FreeMany( pGias, nFNames );

View File

@ -32070,9 +32070,10 @@ int Abc_CommandAbc9Write( Abc_Frame_t * pAbc, int argc, char ** argv )
int fMiniAig = 0; int fMiniAig = 0;
int fMiniLut = 0; int fMiniLut = 0;
int fWriteNewLine = 0; int fWriteNewLine = 0;
int fReverse = 0;
int fVerbose = 0; int fVerbose = 0;
Extra_UtilGetoptReset(); Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "upicabmlnvh" ) ) != EOF ) while ( ( c = Extra_UtilGetopt( argc, argv, "upicabmlnrvh" ) ) != EOF )
{ {
switch ( c ) switch ( c )
{ {
@ -32103,6 +32104,9 @@ int Abc_CommandAbc9Write( Abc_Frame_t * pAbc, int argc, char ** argv )
case 'n': case 'n':
fWriteNewLine ^= 1; fWriteNewLine ^= 1;
break; break;
case 'r':
fReverse ^= 1;
break;
case 'v': case 'v':
fVerbose ^= 1; fVerbose ^= 1;
break; break;
@ -32132,7 +32136,7 @@ int Abc_CommandAbc9Write( Abc_Frame_t * pAbc, int argc, char ** argv )
Gia_ManStop( pGia ); Gia_ManStop( pGia );
} }
else if ( fVerilog ) 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 ) else if ( fMiniAig )
Gia_ManWriteMiniAig( pAbc->pGia, pFileName ); Gia_ManWriteMiniAig( pAbc->pGia, pFileName );
else if ( fMiniLut ) else if ( fMiniLut )
@ -32142,7 +32146,7 @@ int Abc_CommandAbc9Write( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0; return 0;
usage: 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 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-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" ); Abc_Print( -2, "\t-p : toggle writing Verilog with 'and' and 'not' [default = %s]\n", fVerilog? "yes" : "no" );
@ -32153,6 +32157,7 @@ usage:
Abc_Print( -2, "\t-m : toggle writing MiniAIG rather than AIGER [default = %s]\n", fMiniAig? "yes" : "no" ); 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-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-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-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n"); Abc_Print( -2, "\t-h : print the command usage\n");
Abc_Print( -2, "\t<file> : the file name\n"); Abc_Print( -2, "\t<file> : the file name\n");