/* put these statements where variables are declared (such as l2_cache_miss_count) */ UINT64 bp_miss; UINT64 bp_corr_predict; /* you must replace this function in your source code */ void print_stats() { std::ofstream out(KNOB_OUTPUT_FILE.Value().c_str()); /* Do not modify this function. This messages will be used for grading */ out << "Total instruction: " << retired_instruction << endl; out << "Total cycles: " << cycle_count << endl; float ipc = (cycle_count ? ((float)retired_instruction/(float)cycle_count): 0 ); out << "IPC: " << ipc << endl; out << "Total I-cache miss: " << icache_miss_count << endl; out << "Total D-cache miss: " << dcache_miss_count << endl; out << "Total L2-cache miss: " << l2_cache_miss_count << endl; out << "Total data hazard: " << data_hazard_count << endl; out << "Total BR_mispred: " << bp_miss << endl; out << "Total BR_corrpred: " << bp_corr_predict << endl; out << "Total control hazard : " << control_hazard_count << endl; out.close(); } Add the following code where an op is scheduled. (an instruction will be executed at the following cycle) (An in order processor should print out these messages in order.) if (KNOB_DEBUG_PRINT.Value()) { cout << "ID_STAGE OP " << op->inst_id << " is scheduled at cycle " << cycle_count << endl; } Add the following code where an op is retired. (right before calling the free_op function) Both in order processor and out of order processor should print out these messages in order. if (KNOB_DEBUG_PRINT.Value()) { cout << "WB_STAGE OP " << op->inst_id << " is retired at cycle " << cycle_count << endl; }