int main(int argc, char **argv) { if( argc != 2 ){ MSG("use: CacheSample <cfg_file>"); exit(0); } Report::openFile("report.log"); SescConf = new SConfig(argv[1]); EnergyMgr::init(); cache = MyCacheType::create("tst1","","tst1"); int assoc = SescConf->getLong("tst1","assoc"); for(int i=0;i<assoc;i++) { ulong addr = (i<<8)+0xfa; MyCacheType::CacheLine *line = cache->findLine(addr); if(line) { fprintf(stderr,"ERROR: Line 0x%x (0x%x) found\n" ,cache->calcAddr4Tag(line->getTag()) ,addr); exit(-1); } line = cache->fillLine(addr); line->id = i; } for(int i=0;i<assoc;i++) { ulong addr = (i<<8)+0xFa; MyCacheType::CacheLine *line = cache->findLine(addr); if(line == 0) { fprintf(stderr,"ERROR: Line (0x%x) NOT found\n" ,addr); exit(-1); } if (line->id != i) { fprintf(stderr,"ERROR: Line 0x%x (0x%x) line->id %d vs id %d (bad LRU policy)\n" ,cache->calcAddr4Tag(line->getTag()) ,addr ,line->id, i ); exit(-1); } } cache = MyCacheType::create("TLB","","TLB"); benchMatrix("TLB"); cache = MyCacheType::create("L1Cache","","L1"); benchMatrix("DL1"); cache = MyCacheType::create("BTB","","BTB"); benchMatrix("BTB"); cache = MyCacheType::create("DM","","DM"); benchMatrix("DM"); GStats::report("Cache Stats"); Report::close(); cache->destroy(); return 0; }
int main(int32_t argc, const char **argv) { if( argc != 2 ){ MSG("use: CacheSample <cfg_file>"); exit(0); } Report::openFile("report.log"); setenv("ESESC_tradCORE_DL1","DL1_core DL1",1); SescConf = new SConfig(argc,argv); unsetenv("ESESC_tradCore_DL1"); cache = MyCacheType::create("DL1_core","","tst1"); int32_t assoc = SescConf->getInt("DL1_core","assoc"); for(int32_t i=0;i<assoc;i++) { ulong addr = (i<<8)+0xfa; MyCacheType::CacheLine *line = cache->findLine(addr); if(line) { fprintf(stderr,"ERROR: Line 0x%lX (0x%lX) found\n" ,cache->calcAddr4Tag(line->getTag()) ,addr); exit(-1); } line = cache->fillLine(addr); line->id = i; } for(int32_t i=0;i<assoc;i++) { ulong addr = (i<<8)+0xFa; MyCacheType::CacheLine *line = cache->findLine(addr); if(line == 0) { fprintf(stderr,"ERROR: Line (0x%lX) NOT found\n" ,addr); exit(-1); } if (line->id != i) { fprintf(stderr,"ERROR: Line 0x%lX (0x%lX) line->id %d vs id %d (bad LRU policy)\n" ,cache->calcAddr4Tag(line->getTag()) ,addr ,line->id, i ); exit(-1); } } //cache = MyCacheType::create("PerCore_TLB","","TLB"); //benchMatrix("PerCore_TLB"); cache = MyCacheType::create("DL1_core","","L1"); benchMatrix("DL1_core"); #if 0 cache = MyCacheType::create("BTB","","BTB"); benchMatrix("BTB"); cache = MyCacheType::create("DM","","DM"); benchMatrix("DM"); #endif GStats::report("Cache Stats"); Report::close(); //cache->destroy(); return 0; }