An option to extend the number of primary inputs.

This commit is contained in:
Alan Mishchenko 2021-03-28 15:40:27 -10:00
parent 18088bd7dc
commit 9145a5c20d
3 changed files with 65 additions and 3 deletions

View File

@ -4899,6 +4899,38 @@ Gia_Man_t * Gia_ManDupReplaceCut( Gia_Man_t * p )
return pNew;
}
/**Function*************************************************************
Synopsis [Duplicate AIG by creating a cut between logic fed by PIs]
Description []
SideEffects []
SeeAlso []
***********************************************************************/
Gia_Man_t * Gia_ManDupAddPis( Gia_Man_t * p, int nMulti )
{
Gia_Man_t * pNew; int i, k;
Gia_Obj_t * pObj;
pNew = Gia_ManStart( Gia_ManObjNum(p) + Gia_ManCiNum(p) * nMulti );
pNew->pName = Abc_UtilStrsav( p->pName );
Gia_ManConst0(p)->Value = 0;
Gia_ManForEachCi( p, pObj, i )
{
pObj->Value = Gia_ManAppendCi(pNew);
for ( k = 1; k < nMulti; k++ )
Gia_ManAppendCi(pNew);
}
Gia_ManForEachAnd( p, pObj, i )
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
Gia_ManForEachCo( p, pObj, i )
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
assert( Gia_ManCiNum(pNew) == nMulti * Gia_ManCiNum(p) );
return pNew;
}
////////////////////////////////////////////////////////////////////////
/// END OF FILE ///
////////////////////////////////////////////////////////////////////////

View File

@ -877,7 +877,7 @@ void Gia_ManTestWordFile( Gia_Man_t * p, char * pFileName, char * pDumpFile, int
char * pKnownFileNames[3] = {"small.aig", "medium.aig", "large.aig"};
int pLimitFileSizes[3] = {10000, 100000, 1000000};
for ( i = 0; i < 3; i++ )
if ( !strncmp(p->pSpec, pKnownFileNames[i], 5) && Gia_ManAndNum(p) > pLimitFileSizes[i] )
if ( p->pSpec && !strncmp(p->pSpec, pKnownFileNames[i], 5) && Gia_ManAndNum(p) > pLimitFileSizes[i] )
printf( "Warning: The input file \"%s\" contains more than %d internal and-nodes.\n", pKnownFileNames[i], pLimitFileSizes[i] );
if ( nInputs == Gia_ManCiNum(p) )
{

View File

@ -32068,13 +32068,14 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
extern Gia_Man_t * Gia_ManDupMuxRestructure( Gia_Man_t * p );
Gia_Man_t * pTemp;
int c, Limit = 2;
int Multi = 0;
int fAddStrash = 0;
int fCollapse = 0;
int fAddMuxes = 0;
int fStrMuxes = 0;
int fRehashMap = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "Lacmrsh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "LMacmrsh" ) ) != EOF )
{
switch ( c )
{
@ -32089,6 +32090,17 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
if ( Limit < 0 )
goto usage;
break;
case 'M':
if ( globalUtilOptind >= argc )
{
Abc_Print( -1, "Command line switch \"-M\" should be followed by an integer.\n" );
goto usage;
}
Multi = atoi(argv[globalUtilOptind]);
globalUtilOptind++;
if ( Multi <= 0 )
goto usage;
break;
case 'a':
fAddStrash ^= 1;
break;
@ -32115,6 +32127,13 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Abc_CommandAbc9Strash(): There is no AIG.\n" );
return 1;
}
if ( Multi > 0 )
{
extern Gia_Man_t * Gia_ManDupAddPis( Gia_Man_t * p, int nMulti );
pTemp = Gia_ManDupAddPis( pAbc->pGia, Multi );
Abc_FrameUpdateGia( pAbc, pTemp );
return 0;
}
if ( fStrMuxes )
{
if ( Gia_ManHasMapping(pAbc->pGia) )
@ -32182,13 +32201,14 @@ int Abc_CommandAbc9Strash( Abc_Frame_t * pAbc, int argc, char ** argv )
return 0;
usage:
Abc_Print( -2, "usage: &st [-L num] [-acmrsh]\n" );
Abc_Print( -2, "usage: &st [-LM num] [-acmrsh]\n" );
Abc_Print( -2, "\t performs structural hashing\n" );
Abc_Print( -2, "\t-a : toggle additional hashing [default = %s]\n", fAddStrash? "yes": "no" );
Abc_Print( -2, "\t-c : toggle collapsing hierarchical AIG [default = %s]\n", fCollapse? "yes": "no" );
Abc_Print( -2, "\t-m : toggle converting to larger gates [default = %s]\n", fAddMuxes? "yes": "no" );
Abc_Print( -2, "\t-L num : create MUX when sum of refs does not exceed this limit [default = %d]\n", Limit );
Abc_Print( -2, "\t (use L = 1 to create AIG with XORs but without MUXes)\n" );
Abc_Print( -2, "\t-M num : create an AIG with additional primary inputs [default = %d]\n", Multi );
Abc_Print( -2, "\t-r : toggle rehashing AIG while preserving mapping [default = %s]\n", fRehashMap? "yes": "no" );
Abc_Print( -2, "\t-s : toggle using MUX restructuring [default = %s]\n", fStrMuxes? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
@ -33048,6 +33068,11 @@ int Abc_CommandAbc9Iwls21Test( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Abc_CommandAbc9Iwls21Test(): This command works only for combinational AIGs.\n" );
return 0;
}
if ( Gia_ManCoNum(pAig) != 10 )
{
Abc_Print( -1, "Abc_CommandAbc9Iwls21Test(): Expecting an AIG with 10 outputs.\n" );
return 0;
}
Gia_ManTestWordFile( pAig, pArgvNew[1], pDumpFile, fVerbose );
Gia_ManStop( pAig );
return 0;
@ -33057,6 +33082,11 @@ int Abc_CommandAbc9Iwls21Test( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Abc_CommandAbc9Iwls21Test(): There is no AIG.\n" );
return 1;
}
if ( Gia_ManCoNum(pAbc->pGia) != 10 )
{
Abc_Print( -1, "Abc_CommandAbc9Iwls21Test(): Expecting an AIG with 10 outputs.\n" );
return 0;
}
if ( nArgcNew != 1 )
{
Abc_Print( -1, "Abc_CommandAbc9Iwls21Test(): Expecting data file name on the command line.\n" );