misc: Delete the now unnecessary create methods.
[gem5.git] / src / mem / mem_checker_monitor.cc
index 75c797c32555dc212d6fdb23207e77a195bb3a7b..8f343e592571b0db9b2cbc2359963ba7187d7be5 100644 (file)
  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- * Authors: Thomas Grass
- *          Andreas Hansson
- *          Marco Elver
  */
 
 #include "mem/mem_checker_monitor.hh"
 #include "base/trace.hh"
 #include "debug/MemCheckerMonitor.hh"
 
-MemCheckerMonitor::MemCheckerMonitor(Params* params)
-    : MemObject(params),
-      masterPort(name() + "-master", *this),
-      slavePort(name() + "-slave", *this),
-      warnOnly(params->warn_only),
-      memchecker(params->memchecker)
+MemCheckerMonitor::MemCheckerMonitor(const Params &params)
+    : SimObject(params),
+      memSidePort(name() + "-memSidePort", *this),
+      cpuSidePort(name() + "-cpuSidePort", *this),
+      warnOnly(params.warn_only),
+      memchecker(params.memchecker)
 {}
 
 MemCheckerMonitor::~MemCheckerMonitor()
 {}
 
-MemCheckerMonitor*
-MemCheckerMonitorParams::create()
-{
-    return new MemCheckerMonitor(this);
-}
-
 void
 MemCheckerMonitor::init()
 {
     // make sure both sides of the monitor are connected
-    if (!slavePort.isConnected() || !masterPort.isConnected())
+    if (!cpuSidePort.isConnected() || !memSidePort.isConnected())
         fatal("Communication monitor is not connected on both sides.\n");
 }
 
-BaseMasterPort&
-MemCheckerMonitor::getMasterPort(const std::string& if_name, PortID idx)
-{
-    if (if_name == "master" || if_name == "mem_side") {
-        return masterPort;
-    } else {
-        return MemObject::getMasterPort(if_name, idx);
-    }
-}
-
-BaseSlavePort&
-MemCheckerMonitor::getSlavePort(const std::string& if_name, PortID idx)
+Port &
+MemCheckerMonitor::getPort(const std::string &if_name, PortID idx)
 {
-    if (if_name == "slave" || if_name == "cpu_side") {
-        return slavePort;
+    if (if_name == "request" || if_name == "mem_side_port") {
+        return memSidePort;
+    } else if (if_name == "response" || if_name == "cpu_side_port") {
+        return cpuSidePort;
     } else {
-        return MemObject::getSlavePort(if_name, idx);
+        return SimObject::getPort(if_name, idx);
     }
 }
 
@@ -104,7 +86,7 @@ MemCheckerMonitor::recvFunctional(PacketPtr pkt)
     // reads/writes to these location from other devices we do not see.
     memchecker->reset(addr, size);
 
-    masterPort.sendFunctional(pkt);
+    memSidePort.sendFunctional(pkt);
 
     DPRINTF(MemCheckerMonitor,
             "Forwarded functional access: addr = %#llx, size = %d\n",
@@ -120,7 +102,7 @@ MemCheckerMonitor::recvFunctionalSnoop(PacketPtr pkt)
     // See above.
     memchecker->reset(addr, size);
 
-    slavePort.sendFunctionalSnoop(pkt);
+    cpuSidePort.sendFunctionalSnoop(pkt);
 
     DPRINTF(MemCheckerMonitor,
             "Received functional snoop: addr = %#llx, size = %d\n",
@@ -176,7 +158,7 @@ MemCheckerMonitor::recvTimingReq(PacketPtr pkt)
     }
 
     // Attempt to send the packet
-    bool successful = masterPort.sendTimingReq(pkt);
+    bool successful = memSidePort.sendTimingReq(pkt);
 
     // If not successful, restore the sender state
     if (!successful && expects_response && (is_read || is_write)) {
@@ -192,9 +174,9 @@ MemCheckerMonitor::recvTimingReq(PacketPtr pkt)
             // At the time where we push the sender-state, we do not yet know
             // the serial the MemChecker class will assign to this request. We
             // cannot call startRead at the time we push the sender-state, as
-            // the masterPort may not be successful in executing sendTimingReq,
-            // and in case of a failure, we must not modify the state of the
-            // MemChecker.
+            // the memSidePort may not be successful in executing
+            // sendTimingReq, and in case of a failure, we must not
+            // modify the state of the MemChecker.
             //
             // Once we know that sendTimingReq was successful, we can set the
             // serial of the newly constructed sender-state. This is legal, as
@@ -268,7 +250,7 @@ MemCheckerMonitor::recvTimingResp(PacketPtr pkt)
     }
 
     // Attempt to send the packet
-    bool successful = slavePort.sendTimingResp(pkt);
+    bool successful = cpuSidePort.sendTimingResp(pkt);
 
     // If packet successfully send, complete transaction in MemChecker
     // instance, and delete sender state, otherwise restore state.
@@ -330,43 +312,43 @@ MemCheckerMonitor::recvTimingResp(PacketPtr pkt)
 void
 MemCheckerMonitor::recvTimingSnoopReq(PacketPtr pkt)
 {
-    slavePort.sendTimingSnoopReq(pkt);
+    cpuSidePort.sendTimingSnoopReq(pkt);
 }
 
 bool
 MemCheckerMonitor::recvTimingSnoopResp(PacketPtr pkt)
 {
-    return masterPort.sendTimingSnoopResp(pkt);
+    return memSidePort.sendTimingSnoopResp(pkt);
 }
 
 bool
 MemCheckerMonitor::isSnooping() const
 {
-    // check if the connected master port is snooping
-    return slavePort.isSnooping();
+    // check if the connected memSidePort is snooping
+    return cpuSidePort.isSnooping();
 }
 
 AddrRangeList
 MemCheckerMonitor::getAddrRanges() const
 {
-    // get the address ranges of the connected slave port
-    return masterPort.getAddrRanges();
+    // get the address ranges of the connected cpuSidePort
+    return memSidePort.getAddrRanges();
 }
 
 void
 MemCheckerMonitor::recvReqRetry()
 {
-    slavePort.sendRetryReq();
+    cpuSidePort.sendRetryReq();
 }
 
 void
 MemCheckerMonitor::recvRespRetry()
 {
-    masterPort.sendRetryResp();
+    memSidePort.sendRetryResp();
 }
 
 void
 MemCheckerMonitor::recvRangeChange()
 {
-    slavePort.sendRangeChange();
+    cpuSidePort.sendRangeChange();
 }