/**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; }
/**Function************************************************************* Synopsis [Collect variables using their proximity from the nodes.] Description [This procedure creates a variable order based on collecting first the nodes that are the closest to the given two target nodes.] SideEffects [] SeeAlso [] ***********************************************************************/ void Fraig_SetActivity( Fraig_Man_t * pMan, Fraig_Node_t * pOld, Fraig_Node_t * pNew ) { Fraig_Node_t * pNode; int i, Number, MaxLevel; float * pFactors = Msat_SolverReadFactors(pMan->pSat); if ( pFactors == NULL ) return; MaxLevel = FRAIG_MAX( pOld->Level, pNew->Level ); // create the variable order for ( i = 0; i < Msat_IntVecReadSize(pMan->vVarsInt); i++ ) { // get the new node on the frontier Number = Msat_IntVecReadEntry(pMan->vVarsInt, i); pNode = pMan->vNodes->pArray[Number]; pFactors[pNode->Num] = (float)pow( 0.97, MaxLevel - pNode->Level ); // if ( pNode->Num % 50 == 0 ) // printf( "(%d) %.2f ", MaxLevel - pNode->Level, pFactors[pNode->Num] ); } // printf( "\n" ); }