Mem: Use deque instead of list for bus retries
[gem5.git] / src / mem / abstract_mem.hh
index 42ad08e5c46a8d6b644a62d23f023018878b5d72..66d4a1f16ce583b973e8f5fb774ed3fafa74fc43 100644 (file)
@@ -53,6 +53,9 @@
 #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
@@ -65,7 +68,7 @@ class AbstractMemory : public MemObject
   protected:
 
     // Address range of this memory
-    Range<Addr> range;
+    AddrRange range;
 
     // Pointer to host memory used to implement this memory
     uint8_t* pmemAddr;
@@ -140,17 +143,17 @@ class AbstractMemory : public MemObject
     }
 
     /** 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 */
@@ -160,6 +163,13 @@ class AbstractMemory : public MemObject
     /** 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
@@ -175,6 +185,19 @@ class AbstractMemory : public MemObject
     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
     {
@@ -186,21 +209,21 @@ class AbstractMemory : public MemObject
      *
      * @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