style: 清除 test code

This commit is contained in:
Ting-Jun Wang 2022-01-22 19:37:47 +08:00
parent 8da8d0e845
commit 2fbdfc3cb7
Signed by: snsd0805
GPG Key ID: 8DB0D22BC1217D33
3 changed files with 0 additions and 34 deletions

View File

@ -40,7 +40,6 @@ int main(int argc, char* argv[]){
bool status;
std::vector<std::tuple<std::string, std::string, bool, short, short>> Result;
while(std::cin >> action >> address){
// std::cout << "action: "<< action << " address: " << address << std::endl;
tuple<bool, short, short> status = Sim->read(address);
Result.push_back(
std::make_tuple(
@ -51,14 +50,12 @@ int main(int argc, char* argv[]){
std::get<2>(status)
)
);
// std::cout << std::endl << std::endl;
}
// FIFO
int allCount = 0, hitCount = 0;
// std::cout << argv[1] << " Replace Policy:" << std::endl;
for(int i=0; i<Result.size(); i++){
// std::cout << " " << std::setw(6) << std::setfill('0') << Result[i].first << "... ";
allCount++;
if(std::get<2>(Result[i])){
hitCount++;

26
set.cpp
View File

@ -66,14 +66,6 @@ tuple<bool, short> Set::read(vector<bool> tag, short offset){
this->blocks[maxIndex].update(tag);
this->blocks[maxIndex].access();
writeWay = maxIndex;
// for(int i=0; i<this->waySize; i++){
// vector<bool> t = this->blocks[i].getTag();
// for(int j=0; j<t.size(); j++){
// cout << t[j];
// }
// cout << endl;
// }
}
this->countAccess(baseAccessTime);
@ -86,22 +78,4 @@ void Set::countAccess(short baseAccessTime){
this->blocks[i].countAccess();
}
}
// for(int i=0; i<20; i++){
// cout << "=" ;
// }
// cout << "way 狀態";
// for(int i=0; i<20; i++){
// cout << "=";
// }
// cout<<endl;
// for(int i=0; i<this->waySize; i++){
// cout << this->blocks[i].getAccessTime() << " ";
// }
// cout<<endl;
// for(int i=0; i<45; i++){
// cout << "=";
// }
// cout<<endl;
}

View File

@ -17,14 +17,9 @@ Simulator::Simulator(int machineBits, short setSize, short waySize, short tagSiz
tuple<bool, short, short> Simulator::read(string address){
vector<bool> addrBits = this->addressTranslate(address);
// for(int i=0; i<addrBits.size(); i++){
// std::cout << addrBits[i] << " ";
// }
// std::cout << std::endl;
short index = this->getValue(addrBits, "index");
short offset = this->getValue(addrBits, "offset");
vector<bool> tag(addrBits.begin(), addrBits.begin()+this->tagSize);
// std::cout<<"更新 index: "<<index<<std::endl;
tuple<bool, short> setResult = this->sets[index].read(tag, offset);
return std::make_tuple(