mirror of https://github.com/YosysHQ/abc.git
Modify default intermediate AIGER file name.
This commit is contained in:
parent
f4d870e109
commit
cd6e9b582b
|
|
@ -43284,6 +43284,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
|
||||||
Gia_Man_t * pGia;
|
Gia_Man_t * pGia;
|
||||||
char * pTemp;
|
char * pTemp;
|
||||||
char * pOrigFileName = NULL;
|
char * pOrigFileName = NULL;
|
||||||
|
char * pFileTemp = NULL;
|
||||||
int fVerilog, fSystemVerilog;
|
int fVerilog, fSystemVerilog;
|
||||||
|
|
||||||
*pAbc_ReadAigerOrVerilogFileStatus = 0;
|
*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 );
|
extern Aig_Man_t * Abc_NtkToDar( Abc_Ntk_t * pNtk, int fExors, int fRegisters );
|
||||||
Aig_Man_t * pAig = NULL;
|
Aig_Man_t * pAig = NULL;
|
||||||
char pCommand[2000];
|
char pCommand[2000];
|
||||||
|
char * pFileBase;
|
||||||
int RetValue;
|
int RetValue;
|
||||||
int fSystemVerilog2 = pFileName2 && Extra_FileIsType( pFileName2, ".sv", NULL, NULL );
|
int fSystemVerilog2 = pFileName2 && Extra_FileIsType( pFileName2, ".sv", NULL, NULL );
|
||||||
// Save the original filename before changing it
|
// Save the original filename before changing it
|
||||||
pOrigFileName = pFileName;
|
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),
|
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 : "",
|
pDefines ? "-D" : "", pDefines ? pDefines : "",
|
||||||
(fSystemVerilog || fSystemVerilog2) ? "-sv " : "", pFileName,
|
(fSystemVerilog || fSystemVerilog2) ? "-sv " : "", pFileName,
|
||||||
pFileName2 ? " " : "", pFileName2 ? pFileName2 : "",
|
pFileName2 ? " " : "", pFileName2 ? pFileName2 : "",
|
||||||
pTopModule ? "-top " : "-auto-top", pTopModule ? pTopModule : "",
|
pTopModule ? "-top " : "-auto-top", pTopModule ? pTopModule : "",
|
||||||
pFileName2 ? "delete t:\\$scopeinfo; " : "" );
|
pFileName2 ? "delete t:\\$scopeinfo; " : "",
|
||||||
|
pFileTemp );
|
||||||
#if defined(__wasm)
|
#if defined(__wasm)
|
||||||
RetValue = 1;
|
RetValue = 1;
|
||||||
#else
|
#else
|
||||||
|
|
@ -43331,14 +43339,16 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
|
||||||
if ( RetValue != 0 )
|
if ( RetValue != 0 )
|
||||||
{
|
{
|
||||||
Abc_Print( -1, "Yosys command failed: \"%s\".\n", pCommand );
|
Abc_Print( -1, "Yosys command failed: \"%s\".\n", pCommand );
|
||||||
|
ABC_FREE( pFileTemp );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
if ( pFileName2 )
|
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 )
|
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;
|
return NULL;
|
||||||
}
|
}
|
||||||
pAig = Abc_NtkToDar( pNtk, 0, 1 );
|
pAig = Abc_NtkToDar( pNtk, 0, 1 );
|
||||||
|
|
@ -43346,6 +43356,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
|
||||||
if ( pAig == NULL )
|
if ( pAig == NULL )
|
||||||
{
|
{
|
||||||
Abc_Print( -1, "Converting the AIGER network into an internal AIG has failed.\n" );
|
Abc_Print( -1, "Converting the AIGER network into an internal AIG has failed.\n" );
|
||||||
|
ABC_FREE( pFileTemp );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pGia = Gia_ManFromAig( pAig );
|
pGia = Gia_ManFromAig( pAig );
|
||||||
|
|
@ -43353,7 +43364,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pFileName = "_temp_.aig";
|
pFileName = pFileTemp;
|
||||||
pGia = Gia_AigerRead( pFileName, 0, 0, 0 );
|
pGia = Gia_AigerRead( pFileName, 0, 0, 0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -43362,6 +43373,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
|
||||||
if ( pGia == NULL )
|
if ( pGia == NULL )
|
||||||
{
|
{
|
||||||
Abc_Print( -1, "Reading AIGER from file \"%s\" has failed.\n", pFileName );
|
Abc_Print( -1, "Reading AIGER from file \"%s\" has failed.\n", pFileName );
|
||||||
|
ABC_FREE( pFileTemp );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43372,6 +43384,7 @@ static Gia_Man_t * Abc_ReadAigerOrVerilogFile( char * pFileName, char * pFileNam
|
||||||
pGia->pSpec = Abc_UtilStrsav( pOrigFileName );
|
pGia->pSpec = Abc_UtilStrsav( pOrigFileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ABC_FREE( pFileTemp );
|
||||||
return pGia;
|
return pGia;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -212,10 +212,15 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
|
||||||
{
|
{
|
||||||
Gia_Man_t * pGia = NULL;
|
Gia_Man_t * pGia = NULL;
|
||||||
char * pFileNames, * pCommand;
|
char * pFileNames, * pCommand;
|
||||||
char * pFileTemp = "_temp_.aig";
|
char * pFileTemp, * pFileBase;
|
||||||
int fRtlil = nFileNames == 1 && strstr(ppFileNames[0], ".rtl") != NULL;
|
int fRtlil = nFileNames == 1 && strstr(ppFileNames[0], ".rtl") != NULL;
|
||||||
int fSVlog = Wln_FileNamesHasSv(ppFileNames, nFileNames);
|
int fSVlog = Wln_FileNamesHasSv(ppFileNames, nFileNames);
|
||||||
int nCommand;
|
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 );
|
pFileNames = Wln_FileNamesJoin( ppFileNames, nFileNames );
|
||||||
nCommand = strlen(Wln_GetYosysName()) + strlen(pFileNames) + (pDefines ? strlen(pDefines) : 0) + (pTopModule ? strlen(pTopModule) : 0) + strlen(pFileTemp) + 500;
|
nCommand = strlen(Wln_GetYosysName()) + strlen(pFileNames) + (pDefines ? strlen(pDefines) : 0) + (pTopModule ? strlen(pTopModule) : 0) + strlen(pFileTemp) + 500;
|
||||||
pCommand = ABC_ALLOC( char, nCommand );
|
pCommand = ABC_ALLOC( char, nCommand );
|
||||||
|
|
@ -238,6 +243,7 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
|
||||||
{
|
{
|
||||||
ABC_FREE( pCommand );
|
ABC_FREE( pCommand );
|
||||||
ABC_FREE( pFileNames );
|
ABC_FREE( pFileNames );
|
||||||
|
ABC_FREE( pFileTemp );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ABC_FREE( pCommand );
|
ABC_FREE( pCommand );
|
||||||
|
|
@ -250,6 +256,7 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
|
||||||
if ( pNtk == NULL )
|
if ( pNtk == NULL )
|
||||||
{
|
{
|
||||||
printf( "Reading AIGER from file \"%s\" has failed.\n", pFileTemp );
|
printf( "Reading AIGER from file \"%s\" has failed.\n", pFileTemp );
|
||||||
|
ABC_FREE( pFileTemp );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pAig = Abc_NtkToDar( pNtk, 0, 1 );
|
pAig = Abc_NtkToDar( pNtk, 0, 1 );
|
||||||
|
|
@ -257,6 +264,7 @@ Gia_Man_t * Wln_BlastSystemVerilog( char ** ppFileNames, int nFileNames, char *
|
||||||
if ( pAig == NULL )
|
if ( pAig == NULL )
|
||||||
{
|
{
|
||||||
printf( "Converting the AIGER network into an internal AIG has failed.\n" );
|
printf( "Converting the AIGER network into an internal AIG has failed.\n" );
|
||||||
|
ABC_FREE( pFileTemp );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
pGia = fSkipStrash ? Gia_ManFromAigSimple(pAig) : Gia_ManFromAig(pAig);
|
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 )
|
if ( pGia == NULL )
|
||||||
{
|
{
|
||||||
printf( "Converting to AIG has failed.\n" );
|
printf( "Converting to AIG has failed.\n" );
|
||||||
|
ABC_FREE( pFileTemp );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
ABC_FREE( pGia->pName );
|
ABC_FREE( pGia->pName );
|
||||||
pGia->pName = pTopModule ? Abc_UtilStrsav(pTopModule) :
|
pGia->pName = pTopModule ? Abc_UtilStrsav(pTopModule) :
|
||||||
Extra_FileNameGeneric( Extra_FileNameWithoutPath(ppFileNames[0]) );
|
Extra_FileNameGeneric( Extra_FileNameWithoutPath(ppFileNames[0]) );
|
||||||
unlink( pFileTemp );
|
unlink( pFileTemp );
|
||||||
|
ABC_FREE( pFileTemp );
|
||||||
// complement the outputs
|
// complement the outputs
|
||||||
if ( fInvert )
|
if ( fInvert )
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue