/**Function************************************************************* Synopsis [Perfoms the MUX operation with functional hashing.] Description [] SideEffects [] SeeAlso [] ***********************************************************************/ Fraig_Node_t * Fraig_NodeMux( Fraig_Man_t * p, Fraig_Node_t * pC, Fraig_Node_t * pT, Fraig_Node_t * pE ) { Fraig_Node_t * pAnd1, * pAnd2, * pRes; pAnd1 = Fraig_NodeAndCanon( p, pC, pT ); Fraig_Ref( pAnd1 ); pAnd2 = Fraig_NodeAndCanon( p, Fraig_Not(pC), pE ); Fraig_Ref( pAnd2 ); pRes = Fraig_NodeOr( p, pAnd1, pAnd2 ); Fraig_RecursiveDeref( p, pAnd1 ); Fraig_RecursiveDeref( p, pAnd2 ); Fraig_Deref( pRes ); return pRes; }
/**Function************************************************************* Synopsis [Creates a new node.] Description [This procedure should be called to create the constant node and the PI nodes first.] SideEffects [] SeeAlso [] ***********************************************************************/ Fraig_Node_t * Fraig_NodeCreate( Fraig_Man_t * p, Fraig_Node_t * p1, Fraig_Node_t * p2 ) { Fraig_Node_t * pNode; int clk; // create the node pNode = (Fraig_Node_t *)Fraig_MemFixedEntryFetch( p->mmNodes ); memset( pNode, 0, sizeof(Fraig_Node_t) ); // assign the children pNode->p1 = p1; Fraig_Ref(p1); Fraig_Regular(p1)->nRefs++; pNode->p2 = p2; Fraig_Ref(p2); Fraig_Regular(p2)->nRefs++; // assign the number and add to the array of nodes pNode->Num = p->vNodes->nSize; Fraig_NodeVecPush( p->vNodes, pNode ); // assign the PI number pNode->NumPi = -1; // compute the level of this node pNode->Level = 1 + FRAIG_MAX(Fraig_Regular(p1)->Level, Fraig_Regular(p2)->Level); pNode->fInv = Fraig_NodeIsSimComplement(p1) & Fraig_NodeIsSimComplement(p2); pNode->fFailTfo = Fraig_Regular(p1)->fFailTfo | Fraig_Regular(p2)->fFailTfo; // derive the simulation info clk = clock(); // allocate memory for the simulation info pNode->puSimR = (unsigned *)Fraig_MemFixedEntryFetch( p->mmSims ); pNode->puSimD = pNode->puSimR + p->nWordsRand; // derive random simulation info pNode->uHashR = 0; Fraig_NodeSimulate( pNode, 0, p->nWordsRand, 1 ); // derive dynamic simulation info pNode->uHashD = 0; Fraig_NodeSimulate( pNode, 0, p->iWordStart, 0 ); // count the number of ones in the random simulation info pNode->nOnes = Fraig_BitStringCountOnes( pNode->puSimR, p->nWordsRand ); if ( pNode->fInv ) pNode->nOnes = p->nWordsRand * 32 - pNode->nOnes; // add to the runtime of simulation p->timeSims += clock() - clk; #ifdef FRAIG_ENABLE_FANOUTS // create the fanout info Fraig_NodeAddFaninFanout( Fraig_Regular(p1), pNode ); Fraig_NodeAddFaninFanout( Fraig_Regular(p2), pNode ); #endif return pNode; }