Now timing reads work in single level of cache with simple cpu

src/mem/cache/base_cache.cc:
src/mem/cache/base_cache.hh:
src/mem/cache/cache.hh:
    Changes to handle timing reads in Simple CPU (blocking buffers)

--HG--
extra : convert_revision : a2e7d4287d7cdfd1bbf9c929ecbeafde499a5b9f
This commit is contained in:
Ron Dreslinski 2006-07-06 15:15:37 -04:00
parent 4201ec84b2
commit 329e32f8c6
3 changed files with 54 additions and 22 deletions

View file

@ -98,6 +98,37 @@ BaseCache::CachePort::clearBlocked()
blocked = false; blocked = false;
} }
BaseCache::CacheEvent::CacheEvent(CachePort *_cachePort)
: Event(&mainEventQueue, CPU_Tick_Pri), cachePort(_cachePort)
{
this->setFlags(AutoDelete);
pkt = NULL;
}
BaseCache::CacheEvent::CacheEvent(CachePort *_cachePort, Packet *_pkt)
: Event(&mainEventQueue, CPU_Tick_Pri), cachePort(_cachePort), pkt(_pkt)
{
this->setFlags(AutoDelete);
}
void
BaseCache::CacheEvent::process()
{
if (!pkt)
{
if (!cachePort->isCpuSide)
pkt = cachePort->cache->getPacket();
//Else get coherence req
}
cachePort->sendTiming(pkt);
}
const char *
BaseCache::CacheEvent::description()
{
return "timing event\n";
}
Port* Port*
BaseCache::getPort(const std::string &if_name, int idx) BaseCache::getPort(const std::string &if_name, int idx)
{ {

View file

@ -79,9 +79,9 @@ class BaseCache : public MemObject
{ {
class CachePort : public Port class CachePort : public Port
{ {
public:
BaseCache *cache; BaseCache *cache;
public:
CachePort(const std::string &_name, BaseCache *_cache, bool _isCpuSide); CachePort(const std::string &_name, BaseCache *_cache, bool _isCpuSide);
protected: protected:
@ -110,10 +110,11 @@ class BaseCache : public MemObject
struct CacheEvent : public Event struct CacheEvent : public Event
{ {
Packet *pkt;
CachePort *cachePort; CachePort *cachePort;
Packet *pkt;
CacheEvent(Packet *pkt, CachePort *cachePort); CacheEvent(CachePort *_cachePort);
CacheEvent(CachePort *_cachePort, Packet *_pkt);
void process(); void process();
const char *description(); const char *description();
}; };
@ -147,6 +148,11 @@ class BaseCache : public MemObject
fatal("No implementation"); fatal("No implementation");
} }
virtual Packet *getPacket()
{
fatal("No implementation");
}
/** /**
* Bit vector of the blocking reasons for the access path. * Bit vector of the blocking reasons for the access path.
* @sa #BlockedCause * @sa #BlockedCause
@ -388,7 +394,6 @@ class BaseCache : public MemObject
if (!isBlockedForSnoop()) { if (!isBlockedForSnoop()) {
memSidePort->clearBlocked(); memSidePort->clearBlocked();
} }
} }
/** /**
@ -407,10 +412,13 @@ class BaseCache : public MemObject
*/ */
void setMasterRequest(RequestCause cause, Tick time) void setMasterRequest(RequestCause cause, Tick time)
{ {
if (!doMasterRequest())
{
BaseCache::CacheEvent * reqCpu = new BaseCache::CacheEvent(memSidePort);
reqCpu->schedule(time);
}
uint8_t flag = 1<<cause; uint8_t flag = 1<<cause;
masterRequests |= flag; masterRequests |= flag;
assert("Implement\n" && 0);
// mi->pktuest(time);
} }
/** /**
@ -462,8 +470,10 @@ class BaseCache : public MemObject
*/ */
void respond(Packet *pkt, Tick time) void respond(Packet *pkt, Tick time)
{ {
assert("Implement\n" && 0); pkt->makeTimingResponse();
// si->respond(pkt,time); pkt->result = Packet::Success;
CacheEvent *reqCpu = new CacheEvent(cpuSidePort, pkt);
reqCpu->schedule(time);
} }
/** /**
@ -476,8 +486,10 @@ class BaseCache : public MemObject
if (!pkt->req->isUncacheable()) { if (!pkt->req->isUncacheable()) {
missLatency[pkt->cmdToIndex()][pkt->req->getThreadNum()] += time - pkt->time; missLatency[pkt->cmdToIndex()][pkt->req->getThreadNum()] += time - pkt->time;
} }
assert("Implement\n" && 0); pkt->makeTimingResponse();
// si->respond(pkt,time); pkt->result = Packet::Success;
CacheEvent *reqCpu = new CacheEvent(cpuSidePort, pkt);
reqCpu->schedule(time);
} }
/** /**

View file

@ -168,7 +168,7 @@ class Cache : public BaseCache
* Selects a request to send on the bus. * Selects a request to send on the bus.
* @return The memory request to service. * @return The memory request to service.
*/ */
Packet * getPacket(); virtual Packet * getPacket();
/** /**
* Was the request was sent successfully? * Was the request was sent successfully?
@ -241,17 +241,6 @@ class Cache : public BaseCache
return missQueue->getMisses(); return missQueue->getMisses();
} }
/**
* Send a response to the slave interface.
* @param req The request being responded to.
* @param time The time the response is ready.
*/
void respond(Packet * &pkt, Tick time)
{
//si->respond(pkt,time);
cpuSidePort->sendAtomic(pkt);
}
/** /**
* Perform the access specified in the request and return the estimated * Perform the access specified in the request and return the estimated
* time of completion. This function can either update the hierarchy state * time of completion. This function can either update the hierarchy state