Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions abclib.dsp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions src/base/abc/abc.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ struct Abc_Obj_t_ // 48/72 bytes (32-bits/64-bits)
unsigned Level : 20; // the level of the node
Vec_Int_t vFanins; // the array of fanins
Vec_Int_t vFanouts; // the array of fanouts
void * pDataComp;
union { void * pData; // the network specific data
int iData; }; // (SOP, BDD, gate, equiv class, etc)
union { void * pTemp; // temporary store for user's data
Expand Down Expand Up @@ -620,6 +621,7 @@ extern ABC_DLL float Abc_NtkDelayTraceLut( Abc_Ntk_t * pNtk, int fU
/*=== abcDfs.c ==========================================================*/
extern ABC_DLL Vec_Ptr_t * Abc_NtkDfs( Abc_Ntk_t * pNtk, int fCollectAll );
extern ABC_DLL Vec_Ptr_t * Abc_NtkDfs2( Abc_Ntk_t * pNtk );
extern ABC_DLL void Abc_NtkDfsSup_rec( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Vec_Ptr_t * vSup, int iVerbose);
extern ABC_DLL Vec_Ptr_t * Abc_NtkDfsNodes( Abc_Ntk_t * pNtk, Abc_Obj_t ** ppNodes, int nNodes );
extern ABC_DLL Vec_Ptr_t * Abc_NtkDfsReverse( Abc_Ntk_t * pNtk );
extern ABC_DLL Vec_Ptr_t * Abc_NtkDfsReverseNodes( Abc_Ntk_t * pNtk, Abc_Obj_t ** ppNodes, int nNodes );
Expand Down Expand Up @@ -885,6 +887,8 @@ extern ABC_DLL int Abc_NodeRef_rec( Abc_Obj_t * pNode );
extern ABC_DLL int Abc_NtkRefactor( Abc_Ntk_t * pNtk, int nNodeSizeMax, int nMinSaved, int nConeSizeMax, int fUpdateLevel, int fUseZeros, int fUseDcs, int fVerbose );
/*=== abcRewrite.c ==========================================================*/
extern ABC_DLL int Abc_NtkRewrite( Abc_Ntk_t * pNtk, int fUpdateLevel, int fUseZeros, int fVerbose, int fVeryVerbose, int fPlaceEnable );
/*=== abcRmInverters.c ======================================================*/
extern ABC_DLL void Abc_NtkRmInverter(Abc_Ntk_t * pNtk, int iVerbose);
/*=== abcSat.c ==========================================================*/
extern ABC_DLL int Abc_NtkMiterSat( Abc_Ntk_t * pNtk, ABC_INT64_T nConfLimit, ABC_INT64_T nInsLimit, int fVerbose, ABC_INT64_T * pNumConfs, ABC_INT64_T * pNumInspects );
extern ABC_DLL void * Abc_NtkMiterSatCreate( Abc_Ntk_t * pNtk, int fAllPrimes );
Expand Down
96 changes: 96 additions & 0 deletions src/base/abc/abcDfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
***********************************************************************/

#include "abc.h"
#include "misc/vec/vecPtr.h"
#include "proof/cec/cec.h"

ABC_NAMESPACE_IMPL_START
Expand Down Expand Up @@ -137,6 +138,101 @@ Vec_Ptr_t * Abc_NtkDfs2( Abc_Ntk_t * pNtk )
return vNodes;
}

/**Function*************************************************************

Synopsis [Collect support nodes bounded internal nodes.]

Description []

SideEffects []

SeeAlso []

***********************************************************************/
void Abc_NtkDfsSup_rec( Abc_Obj_t * pNode, Vec_Ptr_t * vNodes, Vec_Ptr_t * vSup, int iVerbose)
{
Abc_Obj_t * pFanin;
int i;
assert( !Abc_ObjIsNet(pNode) );
if ( Abc_NodeIsTravIdCurrent( pNode ) )
return;
Abc_NodeSetTravIdCurrent( pNode );
if ( Abc_ObjIsCi(pNode) || Abc_ObjIsCo(pNode) || (Abc_NtkIsStrash(pNode->pNtk) && Abc_AigNodeIsConst(pNode)) )
return;
if( Vec_PtrFind(vSup, pNode) >= 0 )
{
if(iVerbose)
{
printf("Encountered vSup Node: %s\n", Abc_ObjName(pNode));
printf("Whose fanins are:\n");
printf(" Fanin0: %s", Abc_ObjName(Abc_ObjFanin0(pNode)));
printf(" %d on comp\n", pNode->fCompl0);
printf(" Fanin1: %s", Abc_ObjName(Abc_ObjFanin1(pNode)));
printf(" %d on comp\n", pNode->fCompl1);
}
return;
}
assert( Abc_ObjIsNode( pNode ) );
Abc_ObjForEachFanin( pNode, pFanin, i )
{
if(iVerbose)
{
printf(" Node %s Fanin %d: ", Abc_ObjName(pNode), i);
printf("%s", Abc_ObjName(pFanin));
printf(" %d on comp\n", i == 0 ? pNode->fCompl0 : pNode->fCompl1);
}
Abc_NtkDfsSup_rec( Abc_ObjFanin0Ntk(pFanin), vNodes, vSup, iVerbose);
}
Vec_PtrPush( vNodes, pNode );
}

/**Function*************************************************************

Synopsis []

Description []

SideEffects []

SeeAlso []

***********************************************************************/
void Abc_NtkDfsInvSup_rec( Abc_Obj_t * pNode, Vec_Ptr_t * vSup, int * countFlip)
{
Abc_Obj_t * pFanin;
int i;
assert( !Abc_ObjIsNet(pNode) );
if ( Abc_NodeIsTravIdCurrent( pNode ) )
return;
Abc_NodeSetTravIdCurrent( pNode );
if ( Abc_ObjIsCi(pNode) || Abc_ObjIsCo(pNode) || (Abc_NtkIsStrash(pNode->pNtk) && Abc_AigNodeIsConst(pNode)) )
return;
if( Vec_PtrFind(vSup, pNode) >= 0 )
{
return;
}
assert( Abc_ObjIsNode( pNode ) || Abc_ObjIsBox( pNode ) );

Abc_ObjForEachFanin( pNode, pFanin, i )
{
if(Vec_PtrFind(vSup, pFanin) >= 0)
{
if(i == 0)
{
printf("Flipping edge on Node %s %d (Phase = %d)\n", Abc_ObjName(pNode), i, pFanin->fPhase );
pNode->fCompl0 ^= 1;
}
else if(i == 1)
{
printf("Flipping edge on Node %s %d (Phase = %d)\n", Abc_ObjName(pNode),i , pFanin->fPhase);
pNode->fCompl1 ^= 1;
}
*countFlip = *countFlip + 1;
}
Abc_NtkDfsInvSup_rec( Abc_ObjFanin0Ntk(pFanin), vSup, countFlip );
}
}

/**Function*************************************************************

Synopsis [Returns the DFS ordered array of logic nodes.]
Expand Down
55 changes: 54 additions & 1 deletion src/base/abci/abc.c
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@ static int Abc_CommandRunEco ( Abc_Frame_t * pAbc, int argc, cha
static int Abc_CommandRunGen ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandRunScript ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandRunTest ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandRmInverter ( Abc_Frame_t * pAbc, int argc, char ** argv );

static int Abc_CommandRewrite ( Abc_Frame_t * pAbc, int argc, char ** argv );
static int Abc_CommandRefactor ( Abc_Frame_t * pAbc, int argc, char ** argv );
Expand Down Expand Up @@ -1008,6 +1009,7 @@ void Abc_Init( Abc_Frame_t * pAbc )
Cmd_CommandAdd( pAbc, "Synthesis", "resub_unate", Abc_CommandResubUnate, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "resub_core", Abc_CommandResubCore, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "resub_check", Abc_CommandResubCheck, 0 );
Cmd_CommandAdd( pAbc, "Synthesis", "rd_inv", Abc_CommandRmInverter, 1 );
// Cmd_CommandAdd( pAbc, "Synthesis", "rr", Abc_CommandRr, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "cascade", Abc_CommandCascade, 1 );
Cmd_CommandAdd( pAbc, "Synthesis", "lutcasdec", Abc_CommandLutCasDec, 1 );
Expand Down Expand Up @@ -7995,7 +7997,58 @@ int Abc_CommandRunTest( Abc_Frame_t * pAbc, int argc, char ** argv )

Synopsis []

Description [Orchestration synthesis]
Description []

SideEffects []

SeeAlso []

***********************************************************************/
int Abc_CommandRmInverter( Abc_Frame_t * pAbc, int argc, char ** argv )
{
Abc_Ntk_t * pNtk = Abc_FrameReadNtk(pAbc);
Extra_UtilGetoptReset();
int iVerbose = 0;
int c;
while ( ( c = Extra_UtilGetopt( argc, argv, "vh" ) ) != EOF )
{
switch ( c )
{
case 'v':
iVerbose ^= 1;
break;
case 'h':
goto usage;
default:
goto usage;
}
}
if ( pNtk == NULL )
{
Abc_Print( -1, "Empty network.\n" );
return 1;
}
if ( !Abc_NtkHasAig(pNtk) || !Abc_NtkIsStrash(pNtk) )
{
Abc_Print( -1, "This command only works on AIG network.\n" );
return 1;
}
Abc_NtkRmInverter(pNtk, iVerbose);
return 0;

usage:
Abc_Print( -2, "usage: rd_inv\n" );
Abc_Print( -2, "\t redistribute inverters on self-dual and self-anti-dual functions in network\n" );
Abc_Print( -2, "\t-v : verbose output\n");
Abc_Print( -2, "\t-h : print the command usage\n");
return 1;
}

/**Function*************************************************************

Synopsis []

Description []

SideEffects []

Expand Down
Loading
Loading