Update &append to share primary inputs.

This commit is contained in:
Alan Mishchenko 2025-08-01 14:29:45 -07:00
parent 052a365823
commit c69e45916a
3 changed files with 16 additions and 7 deletions

View File

@ -1358,7 +1358,7 @@ extern Gia_Man_t * Gia_ManDupZero( Gia_Man_t * p );
extern Gia_Man_t * Gia_ManDupPerm( Gia_Man_t * p, Vec_Int_t * vPiPerm );
extern Gia_Man_t * Gia_ManDupPermFlop( Gia_Man_t * p, Vec_Int_t * vFfPerm );
extern Gia_Man_t * Gia_ManDupPermFlopGap( Gia_Man_t * p, Vec_Int_t * vFfPerm );
extern void Gia_ManDupAppend( Gia_Man_t * p, Gia_Man_t * pTwo );
extern void Gia_ManDupAppend( Gia_Man_t * p, Gia_Man_t * pTwo, int fShareCis );
extern void Gia_ManDupAppendShare( Gia_Man_t * p, Gia_Man_t * pTwo );
extern Gia_Man_t * Gia_ManDupAppendNew( Gia_Man_t * pOne, Gia_Man_t * pTwo );
extern Gia_Man_t * Gia_ManDupAppendCones( Gia_Man_t * p, Gia_Man_t ** ppCones, int nCones, int fOnlyRegs );

View File

@ -1134,7 +1134,7 @@ Gia_Man_t * Gia_ManDupRandPerm( Gia_Man_t * p )
SeeAlso []
***********************************************************************/
void Gia_ManDupAppend( Gia_Man_t * pNew, Gia_Man_t * pTwo )
void Gia_ManDupAppend( Gia_Man_t * pNew, Gia_Man_t * pTwo, int fShareCis )
{
Gia_Obj_t * pObj;
int i;
@ -1148,7 +1148,7 @@ void Gia_ManDupAppend( Gia_Man_t * pNew, Gia_Man_t * pTwo )
if ( Gia_ObjIsAnd(pObj) )
pObj->Value = Gia_ManAppendAnd( pNew, Gia_ObjFanin0Copy(pObj), Gia_ObjFanin1Copy(pObj) );
else if ( Gia_ObjIsCi(pObj) )
pObj->Value = Gia_ManAppendCi( pNew );
pObj->Value = fShareCis ? Gia_ManCiLit(pNew, Gia_ObjCioId(pObj)) : Gia_ManAppendCi( pNew );
else if ( Gia_ObjIsCo(pObj) )
pObj->Value = Gia_ManAppendCo( pNew, Gia_ObjFanin0Copy(pObj) );
}

View File

@ -39767,13 +39767,16 @@ int Abc_CommandAbc9Append( Abc_Frame_t * pAbc, int argc, char ** argv )
char * FileName, * pTemp;
char ** pArgvNew;
int nArgcNew;
int c;
int c, fShareCis = 0;
int fVerbose = 0;
Extra_UtilGetoptReset();
while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
while ( ( c = Extra_UtilGetopt( argc, argv, "ivh" ) ) != EOF )
{
switch ( c )
{
case 'i':
fShareCis ^= 1;
break;
case 'v':
fVerbose ^= 1;
break;
@ -39813,14 +39816,20 @@ int Abc_CommandAbc9Append( Abc_Frame_t * pAbc, int argc, char ** argv )
Abc_Print( -1, "Reading AIGER has failed.\n" );
return 0;
}
if ( fShareCis && Gia_ManCiNum(pAbc->pGia) != Gia_ManCiNum(pSecond) )
{
Abc_Print( -1, "The AIGs have different number of combinational inputs.\n" );
return 0;
}
// compute the miter
Gia_ManDupAppend( pAbc->pGia, pSecond );
Gia_ManDupAppend( pAbc->pGia, pSecond, fShareCis );
Gia_ManStop( pSecond );
return 0;
usage:
Abc_Print( -2, "usage: &append [-vh] <file>\n" );
Abc_Print( -2, "usage: &append [-ivh] <file>\n" );
Abc_Print( -2, "\t appends <file> to the current AIG using new PIs and POs\n" );
Abc_Print( -2, "\t-i : toggle sharing combinational inputs [default = %s]\n", fShareCis? "yes": "no" );
Abc_Print( -2, "\t-v : toggle printing verbose information [default = %s]\n", fVerbose? "yes": "no" );
Abc_Print( -2, "\t-h : print the command usage\n");
Abc_Print( -2, "\t<file> : AIGER file with the design to miter\n");