/**Function************************************************************* Synopsis [Retimes node forward by one latch.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_ObjRetimeForward( Abc_Obj_t * pObj ) { Abc_Obj_t * pFanout; int Init0, Init1, Init, i; assert( Abc_ObjFaninNum(pObj) == 2 ); assert( Seq_ObjFaninL0(pObj) >= 1 ); assert( Seq_ObjFaninL1(pObj) >= 1 ); // remove the init values from the fanins Init0 = Seq_NodeDeleteFirst( pObj, 0 ); Init1 = Seq_NodeDeleteFirst( pObj, 1 ); assert( Init0 != ABC_INIT_NONE ); assert( Init1 != ABC_INIT_NONE ); // take into account the complements in the node if ( Abc_ObjFaninC0(pObj) ) { if ( Init0 == ABC_INIT_ZERO ) Init0 = ABC_INIT_ONE; else if ( Init0 == ABC_INIT_ONE ) Init0 = ABC_INIT_ZERO; } if ( Abc_ObjFaninC1(pObj) ) { if ( Init1 == ABC_INIT_ZERO ) Init1 = ABC_INIT_ONE; else if ( Init1 == ABC_INIT_ONE ) Init1 = ABC_INIT_ZERO; } // compute the value at the output of the node if ( Init0 == ABC_INIT_ZERO || Init1 == ABC_INIT_ZERO ) Init = ABC_INIT_ZERO; else if ( Init0 == ABC_INIT_ONE && Init1 == ABC_INIT_ONE ) Init = ABC_INIT_ONE; else Init = ABC_INIT_DC; // make sure the label is clean Abc_ObjForEachFanout( pObj, pFanout, i ) assert( pFanout->fMarkC == 0 ); // add the init values to the fanouts Abc_ObjForEachFanout( pObj, pFanout, i ) { if ( pFanout->fMarkC ) continue; pFanout->fMarkC = 1; if ( Abc_ObjFaninId0(pFanout) != Abc_ObjFaninId1(pFanout) ) Seq_NodeInsertLast( pFanout, Abc_ObjFanoutEdgeNum(pObj, pFanout), Init ); else { assert( Abc_ObjFanin0(pFanout) == pObj ); Seq_NodeInsertLast( pFanout, 0, Init ); Seq_NodeInsertLast( pFanout, 1, Init ); } } // clean the label Abc_ObjForEachFanout( pObj, pFanout, i ) pFanout->fMarkC = 0; }
float Abc_NtkComputeNodeLoad( Bus_Man_t * p, Abc_Obj_t * pObj ) { Abc_Obj_t * pFanout; float Load; int i; assert( Bus_SclObjLoad(pObj) == 0 ); Load = Abc_SclFindWireLoad( p->vWireCaps, Abc_ObjFanoutNum(pObj) ); Abc_ObjForEachFanout( pObj, pFanout, i ) Load += Bus_SclObjCin( pFanout ); Bus_SclObjSetLoad( pObj, Load ); return Load; }
/**Function************************************************************* Synopsis [Marks the TFO of the collected nodes up to the given level.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ void Abc_MfsWinSweepLeafTfo_rec( Abc_Obj_t * pObj, int nLevelLimit ) { Abc_Obj_t * pFanout; int i; if ( Abc_ObjIsCo(pObj) || (int)pObj->Level > nLevelLimit ) return; if ( Abc_NodeIsTravIdCurrent(pObj) ) return; Abc_NodeSetTravIdCurrent( pObj ); Abc_ObjForEachFanout( pObj, pFanout, i ) Abc_MfsWinSweepLeafTfo_rec( pFanout, nLevelLimit ); }
/**Function************************************************************* Synopsis [Updates the net.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ static inline void Abc_PlaceUpdateNet( Abc_Obj_t * pObj ) { Abc_Obj_t * pFanout; int k; // free the old array of net terminals if ( nets[pObj->Id].m_terms ) free( nets[pObj->Id].m_terms ); // fill in the net with the new information nets[pObj->Id].m_id = pObj->Id; nets[pObj->Id].m_weight = 1.0; nets[pObj->Id].m_numTerms = Abc_ObjFanoutNum(pObj); //fanout nets[pObj->Id].m_terms = ALLOC(ConcreteCell*, Abc_ObjFanoutNum(pObj)); Abc_ObjForEachFanout( pObj, pFanout, k ) nets[pObj->Id].m_terms[k] = &(cells[pFanout->Id]); addConcreteNet(&(nets[pObj->Id])); }
/**Function************************************************************* Synopsis [Retimes node backward by one latch.] Description [Constructs the problem for initial state computation. Returns 1 if the conflict is found.] SideEffects [] SeeAlso [] ***********************************************************************/ int Abc_ObjRetimeBackward( Abc_Obj_t * pObj, Abc_Ntk_t * pNtkNew, stmm_table * tTable, Vec_Int_t * vValues ) { Abc_Obj_t * pFanout; Abc_InitType_t Init, Value; Seq_RetEdge_t RetEdge; Abc_Obj_t * pNodeNew, * pFanoutNew, * pBuffer; int i, Edge, fMet0, fMet1, fMetN; // make sure the node can be retimed assert( Seq_ObjFanoutLMin(pObj) > 0 ); // get the fanout values fMet0 = fMet1 = fMetN = 0; Abc_ObjForEachFanout( pObj, pFanout, i ) { if ( Abc_ObjFaninId0(pFanout) == pObj->Id ) { Init = Seq_NodeGetInitLast( pFanout, 0 ); if ( Init == ABC_INIT_ZERO ) fMet0 = 1; else if ( Init == ABC_INIT_ONE ) fMet1 = 1; else if ( Init == ABC_INIT_NONE ) fMetN = 1; } if ( Abc_ObjFaninId1(pFanout) == pObj->Id ) { Init = Seq_NodeGetInitLast( pFanout, 1 ); if ( Init == ABC_INIT_ZERO ) fMet0 = 1; else if ( Init == ABC_INIT_ONE ) fMet1 = 1; else if ( Init == ABC_INIT_NONE ) fMetN = 1; } } // consider the case when all fanout latches have don't-care values // the new values on the fanin edges will be don't-cares if ( !fMet0 && !fMet1 && !fMetN ) { // make sure the label is clean Abc_ObjForEachFanout( pObj, pFanout, i ) assert( pFanout->fMarkC == 0 ); // update the fanout edges Abc_ObjForEachFanout( pObj, pFanout, i ) { if ( pFanout->fMarkC ) continue; pFanout->fMarkC = 1; if ( Abc_ObjFaninId0(pFanout) == pObj->Id ) Seq_NodeDeleteLast( pFanout, 0 ); if ( Abc_ObjFaninId1(pFanout) == pObj->Id ) Seq_NodeDeleteLast( pFanout, 1 ); } // clean the label Abc_ObjForEachFanout( pObj, pFanout, i ) pFanout->fMarkC = 0; // update the fanin edges Abc_ObjRetimeBackwardUpdateEdge( pObj, 0, tTable ); Abc_ObjRetimeBackwardUpdateEdge( pObj, 1, tTable ); Seq_NodeInsertFirst( pObj, 0, ABC_INIT_DC ); Seq_NodeInsertFirst( pObj, 1, ABC_INIT_DC ); return 0; }