cloud9_root/src/cloud9/lib/Core/CacheSideChannel.cpp
// generate constraints in order to capture that an access "II" occurs for the first time
generate constraints in order to capture that an access "II" occurs for the first time
generate constraints in order to capture that an access " II " occurs for the first time
ref<Expr> CacheChannel::generateNeverBeforeCnstr(ExecutionState& state, TimingSolver* solver, unsigned II) {
	ref<Expr> ret = NULL;
	ref<Expr> addressI = state.memAddrs[II];
	for (unsigned JJ = 0; JJ < II; JJ++) {
		ref<Expr> addressJ = state.memAddrs[JJ];
		ref<Expr> setCnstr = NULL;
		ref<Expr> tagCnstr = NULL;
		if (addressI->getKind() == Expr::Constant) {
			if (addressJ->getKind() == Expr::Constant) {
				int setR = generateSetCnstrCC(addressI, addressJ);
				if (!setR) continue;
				break; 
			} else {
				setCnstr = generateSetCnstrSC(addressI, addressJ);
			}
		} else {
			if (addressJ->getKind() == Expr::Constant) setCnstr = generateSetCnstrSC(addressI, addressJ);
			else setCnstr = generateSetCnstrSS(addressI, addressJ);
		}
		assert(!setCnstr.isNull() && "cold miss constraint processing went wrong");
		ref<Expr> notConflictJJandII = NotExpr::create(setCnstr);
		bool mustBeTrue = true;
		solver->mustBeTrue(data::SIDE_CHANNEL_ANALYSIS, state, notConflictJJandII, mustBeTrue);
		if (mustBeTrue) continue;
		if (ret.isNull()) ret = notConflictJJandII;
		else ret = AndExpr::create(ret, notConflictJJandII);
	}
	return ret;
}
ref < Expr > CacheChannel :: generateNeverBeforeCnstr ( ExecutionState & state , TimingSolver * solver , unsigned II ) { ref < Expr > ret = NULL ; ref < Expr > addressI = state . memAddrs [ II ] ; for ( unsigned JJ = 0 ; JJ < II ; JJ ++ ) { ref < Expr > addressJ = state . memAddrs [ JJ ] ; ref < Expr > setCnstr = NULL ; ref < Expr > tagCnstr = NULL ; if ( addressI -> getKind ( ) == Expr :: Constant ) { if ( addressJ -> getKind ( ) == Expr :: Constant ) { int setR = generateSetCnstrCC ( addressI , addressJ ) ; if ( ! setR ) continue ; break ; } else { setCnstr = generateSetCnstrSC ( addressI , addressJ ) ; } } else { if ( addressJ -> getKind ( ) == Expr :: Constant ) setCnstr = generateSetCnstrSC ( addressI , addressJ ) ; else setCnstr = generateSetCnstrSS ( addressI , addressJ ) ; } assert ( ! setCnstr . isNull ( ) && " " ) ; ref < Expr > notConflictJJandII = NotExpr :: create ( setCnstr ) ; bool mustBeTrue = true ; solver -> mustBeTrue ( data :: SIDE_CHANNEL_ANALYSIS , state , notConflictJJandII , mustBeTrue ) ; if ( mustBeTrue ) continue ; if ( ret . isNull ( ) ) ret = notConflictJJandII ; else ret = AndExpr :: create ( ret , notConflictJJandII ) ; } return ret ; }
generate constraints in order to capture that an access "II" occurs for the first time
generate constraints in order to capture that an access " II " occurs for the first time
/* make sure that the pair <addressI,addressJ> may conflict in the cache */ /* this cannot be a never-before situation */