⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 floss_reasons.cc

📁 linux下基于c++的处理器仿真平台。具有处理器流水线
💻 CC
📖 第 1 页 / 共 2 页
字号:
	if (!counter)	    panic("No threads have their fetch-loss cause set!");	loss_to_blame = (double)(fetch_width - total_fetched) / counter;    }    counter = 0;    for (thread = 0; thread < number_of_threads; thread++) {        //        //  Only process this thread if we set a FLOSS cause        //        if (state->fetch_end_cause[thread] != FLOSS_FETCH_CAUSE_NOT_SET) {	    if (fetch_split > 1) {		loss_to_blame = (fetch_width / fetch_split) -		    num_fetched[thread];	    }       	    assert(loss_to_blame >= 0);#if DEBUG_CAUSES            floss_total += loss_to_blame;            floss_this_cycle++;#endif            //  If we lost slots in this thread...            if (loss_to_blame) {                cause = state->fetch_end_cause[thread];                switch (cause) {		  case FLOSS_FETCH_IMISS:		    floss_icache[thread][state->fetch_mem_result[thread]] 			+= loss_to_blame;		    break;		  case FLOSS_FETCH_QFULL:		    blame_dispatch_stage(this, state, thread, loss_to_blame);		    break;		  default:		    floss_other[thread][cause] += loss_to_blame;		    break;                }            }        }    }#if DEBUG_CAUSES    if (curTick && (curTick % 100) && floss_total != total_floss())	panic("curTick = %\ncolumn doesn't total correctly!", curTick);#endif#if ENABLE_COUNTER_CHECKING    check_counters(this, state);#endif}//------------------------------------------------------------------------#if ENABLE_COUNTER_CHECKINGstatic doubletotal_floss(FullCPU *cpu){    double total = 0;    int i;    for (int t=0; t<cpu->number_of_threads; ++t) {	for (i=0; i<NUM_MEM_ACCESS_RESULTS; ++i) {	    total += (cpu->floss_icache[t][i] 		+ cpu->floss_iqfull_dcache[t][i] 		+ cpu->floss_lsqfull_dcache[t][i] 		+ cpu->floss_robfull_dcache[t][i]);	}	for (i=0; i<Num_OpClasses; ++i) {	    total += cpu->floss_iqfull_deps[t][i]		+ cpu->floss_lsqfull_deps[t][i]		+ cpu->floss_iqfull_fu[t][i]		+ cpu->floss_lsqfull_fu[t][i]		+ cpu->floss_robfull_fu[t][i];	}	for (i=0; i<NUM_ISSUE_END_CAUSES; ++i) {	    total += cpu->floss_iqfull_other[t][i]		+ cpu->floss_lsqfull_other[t][i];	}	for (i=0; i<NUM_COMMIT_END_CAUSES; ++i) {	    total += cpu->floss_robfull_other[t][i];	}	for (i=0; i<NUM_DIS_END_CAUSES; ++i) {	    total += cpu->floss_qfull_other[t][i];	}	for (i=0; i<NUM_FETCH_END_CAUSES; ++i) {	    total += cpu->floss_other[t][i];	}    }    return total;}static voidcheck_counters(FullCPU *cpu, FlossState *state){    /**     * @todo We get the total number fetched from the stats counters     * even though we really shouldn't. stats aren't really meant to     * be used like this.  They can be, but it's more ideal to keep     * track of these values outside of the stats package. (same goes     * for grabbing the number of cycles)     */    double insts_fetched = rint(cpu->fetched_inst.total());    double total_cycles = rint(cpu->numCycles.value());    double total_slots = rint(cpu->fetch_width * total_cycles);    double total_loss  = rint(total_floss(cpu));    if (total_slots != (insts_fetched + total_loss)) {	ccprintf(cerr,		 "Failed Counter Check!:\n"		 "total_cycles=%f\n"		 "     total_slots   = %f\n"		 "     total_fetched = %f\n"		 "     total_loss    = %f\n"		 "didn't account for = %f\n",		 total_cycles, total_slots, insts_fetched, total_loss,		 total_slots - (insts_fetched + total_loss));	state->dump(cpu->number_of_threads);	panic("fix this!");    }}#endif/////////////////////////////////////////////////////////////////////////////////  Debugging....//////voidFlossState::dump(unsigned number_of_threads){    cout << "FETCH End Causes:" << endl;    for (int t = 0; t < number_of_threads; ++t) {	cout << "  " << t << ": ";	int cause = fetch_end_cause[t];	if (cause == -1) {	    cout << "Not Set" << endl;	} else {	    int mem_res = fetch_mem_result[t];	    cout << FetchEndDesc[cause]		 << " Mem=" << MemCmd::memAccessDesc[mem_res]		 << endl;	}    }    cout << "DISPATCH End Cause:" << endl;    if (dispatch_end_cause != -1)	cout << "  " << DisEndDesc[dispatch_end_cause];    else	cout << "  NOT SET!!!!";    cout << endl;    cout << "ISSUE End Causes:" << endl;    for (int t = 0; t < number_of_threads; ++t) {	cout << "  " << t << ": ";	int cause = issue_end_cause[t];	if (cause == -1) {	    cout << "Not Set" << endl;	} else {	    int mem_res = issue_mem_result[t];	    cout << IssueEndDesc[cause]		 << " Mem=" << MemCmd::memAccessDesc[mem_res]		 << " FU=";	    for (int i = 0; i < TheISA::MaxInstSrcRegs; ++i) {		int fu_class = issue_fu[t][i];		cout << opClassStrings[fu_class] << " ";	    }	}	cout << endl;    }    cout << "  End Thread = " << issue_end_thread << endl;    cout << "COMMIT End Causes:" << endl;    for (int t = 0; t < number_of_threads; ++t) {	cout << "  " << t << ": ";	int cause = commit_end_cause[t];	if (cause == COMMIT_CAUSE_NOT_SET) {	    cout << "Not Set" << endl;	} else {	    int mem_res = commit_mem_result[t];	    cout << CommitEndDesc[cause]		 << " Mem=" << MemCmd::memAccessDesc[mem_res]		 << " FU=";	    for (int i = 0; i < TheISA::MaxInstSrcRegs; ++i) {		int fu_class = commit_fu[t][i];		cout << opClassStrings[fu_class] << " ";	    }	}	cout << endl;    }    cout << "  End Thread = " << commit_end_thread << endl;}inline voidinitv(std::vector<std::vector<double> > &vec, int x, int y){    vec.resize(x);    for (int i = 0; i < x; ++i) {	vec[i].resize(y);	for (int j = 0; j < y; ++j)	    vec[i][j] = 0.0;    }}voidFullCPU::flossRegStats(){    using namespace Stats;    FUDesc = (const char **) new char *[Num_OpClasses+1];    // initialize FU labels by copying from opClassStrings[]    for (int i = 0; i < Num_OpClasses; ++i) {	FUDesc[i] = opClassStrings[i];    }    FUDesc[Num_OpClasses] = "No_FU";    string name = this->name() + ".floss";    //    //  I-Cache    //    initv(floss_icache, number_of_threads, NUM_MEM_ACCESS_RESULTS);    stat_floss_icache	.init(number_of_threads, NUM_MEM_ACCESS_RESULTS)	.name(name + ".icache")	.flags(dist)	;    stat_floss_icache.ysubnames(MemCmd::memAccessDesc);    //    //  Queue-full deps    //    initv(floss_iqfull_deps, number_of_threads, Num_OpClasses);    stat_floss_iqfull_deps	.init(number_of_threads, Num_OpClasses)	.name(name + ".iq_full_deps")	.flags(dist)	;    stat_floss_iqfull_deps.ysubnames(FUDesc);    initv(floss_lsqfull_deps, number_of_threads, Num_OpClasses);    stat_floss_lsqfull_deps	.init(number_of_threads, Num_OpClasses)	.name(name + ".lsq_full_deps")	.flags(dist)	;    stat_floss_lsqfull_deps.ysubnames(FUDesc);    //    //  Queue-full FU    //    initv(floss_iqfull_fu, number_of_threads, Num_OpClasses);    stat_floss_iqfull_fu	.init(number_of_threads, Num_OpClasses)	.name(name + ".iq_full_fu")	.flags(dist)	;    stat_floss_iqfull_fu.ysubnames(FUDesc);    initv(floss_lsqfull_fu, number_of_threads, Num_OpClasses);    stat_floss_lsqfull_fu	.init(number_of_threads, Num_OpClasses)	.name(name + ".lsq_full_fu")	.flags(dist)	;    stat_floss_lsqfull_fu.ysubnames(FUDesc);    initv(floss_robfull_fu, number_of_threads, Num_OpClasses);    stat_floss_robfull_fu	.init(number_of_threads, Num_OpClasses)	.name(name + ".rob_full_fu")	.flags(dist)	;    stat_floss_robfull_fu.ysubnames(FUDesc);    //    //  Queue-full D-Cache    //    initv(floss_iqfull_dcache, number_of_threads, NUM_MEM_ACCESS_RESULTS);    stat_floss_iqfull_dcache	.init(number_of_threads, NUM_MEM_ACCESS_RESULTS)	.name(name + ".iq_full_dcache")	.flags(dist)	;    stat_floss_iqfull_dcache.ysubnames(MemCmd::memAccessDesc);    initv(floss_lsqfull_dcache, number_of_threads, NUM_MEM_ACCESS_RESULTS);    stat_floss_lsqfull_dcache	.init(number_of_threads, NUM_MEM_ACCESS_RESULTS)	.name(name + ".lsq_full_dcache")	.flags(dist)	;    stat_floss_lsqfull_dcache.ysubnames(MemCmd::memAccessDesc);    initv(floss_robfull_dcache, number_of_threads, NUM_MEM_ACCESS_RESULTS);    stat_floss_robfull_dcache	.init(number_of_threads, NUM_MEM_ACCESS_RESULTS)	.name(name + ".rob_full_dcache")	.flags(dist)	;    stat_floss_robfull_dcache.ysubnames(MemCmd::memAccessDesc);    //    //  Queue-full Other    //    initv(floss_iqfull_other, number_of_threads, NUM_ISSUE_END_CAUSES);    stat_floss_iqfull_other	.init(number_of_threads, NUM_ISSUE_END_CAUSES)	.name(name + ".iq_full")	.flags(dist)	;    stat_floss_iqfull_other.ysubnames(IssueEndDesc);    initv(floss_lsqfull_other, number_of_threads, NUM_ISSUE_END_CAUSES);    stat_floss_lsqfull_other	.init(number_of_threads, NUM_ISSUE_END_CAUSES)	.name(name + ".lsq_full")	.flags(dist)	;    stat_floss_lsqfull_other.ysubnames(IssueEndDesc);    initv(floss_robfull_other, number_of_threads, NUM_COMMIT_END_CAUSES);    stat_floss_robfull_other	.init(number_of_threads, NUM_COMMIT_END_CAUSES)	.name(name + ".rob_full")	.flags(dist)	;    stat_floss_robfull_other.ysubnames(CommitEndDesc);    //    //  QueueFull causes    //    initv(floss_qfull_other, number_of_threads, NUM_DIS_END_CAUSES);    stat_floss_qfull_other	.init(number_of_threads, NUM_DIS_END_CAUSES)	.name(name + ".qfull")	.flags(dist)	;    stat_floss_qfull_other.ysubnames(DisEndDesc);    //    //  Other random stuff...    //    initv(floss_other, number_of_threads, NUM_FETCH_END_CAUSES);    stat_floss_other	.init(number_of_threads, NUM_FETCH_END_CAUSES)	.name(name + ".fetch")	.flags(dist)	;    stat_floss_other.ysubnames(FetchEndDesc);}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -