cloud9_root/src/cloud9/lib/Core/CacheSideChannel.cpp
// record constraints related only to set-associative caches
record constraints related only to set-associative caches
record constraints related only to set - associative caches
void CacheChannel::logSetAssociativeCnstr(ref<Expr> constraint, unsigned accessID, bool reload) {
	static unsigned ID = 0;
#ifdef _DEBUG
	fprintf(stdout, "logging set-associative cache constraints\n");
#endif
	if (reload) {
		assert(!setAssocReloadCnstrLog.count(accessID) && "reload constaint loaded only once");
		if (constraint.isNull()) {
			fixedColdMisses++;
			pairT nullCnstr(NULL, NULL);
			missConstraintLog[accessID] = nullCnstr;
		}
		setAssocReloadCnstrLog[accessID] = constraint;
	} else {
		std::string missStr("missIJ");
		std::ostringstream ss;
		ss << accessID;
		ss << ID;
		ID++;
		missStr += ss.str();
		const Array* array = Array::CreateArray(missStr.c_str(), 1);
		ref<Expr> read = Expr::createTempRead(array, 8);
		if (setAssocCnstrLog.count(accessID)) setAssocCnstrLog[accessID].push_back(read);
		else {
			std::vector<ref<Expr> > cnstrSet;
			cnstrSet.push_back(read);
			setAssocCnstrLog[accessID] = cnstrSet;
		}
		ref<Expr> zeroConflict = EqExpr::create(read, ConstantExpr::alloc(0, read->getWidth()));
		ref<Expr> oneConflict = EqExpr::create(read, ConstantExpr::alloc(1, read->getWidth()));
		ref<Expr> notConstraint = NotExpr::create(constraint);
		ref<Expr> evictCnstr = Expr::createImplies(constraint, oneConflict);
		ref<Expr> notEvictCnstr = Expr::createImplies(notConstraint, zeroConflict);
		pairT conflictCnstr(evictCnstr, notEvictCnstr);
		if (setAssocConflictCnstrLog.count(accessID)) setAssocConflictCnstrLog[accessID].push_back(conflictCnstr);
		else {
			std::vector<pairT> cnstrSet;
			cnstrSet.push_back(conflictCnstr);
			setAssocConflictCnstrLog[accessID] = cnstrSet;
		}
	}
}
void CacheChannel :: logSetAssociativeCnstr ( ref < Expr > constraint , unsigned accessID , bool reload ) { static unsigned ID = 0 ; #ifdef _DEBUG fprintf ( stdout , " \n " ) ; #endif if ( reload ) { assert ( ! setAssocReloadCnstrLog . count ( accessID ) && " " ) ; if ( constraint . isNull ( ) ) { fixedColdMisses ++ ; pairT nullCnstr ( NULL , NULL ) ; missConstraintLog [ accessID ] = nullCnstr ; } setAssocReloadCnstrLog [ accessID ] = constraint ; } else { std :: string missStr ( " " ) ; std :: ostringstream ss ; ss << accessID ; ss << ID ; ID ++ ; missStr += ss . str ( ) ; const Array * array = Array :: CreateArray ( missStr . c_str ( ) , 1 ) ; ref < Expr > read = Expr :: createTempRead ( array , 8 ) ; if ( setAssocCnstrLog . count ( accessID ) ) setAssocCnstrLog [ accessID ] . push_back ( read ) ; else { std :: vector < ref < Expr > > cnstrSet ; cnstrSet . push_back ( read ) ; setAssocCnstrLog [ accessID ] = cnstrSet ; } ref < Expr > zeroConflict = EqExpr :: create ( read , ConstantExpr :: alloc ( 0 , read -> getWidth ( ) ) ) ; ref < Expr > oneConflict = EqExpr :: create ( read , ConstantExpr :: alloc ( 1 , read -> getWidth ( ) ) ) ; ref < Expr > notConstraint = NotExpr :: create ( constraint ) ; ref < Expr > evictCnstr = Expr :: createImplies ( constraint , oneConflict ) ; ref < Expr > notEvictCnstr = Expr :: createImplies ( notConstraint , zeroConflict ) ; pairT conflictCnstr ( evictCnstr , notEvictCnstr ) ; if ( setAssocConflictCnstrLog . count ( accessID ) ) setAssocConflictCnstrLog [ accessID ] . push_back ( conflictCnstr ) ; else { std :: vector < pairT > cnstrSet ; cnstrSet . push_back ( conflictCnstr ) ; setAssocConflictCnstrLog [ accessID ] = cnstrSet ; } } }
record constraints related only to set-associative caches
record constraints related only to set - associative caches
/* check whether it is a (sure) cold miss */ /* sudiptac: for FIFO replacement policy */ /* create symbolic cache conflict variable */