inorder: import name for addtl. bpred stats

This commit is contained in:
Korey Sewell 2010-03-22 17:19:48 -04:00
parent 0170e851de
commit 2620e08722
3 changed files with 22 additions and 19 deletions

View file

@ -39,10 +39,9 @@
using namespace std; using namespace std;
using namespace ThePipeline; using namespace ThePipeline;
BPredUnit::BPredUnit(ThePipeline::Params *params) BPredUnit::BPredUnit(Resource *_res, ThePipeline::Params *params)
: BTB(params->BTBEntries, : res(_res),
params->BTBTagSize, BTB(params->BTBEntries, params->BTBTagSize, params->instShiftAmt)
params->instShiftAmt)
{ {
// Setup the selected predictor. // Setup the selected predictor.
if (params->predType == "local") { if (params->predType == "local") {
@ -70,48 +69,47 @@ BPredUnit::BPredUnit(ThePipeline::Params *params)
RAS[i].init(params->RASSize); RAS[i].init(params->RASSize);
} }
std::string
BPredUnit::name()
{
return res->name();
}
void void
BPredUnit::regStats() BPredUnit::regStats()
{ {
lookups lookups
.name(name() + ".BPredUnit.lookups") .name(name() + ".lookups")
.desc("Number of BP lookups") .desc("Number of BP lookups")
; ;
condPredicted condPredicted
.name(name() + ".BPredUnit.condPredicted") .name(name() + ".condPredicted")
.desc("Number of conditional branches predicted") .desc("Number of conditional branches predicted")
; ;
condIncorrect condIncorrect
.name(name() + ".BPredUnit.condIncorrect") .name(name() + ".condIncorrect")
.desc("Number of conditional branches incorrect") .desc("Number of conditional branches incorrect")
; ;
BTBLookups BTBLookups
.name(name() + ".BPredUnit.BTBLookups") .name(name() + ".BTBLookups")
.desc("Number of BTB lookups") .desc("Number of BTB lookups")
; ;
BTBHits BTBHits
.name(name() + ".BPredUnit.BTBHits") .name(name() + ".BTBHits")
.desc("Number of BTB hits") .desc("Number of BTB hits")
; ;
BTBCorrect
.name(name() + ".BPredUnit.BTBCorrect")
.desc("Number of correct BTB predictions (this stat may not "
"work properly.")
;
usedRAS usedRAS
.name(name() + ".BPredUnit.usedRAS") .name(name() + ".usedRAS")
.desc("Number of times the RAS was used to get a target.") .desc("Number of times the RAS was used to get a target.")
; ;
RASIncorrect RASIncorrect
.name(name() + ".BPredUnit.RASInCorrect") .name(name() + ".RASInCorrect")
.desc("Number of incorrect RAS predictions.") .desc("Number of incorrect RAS predictions.")
; ;
} }

View file

@ -39,6 +39,7 @@
#include "cpu/inst_seq.hh" #include "cpu/inst_seq.hh"
#include "cpu/inorder/inorder_dyn_inst.hh" #include "cpu/inorder/inorder_dyn_inst.hh"
#include "cpu/inorder/pipeline_traits.hh" #include "cpu/inorder/pipeline_traits.hh"
#include "cpu/inorder/resource.hh"
#include "cpu/pred/2bit_local.hh" #include "cpu/pred/2bit_local.hh"
#include "cpu/pred/btb.hh" #include "cpu/pred/btb.hh"
#include "cpu/pred/ras.hh" #include "cpu/pred/ras.hh"
@ -65,7 +66,9 @@ class BPredUnit
/** /**
* @param params The params object, that has the size of the BP and BTB. * @param params The params object, that has the size of the BP and BTB.
*/ */
BPredUnit(ThePipeline::Params *params); BPredUnit(Resource *_res, ThePipeline::Params *params);
std::string name();
/** /**
* Registers statistics. * Registers statistics.
@ -169,6 +172,8 @@ class BPredUnit
void dump(); void dump();
private: private:
Resource *res;
struct PredictorHistory { struct PredictorHistory {
/** /**
* Makes a predictor history struct that contains any * Makes a predictor history struct that contains any

View file

@ -39,7 +39,7 @@ using namespace ThePipeline;
BranchPredictor::BranchPredictor(std::string res_name, int res_id, int res_width, BranchPredictor::BranchPredictor(std::string res_name, int res_id, int res_width,
int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params) int res_latency, InOrderCPU *_cpu, ThePipeline::Params *params)
: Resource(res_name, res_id, res_width, res_latency, _cpu), : Resource(res_name, res_id, res_width, res_latency, _cpu),
branchPred(params) branchPred(this, params)
{ {
instSize = sizeof(MachInst); instSize = sizeof(MachInst);
} }