Skip to content

Commit cd6e9b5

Browse files
committed
Modify default intermediate AIGER file name.
1 parent f4d870e commit cd6e9b5

2 files changed

Lines changed: 29 additions & 6 deletions

File tree

src/base/abci/abc.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43284,6 +43284,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
4328443284
Gia_Man_t * pGia;
4328543285
char * pTemp;
4328643286
char * pOrigFileName = NULL;
43287+
char * pFileTemp = NULL;
4328743288
int fVerilog, fSystemVerilog;
4328843289

4328943290
*pAbc_ReadAigerOrVerilogFileStatus = 0;
@@ -43312,17 +43313,24 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
4331243313
extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
4331343314
Aig_Man_t * pAig = NULL;
4331443315
char pCommand[2000];
43316+
char * pFileBase;
4331543317
int RetValue;
4331643318
int fSystemVerilog2 = pFileName2 && Extra_FileIsType( pFileName2, ".sv", NULL, NULL );
4331743319
// Save the original filename before changing it
4331843320
pOrigFileName = pFileName;
43321+
pFileBase = pTopModule ? Abc_UtilStrsav(pTopModule) :
43322+
Extra_FileNameGeneric( Extra_FileNameWithoutPath(pFileName) );
43323+
pFileTemp = ABC_ALLOC( char, strlen(pFileBase) + 5 );
43324+
sprintf( pFileTemp, "%s.aig", pFileBase );
43325+
ABC_FREE( pFileBase );
4331943326
snprintf( pCommand, sizeof(pCommand),
43320-
"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\"",
43327+
"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\"",
4332143328
pDefines ? "-D" : "", pDefines ? pDefines : "",
4332243329
(fSystemVerilog || fSystemVerilog2) ? "-sv " : "", pFileName,
4332343330
pFileName2 ? " " : "", pFileName2 ? pFileName2 : "",
4332443331
pTopModule ? "-top " : "-auto-top", pTopModule ? pTopModule : "",
43325-
pFileName2 ? "delete t:\\$scopeinfo; " : "" );
43332+
pFileName2 ? "delete t:\\$scopeinfo; " : "",
43333+
pFileTemp );
4332643334
#if defined(__wasm)
4332743335
RetValue = 1;
4332843336
#else
@@ -43331,29 +43339,32 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
4333143339
if ( RetValue != 0 )
4333243340
{
4333343341
Abc_Print( -1, "Yosys command failed: \"%s\".\n", pCommand );
43342+
ABC_FREE( pFileTemp );
4333443343
return NULL;
4333543344
}
4333643345
if ( pFileName2 )
4333743346
{
43338-
Abc_Ntk_t * pNtk = Io_Read( "_temp_.aig", IO_FILE_AIGER, 1, 0 );
43347+
Abc_Ntk_t * pNtk = Io_Read( pFileTemp, IO_FILE_AIGER, 1, 0 );
4333943348
if ( pNtk == NULL )
4334043349
{
43341-
Abc_Print( -1, "Reading AIGER from file \"%s\" has failed.\n", "_temp_.aig" );
43350+
Abc_Print( -1, "Reading AIGER from file \"%s\" has failed.\n", pFileTemp );
43351+
ABC_FREE( pFileTemp );
4334243352
return NULL;
4334343353
}
4334443354
pAig = Abc_NtkToDar( pNtk, 0, 1 );
4334543355
Abc_NtkDelete( pNtk );
4334643356
if ( pAig == NULL )
4334743357
{
4334843358
Abc_Print( -1, "Converting the AIGER network into an internal AIG has failed.\n" );
43359+
ABC_FREE( pFileTemp );
4334943360
return NULL;
4335043361
}
4335143362
pGia = Gia_ManFromAig( pAig );
4335243363
Aig_ManStop( pAig );
4335343364
}
4335443365
else
4335543366
{
43356-
pFileName = "_temp_.aig";
43367+
pFileName = pFileTemp;
4335743368
pGia = Gia_AigerRead( pFileName, 0, 0, 0 );
4335843369
}
4335943370
}
@@ -43362,6 +43373,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
4336243373
if ( pGia == NULL )
4336343374
{
4336443375
Abc_Print( -1, "Reading AIGER from file \"%s\" has failed.\n", pFileName );
43376+
ABC_FREE( pFileTemp );
4336543377
return NULL;
4336643378
}
4336743379

@@ -43372,6 +43384,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
4337243384
pGia->pSpec = Abc_UtilStrsav( pOrigFileName );
4337343385
}
4337443386

43387+
ABC_FREE( pFileTemp );
4337543388
return pGia;
4337643389
}
4337743390

src/base/wln/wlnRtl.c

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,15 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
212212
{
213213
Gia_Man_t * pGia = NULL;
214214
char * pFileNames, * pCommand;
215-
char * pFileTemp = "_temp_.aig";
215+
char * pFileTemp, * pFileBase;
216216
int fRtlil = nFileNames == 1 && strstr(ppFileNames[0], ".rtl") != NULL;
217217
int fSVlog = Wln_FileNamesHasSv(ppFileNames, nFileNames);
218218
int nCommand;
219+
pFileBase = pTopModule ? Abc_UtilStrsav(pTopModule) :
220+
Extra_FileNameGeneric( Extra_FileNameWithoutPath(ppFileNames[0]) );
221+
pFileTemp = ABC_ALLOC( char, strlen(pFileBase) + 5 );
222+
sprintf( pFileTemp, "%s.aig", pFileBase );
223+
ABC_FREE( pFileBase );
219224
pFileNames = Wln_FileNamesJoin( ppFileNames, nFileNames );
220225
nCommand = strlen(Wln_GetYosysName()) + strlen(pFileNames) + (pDefines ? strlen(pDefines) : 0) + (pTopModule ? strlen(pTopModule) : 0) + strlen(pFileTemp) + 500;
221226
pCommand = ABC_ALLOC( char, nCommand );
@@ -238,6 +243,7 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
238243
{
239244
ABC_FREE( pCommand );
240245
ABC_FREE( pFileNames );
246+
ABC_FREE( pFileTemp );
241247
return NULL;
242248
}
243249
ABC_FREE( pCommand );
@@ -250,13 +256,15 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
250256
if ( pNtk == NULL )
251257
{
252258
printf( "Reading AIGER from file \"%s\" has failed.\n", pFileTemp );
259+
ABC_FREE( pFileTemp );
253260
return NULL;
254261
}
255262
pAig = Abc_NtkToDar( pNtk, 0, 1 );
256263
Abc_NtkDelete( pNtk );
257264
if ( pAig == NULL )
258265
{
259266
printf( "Converting the AIGER network into an internal AIG has failed.\n" );
267+
ABC_FREE( pFileTemp );
260268
return NULL;
261269
}
262270
pGia = fSkipStrash ? Gia_ManFromAigSimple(pAig) : Gia_ManFromAig(pAig);
@@ -267,12 +275,14 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
267275
if ( pGia == NULL )
268276
{
269277
printf( "Converting to AIG has failed.\n" );
278+
ABC_FREE( pFileTemp );
270279
return NULL;
271280
}
272281
ABC_FREE( pGia->pName );
273282
pGia->pName = pTopModule ? Abc_UtilStrsav(pTopModule) :
274283
Extra_FileNameGeneric( Extra_FileNameWithoutPath(ppFileNames[0]) );
275284
unlink( pFileTemp );
285+
ABC_FREE( pFileTemp );
276286
// complement the outputs
277287
if ( fInvert )
278288
{

0 commit comments

Comments
 (0)