Esempio n. 1
0
void
V3VrfMPDR::resolveInitial(V3MPDRCube* const cube, const V3SvrDataSet& coreProofVars) {
   // Get Proof Related State Variables
   assert (cube); //if (coreProofVars.size() == cube->getState().size()) return;
   // Store Values of State Variable
   const V3NetVec& state = cube->getState();
   // Remove Variables to Form New State
   assert (!existInitial(state));
   bool conflictInitial = false;
   V3NetId conflictId = V3NetUD;
   uint32_t pos = 0;
   V3NetVec newState; newState.reserve(state.size());
   for (uint32_t i = 0; i < state.size(); ++i) {
      if (coreProofVars.end() != coreProofVars.find(_pdrSvr->getFormula(_vrfNtk->getLatch(state[i].id), 1))) {
         newState.push_back(state[i]);
         if (!conflictInitial && (_pdrInitConst[state[i].id] && (_pdrInitValue[state[i].id] ^ state[i].cp))) {
            assert (!existInitial(newState)); conflictInitial = true;
         }
      }
      else if (!conflictInitial && V3NetUD == conflictId) {
         if (_pdrInitConst[state[i].id] && (_pdrInitValue[state[i].id] ^ state[i].cp)) {
            conflictId = state[i]; assert (V3NetUD != conflictId); pos = newState.size();
         }
      }
   }
   // Resolve Intersection with Initial State
   if (!conflictInitial) { assert (V3NetUD != conflictId); newState.insert(newState.begin() + pos, conflictId); }
   if (newState.size() < state.size()) cube->setState(newState);
}
Esempio n. 2
0
const bool
V3VrfMPDR::removeFromProof(V3MPDRTimedCube& timedCube, const bool& pushForward) {
   // This function can ONLY be called after UNSAT of (R ^ T ^ cube')
   // Generate UNSAT Source from Solver if Possible
   V3SvrDataVec coreProofVars; coreProofVars.clear(); _pdrSvr->getDataConflict(coreProofVars);
   if (!coreProofVars.size()) return false;  // Solver does not Support Analyze Conflict
   V3SvrDataSet coreProofVarSet; coreProofVarSet.clear();
   for (uint32_t i = 0; i < coreProofVars.size(); ++i) coreProofVarSet.insert(coreProofVars[i]);
   const bool isSvrDataInvolved = coreProofVarSet.end() != coreProofVarSet.find(_pdrSvrData);
   // Get Generalized State from Solver Proof
   assert (!existInitial(timedCube.second->getState()));
   resolveInitial(timedCube.second, coreProofVarSet);
   assert (!existInitial(timedCube.second->getState()));
   if (!pushForward) return isSvrDataInvolved;
   // Return the Smallest Activity Index Used
   uint32_t i = timedCube.first;
   for (; i < getPDRFrame(); ++i) 
      if (coreProofVarSet.find(_pdrFrame[i - 1]->getActivator()) != coreProofVarSet.end()) { timedCube.first = i; break; }
   if (i == getPDRFrame()) {
      if (coreProofVarSet.find(_pdrFrame[getPDRDepth()]->getActivator()) == coreProofVarSet.end())
         timedCube.first = getPDRFrame();
      else timedCube.first = getPDRDepth();
   }
   assert (!checkReachability(timedCube.first, timedCube.second->getState())); return isSvrDataInvolved;
}
Esempio n. 3
0
const bool
V3SVrfIPDR::removeFromProof2(V3SIPDRTimedCube& timedCube) {
   // This function can ONLY be called after UNSAT of (R ^ T ^ cube')
   // Generate UNSAT Source from Solver if Possible
   V3SvrDataVec coreProofVars; coreProofVars.clear(); assert (timedCube.first < _pdrSvr.size());
   assert (timedCube.first); _pdrSvr[timedCube.first - 1]->getDataConflict(coreProofVars);
   if (!coreProofVars.size()) return false;  // Solver does not Support Analyze Conflict
   V3SvrDataSet coreProofVarSet; coreProofVarSet.clear();
   for (uint32_t i = 0; i < coreProofVars.size(); ++i) coreProofVarSet.insert(coreProofVars[i]);
   const bool isSvrDataInvolved = coreProofVarSet.end() != coreProofVarSet.find(_pdrSvrData); // not used var
   // Get Proof Related State Variables in UNSAT core
   assert (!existInitial2(timedCube.second->getState()));

   const V3NetVec& state = timedCube.second->getState();
   // Remove Variables to Form New State
   assert (!existInitial2(state));
   bool conflictInitial = false;
   V3NetId conflictId = V3NetUD;
   uint32_t pos = 0;
   V3NetVec newState; newState.reserve(state.size());
   for (uint32_t i = 0; i < state.size(); ++i) {
      if (coreProofVarSet.end() != coreProofVarSet.find(
            _pdrSvr[timedCube.first - 1]->getFormula(_vrfNtk->getLatch(state[i].id), 1))) {
         newState.push_back(state[i]); //OrzOrz
         if (!conflictInitial && (_pdrInitValue[state[i].id] ^ state[i].cp)) {
            assert (!existInitial2(newState)); conflictInitial = true;
         }
      }
      else if (!conflictInitial && V3NetUD == conflictId) {
         if (_pdrInitValue[state[i].id] ^ state[i].cp) {
            conflictId = state[i]; assert (V3NetUD != conflictId); pos = newState.size();
         }
      }
   }
   // Resolve Intersection with Initial State
   if (!conflictInitial && V3NetUD != conflictId) { newState.insert(newState.begin() + pos, conflictId); }
   else if( !conflictInitial ) cerr << "GGGG in removing UNSATCore" << endl;
   if (newState.size() < state.size()) timedCube.second->setState(newState);
   //checkCubeSorted(newState);
   assert (!existInitial2(timedCube.second->getState()));
   assert (!checkReachability(timedCube.first, timedCube.second->getState())); return isSvrDataInvolved;
}