Skip to content

Commit 0ff43a1

Browse files
committed
Command "aigsim".
1 parent 28cc761 commit 0ff43a1

File tree

3 files changed

+723
-1
lines changed

3 files changed

+723
-1
lines changed

src/base/abci/abc.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,7 @@ static int Abc_CommandSimSec ( Abc_Frame_t * pAbc, int argc, cha
278278
static int Abc_CommandMatch ( Abc_Frame_t * pAbc, int argc, char ** argv );
279279
//static int Abc_CommandHaig ( Abc_Frame_t * pAbc, int argc, char ** argv );
280280
static int Abc_CommandQbf ( Abc_Frame_t * pAbc, int argc, char ** argv );
281+
static int Abc_CommandAigSim ( Abc_Frame_t * pAbc, int argc, char ** argv );
281282

282283
static int Abc_CommandFraig ( Abc_Frame_t * pAbc, int argc, char ** argv );
283284
static int Abc_CommandFraigTrust ( Abc_Frame_t * pAbc, int argc, char ** argv );
@@ -1107,6 +1108,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
11071108
Cmd_CommandAdd( pAbc, "New AIG", "csweep", Abc_CommandCSweep, 1 );
11081109
// Cmd_CommandAdd( pAbc, "New AIG", "haig", Abc_CommandHaig, 1 );
11091110
Cmd_CommandAdd( pAbc, "New AIG", "qbf", Abc_CommandQbf, 0 );
1111+
Cmd_CommandAdd( pAbc, "New AIG", "aigsim", Abc_CommandAigSim, 0 );
11101112

11111113
Cmd_CommandAdd( pAbc, "Fraiging", "fraig", Abc_CommandFraig, 1 );
11121114
Cmd_CommandAdd( pAbc, "Fraiging", "fraig_trust", Abc_CommandFraigTrust, 1 );
@@ -19269,6 +19271,68 @@ int Abc_CommandQbf( Abc_Frame_t * pAbc, int argc, char ** argv )
1926919271
return 1;
1927019272
}
1927119273

19274+
19275+
/**Function*************************************************************
19276+
19277+
Synopsis []
19278+
19279+
Description []
19280+
19281+
SideEffects []
19282+
19283+
SeeAlso []
19284+
19285+
***********************************************************************/
19286+
int Abc_CommandAigSim( Abc_Frame_t * pAbc, int argc, char ** argv )
19287+
{
19288+
extern int SimulateAigTop( char *fname1, char *fname2, char * mask, int verbose );
19289+
char * pMask = NULL;
19290+
char ** pArgvNew = NULL;
19291+
int nArgcNew = 0;
19292+
int c, fVerbose = 0;
19293+
Extra_UtilGetoptReset();
19294+
while ( ( c = Extra_UtilGetopt( argc, argv, "Mvh" ) ) != EOF )
19295+
{
19296+
switch ( c )
19297+
{
19298+
case 'M':
19299+
if ( globalUtilOptind >= argc )
19300+
{
19301+
Abc_Print( -1, "Command line switch \"-M\" should be followed by a string.\n" );
19302+
goto usage;
19303+
}
19304+
pMask = argv[globalUtilOptind];
19305+
globalUtilOptind++;
19306+
break;
19307+
case 'v':
19308+
fVerbose ^= 1;
19309+
break;
19310+
case 'h':
19311+
goto usage;
19312+
default:
19313+
goto usage;
19314+
}
19315+
}
19316+
pArgvNew = argv + globalUtilOptind;
19317+
nArgcNew = argc - globalUtilOptind;
19318+
if ( nArgcNew != 2 ) {
19319+
Abc_Print( -1, "Expecting two files names on the command line.\n" );
19320+
return 1;
19321+
}
19322+
SimulateAigTop( pArgvNew[0], pArgvNew[1], pMask, fVerbose );
19323+
return 0;
19324+
19325+
usage:
19326+
Abc_Print( -2, "usage: aigsim -M <str> [-vh] <file1> <file2>\n" );
19327+
Abc_Print( -2, "\t combinational AIG simulation\n" );
19328+
Abc_Print( -2, "\t-M <str> : mask to select inputs for simulation [default = unused]\n" );
19329+
Abc_Print( -2, "\t-v : toggle verbose output [default = %s]\n", fVerbose? "yes": "no" );
19330+
Abc_Print( -2, "\t-h : print the command usage\n");
19331+
Abc_Print( -2, "\t<file1> : the first file to simulate\n");
19332+
Abc_Print( -2, "\t<file2> : the second file to simulate\n");
19333+
return 1;
19334+
}
19335+
1927219336
/**Function*************************************************************
1927319337

1927419338
Synopsis []

src/misc/util/module.make

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
SRC += src/misc/util/utilBridge.c \
1+
SRC += src/misc/util/utilAigSim.c \
2+
src/misc/util/utilBridge.c \
23
src/misc/util/utilBipart.c \
34
src/misc/util/utilBSet.c \
45
src/misc/util/utilCex.c \

0 commit comments

Comments
 (0)