mem-cache: Add match functions to QueueEntry
[gem5.git] / src / mem / comm_monitor.hh
index df61b0b801c869e2909bedaecbdbcdd783e396d2..1eea6a535fc1765939989debe0676b43a973faa1 100644 (file)
@@ -1,6 +1,8 @@
 /*
- * Copyright (c) 2012-2013, 2015 ARM Limited
- * All rights reserved
+ * Copyright (c) 2012-2013, 2015, 2018 ARM Limited
+ * Copyright (c) 2016 Google Inc.
+ * Copyright (c) 2017, Centre National de la Recherche Scientifique
+ * All rights reserved.
  *
  * The license below extends only to copyright in the software and shall
  * not be construed as granting a license to any other intellectual
@@ -36,6 +38,8 @@
  *
  * Authors: Thomas Grass
  *          Andreas Hansson
+ *          Rahul Thakur
+ *          Pierre-Yves Peneau
  */
 
 #ifndef __MEM_COMM_MONITOR_HH__
@@ -80,11 +84,8 @@ class CommMonitor : public MemObject
     void regProbePoints() override;
 
   public: // MemObject interfaces
-    BaseMasterPort& getMasterPort(const std::string& if_name,
-                                  PortID idx = InvalidPortID) override;
-
-    BaseSlavePort& getSlavePort(const std::string& if_name,
-                                PortID idx = InvalidPortID) override;
+    Port &getPort(const std::string &if_name,
+                  PortID idx=InvalidPortID) override;
 
   private:
 
@@ -167,6 +168,11 @@ class CommMonitor : public MemObject
             mon.recvReqRetry();
         }
 
+        void recvRetrySnoopResp()
+        {
+            mon.recvRetrySnoopResp();
+        }
+
       private:
 
         CommMonitor& mon;
@@ -223,6 +229,11 @@ class CommMonitor : public MemObject
             mon.recvRespRetry();
         }
 
+        bool tryTiming(PacketPtr pkt)
+        {
+            return mon.tryTiming(pkt);
+        }
+
       private:
 
         CommMonitor& mon;
@@ -248,6 +259,8 @@ class CommMonitor : public MemObject
 
     bool recvTimingSnoopResp(PacketPtr pkt);
 
+    void recvRetrySnoopResp();
+
     AddrRangeList getAddrRanges() const;
 
     bool isSnooping() const;
@@ -258,11 +271,13 @@ class CommMonitor : public MemObject
 
     void recvRangeChange();
 
+    bool tryTiming(PacketPtr pkt);
+
     /** Stats declarations, all in a struct for convenience. */
     struct MonitorStats
     {
 
-        /** Disable flag for burst length historgrams **/
+        /** Disable flag for burst length histograms **/
         bool disableBurstLengthHists;
 
         /** Histogram of read burst lengths */
@@ -350,6 +365,12 @@ class CommMonitor : public MemObject
         /** Disable flag for address distributions. */
         bool disableAddrDists;
 
+        /** Address mask for sources of read accesses to be captured */
+        const Addr readAddrMask;
+
+        /** Address mask for sources of write accesses to be captured */
+        const Addr writeAddrMask;
+
         /**
          * Histogram of number of read accesses to addresses over
          * time.
@@ -378,16 +399,22 @@ class CommMonitor : public MemObject
             outstandingReadReqs(0), outstandingWriteReqs(0),
             disableTransactionHists(params->disable_transaction_hists),
             readTrans(0), writeTrans(0),
-            disableAddrDists(params->disable_addr_dists)
+            disableAddrDists(params->disable_addr_dists),
+            readAddrMask(params->read_addr_mask),
+            writeAddrMask(params->write_addr_mask)
         { }
 
+        void updateReqStats(const ProbePoints::PacketInfo& pkt, bool is_atomic,
+                            bool expects_response);
+        void updateRespStats(const ProbePoints::PacketInfo& pkt, Tick latency,
+                             bool is_atomic);
     };
 
     /** This function is called periodically at the end of each time bin */
     void samplePeriodic();
 
     /** Periodic event called at the end of each simulation time bin */
-    EventWrapper<CommMonitor, &CommMonitor::samplePeriodic> samplePeriodicEvent;
+    EventFunctionWrapper samplePeriodicEvent;
 
     /**
      *@{
@@ -399,12 +426,6 @@ class CommMonitor : public MemObject
     /** Sample period in seconds */
     const double samplePeriod;
 
-    /** Address mask for sources of read accesses to be captured */
-    const Addr readAddrMask;
-
-    /** Address mask for sources of write accesses to be captured */
-    const Addr writeAddrMask;
-
     /** @} */
 
     /** Instantiate stats */