summaryrefslogtreecommitdiffstats
path: root/src/base
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2018-06-13 19:34:52 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2018-06-13 19:34:52 -0700
commit01d736cba40f0bc12139fed73679c92b1f6bb383 (patch)
treeb9789f116cbeaa9c2ef4f2a1d435460b9247cb49 /src/base
parentaa2f29fa67b09c6df71df08b6b52fc2cca6cf742 (diff)
downloadabc-01d736cba40f0bc12139fed73679c92b1f6bb383.tar.gz
abc-01d736cba40f0bc12139fed73679c92b1f6bb383.tar.bz2
abc-01d736cba40f0bc12139fed73679c92b1f6bb383.zip
Enabling user-specified output signature in &polyn.
Diffstat (limited to 'src/base')
-rw-r--r--src/base/abci/abc.c38
1 files changed, 32 insertions, 6 deletions
diff --git a/src/base/abci/abc.c b/src/base/abci/abc.c
index ba4452a8..e891882d 100644
--- a/src/base/abci/abc.c
+++ b/src/base/abci/abc.c
@@ -42775,11 +42775,11 @@ usage:
***********************************************************************/
int Abc_CommandAbc9Polyn( Abc_Frame_t * pAbc, int argc, char ** argv )
{
- extern void Gia_PolynBuild2Test( Gia_Man_t * pGia, int nExtra, int fSigned, int fVerbose, int fVeryVerbose );
- Vec_Int_t * vOrder = NULL;
- int c, nExtra = -1, fOld = 0, fSimple = 1, fSigned = 0, fVerbose = 0, fVeryVerbose = 0;
+ extern void Gia_PolynBuild2Test( Gia_Man_t * pGia, char * pSign, int nExtra, int fSigned, int fVerbose, int fVeryVerbose );
+ Vec_Int_t * vOrder = NULL; char * pSign = NULL;
+ int c, nExtra = 0, fOld = 0, fSimple = 1, fSigned = 0, fVerbose = 0, fVeryVerbose = 0;
Extra_UtilGetoptReset();
- while ( ( c = Extra_UtilGetopt( argc, argv, "Noasvwh" ) ) != EOF )
+ while ( ( c = Extra_UtilGetopt( argc, argv, "NSoasvwh" ) ) != EOF )
{
switch ( c )
{
@@ -42794,6 +42794,15 @@ int Abc_CommandAbc9Polyn( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( nExtra < 0 )
goto usage;
break;
+ case 'S':
+ if ( globalUtilOptind >= argc )
+ {
+ Abc_Print( -1, "Command line switch \"-S\" should be followed by a char string without spaces.\n" );
+ goto usage;
+ }
+ pSign = argv[globalUtilOptind];
+ globalUtilOptind++;
+ break;
case 'o':
fOld ^= 1;
break;
@@ -42820,6 +42829,11 @@ int Abc_CommandAbc9Polyn( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Abc_CommandAbc9Esop(): There is no AIG.\n" );
return 0;
}
+ if ( argc >= globalUtilOptind + 1 )
+ {
+ printf( "Trailing symbols on the command line (\"%s\").\n", argv[globalUtilOptind] );
+ return 0;
+ }
if ( fOld )
{
vOrder = fSimple ? NULL : Gia_PolynReorder( pAbc->pGia, fVerbose, fVeryVerbose );
@@ -42827,11 +42841,11 @@ int Abc_CommandAbc9Polyn( Abc_Frame_t * pAbc, int argc, char ** argv )
Vec_IntFreeP( &vOrder );
}
else
- Gia_PolynBuild2Test( pAbc->pGia, nExtra, fSigned, fVerbose, fVeryVerbose );
+ Gia_PolynBuild2Test( pAbc->pGia, pSign, nExtra, fSigned, fVerbose, fVeryVerbose );
return 0;
usage:
- Abc_Print( -2, "usage: &polyn [-N num] [-oasvwh]\n" );
+ Abc_Print( -2, "usage: &polyn [-N num] [-oasvwh] [-S str]\n" );
Abc_Print( -2, "\t derives algebraic polynomial from AIG\n" );
Abc_Print( -2, "\t-N num : the number of additional primary outputs (-1 = unused) [default = %d]\n", nExtra );
Abc_Print( -2, "\t-o : toggles old computation [default = %s]\n", fOld? "yes": "no" );
@@ -42840,6 +42854,18 @@ usage:
Abc_Print( -2, "\t-v : toggles printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-w : toggles printing very verbose information [default = %s]\n", fVeryVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
+ Abc_Print( -2, "\t\n");
+ Abc_Print( -2, "\t-S str : (optional) the output signature as a character string\n" );
+ Abc_Print( -2, "\t The format used to represent the output signature is very restrictive.\n" );
+ Abc_Print( -2, "\t It should be a string without spaces containing monomials in terms of\n" );
+ Abc_Print( -2, "\t inputs (i<num>) and outputs (o<num>) where <num> is 0-based. Coefficients\n" );
+ Abc_Print( -2, "\t are degrees of two, represented by log2 of their value: for example, \n" );
+ Abc_Print( -2, "\t \"2\" is 2^2 = 4, \"-4\" is -2^4=-16, \"-0\" is -2^0=-1, etc\n" );
+ Abc_Print( -2, "\t Two types of signature are accepted:\n" );
+ Abc_Print( -2, "\t (1) a sequence of monomials without parentheses (for example, \"-2*o0+1*o1+0*o2\")\n" );
+ Abc_Print( -2, "\t (2) a product of two sequences followed by a sum with a sequence\n" );
+ Abc_Print( -2, "\t (for example, \"(4*o0+2*o1+1*o2)*(4*i3+2*i4+1*i5)+(4*o3+2*o4+1*o5)\")\n" );
+ Abc_Print( -2, "\t Here is the signature of a signed 2-bit multiplier: \"(0*o0+1*o1+2*o2-3*o3)\"\n" );
return 1;
}