Commit 302f7d7a by Alan Mishchenko

Other changes to enable new features in the mapper (bug fix).

parent 96e44e31
...@@ -254,7 +254,7 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk ) ...@@ -254,7 +254,7 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk )
{ {
ProgressBar * pProgress; ProgressBar * pProgress;
Abc_Ntk_t * pNtkNew; Abc_Ntk_t * pNtkNew;
Abc_Obj_t * pNode, * pNodeNew; Abc_Obj_t * pNode, * pNodeNew, * pExor;
Vec_Int_t * vCover; Vec_Int_t * vCover;
int i, nDupGates; int i, nDupGates;
// create the new network // create the new network
...@@ -274,6 +274,55 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk ) ...@@ -274,6 +274,55 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk )
// process the nodes in topological order // process the nodes in topological order
vCover = Vec_IntAlloc( 1 << 16 ); vCover = Vec_IntAlloc( 1 << 16 );
pProgress = Extra_ProgressBarStart( stdout, Abc_NtkCoNum(pNtk) ); pProgress = Extra_ProgressBarStart( stdout, Abc_NtkCoNum(pNtk) );
if ( pIfMan->pPars->fEnableRealPos )
{
// collect drivers
Vec_Ptr_t * vDrivers, * vFanins;
vDrivers = Vec_PtrAlloc( Abc_NtkCoNum(pNtk) );
Abc_NtkForEachCo( pNtk, pNode, i )
{
Extra_ProgressBarUpdate( pProgress, i, "Final" );
pNodeNew = Abc_NodeFromIf_rec( pNtkNew, pIfMan, If_ObjFanin0(If_ManCo(pIfMan, i)), vCover );
pNodeNew = Abc_ObjNotCond( pNodeNew, If_ObjFaninC0(If_ManCo(pIfMan, i)) );
// Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
if ( Abc_ObjIsComplement(pNodeNew) )
pNodeNew = Abc_NtkCreateNodeInv( pNtkNew, Abc_ObjRegular(pNodeNew) );
else
pNodeNew = Abc_NtkCreateNodeBuf( pNtkNew, pNodeNew );
Vec_PtrPush( vDrivers, pNodeNew );
}
// update drivers
vFanins = Vec_PtrAlloc( 2 );
for ( i = pNtk->nRealPos; i < Abc_NtkPoNum(pNtk); i += 5 )
{
// create first XOR
Vec_PtrClear( vFanins );
Vec_PtrPush( vFanins, (Abc_Obj_t *)Vec_PtrEntry(vDrivers, i+0) );
Vec_PtrPush( vFanins, (Abc_Obj_t *)Vec_PtrEntry(vDrivers, i+1) );
pExor = Abc_NtkCreateNodeExor( pNtkNew, vFanins );
// create second XOR
Vec_PtrClear( vFanins );
Vec_PtrPush( vFanins, pExor );
Vec_PtrPush( vFanins, (Abc_Obj_t *)Vec_PtrEntry(vDrivers, i+2) );
pNode = Abc_NtkCreateNodeExor( pNtkNew, vFanins );
Vec_PtrWriteEntry( vDrivers, i+3, pNode );
// create MUX
pNode = Abc_NtkCreateNodeMux( pNtkNew, pExor,
(Abc_Obj_t *)Vec_PtrEntry(vDrivers, i+2),
(Abc_Obj_t *)Vec_PtrEntry(vDrivers, i+1) );
Vec_PtrWriteEntry( vDrivers, i+4, pNode );
}
Vec_PtrFree( vFanins );
// connect drivers
Abc_NtkForEachCo( pNtk, pNode, i )
Abc_ObjAddFanin( pNode->pCopy, (Abc_Obj_t *)Vec_PtrEntry(vDrivers, i) );
Vec_PtrFree( vDrivers );
// sweep
nDupGates = Abc_NtkCleanup( pNtkNew, 0 );
printf( "The number of removed nodes = %d.\n", nDupGates );
}
else
{
Abc_NtkForEachCo( pNtk, pNode, i ) Abc_NtkForEachCo( pNtk, pNode, i )
{ {
Extra_ProgressBarUpdate( pProgress, i, "Final" ); Extra_ProgressBarUpdate( pProgress, i, "Final" );
...@@ -281,6 +330,7 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk ) ...@@ -281,6 +330,7 @@ Abc_Ntk_t * Abc_NtkFromIf( If_Man_t * pIfMan, Abc_Ntk_t * pNtk )
pNodeNew = Abc_ObjNotCond( pNodeNew, If_ObjFaninC0(If_ManCo(pIfMan, i)) ); pNodeNew = Abc_ObjNotCond( pNodeNew, If_ObjFaninC0(If_ManCo(pIfMan, i)) );
Abc_ObjAddFanin( pNode->pCopy, pNodeNew ); Abc_ObjAddFanin( pNode->pCopy, pNodeNew );
} }
}
Extra_ProgressBarStop( pProgress ); Extra_ProgressBarStop( pProgress );
Vec_IntFree( vCover ); Vec_IntFree( vCover );
// remove the constant node if not used // remove the constant node if not used
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment