Mahyar Samani has uploaded this change for review. ( https://gem5-review.googlesource.com/c/public/gem5/+/31856 )

Change subject: sim: Fix callback crushing issue
......................................................................

sim: Fix callback crushing issue

Change-Id: I5943cf2ca3bba8495b4ff238898a823ba8562a81
---
M src/mem/DRAMSim3.py
M src/mem/dramsim3.cc
M src/mem/dramsim3.hh
3 files changed, 19 insertions(+), 13 deletions(-)



diff --git a/src/mem/DRAMSim3.py b/src/mem/DRAMSim3.py
index 45feab0..d33d001 100644
--- a/src/mem/DRAMSim3.py
+++ b/src/mem/DRAMSim3.py
@@ -46,7 +46,8 @@
     # A single port for now
     port = SlavePort("Slave port")

-    deviceConfigFile = Param.String("configs/DDR4_8Gb_x8_2400.ini",
-                                    "One configuration file")
+    configFile = Param.String("ext/dramsim3/DRAMSim3/configs/"
+                              "DDR4_8Gb_x8_2400.ini",
+                              "One configuration file")
     filePath = Param.String("ext/dramsim3/DRAMSim3/",
                             "Directory to prepend to file names")
diff --git a/src/mem/dramsim3.cc b/src/mem/dramsim3.cc
index 26212e3..a18e1f4 100644
--- a/src/mem/dramsim3.cc
+++ b/src/mem/dramsim3.cc
@@ -48,17 +48,21 @@
 DRAMSim3::DRAMSim3(const Params* p) :
     AbstractMemory(p),
     port(name() + ".port", *this),
-    wrapper(p->deviceConfigFile, p->filePath, NULL, NULL),
+    read_cb(std::bind(&DRAMSim3::readComplete,
+                      this, 0, std::placeholders::_1)),
+    write_cb(std::bind(&DRAMSim3::writeComplete,
+                       this, 0, std::placeholders::_1)),
+    wrapper(p->configFile, p->filePath, read_cb, write_cb),
     retryReq(false), retryResp(false), startTick(0),
     nbrOutstandingReads(0), nbrOutstandingWrites(0),
     sendResponseEvent([this]{ sendResponse(); }, name()),
     tickEvent([this]{ tick(); }, name())
 {
-    read_cb =
-        std::bind(&DRAMSim3::readComplete, this, 0, std::placeholders::_1);
-    write_cb =
- std::bind(&DRAMSim3::writeComplete, this, 0, std::placeholders::_1);
-    wrapper.setCallbacks(read_cb, write_cb);
+    // read_cb =
+ // std::bind(&DRAMSim3::readComplete, this, 0, std::placeholders::_1);
+    // write_cb =
+ // std::bind(&DRAMSim3::writeComplete, this, 0, std::placeholders::_1);
+    // wrapper.setCallbacks(read_cb, write_cb);

     DPRINTF(DRAMSim3,
             "Instantiated DRAMSim3 with clock %d ns and queue size %d\n",
diff --git a/src/mem/dramsim3.hh b/src/mem/dramsim3.hh
index 48c28d6..3717906 100644
--- a/src/mem/dramsim3.hh
+++ b/src/mem/dramsim3.hh
@@ -90,6 +90,12 @@
     MemoryPort port;

     /**
+     * Callback functions
+     */
+    std::function<void(uint64_t)> read_cb;
+    std::function<void(uint64_t)> write_cb;
+
+    /**
      * The actual DRAMSim3 wrapper
      */
     DRAMSim3Wrapper wrapper;
@@ -133,11 +139,6 @@
      */
     std::deque<PacketPtr> responseQueue;

-    /**
-     * Callback functions
-     */
-    std::function<void(uint64_t)> read_cb;
-    std::function<void(uint64_t)> write_cb;

     unsigned int nbrOutstanding() const;


--
To view, visit https://gem5-review.googlesource.com/c/public/gem5/+/31856
To unsubscribe, or for help writing mail filters, visit https://gem5-review.googlesource.com/settings

Gerrit-Project: public/gem5
Gerrit-Branch: develop
Gerrit-Change-Id: I5943cf2ca3bba8495b4ff238898a823ba8562a81
Gerrit-Change-Number: 31856
Gerrit-PatchSet: 1
Gerrit-Owner: Mahyar Samani <msam...@ucdavis.edu>
Gerrit-MessageType: newchange
_______________________________________________
gem5-dev mailing list -- gem5-dev@gem5.org
To unsubscribe send an email to gem5-dev-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

Reply via email to