summaryrefslogtreecommitdiff
path: root/src/cpu/simple/atomic.cc
diff options
context:
space:
mode:
authorAli Saidi <saidi@eecs.umich.edu>2007-08-13 23:44:26 -0400
committerAli Saidi <saidi@eecs.umich.edu>2007-08-13 23:44:26 -0400
commit27ddf0b40e9b0bea1d75d825c7339c9fb9411bc9 (patch)
treec6dea0a58fec9d5efecfb5559e3e1eaa24b33878 /src/cpu/simple/atomic.cc
parentb069b81acf498a538b1ce4b30ff8b2d96b2ec8de (diff)
parent9b4be6532741a511ca8f9e1d051269245814be8b (diff)
downloadgem5-27ddf0b40e9b0bea1d75d825c7339c9fb9411bc9.tar.xz
Merge IGNORE_STYLE change and my change.
--HG-- extra : convert_revision : 13880ec6df17b0317d4097243bb24add753a098a
Diffstat (limited to 'src/cpu/simple/atomic.cc')
-rw-r--r--src/cpu/simple/atomic.cc33
1 files changed, 28 insertions, 5 deletions
diff --git a/src/cpu/simple/atomic.cc b/src/cpu/simple/atomic.cc
index 704b65f36..e2a7d5938 100644
--- a/src/cpu/simple/atomic.cc
+++ b/src/cpu/simple/atomic.cc
@@ -67,6 +67,10 @@ AtomicSimpleCPU::getPort(const std::string &if_name, int idx)
return &dcachePort;
else if (if_name == "icache_port")
return &icachePort;
+ else if (if_name == "physmem_port") {
+ hasPhysMemPort = true;
+ return &physmemPort;
+ }
else
panic("No Such Port\n");
}
@@ -83,6 +87,12 @@ AtomicSimpleCPU::init()
TheISA::initCPU(tc, tc->readCpuId());
}
#endif
+ if (hasPhysMemPort) {
+ bool snoop = false;
+ AddrRangeList pmAddrList;
+ physmemPort.getPeerAddressRanges(pmAddrList, snoop);
+ physMemAddr = *pmAddrList.begin();
+ }
}
bool
@@ -141,7 +151,8 @@ AtomicSimpleCPU::DcachePort::setPeer(Port *port)
AtomicSimpleCPU::AtomicSimpleCPU(Params *p)
: BaseSimpleCPU(p), tickEvent(this),
width(p->width), simulate_stalls(p->simulate_stalls),
- icachePort(name() + "-iport", this), dcachePort(name() + "-iport", this)
+ icachePort(name() + "-iport", this), dcachePort(name() + "-iport", this),
+ physmemPort(name() + "-iport", this), hasPhysMemPort(false)
{
_status = Idle;
@@ -293,8 +304,12 @@ AtomicSimpleCPU::read(Addr addr, T &data, unsigned flags)
if (req->isMmapedIpr())
dcache_latency = TheISA::handleIprRead(thread->getTC(), &pkt);
- else
- dcache_latency = dcachePort.sendAtomic(&pkt);
+ else {
+ if (hasPhysMemPort && pkt.getAddr() == physMemAddr)
+ dcache_latency = physmemPort.sendAtomic(&pkt);
+ else
+ dcache_latency = dcachePort.sendAtomic(&pkt);
+ }
dcache_access = true;
assert(!pkt.isError());
@@ -402,7 +417,10 @@ AtomicSimpleCPU::write(T data, Addr addr, unsigned flags, uint64_t *res)
dcache_latency = TheISA::handleIprWrite(thread->getTC(), &pkt);
} else {
data = htog(data);
- dcache_latency = dcachePort.sendAtomic(&pkt);
+ if (hasPhysMemPort && pkt.getAddr() == physMemAddr)
+ dcache_latency = physmemPort.sendAtomic(&pkt);
+ else
+ dcache_latency = dcachePort.sendAtomic(&pkt);
}
dcache_access = true;
assert(!pkt.isError());
@@ -513,7 +531,12 @@ AtomicSimpleCPU::tick()
Packet::Broadcast);
ifetch_pkt.dataStatic(&inst);
- icache_latency = icachePort.sendAtomic(&ifetch_pkt);
+ if (hasPhysMemPort && ifetch_pkt.getAddr() == physMemAddr)
+ icache_latency = physmemPort.sendAtomic(&ifetch_pkt);
+ else
+ icache_latency = icachePort.sendAtomic(&ifetch_pkt);
+
+
// ifetch_req is initialized to read the instruction directly
// into the CPU object's inst field.
//}