// Get the right port based on name. This applies to all the
// subclasses of the base CPU and relies on their implementation
// of getDataPort and getInstPort. In all cases there methods
- // return a CpuPort pointer.
+ // return a MasterPort pointer.
if (if_name == "dcache_port")
return getDataPort();
else if (if_name == "icache_port")
functionEntryTick = curTick();
}
}
-
-bool
-BaseCPU::CpuPort::recvTimingResp(PacketPtr pkt)
-{
- panic("BaseCPU doesn't expect recvTiming!\n");
- return true;
-}
-
-void
-BaseCPU::CpuPort::recvRetry()
-{
- panic("BaseCPU doesn't expect recvRetry!\n");
-}
-
-void
-BaseCPU::CpuPort::recvFunctionalSnoop(PacketPtr pkt)
-{
- // No internal storage to update (in the general case). A CPU with
- // internal storage, e.g. an LSQ that should be part of the
- // coherent memory has to check against stored data.
-}
/*
- * Copyright (c) 2011-2012 ARM Limited
+ * Copyright (c) 2011-2013 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
/** Is the CPU switched out or active? */
bool _switchedOut;
- /**
- * Define a base class for the CPU ports (instruction and data)
- * that is refined in the subclasses. This class handles the
- * common cases, i.e. the functional accesses and the status
- * changes and address range queries. The default behaviour for
- * both atomic and timing access is to panic and the corresponding
- * subclasses have to override these methods.
- */
- class CpuPort : public MasterPort
- {
- public:
-
- /**
- * Create a CPU port with a name and a structural owner.
- *
- * @param _name port name including the owner
- * @param _name structural owner of this port
- */
- CpuPort(const std::string& _name, MemObject* _owner) :
- MasterPort(_name, _owner)
- { }
-
- protected:
-
- virtual bool recvTimingResp(PacketPtr pkt);
-
- virtual void recvRetry();
-
- virtual void recvFunctionalSnoop(PacketPtr pkt);
-
- };
-
public:
/**
*
* @return a reference to the data port
*/
- virtual CpuPort &getDataPort() = 0;
+ virtual MasterPort &getDataPort() = 0;
/**
* Purely virtual method that returns a reference to the instruction
*
* @return a reference to the instruction port
*/
- virtual CpuPort &getInstPort() = 0;
+ virtual MasterPort &getInstPort() = 0;
/** Reads this CPU's ID. */
int cpuId() { return _cpuId; }
}
void
-CheckerCPU::setIcachePort(CpuPort *icache_port)
+CheckerCPU::setIcachePort(MasterPort *icache_port)
{
icachePort = icache_port;
}
void
-CheckerCPU::setDcachePort(CpuPort *dcache_port)
+CheckerCPU::setDcachePort(MasterPort *dcache_port)
{
dcachePort = dcache_port;
}
void setSystem(System *system);
- void setIcachePort(CpuPort *icache_port);
+ void setIcachePort(MasterPort *icache_port);
- void setDcachePort(CpuPort *dcache_port);
+ void setDcachePort(MasterPort *dcache_port);
- CpuPort &getDataPort()
+ MasterPort &getDataPort()
{
// the checker does not have ports on its own so return the
// data port of the actual CPU core
return *dcachePort;
}
- CpuPort &getInstPort()
+ MasterPort &getInstPort()
{
// the checker does not have ports on its own so return the
// data port of the actual CPU core
System *systemPtr;
- CpuPort *icachePort;
- CpuPort *dcachePort;
+ MasterPort *icachePort;
+ MasterPort *dcachePort;
ThreadContext *tc;
InOrderCPU::CachePort::CachePort(CacheUnit *_cacheUnit,
const std::string& name) :
- CpuPort(_cacheUnit->name() + name, _cacheUnit->cpu),
+ MasterPort(_cacheUnit->name() + name, _cacheUnit->cpu),
cacheUnit(_cacheUnit)
{ }
/*
- * Copyright (c) 2012 ARM Limited
+ * Copyright (c) 2012-2013 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
void verifyMemoryMode() const;
/** Return a reference to the data port. */
- virtual CpuPort &getDataPort() { return dataPort; }
+ virtual MasterPort &getDataPort() { return dataPort; }
/** Return a reference to the instruction port. */
- virtual CpuPort &getInstPort() { return instPort; }
+ virtual MasterPort &getInstPort() { return instPort; }
/** CPU ID */
int cpu_id;
* CachePort class for the in-order CPU, interacting with a
* specific CacheUnit in the pipeline.
*/
- class CachePort : public CpuPort
+ class CachePort : public MasterPort
{
private:
/*
- * Copyright (c) 2011-2012 ARM Limited
+ * Copyright (c) 2011-2013 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
/**
* IcachePort class for instruction fetch.
*/
- class IcachePort : public CpuPort
+ class IcachePort : public MasterPort
{
protected:
/** Pointer to fetch. */
public:
/** Default constructor. */
IcachePort(DefaultFetch<Impl> *_fetch, FullO3CPU<Impl>* _cpu)
- : CpuPort(_cpu->name() + ".icache_port", _cpu), fetch(_fetch)
+ : MasterPort(_cpu->name() + ".icache_port", _cpu), fetch(_fetch)
{ }
protected:
/**
* DcachePort class for the load/store queue.
*/
- class DcachePort : public CpuPort
+ class DcachePort : public MasterPort
{
protected:
public:
/** Default constructor. */
DcachePort(LSQ<Impl> *_lsq, FullO3CPU<Impl>* _cpu)
- : CpuPort(_cpu->name() + ".dcache_port", _cpu), lsq(_lsq)
+ : MasterPort(_cpu->name() + ".dcache_port", _cpu), lsq(_lsq)
{ }
protected:
virtual bool recvTimingResp(PacketPtr pkt);
virtual void recvTimingSnoopReq(PacketPtr pkt);
+ virtual void recvFunctionalSnoop(PacketPtr pkt)
+ {
+ // @todo: Is there a need for potential invalidation here?
+ }
+
/** Handles doing a retry of the previous send. */
virtual void recvRetry();
}
/** Used by the fetch unit to get a hold of the instruction port. */
- virtual CpuPort &getInstPort() { return icachePort; }
+ virtual MasterPort &getInstPort() { return icachePort; }
/** Get the dcache port (used to find block size for translations). */
- virtual CpuPort &getDataPort() { return dcachePort; }
+ virtual MasterPort &getDataPort() { return dcachePort; }
/** Stat for total number of times the CPU is descheduled. */
Stats::Scalar timesIdled;
/*
- * Copyright (c) 2012 ARM Limited
+ * Copyright (c) 2012-2013 ARM Limited
* All rights reserved.
*
* The license below extends only to copyright in the software and shall
/**
* An AtomicCPUPort overrides the default behaviour of the
- * recvAtomic and ignores the packet instead of panicking.
+ * recvAtomicSnoop and ignores the packet instead of panicking. It
+ * also provides an implementation for the purely virtual timing
+ * functions and panics on either of these.
*/
- class AtomicCPUPort : public CpuPort
+ class AtomicCPUPort : public MasterPort
{
public:
AtomicCPUPort(const std::string &_name, BaseCPU* _cpu)
- : CpuPort(_name, _cpu)
+ : MasterPort(_name, _cpu)
{ }
protected:
return 0;
}
+ bool recvTimingResp(PacketPtr pkt)
+ {
+ panic("Atomic CPU doesn't expect recvTimingResp!\n");
+ return true;
+ }
+
+ void recvRetry()
+ {
+ panic("Atomic CPU doesn't expect recvRetry!\n");
+ }
+
};
AtomicCPUPort icachePort;
protected:
/** Return a reference to the data port. */
- virtual CpuPort &getDataPort() { return dcachePort; }
+ virtual MasterPort &getDataPort() { return dcachePort; }
/** Return a reference to the instruction port. */
- virtual CpuPort &getInstPort() { return icachePort; }
+ virtual MasterPort &getInstPort() { return icachePort; }
public:
/*
- * Copyright (c) 2012 ARM Limited
+ * Copyright (c) 2012-2013 ARM Limited
* All rights reserved
*
* The license below extends only to copyright in the software and shall
* scheduling of handling of incoming packets in the following
* cycle.
*/
- class TimingCPUPort : public CpuPort
+ class TimingCPUPort : public MasterPort
{
public:
TimingCPUPort(const std::string& _name, TimingSimpleCPU* _cpu)
- : CpuPort(_name, _cpu), cpu(_cpu), retryEvent(this)
+ : MasterPort(_name, _cpu), cpu(_cpu), retryEvent(this)
{ }
protected:
protected:
/** Return a reference to the data port. */
- virtual CpuPort &getDataPort() { return dcachePort; }
+ virtual MasterPort &getDataPort() { return dcachePort; }
/** Return a reference to the instruction port. */
- virtual CpuPort &getInstPort() { return icachePort; }
+ virtual MasterPort &getInstPort() { return icachePort; }
public: