Skip to content

Commit 5ade9e9

Browse files
committed
Adding command line option of &symfun.
1 parent 28f4ad8 commit 5ade9e9

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

src/base/abci/abc.c

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45535,9 +45535,9 @@ int Abc_CommandAbc9SymFun( Abc_Frame_t * pAbc, int argc, char ** argv )
4553545535
extern Gia_Man_t * Gia_ManGenSymFun( Vec_Wrd_t * vFuns, int nChars, int fVerbose );
4553645536
Gia_Man_t * pNew = NULL;
4553745537
Vec_Wrd_t * vFuns = NULL;
45538-
int c, nChars = 0, nMaj = 0, nHot = 0, nXor = 0, fVerbose = 0;
45538+
int c, nChars = 0, nMaj = 0, nHot = 0, nXor = 0, nWgt = 0, fVerbose = 0;
4553945539
Extra_UtilGetoptReset();
45540-
while ( ( c = Extra_UtilGetopt( argc, argv, "MHXvh" ) ) != EOF )
45540+
while ( ( c = Extra_UtilGetopt( argc, argv, "MHXWvh" ) ) != EOF )
4554145541
{
4554245542
switch ( c )
4554345543
{
@@ -45565,6 +45565,14 @@ int Abc_CommandAbc9SymFun( Abc_Frame_t * pAbc, int argc, char ** argv )
4556545565
}
4556645566
nXor = atoi(argv[globalUtilOptind++]);
4556745567
break;
45568+
case 'W':
45569+
if ( globalUtilOptind >= argc )
45570+
{
45571+
Abc_Print( -1, "Command line switch \"-W\" should be followed by a file name.\n" );
45572+
goto usage;
45573+
}
45574+
nWgt = atoi(argv[globalUtilOptind++]);
45575+
break;
4556845576
case 'v':
4556945577
fVerbose ^= 1;
4557045578
break;
@@ -45586,7 +45594,14 @@ int Abc_CommandAbc9SymFun( Abc_Frame_t * pAbc, int argc, char ** argv )
4558645594
else if ( nXor ) {
4558745595
nChars = nXor+1;
4558845596
vFuns = Vec_WrdAlloc(1);
45589-
Vec_WrdPush( vFuns, ABC_CONST(0xAAAAAAAAAAAAAAAA) & Abc_Tt6Mask(nXor+1) );
45597+
Vec_WrdPush( vFuns, s_Truths6[0] & Abc_Tt6Mask(nChars) );
45598+
}
45599+
else if ( nWgt ) {
45600+
int nOuts = Abc_Base2Log(nWgt+1);
45601+
nChars = nWgt+1;
45602+
vFuns = Vec_WrdAlloc(nOuts);
45603+
for ( int i = 0; i < nOuts; i++ )
45604+
Vec_WrdPush( vFuns, s_Truths6[i] & Abc_Tt6Mask(nChars) );
4559045605
}
4559145606
else {
4559245607
if ( argc == globalUtilOptind ) {
@@ -45613,11 +45628,12 @@ int Abc_CommandAbc9SymFun( Abc_Frame_t * pAbc, int argc, char ** argv )
4561345628
return 0;
4561445629

4561545630
usage:
45616-
Abc_Print( -2, "usage: &symfun [-MHX num] [-vh] <str0> <str1> ... <str(N-1)>\n" );
45631+
Abc_Print( -2, "usage: &symfun [-MHXW num] [-vh] <str0> <str1> ... <str(N-1)>\n" );
4561745632
Abc_Print( -2, "\t derives AIG of a multi-output symmetric function\n" );
4561845633
Abc_Print( -2, "\t-M <num> : generate the majority gate with the given input count [default = unused]\n" );
4561945634
Abc_Print( -2, "\t-H <num> : generate the 1-hot condition with the given input count [default = unused]\n" );
4562045635
Abc_Print( -2, "\t-X <num> : generate the xor-gate with the given input count [default = unused]\n" );
45636+
Abc_Print( -2, "\t-W <num> : generate the weight(W) function with the given input count [default = unused]\n" );
4562145637
Abc_Print( -2, "\t-v : toggles verbose output [default = %s]\n", fVerbose? "yes": "no" );
4562245638
Abc_Print( -2, "\t-h : prints the command usage\n");
4562345639
Abc_Print( -2, "\t<str0> <str1> ... <str(N-1)> : char strings in binary notation LSB first\n");

0 commit comments

Comments
 (0)