Modify default intermediate AIGER file name.

This commit is contained in:
Alan Mishchenko 2026-05-21 23:41:12 -07:00
parent f4d870e109
commit cd6e9b582b
2 changed files with 29 additions and 6 deletions

View File

@ -43284,6 +43284,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
Gia_Man_t * pGia;
char * pTemp;
char * pOrigFileName = NULL;
char * pFileTemp = NULL;
int fVerilog, fSystemVerilog;
*pAbc_ReadAigerOrVerilogFileStatus = 0;
@ -43312,17 +43313,24 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
Aig_Man_t * pAig = NULL;
char pCommand[2000];
char * pFileBase;
int RetValue;
int fSystemVerilog2 = pFileName2 && Extra_FileIsType( pFileName2, ".sv", NULL, NULL );
// Save the original filename before changing it
pOrigFileName = pFileName;
pFileBase = pTopModule ? Abc_UtilStrsav(pTopModule) :
Extra_FileNameGeneric( Extra_FileNameWithoutPath(pFileName) );
pFileTemp = ABC_ALLOC( char, strlen(pFileBase) + 5 );
sprintf( pFileTemp, "%s.aig", pFileBase );
ABC_FREE( pFileBase );
snprintf( pCommand, sizeof(pCommand),
"yosys -qp \"read_verilog %s%s %s%s%s%s; hierarchy %s%s; flatten; proc; opt; async2sync; opt; setundef -undriven -zero; techmap; memory -nomap; memory_map; dffunmap; opt_clean; opt_expr; %saigmap; write_aiger -symbols _temp_.aig\"",
"yosys -qp \"read_verilog %s%s %s%s%s%s; hierarchy %s%s; flatten; proc; opt; async2sync; opt; setundef -undriven -zero; techmap; memory -nomap; memory_map; dffunmap; opt_clean; opt_expr; %saigmap; write_aiger -symbols %s\"",
pDefines ? "-D" : "", pDefines ? pDefines : "",
(fSystemVerilog || fSystemVerilog2) ? "-sv " : "", pFileName,
pFileName2 ? " " : "", pFileName2 ? pFileName2 : "",
pTopModule ? "-top " : "-auto-top", pTopModule ? pTopModule : "",
pFileName2 ? "delete t:\\$scopeinfo; " : "" );
pFileName2 ? "delete t:\\$scopeinfo; " : "",
pFileTemp );
#if defined(__wasm)
RetValue = 1;
#else
@ -43331,14 +43339,16 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
if ( RetValue != 0 )
{
Abc_Print( -1, "Yosys command failed: \"%s\".\n", pCommand );
ABC_FREE( pFileTemp );
return NULL;
}
if ( pFileName2 )
{
Abc_Ntk_t * pNtk = Io_Read( "_temp_.aig", IO_FILE_AIGER, 1, 0 );
Abc_Ntk_t * pNtk = Io_Read( pFileTemp, IO_FILE_AIGER, 1, 0 );
if ( pNtk == NULL )
{
Abc_Print( -1, "Reading AIGER from file \"%s\" has failed.\n", "_temp_.aig" );
Abc_Print( -1, "Reading AIGER from file \"%s\" has failed.\n", pFileTemp );
ABC_FREE( pFileTemp );
return NULL;
}
pAig = Abc_NtkToDar( pNtk, 0, 1 );
@ -43346,6 +43356,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
if ( pAig == NULL )
{
Abc_Print( -1, "Converting the AIGER network into an internal AIG has failed.\n" );
ABC_FREE( pFileTemp );
return NULL;
}
pGia = Gia_ManFromAig( pAig );
@ -43353,7 +43364,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
}
else
{
pFileName = "_temp_.aig";
pFileName = pFileTemp;
pGia = Gia_AigerRead( pFileName, 0, 0, 0 );
}
}
@ -43362,6 +43373,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
if ( pGia == NULL )
{
Abc_Print( -1, "Reading AIGER from file \"%s\" has failed.\n", pFileName );
ABC_FREE( pFileTemp );
return NULL;
}
@ -43372,6 +43384,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
pGia->pSpec = Abc_UtilStrsav( pOrigFileName );
}
ABC_FREE( pFileTemp );
return pGia;
}

View File

@ -212,10 +212,15 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
{
Gia_Man_t * pGia = NULL;
char * pFileNames, * pCommand;
char * pFileTemp = "_temp_.aig";
char * pFileTemp, * pFileBase;
int fRtlil = nFileNames == 1 && strstr(ppFileNames[0], ".rtl") != NULL;
int fSVlog = Wln_FileNamesHasSv(ppFileNames, nFileNames);
int nCommand;
pFileBase = pTopModule ? Abc_UtilStrsav(pTopModule) :
Extra_FileNameGeneric( Extra_FileNameWithoutPath(ppFileNames[0]) );
pFileTemp = ABC_ALLOC( char, strlen(pFileBase) + 5 );
sprintf( pFileTemp, "%s.aig", pFileBase );
ABC_FREE( pFileBase );
pFileNames = Wln_FileNamesJoin( ppFileNames, nFileNames );
nCommand = strlen(Wln_GetYosysName()) + strlen(pFileNames) + (pDefines ? strlen(pDefines) : 0) + (pTopModule ? strlen(pTopModule) : 0) + strlen(pFileTemp) + 500;
pCommand = ABC_ALLOC( char, nCommand );
@ -238,6 +243,7 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
{
ABC_FREE( pCommand );
ABC_FREE( pFileNames );
ABC_FREE( pFileTemp );
return NULL;
}
ABC_FREE( pCommand );
@ -250,6 +256,7 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
if ( pNtk == NULL )
{
printf( "Reading AIGER from file \"%s\" has failed.\n", pFileTemp );
ABC_FREE( pFileTemp );
return NULL;
}
pAig = Abc_NtkToDar( pNtk, 0, 1 );
@ -257,6 +264,7 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
if ( pAig == NULL )
{
printf( "Converting the AIGER network into an internal AIG has failed.\n" );
ABC_FREE( pFileTemp );
return NULL;
}
pGia = fSkipStrash ? Gia_ManFromAigSimple(pAig) : Gia_ManFromAig(pAig);
@ -267,12 +275,14 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
if ( pGia == NULL )
{
printf( "Converting to AIG has failed.\n" );
ABC_FREE( pFileTemp );
return NULL;
}
ABC_FREE( pGia->pName );
pGia->pName = pTopModule ? Abc_UtilStrsav(pTopModule) :
Extra_FileNameGeneric( Extra_FileNameWithoutPath(ppFileNames[0]) );
unlink( pFileTemp );
ABC_FREE( pFileTemp );
// complement the outputs
if ( fInvert )
{