#include "cpu/smt.hh"
#include "cpu/static_inst.hh"
#include "kern/kernel_stats.hh"
-#include "mem/base_mem.hh"
-#include "mem/mem_interface.hh"
#include "sim/builder.hh"
#include "sim/debug.hh"
#include "sim/host.hh"
#include "targetarch/stacktrace.hh"
#include "targetarch/vtophys.hh"
#else // !FULL_SYSTEM
-#include "mem/functional/functional.hh"
+#include "mem/memory.hh"
#endif // FULL_SYSTEM
using namespace std;
}
-SimpleCPU::CacheCompletionEvent::CacheCompletionEvent(SimpleCPU *_cpu)
- : Event(&mainEventQueue), cpu(_cpu)
-{
-}
-
-
bool
SimpleCPU::CpuPort::recvTiming(Packet &pkt)
{
SimpleCPU::SimpleCPU(Params *p)
- : BaseCPU(p), tickEvent(this, p->width), xc(NULL),
- cacheCompletionEvent(this), dcachePort(this), icachePort(this)
+ : BaseCPU(p), icachePort(this),
+ dcachePort(this), tickEvent(this, p->width), xc(NULL)
{
_status = Idle;
#if FULL_SYSTEM
xc = new ExecContext(this, /* thread_num */ 0, p->process, /* asid */ 0);
#endif // !FULL_SYSTEM
- xc->memPort = dcachePort;
+ memPort = &dcachePort;
req = new CpuRequest;
nameOut(os, csprintf("%s.tickEvent", name()));
tickEvent.serialize(os);
nameOut(os, csprintf("%s.cacheCompletionEvent", name()));
- cacheCompletionEvent.serialize(os);
}
void
UNSERIALIZE_SCALAR(inst);
xc->unserialize(cp, csprintf("%s.xc", section));
tickEvent.unserialize(cp, csprintf("%s.tickEvent", section));
- cacheCompletionEvent
- .unserialize(cp, csprintf("%s.cacheCompletionEvent", section));
}
void
memReq->reset(src & ~(blk_size - 1), blk_size);
// translate to physical address
- Fault fault = xc->translateDataReadReq(memReq);
+ Fault fault = xc->translateDataReadReq(req);
assert(fault != Alignment_Fault);
}
return fault;
#else
- return No_Fault
+ return No_Fault;
#endif
}
memReq->reset(dest & ~(blk_size -1), blk_size);
// translate to physical address
- Fault fault = xc->translateDataWriteReq(memReq);
+ Fault fault = xc->translateDataWriteReq(req);
assert(fault != Alignment_Fault);
// translate to physical address
// NEED NEW TRANSLATION HERE
- Fault fault = xc->translateDataReadReq(memReq);
+ Fault fault = xc->translateDataReadReq(req);
// Now do the access.
if (fault == No_Fault) {
}
*/
// This will need a new way to tell if it has a dcache attached.
- if (/*!dcacheInterface && */(memReq->flags & UNCACHEABLE))
+ if (/*!dcacheInterface && */(req->flags & UNCACHEABLE))
recordEvent("Uncached Read");
return fault;
// translate to physical address
// NEED NEW TRANSLATION HERE
- Fault fault = xc->translateDataWriteReq(memReq);
+ Fault fault = xc->translateDataWriteReq(req);
// Now do the access.
if (fault == No_Fault) {
}
*/
if (res && (fault == No_Fault))
- *res = memReq->result;
+ *res = pkt->result;
// This will need a new way to tell if it's hooked up to a cache or not.
- if (/*!dcacheInterface && */(memReq->flags & UNCACHEABLE))
+ if (/*!dcacheInterface && */(req->flags & UNCACHEABLE))
recordEvent("Uncached Write");
// If the write needs to have a fault on the access, consider calling
SimpleCPU::sendIcacheRequest()
{
#if 1
- bool success = icachePort.sendTiming(pkt);
+ bool success = icachePort.sendTiming(*pkt);
unscheduleTickEvent();
unscheduleTickEvent();
#if 1
- bool success = dcachePort.sendTiming(pkt);
+ bool success = dcachePort.sendTiming(*pkt);
lastDcacheStall = curTick;
}
void
-SimpleCPU::processResponse(Packet *response)
+SimpleCPU::processResponse(Packet &response)
{
// For what things is the CPU the consumer of the packet it sent
// out? This may create a memory leak if that's the case and it's
// expected of the SimpleCPU to delete its own packet.
- pkt = response;
+ pkt = &response;
switch (status()) {
case IcacheWaitResponse:
delete pkt;
break;
case DcacheWaitResponse:
- if (req->cmd.isRead()) {
+ if (pkt->cmd == Read) {
curStaticInst->execute(this,traceData);
if (traceData)
traceData->finalize();
scheduleTickEvent(1);
break;
case DcacheWaitSwitch:
- if (memReq->cmd.isRead()) {
+ if (pkt->cmd == Read) {
curStaticInst->execute(this,traceData);
if (traceData)
traceData->finalize();
IFETCH_FLAGS(xc->regs.pc));
*/
//NEED NEW TRANSLATION HERE
- fault = xc->translateInstReq(memReq);
+ fault = xc->translateInstReq(req);
if (fault == No_Fault) {
pkt = new Packet;
// If we have a dcache miss, then we can't finialize the instruction
// trace yet because we want to populate it with the data later
if (traceData &&
- !(status() == DcacheWaitResponse && memReq->cmd.isRead())) {
+ !(status() == DcacheWaitResponse && pkt->cmd == Read)) {
traceData->finalize();
}
#endif // FULL_SYSTEM
Param<int> clock;
- SimObjectParam<BaseMem *> icache;
- SimObjectParam<BaseMem *> dcache;
Param<bool> defer_registration;
Param<int> width;
#endif // FULL_SYSTEM
INIT_PARAM(clock, "clock speed"),
- INIT_PARAM(icache, "L1 instruction cache object"),
- INIT_PARAM(dcache, "L1 data cache object"),
INIT_PARAM(defer_registration, "defer system registration (for sampling)"),
INIT_PARAM(width, "cpu width"),
INIT_PARAM(function_trace, "Enable function trace"),
params->clock = clock;
params->functionTrace = function_trace;
params->functionTraceStart = function_trace_start;
- params->icache_interface = (icache) ? icache->getInterface() : NULL;
- params->dcache_interface = (dcache) ? dcache->getInterface() : NULL;
params->width = width;
#if FULL_SYSTEM