summaryrefslogtreecommitdiff
path: root/cpu/o3/btb.cc
diff options
context:
space:
mode:
authorKevin Lim <ktlim@umich.edu>2006-04-22 18:26:48 -0400
committerKevin Lim <ktlim@umich.edu>2006-04-22 18:26:48 -0400
commita8b03e4d017b66d7b5502a101ea5b7115827a107 (patch)
tree9e606dc41a9b84a574d6935e5718c8fe665cc32f /cpu/o3/btb.cc
parentc30f91c2f634a0b55a9b9b9145b1fbe605bb1a02 (diff)
downloadgem5-a8b03e4d017b66d7b5502a101ea5b7115827a107.tar.xz
Updates for O3 model.
arch/alpha/isa/decoder.isa: Make IPR accessing instructions serializing so they are not issued incorrectly in the O3 model. arch/alpha/isa/pal.isa: Allow IPR instructions to have flags. base/traceflags.py: Include new trace flags from the two new CPU models. cpu/SConscript: Create the templates for the split mem accessor methods. Also include the new files from the new models (the Ozone model will be checked in next). cpu/base_dyn_inst.cc: cpu/base_dyn_inst.hh: Update to the BaseDynInst for the new models. --HG-- extra : convert_revision : cc82db9c72ec3e29cea4c3fdff74a3843e287a35
Diffstat (limited to 'cpu/o3/btb.cc')
-rw-r--r--cpu/o3/btb.cc26
1 files changed, 16 insertions, 10 deletions
diff --git a/cpu/o3/btb.cc b/cpu/o3/btb.cc
index 2d39c3856..e084142d7 100644
--- a/cpu/o3/btb.cc
+++ b/cpu/o3/btb.cc
@@ -39,14 +39,15 @@ DefaultBTB::DefaultBTB(unsigned _numEntries,
tagBits(_tagBits),
instShiftAmt(_instShiftAmt)
{
- // @todo Check to make sure num_entries is valid (a power of 2)
-
DPRINTF(Fetch, "BTB: Creating BTB object.\n");
- btb = new BTBEntry[numEntries];
+ if (!isPowerOf2(numEntries)) {
+ fatal("BTB entries is not a power of 2!");
+ }
+
+ btb.resize(numEntries);
- for (int i = 0; i < numEntries; ++i)
- {
+ for (int i = 0; i < numEntries; ++i) {
btb[i].valid = false;
}
@@ -73,7 +74,7 @@ DefaultBTB::getTag(const Addr &inst_PC)
}
bool
-DefaultBTB::valid(const Addr &inst_PC)
+DefaultBTB::valid(const Addr &inst_PC, unsigned tid)
{
unsigned btb_idx = getIndex(inst_PC);
@@ -81,7 +82,9 @@ DefaultBTB::valid(const Addr &inst_PC)
assert(btb_idx < numEntries);
- if (btb[btb_idx].valid && inst_tag == btb[btb_idx].tag) {
+ if (btb[btb_idx].valid
+ && inst_tag == btb[btb_idx].tag
+ && btb[btb_idx].tid == tid) {
return true;
} else {
return false;
@@ -92,7 +95,7 @@ DefaultBTB::valid(const Addr &inst_PC)
// address is valid, and also the address. For now will just use addr = 0 to
// represent invalid entry.
Addr
-DefaultBTB::lookup(const Addr &inst_PC)
+DefaultBTB::lookup(const Addr &inst_PC, unsigned tid)
{
unsigned btb_idx = getIndex(inst_PC);
@@ -100,7 +103,9 @@ DefaultBTB::lookup(const Addr &inst_PC)
assert(btb_idx < numEntries);
- if (btb[btb_idx].valid && inst_tag == btb[btb_idx].tag) {
+ if (btb[btb_idx].valid
+ && inst_tag == btb[btb_idx].tag
+ && btb[btb_idx].tid == tid) {
return btb[btb_idx].target;
} else {
return 0;
@@ -108,12 +113,13 @@ DefaultBTB::lookup(const Addr &inst_PC)
}
void
-DefaultBTB::update(const Addr &inst_PC, const Addr &target)
+DefaultBTB::update(const Addr &inst_PC, const Addr &target, unsigned tid)
{
unsigned btb_idx = getIndex(inst_PC);
assert(btb_idx < numEntries);
+ btb[btb_idx].tid = tid;
btb[btb_idx].valid = true;
btb[btb_idx].target = target;
btb[btb_idx].tag = getTag(inst_PC);