Skip to content

Commit 9390a74

Browse files
committed
Changes to the file interface in "stochmap".
1 parent bd9fb45 commit 9390a74

File tree

1 file changed

+15
-20
lines changed

1 file changed

+15
-20
lines changed

src/base/abci/abcPart.c

Lines changed: 15 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include "base/abc/abc.h"
2222
#include "base/main/main.h"
2323
#include "base/cmd/cmd.h"
24+
#include "map/mio/mio.h"
2425

2526
#ifdef WIN32
2627
#include <process.h>
@@ -1284,26 +1285,18 @@ typedef struct StochSynData_t_
12841285
int TimeOut;
12851286
} StochSynData_t;
12861287

1287-
Abc_Ntk_t * Abc_NtkStochProcessOne( Abc_Ntk_t * p, char * pScript, int Rand, int TimeSecs )
1288+
Abc_Ntk_t * Abc_NtkStochProcessOne( Abc_Ntk_t * p, char * pScript0, int Rand, int TimeSecs )
12881289
{
1290+
extern int Abc_NtkWriteToFile( char * pFileName, Abc_Ntk_t * pNtk );
1291+
extern Abc_Ntk_t * Abc_NtkReadFromFile( char * pFileName );
12891292
Abc_Ntk_t * pNew, * pTemp;
1290-
char * pSpot, FileName[100], Command[1000];
1291-
sprintf( FileName, "%06x.blif", Rand );
1292-
Abc_Ntk_t * pNetlist = Abc_NtkToNetlist(p);
1293-
if ( pNetlist == NULL ) {
1294-
printf( "Cannot produce an intermediate network.\n" );
1295-
return NULL;
1296-
}
1297-
Io_WriteBlif( pNetlist, FileName, 1, 0, 0 );
1298-
Abc_NtkDelete( pNetlist );
1299-
if ( (pSpot = strstr(pScript, ".genlib")) ) {
1300-
char Spot = pSpot[strlen(".genlib")];
1301-
pSpot[strlen(".genlib")] = 0;
1302-
sprintf( Command, "./abc -q \"%s; read %s%c%s; write %s\"", pScript, FileName, Spot, pSpot+strlen(".genlib")+1, FileName );
1303-
pSpot[strlen(".genlib")] = Spot;
1304-
}
1305-
else
1306-
sprintf( Command, "./abc -q \"read %s; %s; write %s\"", FileName, pScript, FileName );
1293+
char FileName[100], Command[1000], PreCommand[500] = {0};
1294+
char * pLibFileName = Abc_NtkIsMappedLogic(p) ? Mio_LibraryReadFileName((Mio_Library_t *)p->pManFunc) : NULL;
1295+
if ( pLibFileName ) sprintf( PreCommand, "read_genlib %s; ", pLibFileName );
1296+
sprintf( FileName, "%06x.mm", Rand );
1297+
Abc_NtkWriteToFile( FileName, p );
1298+
char * pScript = Abc_UtilStrsav( pScript0 );
1299+
sprintf( Command, "./abc -q \"%sread_mm %s; %s; write_mm %s\"", PreCommand[0] ? PreCommand : "", FileName, pScript, FileName );
13071300
#if defined(__wasm)
13081301
if ( 1 )
13091302
#else
@@ -1315,9 +1308,11 @@ Abc_Ntk_t * Abc_NtkStochProcessOne( Abc_Ntk_t * p, char * pScript, int Rand, int
13151308
fprintf( stderr, "Sorry for the inconvenience.\n" );
13161309
fflush( stdout );
13171310
unlink( FileName );
1311+
ABC_FREE( pScript );
13181312
return Abc_NtkDupDfs(p);
1319-
}
1320-
pNew = Io_ReadBlif( FileName, 0 );
1313+
}
1314+
ABC_FREE( pScript );
1315+
pNew = Abc_NtkReadFromFile( FileName );
13211316
unlink( FileName );
13221317
if ( pNew && Abc_NtkGetMappedArea(pNew) < Abc_NtkGetMappedArea(p) ) {
13231318
pNew = Abc_NtkDupDfs( pTemp = pNew );

0 commit comments

Comments
 (0)