#include "params/AbstractMemory.hh"
#include "sim/stats.hh"
+
+class System;
+
/**
* An abstract memory represents a contiguous block of physical
* memory, with an associated address range, and also provides basic
protected:
// Address range of this memory
- Range<Addr> range;
+ AddrRange range;
// Pointer to host memory used to implement this memory
uint8_t* pmemAddr;
}
/** Number of total bytes read from this memory */
- Stats::Scalar bytesRead;
+ Stats::Vector bytesRead;
/** Number of instruction bytes read from this memory */
- Stats::Scalar bytesInstRead;
+ Stats::Vector bytesInstRead;
/** Number of bytes written to this memory */
- Stats::Scalar bytesWritten;
+ Stats::Vector bytesWritten;
/** Number of read requests */
- Stats::Scalar numReads;
+ Stats::Vector numReads;
/** Number of write requests */
- Stats::Scalar numWrites;
+ Stats::Vector numWrites;
/** Number of other requests */
- Stats::Scalar numOther;
+ Stats::Vector numOther;
/** Read bandwidth from this memory */
Stats::Formula bwRead;
/** Read bandwidth from this memory */
/** Total bandwidth from this memory */
Stats::Formula bwTotal;
+ /** Pointor to the System object.
+ * This is used for getting the number of masters in the system which is
+ * needed when registering stats
+ */
+ System *_system;
+
+
private:
// Prevent copying
AbstractMemory(const Params* p);
virtual ~AbstractMemory();
+ /** read the system pointer
+ * Implemented for completeness with the setter
+ * @return pointer to the system object */
+ System* system() const { return _system; }
+
+ /** Set the system pointer on this memory
+ * This can't be done via a python parameter because the system needs
+ * pointers to all the memories and the reverse would create a cycle in the
+ * object graph. An init() this is set.
+ * @param sys system pointer to set
+ */
+ void system(System *sys) { _system = sys; }
+
const Params *
params() const
{
*
* @return a single contigous address range
*/
- Range<Addr> getAddrRange();
+ AddrRange getAddrRange() const;
/**
* Get the memory size.
*
* @return the size of the memory
*/
- uint64_t size() { return range.size(); }
+ uint64_t size() const { return range.size(); }
/**
* Get the start address.
*
* @return the start address of the memory
*/
- Addr start() { return range.start; }
+ Addr start() const { return range.start; }
/**
* Should this memory be passed to the kernel and part of the OS